llvm.org GIT mirror llvm / 02b985c
ARM test cases contributed by Apple. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33354 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 13 years ago
47 changed file(s) with 955 addition(s) and 211 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6
1
2 %struct.layer_data = type { int, [2048 x ubyte], ubyte*, [16 x ubyte], uint, ubyte*, int, int, [64 x int], [64 x int], [64 x int], [64 x int], int, int, int, int, int, int, int, int, int, int, int, int, [12 x [64 x short]] }
3 %ld = external global %struct.layer_data*
4
5 void %main() {
6 entry:
7 br bool false, label %bb169.i, label %cond_true11
8
9 bb169.i:
10 ret void
11
12 cond_true11:
13 %tmp.i32 = load %struct.layer_data** %ld
14 %tmp3.i35 = getelementptr %struct.layer_data* %tmp.i32, int 0, uint 1, int 2048
15 %tmp.i36 = getelementptr %struct.layer_data* %tmp.i32, int 0, uint 2
16 store ubyte* %tmp3.i35, ubyte** %tmp.i36
17 store ubyte* %tmp3.i35, ubyte** null
18 ret void
19 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
11 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep bne &&
22 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep bge &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep bcs &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep bcc
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep bhs &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep blo
55
66 void %f1(int %a, int %b, int* %v) {
77 entry:
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | not grep bx
2
3 void %test(int %Ptr, ubyte* %L) {
4 entry:
5 br label %bb1
6
7 bb:
8 %tmp7 = getelementptr ubyte* %L, uint %indvar
9 store ubyte 0, ubyte* %tmp7
10 %indvar.next = add uint %indvar, 1
11 br label %bb1
12
13 bb1:
14 %indvar = phi uint [ 0, %entry ], [ %indvar.next, %bb ]
15 %i.0 = cast uint %indvar to int
16 %Ptr_addr.0 = sub int %Ptr, %i.0
17 %tmp12 = seteq int %i.0, %Ptr
18 %tmp12.not = xor bool %tmp12, true
19 %bothcond = and bool %tmp12.not, false
20 br bool %bothcond, label %bb, label %bb18
21
22 bb18:
23 ret void
24 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep bl &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep blx
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep 'mov lr, pc' &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v5t | grep 'blx'
3
4 %t = weak global int ()* null
5 declare void %g(int, int, int, int)
36
47 void %f() {
5 entry:
68 call void %g( int 1, int 2, int 3, int 4 )
7 call fastcc void %h()
89 ret void
910 }
1011
11 declare void %g(int, int, int, int)
12 declare fastcc void %h()
13
14 void %g(void (...)* %g) {
15 entry:
16 %g_c = cast void (...)* %g to void ()*
17 call void %g_c( )
12 void %g() {
13 %tmp = load int ()** %t
14 %tmp = tail call int %tmp( )
1815 ret void
1916 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v5t | grep "clz"
2
3 declare uint %llvm.ctlz.i32(uint)
4
5 uint %test(uint %x) {
6 %tmp.1 = call uint %llvm.ctlz.i32( uint %x )
7 ret uint %tmp.1
8 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6,+vfp2 | grep fcmpes
2
3 void %test3(float* %glob, int %X) {
4 entry:
5 %tmp = load float* %glob ; [#uses=1]
6 %tmp2 = getelementptr float* %glob, int 2 ; [#uses=1]
7 %tmp3 = load float* %tmp2 ; [#uses=1]
8 %tmp = setgt float %tmp, %tmp3 ; [#uses=1]
9 br bool %tmp, label %cond_true, label %UnifiedReturnBlock
10
11 cond_true: ; preds = %entry
12 %tmp = tail call int (...)* %bar( ) ; [#uses=0]
13 ret void
14
15 UnifiedReturnBlock: ; preds = %entry
16 ret void
17 }
18
19 declare int %bar(...)
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -o %t.s -f &&
1 ; RUN: grep "mov r0, #0" %t.s | wc -l | grep 1 &&
2 ; RUN: grep "mov r0, #255" %t.s | wc -l | grep 1 &&
3 ; RUN: grep "mov r0, #256" %t.s | wc -l | grep 1 &&
4 ; RUN: grep "mov r0, #1" %t.s | wc -l | grep 2 &&
5 ; RUN: grep "orr r0, r0, #256" %t.s | wc -l | grep 1 &&
6 ; RUN: grep "mov r0, #-1073741761" %t.s | wc -l | grep 1 &&
7 ; RUN: grep "mov r0, #1008" %t.s | wc -l | grep 1 &&
8 ; RUN: grep "cmp r0, #65536" %t.s | wc -l | grep 1 &&
9 ; RUN: grep "\.comm.*a,4,4" %t.s | wc -l | grep 1
10
11 %a = internal global int 0
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #0" | wc -l | grep 1 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #255$" | wc -l | grep 1 &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0.*256" | wc -l | grep 1 &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "orr.*256" | wc -l | grep 1 &&
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, .*-1073741761" | wc -l | grep 1 &&
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, .*1008" | wc -l | grep 1 &&
7 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "cmp r0, #1, 16" | wc -l | grep 1
128
139 uint %f1() {
1410 ret uint 0
3531 }
3632
3733 void %f7(uint %a) {
38 entry:
3934 %b = setgt uint %a, 65536
4035 br bool %b, label %r, label %r
4136
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -o %t.s -f &&
1 ; RUN: grep '\.section \.ctors,"aw",.progbits' %t.s | grep % &&
2 ; RUN: grep '\.section \.dtors,"aw",.progbits' %t.s | grep %
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin | grep '\.mod_init_func' &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin | grep '\.mod_term_func' &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux | grep '\.section \.ctors,"aw",.progbits' &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux | grep '\.section \.dtors,"aw",.progbits'
35
46 %llvm.global_ctors = appending global [1 x { int, void ()* }] [ { int, void ()* } { int 65535, void ()* %__mf_init } ] ; <[1 x { int, void ()* }]*> [#uses=0]
57 %llvm.global_dtors = appending global [1 x { int, void ()* }] [ { int, void ()* } { int 65535, void ()* %__mf_fini } ] ; <[1 x { int, void ()* }]*> [#uses=0]
None ; RUN: llvm-as < %s | llc -march=arm
0 ; RUN: llvm-as < fcopysign.ll | llc -march=arm &&
1 ; RUN: llvm-as < fcopysign.ll | llc -march=arm | grep bic | wc -l | grep 2 &&
2 ; RUN: llvm-as < fcopysign.ll | llc -march=arm -mattr=+v6,+vfp2 &&
3 ; RUN: llvm-as < fcopysign.ll | llc -march=arm -mattr=+v6,+vfp2 | grep fneg | wc -l | grep 2
14
2 define csretcc void %__divsc3({ float, float }* %agg.result, float %a, float %b, float %c, float %d) {
3 entry:
4 br i1 false, label %bb, label %cond_next375
5
6 bb: ; preds = %entry
7 %tmp81 = tail call float %copysignf( float 0x7FF0000000000000, float %c ) ; [#uses=1]
8 %tmp87 = mul float %tmp81, %b ; [#uses=1]
9 br label %cond_next375
10
11 cond_next375: ; preds = %bb, %entry
12 %y.1 = phi float [ %tmp87, %bb ], [ 0.000000e+00, %entry ] ; [#uses=0]
13 ret void
5 define float %test1(float %x, double %y) {
6 %tmp = fpext float %x to double
7 %tmp2 = tail call double %copysign( double %tmp, double %y )
8 %tmp2 = fptrunc double %tmp2 to float
9 ret float %tmp2
1410 }
1511
16 declare float %fabsf(float)
12 define double %test2(double %x, float %y) {
13 %tmp = fpext float %y to double
14 %tmp2 = tail call double %copysign( double %x, double %tmp )
15 ret double %tmp2
16 }
1717
18 declare i1 %llvm.isunordered.f32(float, float)
19
20 declare float %copysignf(float, float)
18 declare double %copysign(double, double)
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fmsr &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fmrs &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fmrrd &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fmdrr &&
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fldd &&
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep flds &&
7 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fstd &&
8 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fsts &&
9 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #1065353216"
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fmsr | wc -l | grep 4 &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fsitos &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fmrs &&
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fsitod &&
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fmrrd | wc -l | grep 5 &&
7 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fmdrr | wc -l | grep 2 &&
8 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fldd &&
9 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep flds &&
10 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fuitod &&
11 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fuitos &&
12 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep 1065353216
13
14 float %f(int %a) {
15 entry:
16 %tmp = cast int %a to float ; [#uses=1]
17 ret float %tmp
18 }
19
20 double %g(int %a) {
21 entry:
22 %tmp = cast int %a to double ; [#uses=1]
23 ret double %tmp
24 }
25
26 double %uint_to_double(uint %a) {
27 entry:
28 %tmp = cast uint %a to double
29 ret double %tmp
30 }
31
32 float %uint_to_float(uint %a) {
33 entry:
34 %tmp = cast uint %a to float
35 ret float %tmp
36 }
1037
1138
1239 double %h(double* %v) {
1340 entry:
1441 %tmp = load double* %v ; [#uses=1]
1542 ret double %tmp
16 }
17
18 float %h(float* %v) {
19 entry:
20 %tmp = load float* %v ; [#uses=1]
21 ret float %tmp
2243 }
2344
2445 float %h() {
3960
4061 declare void %f4(double)
4162 declare double %f5()
42
43 void %f6(float %a, float* %b) {
44 entry:
45 store float %a, float* %b
46 ret void
47 }
48
49 void %f7(double %a, double* %b) {
50 entry:
51 store double %a, double* %b
52 ret void
53 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fadds &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep faddd &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fmuls &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fmuld &&
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fnegs &&
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fnegd &&
7 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fdivs &&
8 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fdivd
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fadds &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep faddd &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fmuls &&
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fmuld &&
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fnegs &&
7 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fnegd &&
8 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fdivs &&
9 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fdivd
10
911
1012 float %f1(float %a, float %b) {
1113 entry:
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movmi &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep moveq &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movgt &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movge &&
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movls &&
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movne &&
7 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fcmps &&
8 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fcmpd
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep movmi &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep moveq &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep movgt &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep movge &&
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep movne &&
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fcmped | wc -l | grep 1
7 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fcmpes | wc -l | grep 6
98
109 int %f1(float %a) {
1110 entry:
0 ; RUN: llvm-as < %s | llc -march=arm &&
11 ; RUN: llvm-as < %s | llc -march=arm | grep moveq &&
2 ; RUN: llvm-as < %s | llc -march=arm | grep movvs
2 ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | grep movvs
33
44 define i32 %f7(float %a, float %b) {
55 entry:
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fcvtsd &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fcvtds &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep ftosis &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep ftouis &&
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep ftosid &&
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep ftouid &&
7 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fsitos &&
8 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fsitod &&
9 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fuitos &&
10 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fuitod
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fcvtsd &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fcvtds &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep ftosizs &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep ftouizs &&
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep ftosizd &&
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep ftouizd &&
7 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fsitos &&
8 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fsitod &&
9 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fuitos &&
10 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fuitod
1111
1212 float %f1(double %x) {
1313 entry:
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
11 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #0" | wc -l | grep 1 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "flds.*\[" | wc -l | grep 1 &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "fsts.*\[" | wc -l | grep 1
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep "flds.*\[" | wc -l | grep 1 &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep "fsts.*\[" | wc -l | grep 1
44
55 float %f1(float %a) {
66 entry:
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mov | wc -l | grep 1
2 %str = internal constant [12 x sbyte] c"Hello World\00" ; <[12 x sbyte]*> [#uses=1]
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux | grep mov | wc -l | grep 1 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin | grep mov | wc -l | grep 2
33
4 implementation ; Functions:
4 %str = internal constant [12 x sbyte] c"Hello World\00"
55
66 int %main() {
7 entry:
8 %tmp = call int %puts( sbyte* getelementptr ([12 x sbyte]* %str, int 0, uint 0) ) ; [#uses=0]
7 %tmp = call int %puts( sbyte* getelementptr ([12 x sbyte]* %str, int 0, uint 0) )
98 ret int 0
109 }
1110
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | not grep CPI
2
3 int %test1(int %A) {
4 %B = add int %A, -268435441 ; 0xF000000F
5 ret int %B
6 }
7
8 int %test2() {
9 ret int 65533
10 }
11
12 int %test3(int %A) {
13 %B = or int %A, 65533
14 ret int %B
15 }
16
17
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6
1
2 uint %test1(uint %tmp54) {
3 %tmp56 = tail call uint asm "uxtb16 $0,$1", "=r,r"( uint %tmp54 )
4 ret uint %tmp56
5 }
6
7 void %test2() {
8 %tmp1 = call long asm "ldmia $1!, {$0, ${0:H}}", "=r,==r,1"( int** null, int* null )
9 %tmp1 = cast long %tmp1 to ulong
10 %tmp2 = shr ulong %tmp1, ubyte 32
11 %tmp3 = cast ulong %tmp2 to int
12 %tmp4 = call int asm "pkhbt $0, $1, $2, lsl #16", "=r,r,r"( int 0, int %tmp3 )
13 ret void
14 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep mov | wc -l | grep 2
3
4 int %test(int %x) {
5 %tmp = cast int %x to short
6 %tmp2 = tail call int %f( int 1, short %tmp )
7 ret int %tmp2
8 }
9
10 declare int %f(int, short)
0 ; RUN: llvm-as < %s | llc -march=arm &&
1 ; RUN: llvm-as < %s | llc -march=arm -enable-thumb
2
3 define void %test1() {
4 %tmp = alloca [ 64 x i32 ] , align 4
5 ret void
6 }
7
8 define void %test2() {
9 %tmp = alloca [ 4168 x i8 ] , align 4
10 ret void
11 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldmia" | wc -l | grep 2 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldmib" | wc -l | grep 1 &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldmfd sp\!" | wc -l | grep 3
4
5 %X = external global [0 x int]
6
7 int %t1() {
8 %tmp = load int* getelementptr ([0 x int]* %X, int 0, int 0)
9 %tmp3 = load int* getelementptr ([0 x int]* %X, int 0, int 1)
10 %tmp4 = tail call int %f1( int %tmp, int %tmp3 )
11 ret int %tmp4
12 }
13
14 int %t2() {
15 %tmp = load int* getelementptr ([0 x int]* %X, int 0, int 2)
16 %tmp3 = load int* getelementptr ([0 x int]* %X, int 0, int 3)
17 %tmp5 = load int* getelementptr ([0 x int]* %X, int 0, int 4)
18 %tmp6 = tail call int %f2( int %tmp, int %tmp3, int %tmp5 )
19 ret int %tmp6
20 }
21
22 int %t3() {
23 %tmp = load int* getelementptr ([0 x int]* %X, int 0, int 1)
24 %tmp3 = load int* getelementptr ([0 x int]* %X, int 0, int 2)
25 %tmp5 = load int* getelementptr ([0 x int]* %X, int 0, int 3)
26 %tmp6 = tail call int %f2( int %tmp, int %tmp3, int %tmp5 )
27 ret int %tmp6
28 }
29
30 declare int %f1(int, int)
31 declare int %f2(int, int, int)
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldr r0.*#0" | wc -l | grep 2 &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldr r0" | wc -l | grep 3 &&
22 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldr r0.*#4092" | wc -l | grep 1
33
44 int %f1(int* %v) {
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldrb" | wc -l | grep 1 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldrsb" | wc -l | grep 1 &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldrh" | wc -l | grep 1 &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldrsh" | wc -l | grep 1
5
6 int %test1(ubyte* %v) {
7 %tmp = load ubyte* %v
8 %tmp1 = cast ubyte %tmp to int
9 ret int %tmp1
10 }
11
12 int %test2(ushort* %v) {
13 %tmp = load ushort* %v
14 %tmp1 = cast ushort %tmp to int
15 ret int %tmp1
16 }
17
18 int %test3(sbyte* %v) {
19 %tmp = load sbyte* %v
20 %tmp1 = cast sbyte %tmp to int
21 ret int %tmp1
22 }
23
24 int %test4(short* %v) {
25 %tmp = load short* %v
26 %tmp1 = cast short %tmp to int
27 ret int %tmp1
28 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldr.*\[.*]," | wc -l | grep 1
2
3 int %test(int %a, int %b, int %c) {
4 %tmp1 = mul int %a, %b
5 %tmp2 = cast int %tmp1 to int*
6 %tmp3 = load int* %tmp2
7 %tmp4 = sub int %tmp1, %c
8 %tmp5 = mul int %tmp4, %tmp3
9 ret int %tmp5
10 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldr.*\!" | wc -l | grep 2
2
3 int *%test1(int *%X, int *%dest) {
4 %Y = getelementptr int* %X, int 4
5 %A = load int* %Y
6 store int %A, int* %dest
7 ret int* %Y
8 }
9
10 int %test2(int %a, int %b, int %c) {
11 %tmp1 = sub int %a, %b
12 %tmp2 = cast int %tmp1 to int*
13 %tmp3 = load int* %tmp2
14 %tmp4 = sub int %tmp1, %c
15 %tmp5 = add int %tmp4, %tmp3
16 ret int %tmp5
17 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin -relocation-model=dynamic-no-pic | grep "L_G$non_lazy_ptr" | wc -l | grep 2 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin -relocation-model=pic | grep "ldr.*pc" | wc -l | grep 1
3
4 %G = external global int
5
6 int %test1() {
7 %tmp = load int* %G
8 ret int %tmp
9 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r1, #0" | wc -l | grep 4 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #1" | wc -l | grep 1 &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mvn r0, #-2147483648" | wc -l | grep 1 &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #-2147483648" | wc -l | grep 1 &&
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mvn r1, #-2147483648" | wc -l | grep 1 &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "\-2147483648" | wc -l | grep 3 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mvn" | wc -l | grep 3 &&
63 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "adds" | wc -l | grep 1 &&
7 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "adcs" | wc -l | grep 1 &&
8 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "subs" | wc -l | grep 1 &&
9 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "sbcs" | wc -l | grep 1 &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "adc" | wc -l | grep 1 &&
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux | grep "subs" | wc -l | grep 1 &&
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "sbc" | wc -l | grep 1 &&
107 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "smull" | wc -l | grep 1 &&
118 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "umull" | wc -l | grep 1
129
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
1
2 long %foo0(long %A, ulong %B) {
3 %tmp = cast long %A to ulong ; [#uses=1]
4 %tmp2 = shr ulong %B, ubyte 1 ; [#uses=1]
5 %tmp3 = sub ulong %tmp, %tmp2 ; [#uses=1]
6 %tmp3 = cast ulong %tmp3 to long ; [#uses=1]
7 ret long %tmp3
8 }
9
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mul r0, r12, r0" | wc -l | grep 1 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mul r0, r1, r0" | wc -l | grep 1
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mul | wc -l | grep 2
32
4 int %mul1(int %u) {
3 int %f1(int %u) {
54 entry:
65 %tmp = mul int %u, %u;
76 ret int %tmp
87 }
98
10 int %mul2(int %u, int %v) {
9 int %f2(int %u, int %v) {
1110 entry:
1211 %tmp = mul int %u, %v;
1312 ret int %tmp
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep smmul | wc -l | grep 1 &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep umull | wc -l | grep 1
4
5 int %smulhi(int %x, int %y) {
6 %tmp = cast int %x to ulong ; [#uses=1]
7 %tmp1 = cast int %y to ulong ; [#uses=1]
8 %tmp2 = mul ulong %tmp1, %tmp ; [#uses=1]
9 %tmp3 = shr ulong %tmp2, ubyte 32 ; [#uses=1]
10 %tmp3 = cast ulong %tmp3 to int ; [#uses=1]
11 ret int %tmp3
12 }
13
14 int %umulhi(uint %x, uint %y) {
15 %tmp = cast uint %x to ulong ; [#uses=1]
16 %tmp1 = cast uint %y to ulong ; [#uses=1]
17 %tmp2 = mul ulong %tmp1, %tmp ; [#uses=1]
18 %tmp3 = shr ulong %tmp2, ubyte 32 ; [#uses=1]
19 %tmp3 = cast ulong %tmp3 to int ; [#uses=1]
20 ret int %tmp3
21 }
22
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 7
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 8
22
33 int %f1() {
44 entry:
1111 ret int %tmpnot
1212 }
1313
14 ;int %f3(int %a) {
15 ;entry:
16 ; %tmp1 = shl int %a, ubyte 2 ; [#uses=1]
17 ; %tmp1not = xor int %tmp1, -1 ; [#uses=1]
18 ; ret int %tmp1not
19 ;}
14 int %f3(int %a) {
15 entry:
16 %tmp1 = shl int %a, ubyte 2 ; [#uses=1]
17 %tmp1not = xor int %tmp1, -1 ; [#uses=1]
18 ret int %tmp1not
19 }
2020
2121 int %f4(int %a, ubyte %b) {
2222 entry:
2525 ret int %tmp3not
2626 }
2727
28 ;uint %f5(uint %a) {
29 ;entry:
30 ; %tmp1 = lshr uint %a, ubyte 2 ; [#uses=1]
31 ; %tmp1not = xor uint %tmp1, 4294967295 ; [#uses=1]
32 ; ret uint %tmp1not
33 ;}
28 uint %f5(uint %a) {
29 entry:
30 %tmp1 = lshr uint %a, ubyte 2 ; [#uses=1]
31 %tmp1not = xor uint %tmp1, 4294967295 ; [#uses=1]
32 ret uint %tmp1not
33 }
3434
3535 uint %f6(uint %a, ubyte %b) {
3636 entry:
3939 ret uint %tmp2not
4040 }
4141
42 ;int %f7(int %a) {
43 ;entry:
44 ; %tmp1 = ashr int %a, ubyte 2 ; [#uses=1]
45 ; %tmp1not = xor int %tmp1, -1 ; [#uses=1]
46 ; ret int %tmp1not
47 ;}
42 int %f7(int %a) {
43 entry:
44 %tmp1 = ashr int %a, ubyte 2 ; [#uses=1]
45 %tmp1not = xor int %tmp1, -1 ; [#uses=1]
46 ret int %tmp1not
47 }
4848
4949 int %f8(int %a, ubyte %b) {
5050 entry:
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep pkhbt | wc -l | grep 5 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep pkhtb | wc -l | grep 4
3 implementation ; Functions:
4
5 int %test1(int %X, int %Y) {
6 %tmp1 = and int %X, 65535 ; [#uses=1]
7 %tmp4 = shl int %Y, ubyte 16 ; [#uses=1]
8 %tmp5 = or int %tmp4, %tmp1 ; [#uses=1]
9 ret int %tmp5
10 }
11
12 int %test1a(int %X, int %Y) {
13 %tmp19 = and int %X, 65535 ; [#uses=1]
14 %tmp37 = shl int %Y, ubyte 16 ; [#uses=1]
15 %tmp5 = or int %tmp37, %tmp19 ; [#uses=1]
16 ret int %tmp5
17 }
18
19 int %test2(int %X, int %Y) {
20 %tmp1 = and int %X, 65535 ; [#uses=1]
21 %tmp3 = shl int %Y, ubyte 12 ; [#uses=1]
22 %tmp4 = and int %tmp3, -65536 ; [#uses=1]
23 %tmp57 = or int %tmp4, %tmp1 ; [#uses=1]
24 ret int %tmp57
25 }
26
27 int %test3(int %X, int %Y) {
28 %tmp19 = and int %X, 65535 ; [#uses=1]
29 %tmp37 = shl int %Y, ubyte 18 ; [#uses=1]
30 %tmp5 = or int %tmp37, %tmp19 ; [#uses=1]
31 ret int %tmp5
32 }
33
34 int %test4(int %X, int %Y) {
35 %tmp1 = and int %X, 65535 ; [#uses=1]
36 %tmp3 = and int %Y, -65536 ; [#uses=1]
37 %tmp46 = or int %tmp3, %tmp1 ; [#uses=1]
38 ret int %tmp46
39 }
40
41 int %test5(int %X, int %Y) {
42 %tmp17 = and int %X, -65536 ; [#uses=1]
43 %tmp2 = cast int %Y to uint ; [#uses=1]
44 %tmp4 = shr uint %tmp2, ubyte 16 ; [#uses=1]
45 %tmp4 = cast uint %tmp4 to int ; [#uses=1]
46 %tmp5 = or int %tmp4, %tmp17 ; [#uses=1]
47 ret int %tmp5
48 }
49
50 int %test5a(int %X, int %Y) {
51 %tmp110 = and int %X, -65536 ; [#uses=1]
52 %Y = cast int %Y to uint ; [#uses=1]
53 %tmp37 = shr uint %Y, ubyte 16 ; [#uses=1]
54 %tmp39 = cast uint %tmp37 to int ; [#uses=1]
55 %tmp5 = or int %tmp39, %tmp110 ; [#uses=1]
56 ret int %tmp5
57 }
58
59 int %test6(int %X, int %Y) {
60 %tmp1 = and int %X, -65536 ; [#uses=1]
61 %Y = cast int %Y to uint ; [#uses=1]
62 %tmp37 = shr uint %Y, ubyte 12 ; [#uses=1]
63 %tmp38 = cast uint %tmp37 to int ; [#uses=1]
64 %tmp4 = and int %tmp38, 65535 ; [#uses=1]
65 %tmp59 = or int %tmp4, %tmp1 ; [#uses=1]
66 ret int %tmp59
67 }
68
69 int %test7(int %X, int %Y) {
70 %tmp1 = and int %X, -65536 ; [#uses=1]
71 %tmp3 = shr int %Y, ubyte 18 ; [#uses=1]
72 %tmp4 = and int %tmp3, 65535 ; [#uses=1]
73 %tmp57 = or int %tmp4, %tmp1 ; [#uses=1]
74 ret int %tmp57
75 }
76
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
1 int %test() {
2 ret int 0
3 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep rev16 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep revsh
3
4 int %test1(uint %X) {
5 %tmp1 = shr uint %X, ubyte 8 ; [#uses=1]
6 %tmp1 = cast uint %tmp1 to int ; [#uses=2]
7 %X15 = cast uint %X to int ; [#uses=1]
8 %tmp4 = shl int %X15, ubyte 8 ; [#uses=2]
9 %tmp2 = and int %tmp1, 16711680 ; [#uses=1]
10 %tmp5 = and int %tmp4, -16777216 ; [#uses=1]
11 %tmp9 = and int %tmp1, 255 ; [#uses=1]
12 %tmp13 = and int %tmp4, 65280 ; [#uses=1]
13 %tmp6 = or int %tmp5, %tmp2 ; [#uses=1]
14 %tmp10 = or int %tmp6, %tmp13 ; [#uses=1]
15 %tmp14 = or int %tmp10, %tmp9 ; [#uses=1]
16 ret int %tmp14
17 }
18
19 int %test2(uint %X) { ; revsh
20 %tmp1 = shr uint %X, ubyte 8 ; [#uses=1]
21 %tmp1 = cast uint %tmp1 to short ; [#uses=1]
22 %tmp3 = cast uint %X to short ; [#uses=1]
23 %tmp2 = and short %tmp1, 255 ; [#uses=1]
24 %tmp4 = shl short %tmp3, ubyte 8 ; [#uses=1]
25 %tmp5 = or short %tmp2, %tmp4 ; [#uses=1]
26 %tmp5 = cast short %tmp5 to int ; [#uses=1]
27 ret int %tmp5
28 }
29
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "__DTOR_END__:" &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux | grep "__DTOR_END__:" &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux | \
33 ; RUN: grep '.section .dtors,"aw",.progbits'
44
55 %__DTOR_END__ = internal global [1 x int] zeroinitializer, section ".dtors"
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep moveq | wc -l | grep 1 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movgt | wc -l | grep 1 &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movlt | wc -l | grep 1 &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movle | wc -l | grep 1 &&
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movls | wc -l | grep 1 &&
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movhi | wc -l | grep 1
0 ; RUN: llvm-as < %s | llc -march=arm &&
1 ; RUN: llvm-as < %s | llc -march=arm | grep moveq | wc -l | grep 1 &&
2 ; RUN: llvm-as < %s | llc -march=arm | grep movgt | wc -l | grep 1 &&
3 ; RUN: llvm-as < %s | llc -march=arm | grep movlt | wc -l | grep 3 &&
4 ; RUN: llvm-as < %s | llc -march=arm | grep movle | wc -l | grep 1 &&
5 ; RUN: llvm-as < %s | llc -march=arm | grep movls | wc -l | grep 1 &&
6 ; RUN: llvm-as < %s | llc -march=arm | grep movhi | wc -l | grep 1 &&
7 ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | grep fcpydmi | wc -l | grep 1 &&
8 ; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep beq | wc -l | grep 1 &&
9 ; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep bgt | wc -l | grep 1 &&
10 ; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep blt | wc -l | grep 3 &&
11 ; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep ble | wc -l | grep 1 &&
12 ; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep bls | wc -l | grep 1 &&
13 ; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep bhi | wc -l | grep 1 &&
14 ; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep __ltdf2
715
8 int %f1(int %a) {
16 define i32 %f1(i32 %a.s) {
917 entry:
10 %tmp = seteq int %a, 4 ; [#uses=1]
11 %tmp1 = select bool %tmp, int 2, int 3
12 ret int %tmp1
18 %tmp = icmp eq i32 %a.s, 4
19 %tmp1.s = select i1 %tmp, i32 2, i32 3
20 ret i32 %tmp1.s
1321 }
1422
15 int %f2(int %a) {
23 define i32 %f2(i32 %a.s) {
1624 entry:
17 %tmp = setgt int %a, 4 ; [#uses=1]
18 %tmp1 = select bool %tmp, int 2, int 3
19 ret int %tmp1
25 %tmp = icmp sgt i32 %a.s, 4
26 %tmp1.s = select i1 %tmp, i32 2, i32 3
27 ret i32 %tmp1.s
2028 }
2129
22 int %f3(int %a, int %b) {
30 define i32 %f3(i32 %a.s, i32 %b.s) {
2331 entry:
24 %tmp = setlt int %a, %b ; [#uses=1]
25 %tmp1 = select bool %tmp, int 2, int 3
26 ret int %tmp1
32 %tmp = icmp slt i32 %a.s, %b.s
33 %tmp1.s = select i1 %tmp, i32 2, i32 3
34 ret i32 %tmp1.s
2735 }
2836
29 int %f4(int %a, int %b) {
37 define i32 %f4(i32 %a.s, i32 %b.s) {
3038 entry:
31 %tmp = setle int %a, %b ; [#uses=1]
32 %tmp1 = select bool %tmp, int 2, int 3
33 ret int %tmp1
39 %tmp = icmp sle i32 %a.s, %b.s
40 %tmp1.s = select i1 %tmp, i32 2, i32 3
41 ret i32 %tmp1.s
3442 }
3543
36 int %f5(uint %a, uint %b) {
44 define i32 %f5(i32 %a.u, i32 %b.u) {
3745 entry:
38 %tmp = setle uint %a, %b ; [#uses=1]
39 %tmp1 = select bool %tmp, int 2, int 3
40 ret int %tmp1
46 %tmp = icmp ule i32 %a.u, %b.u
47 %tmp1.s = select i1 %tmp, i32 2, i32 3
48 ret i32 %tmp1.s
4149 }
4250
43 int %f6(uint %a, uint %b) {
51 define i32 %f6(i32 %a.u, i32 %b.u) {
4452 entry:
45 %tmp = setgt uint %a, %b ; [#uses=1]
46 %tmp1 = select bool %tmp, int 2, int 3
47 ret int %tmp1
53 %tmp = icmp ugt i32 %a.u, %b.u
54 %tmp1.s = select i1 %tmp, i32 2, i32 3
55 ret i32 %tmp1.s
4856 }
57
58 define double %f7(double %a, double %b) {
59 %tmp = fcmp olt double %a, 1.234e+00
60 %tmp1 = select i1 %tmp, double -1.000e+00, double %b
61 ret double %tmp1
62 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep 'add r0, r0, r1, lsl r2' &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep 'bic r0, r0, r1, asr r2'
2
3 int %test1(int %X, int %Y, ubyte %sh) {
4 %A = shl int %Y, ubyte %sh
5 %B = add int %X, %A
6 ret int %B
7 }
8
9 int %test2(int %X, int %Y, ubyte %sh) {
10 %A = shr int %Y, ubyte %sh
11 %B = xor int %A, -1
12 %C = and int %X, %B
13 ret int %C
14 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v5TE &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v5TE | grep "smulbt" | wc -l | grep 1 &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v5TE | grep "smultt" | wc -l | grep 1 &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v5TE | grep "smlabt" | wc -l | grep 1
5
6 %x = weak global short 0
7 %y = weak global short 0
8
9 int %f1(int %y) {
10 %tmp = load short* %x
11 %tmp1 = add short %tmp, 2
12 %tmp2 = cast short %tmp1 to int
13 %tmp3 = shr int %y, ubyte 16
14 %tmp4 = mul int %tmp2, %tmp3
15 ret int %tmp4
16 }
17
18 int %f2(int %x, int %y) {
19 %tmp1 = shr int %x, ubyte 16
20 %tmp3 = shr int %y, ubyte 16
21 %tmp4 = mul int %tmp3, %tmp1
22 ret int %tmp4
23 }
24
25 int %f3(int %a, short %x, int %y) {
26 %tmp = cast short %x to int
27 %tmp2 = shr int %y, ubyte 16
28 %tmp3 = mul int %tmp2, %tmp
29 %tmp5 = add int %tmp3, %a
30 ret int %tmp5
31 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "strh .*\[.*], #-4" | wc -l | grep 1 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "str .*\[.*]," | wc -l | grep 1
3
4 short %test1(int *%X, short *%A) {
5 %Y = load int* %X
6 %tmp1 = cast int %Y to short
7 store short %tmp1, short* %A
8 %tmp2 = cast short* %A to short
9 %tmp3 = sub short %tmp2, 4
10 ret short %tmp3
11 }
12
13 int %test2(int *%X, int *%A) {
14 %Y = load int* %X
15 store int %Y, int* %A
16 %tmp1 = cast int* %A to int
17 %tmp2 = sub int %tmp1, 4
18 ret int %tmp2
19 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "str.*\!" | wc -l | grep 2
2
3 void %test1(int *%X, int *%A, int **%dest) {
4 %B = load int* %A
5 %Y = getelementptr int* %X, int 4
6 store int %B, int* %Y
7 store int* %Y, int** %dest
8 ret void
9 }
10
11 short *%test2(short *%X, int *%A) {
12 %B = load int* %A
13 %Y = getelementptr short* %X, int 4
14 %tmp = cast int %B to short
15 store short %tmp, short* %Y
16 ret short* %Y
17 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "strb" | wc -l | grep 1 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "strh" | wc -l | grep 1
3
4 void %test1(int %v, short* %ptr) {
5 %tmp = cast int %v to short
6 store short %tmp, short* %ptr
7 ret void
8 }
9
10 void %test2(int %v, ubyte* %ptr) {
11 %tmp = cast int %v to ubyte
12 store ubyte %tmp, ubyte* %ptr
13 ret void
14 }
0 ; RUN: llvm-as < %s | llc -march=arm &&
1 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 &&
2 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | grep "sxtb" | wc -l | grep 1 &&
3 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | grep "sxtab" | wc -l | grep 1
4
5 define i8 %test1(i32 %A) sext {
6 %B = lshr i32 %A, i8 8
7 %C = shl i32 %A, i8 24
8 %D = or i32 %B, %C
9 %E = trunc i32 %D to i8
10 ret i8 %E
11 }
12
13 define i32 %test2(i32 %A, i32 %X) sext {
14 %B = lshr i32 %A, i8 8
15 %C = shl i32 %A, i8 24
16 %D = or i32 %B, %C
17 %E = trunc i32 %D to i8
18 %F = sext i8 %E to i32
19 %G = add i32 %F, %X
20 ret i32 %G
21 }
0 ; RUN: llvm-as < %s | llc -march=arm -enable-thumb &&
1 ; RUN: llvm-as < %s | llc -march=arm -enable-thumb | not grep CPI
2
3
4 define i32 %test1() {
5 ret i32 1000
6 }
7
8 define i32 %test2() {
9 ret i32 -256
10 }
0 ; RUN: llvm-as < %s | llc -march=arm &&
1 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 &&
2 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | grep "uxtb" | wc -l | grep 1 &&
3 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | grep "uxtab" | wc -l | grep 1 &&
4 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | grep "uxth" | wc -l | grep 1
5
6 define i8 %test1(i32 %A.u) zext {
7 %B.u = trunc i32 %A.u to i8
8 ret i8 %B.u
9 }
10
11 define i32 %test2(i32 %A.u, i32 %B.u) zext {
12 %C.u = trunc i32 %B.u to i8
13 %D.u = zext i8 %C.u to i32
14 %E.u = add i32 %A.u, %D.u
15 ret i32 %E.u
16 }
17
18 define i32 %test3(i32 %A.u) zext {
19 %B.u = lshr i32 %A.u, i8 8
20 %C.u = shl i32 %A.u, i8 24
21 %D.u = or i32 %B.u, %C.u
22 %E.u = trunc i32 %D.u to i16
23 %F.u = zext i16 %E.u to i32
24 ret i32 %F.u
25 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep uxt | wc -l | grep 10
2
3 uint %test1(uint %x) {
4 %tmp1 = and uint %x, 16711935 ; [#uses=1]
5 ret uint %tmp1
6 }
7
8 uint %test2(uint %x) {
9 %tmp1 = shr uint %x, ubyte 8 ; [#uses=1]
10 %tmp2 = and uint %tmp1, 16711935 ; [#uses=1]
11 ret uint %tmp2
12 }
13
14 uint %test3(uint %x) {
15 %tmp1 = shr uint %x, ubyte 8 ; [#uses=1]
16 %tmp2 = and uint %tmp1, 16711935 ; [#uses=1]
17 ret uint %tmp2
18 }
19
20 uint %test4(uint %x) {
21 %tmp1 = shr uint %x, ubyte 8 ; [#uses=1]
22 %tmp6 = and uint %tmp1, 16711935 ; [#uses=1]
23 ret uint %tmp6
24 }
25
26 uint %test5(uint %x) {
27 %tmp1 = shr uint %x, ubyte 8 ; [#uses=1]
28 %tmp2 = and uint %tmp1, 16711935 ; [#uses=1]
29 ret uint %tmp2
30 }
31
32 uint %test6(uint %x) {
33 %tmp1 = shr uint %x, ubyte 16 ; [#uses=1]
34 %tmp2 = and uint %tmp1, 255 ; [#uses=1]
35 %tmp4 = shl uint %x, ubyte 16 ; [#uses=1]
36 %tmp5 = and uint %tmp4, 16711680 ; [#uses=1]
37 %tmp6 = or uint %tmp2, %tmp5 ; [#uses=1]
38 ret uint %tmp6
39 }
40
41 uint %test7(uint %x) {
42 %tmp1 = shr uint %x, ubyte 16 ; [#uses=1]
43 %tmp2 = and uint %tmp1, 255 ; [#uses=1]
44 %tmp4 = shl uint %x, ubyte 16 ; [#uses=1]
45 %tmp5 = and uint %tmp4, 16711680 ; [#uses=1]
46 %tmp6 = or uint %tmp2, %tmp5 ; [#uses=1]
47 ret uint %tmp6
48 }
49
50 uint %test8(uint %x) {
51 %tmp1 = shl uint %x, ubyte 8 ; [#uses=1]
52 %tmp2 = and uint %tmp1, 16711680 ; [#uses=1]
53 %tmp5 = shr uint %x, ubyte 24 ; [#uses=1]
54 %tmp6 = or uint %tmp2, %tmp5 ; [#uses=1]
55 ret uint %tmp6
56 }
57
58 uint %test9(uint %x) {
59 %tmp1 = shr uint %x, ubyte 24 ; [#uses=1]
60 %tmp4 = shl uint %x, ubyte 8 ; [#uses=1]
61 %tmp5 = and uint %tmp4, 16711680 ; [#uses=1]
62 %tmp6 = or uint %tmp5, %tmp1 ; [#uses=1]
63 ret uint %tmp6
64 }
65
66 uint %test10(uint %p0) {
67 %tmp1 = shr uint %p0, ubyte 7 ; [#uses=1]
68 %tmp2 = and uint %tmp1, 16253176 ; [#uses=2]
69 %tmp4 = shr uint %tmp2, ubyte 5 ; [#uses=1]
70 %tmp5 = and uint %tmp4, 458759 ; [#uses=1]
71 %tmp7 = or uint %tmp5, %tmp2 ; [#uses=1]
72 ret uint %tmp7
73 }
74
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
1 %str = internal constant [7 x ubyte] c"%d %d\0A\00" ; <[7 x ubyte]*> [#uses=1]
1 %str = internal constant [4 x sbyte] c"%d\0A\00" ; <[4 x sbyte]*> [#uses=1]
22
33 implementation ; Functions:
44
5 void %f(int %a_arg, ...) {
5 void %f(int %a, ...) {
66 entry:
7 %a = cast int %a_arg to uint ; [#uses=1]
8 %l1 = alloca sbyte*, align 4 ; [#uses=5]
9 %l2 = alloca sbyte*, align 4 ; [#uses=4]
10 %memtmp = alloca sbyte* ; [#uses=2]
11 call void %llvm.va_start( sbyte** %l1 )
12 %tmp22 = seteq int %a_arg, 0 ; [#uses=1]
13 %tmp23 = volatile load sbyte** %l1 ; [#uses=2]
14 br bool %tmp22, label %bb8, label %bb
7 %va = alloca sbyte*, align 4 ; [#uses=4]
8 call void %llvm.va_start( sbyte** %va )
9 br label %bb
1510
1611 bb: ; preds = %bb, %entry
17 %indvar = phi uint [ 0, %entry ], [ %indvar.next, %bb ] ; [#uses=1]
18 %tmp.0 = phi sbyte* [ %tmp23, %entry ], [ %tmp, %bb ] ; [#uses=2]
19 %tmp2 = getelementptr sbyte* %tmp.0, int 4 ; [#uses=1]
20 volatile store sbyte* %tmp2, sbyte** %l1
21 %tmp3 = cast sbyte* %tmp.0 to int* ; [#uses=1]
12 %a_addr.0 = phi int [ %a, %entry ], [ %tmp5, %bb ] ; [#uses=2]
13 %tmp = volatile load sbyte** %va ; [#uses=2]
14 %tmp2 = getelementptr sbyte* %tmp, int 4 ; [#uses=1]
15 volatile store sbyte* %tmp2, sbyte** %va
16 %tmp5 = add int %a_addr.0, -1 ; [#uses=1]
17 %tmp = seteq int %a_addr.0, 1 ; [#uses=1]
18 br bool %tmp, label %bb7, label %bb
19
20 bb7: ; preds = %bb
21 %tmp3 = cast sbyte* %tmp to int* ; [#uses=1]
2222 %tmp = load int* %tmp3 ; [#uses=1]
23 %tmp = volatile load sbyte** %l1 ; [#uses=2]
24 %indvar.next = add uint %indvar, 1 ; [#uses=2]
25 %exitcond = seteq uint %indvar.next, %a ; [#uses=1]
26 br bool %exitcond, label %bb8, label %bb
27
28 bb8: ; preds = %bb, %entry
29 %p1.0.1 = phi int [ undef, %entry ], [ %tmp, %bb ] ; [#uses=1]
30 %tmp.1 = phi sbyte* [ %tmp23, %entry ], [ %tmp, %bb ] ; [#uses=1]
31 store sbyte* %tmp.1, sbyte** %memtmp
32 call void %llvm.va_copy( sbyte** %l2, sbyte** %memtmp )
33 %tmp10 = volatile load sbyte** %l2 ; [#uses=2]
34 %tmp12 = getelementptr sbyte* %tmp10, int 4 ; [#uses=1]
35 volatile store sbyte* %tmp12, sbyte** %l2
36 %tmp13 = cast sbyte* %tmp10 to int* ; [#uses=1]
37 %tmp14 = load int* %tmp13 ; [#uses=1]
38 %tmp17 = call int (ubyte*, ...)* %printf( ubyte* getelementptr ([7 x ubyte]* %str, int 0, uint 0), int %p1.0.1, int %tmp14 ) ; [#uses=0]
39 call void %llvm.va_end( sbyte** %l1 )
40 call void %llvm.va_end( sbyte** %l2 )
23 %tmp10 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([4 x sbyte]* %str, int 0, uint 0), int %tmp ) ; [#uses=0]
24 call void %llvm.va_end( sbyte** %va )
4125 ret void
4226 }
4327
4428 declare void %llvm.va_start(sbyte**)
4529
46 declare void %llvm.va_copy(sbyte**, sbyte**)
47
48 declare int %printf(ubyte*, ...)
30 declare int %printf(sbyte*, ...)
4931
5032 declare void %llvm.va_end(sbyte**)
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fabs | wc -l | grep 2 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fmscs | wc -l | grep 1 &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fcvt | wc -l | grep 2 &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fuito | wc -l | grep 2 &&
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fto.i | wc -l | grep 4 &&
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep bmi | wc -l | grep 1 &&
7 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep bgt | wc -l | grep 1 &&
8 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fcmpezs | wc -l | grep 1
9
10 void %test(float *%P, double* %D) {
11 %A = load float* %P
12 %B = load double* %D
13 store float %A, float* %P
14 store double %B, double* %D
15 ret void
16 }
17
18 declare float %fabsf(float)
19 declare double %fabs(double)
20
21 void %test_abs(float *%P, double* %D) {
22 %a = load float* %P
23 %b = call float %fabsf(float %a)
24 store float %b, float* %P
25
26 %A = load double* %D
27 %B = call double %fabs(double %A)
28 store double %B, double* %D
29 ret void
30 }
31
32 void %test_add(float *%P, double* %D) {
33 %a = load float* %P
34 %b = add float %a, %a
35 store float %b, float* %P
36
37 %A = load double* %D
38 %B = add double %A, %A
39 store double %B, double* %D
40 ret void
41 }
42
43 void %test_ext_round(float *%P, double* %D) {
44 %a = load float* %P
45 %b = cast float %a to double
46
47 %A = load double* %D
48 %B = cast double %A to float
49
50 store double %b, double* %D
51 store float %B, float* %P
52 ret void
53 }
54
55 void %test_fma(float *%P1, float* %P2, float *%P3) {
56 %a1 = load float* %P1
57 %a2 = load float* %P2
58 %a3 = load float* %P3
59
60 %X = mul float %a1, %a2
61 %Y = sub float %X, %a3
62
63 store float %Y, float* %P1
64 ret void
65 }
66
67 int %test_ftoi(float *%P1) {
68 %a1 = load float* %P1
69 %b1 = cast float %a1 to int
70 ret int %b1
71 }
72
73 uint %test_ftou(float *%P1) {
74 %a1 = load float* %P1
75 %b1 = cast float %a1 to uint
76 ret uint %b1
77 }
78
79 int %test_dtoi(double *%P1) {
80 %a1 = load double* %P1
81 %b1 = cast double %a1 to int
82 ret int %b1
83 }
84
85 uint %test_dtou(double *%P1) {
86 %a1 = load double* %P1
87 %b1 = cast double %a1 to uint
88 ret uint %b1
89 }
90
91 void %test_utod(double *%P1, uint %X) {
92 %b1 = cast uint %X to double
93 store double %b1, double* %P1
94 ret void
95 }
96
97 void %test_utod2(double *%P1, ubyte %X) {
98 %b1 = cast ubyte %X to double
99 store double %b1, double* %P1
100 ret void
101 }
102
103 void %test_cmp(float* %glob, int %X) {
104 entry:
105 %tmp = load float* %glob ; [#uses=2]
106 %tmp3 = getelementptr float* %glob, int 2 ; [#uses=1]
107 %tmp4 = load float* %tmp3 ; [#uses=2]
108 %tmp = seteq float %tmp, %tmp4 ; [#uses=1]
109 %tmp5 = tail call bool %llvm.isunordered.f32( float %tmp, float %tmp4 ) ; [#uses=1]
110 %tmp6 = or bool %tmp, %tmp5 ; [#uses=1]
111 br bool %tmp6, label %cond_true, label %cond_false
112
113 cond_true: ; preds = %entry
114 %tmp = tail call int (...)* %bar( ) ; [#uses=0]
115 ret void
116
117 cond_false: ; preds = %entry
118 %tmp7 = tail call int (...)* %baz( ) ; [#uses=0]
119 ret void
120 }
121
122 declare bool %llvm.isunordered.f32(float, float)
123
124 declare int %bar(...)
125
126 declare int %baz(...)
127
128 void %test_cmpfp0(float* %glob, int %X) {
129 entry:
130 %tmp = load float* %glob ; [#uses=1]
131 %tmp = setgt float %tmp, 0.000000e+00 ; [#uses=1]
132 br bool %tmp, label %cond_true, label %cond_false
133
134 cond_true: ; preds = %entry
135 %tmp = tail call int (...)* %bar( ) ; [#uses=0]
136 ret void
137
138 cond_false: ; preds = %entry
139 %tmp1 = tail call int (...)* %baz( ) ; [#uses=0]
140 ret void
141 }
142