llvm.org GIT mirror llvm / 6263f94
Remove llvm-upgrade. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47238 91177308-0d34-0410-b5e6-96231b3b80d8 Tanya Lattner 12 years ago
50 changed file(s) with 906 addition(s) and 906 deletion(s). Raw diff Collapse all Expand all
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6
0 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6
11
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*
2 %struct.layer_data = type { i32, [2048 x i8], i8*, [16 x i8], i32, i8*, i32, i32, [64 x i32], [64 x i32], [64 x i32], [64 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [12 x [64 x i16]] }
3 @ld = external global %struct.layer_data* ; <%struct.layer_data**> [#uses=1]
44
5 void %main() {
5 define void @main() {
66 entry:
7 br bool false, label %bb169.i, label %cond_true11
7 br i1 false, label %bb169.i, label %cond_true11
88
9 bb169.i:
9 bb169.i: ; preds = %entry
1010 ret void
1111
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
12 cond_true11: ; preds = %entry
13 %tmp.i32 = load %struct.layer_data** @ld ; <%struct.layer_data*> [#uses=2]
14 %tmp3.i35 = getelementptr %struct.layer_data* %tmp.i32, i32 0, i32 1, i32 2048; [#uses=2]
15 %tmp.i36 = getelementptr %struct.layer_data* %tmp.i32, i32 0, i32 2 ; [#uses=1]
16 store i8* %tmp3.i35, i8** %tmp.i36
17 store i8* %tmp3.i35, i8** null
18 ret void
1919 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
1 ; RUN: grep align.*1 | count 1
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux-gnueabi | \
0 ; RUN: llvm-as < %s | llc -march=arm | grep align.*1 | count 1
1 ; RUN: llvm-as < %s | llc -mtriple=arm-linux-gnueabi | \
32 ; RUN: grep align.*2 | count 2
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux-gnueabi | \
3 ; RUN: llvm-as < %s | llc -mtriple=arm-linux-gnueabi | \
54 ; RUN: grep align.*3 | count 2
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin | \
5 ; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin | \
76 ; RUN: grep align.*2 | count 4
87
9 %a = global bool true
10 %b = global sbyte 1
11 %c = global short 2
12 %d = global int 3
13 %e = global long 4
14 %f = global float 5.0
15 %g = global double 6.0
8 @a = global i1 true
9 @b = global i8 1
10 @c = global i16 2
11 @d = global i32 3
12 @e = global i64 4
13 @f = global float 5.0
14 @g = global double 6.0
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mtriple=arm-linux-gnu | \
0 ; RUN: llvm-as < %s | llc -march=arm -mtriple=arm-linux-gnu | \
11 ; RUN: grep {mov r11, sp}
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mtriple=arm-linux-gnu | \
2 ; RUN: llvm-as < %s | llc -march=arm -mtriple=arm-linux-gnu | \
33 ; RUN: grep {mov sp, r11}
44
5 void %f(uint %a) {
5 define void @f(i32 %a) {
66 entry:
7 %tmp = alloca sbyte, uint %a
8 call void %g( sbyte* %tmp, uint %a, uint 1, uint 2, uint 3 )
9 ret void
7 %tmp = alloca i8, i32 %a ; [#uses=1]
8 call void @g( i8* %tmp, i32 %a, i32 1, i32 2, i32 3 )
9 ret void
1010 }
1111
12 declare void %g(sbyte*, uint, uint, uint, uint)
12 declare void @g(i8*, i32, i32, i32, i32)
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
1 void %f(int %a, int %b, int %c, int %d, int %e) {
0 ; RUN: llvm-as < %s | llc -march=arm
1
2 define void @f(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) {
23 entry:
3 %a_addr = alloca int ; [#uses=2]
4 %b_addr = alloca int ; [#uses=2]
5 %c_addr = alloca int ; [#uses=2]
6 %d_addr = alloca int ; [#uses=2]
7 %e_addr = alloca int ; [#uses=2]
8 store int %a, int* %a_addr
9 store int %b, int* %b_addr
10 store int %c, int* %c_addr
11 store int %d, int* %d_addr
12 store int %e, int* %e_addr
13 call void %g( int* %a_addr, int* %b_addr, int* %c_addr, int* %d_addr, int* %e_addr )
14 ret void
4 %a_addr = alloca i32 ; [#uses=2]
5 %b_addr = alloca i32 ; [#uses=2]
6 %c_addr = alloca i32 ; [#uses=2]
7 %d_addr = alloca i32 ; [#uses=2]
8 %e_addr = alloca i32 ; [#uses=2]
9 store i32 %a, i32* %a_addr
10 store i32 %b, i32* %b_addr
11 store i32 %c, i32* %c_addr
12 store i32 %d, i32* %d_addr
13 store i32 %e, i32* %e_addr
14 call void @g( i32* %a_addr, i32* %b_addr, i32* %c_addr, i32* %d_addr, i32* %e_addr )
15 ret void
1516 }
1617
17 declare void %g(int*, int*, int*, int*, int*)
18 declare void @g(i32*, i32*, i32*, i32*, i32*)
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
0 ; RUN: llvm-as < %s | llc -march=arm
11
2 void %frame_dummy() {
2 define void @frame_dummy() {
33 entry:
4 %tmp1 = tail call void (sbyte*)* (void (sbyte*)*)* asm "", "=r,0,~{dirflag},~{fpsr},~{flags}"( void (sbyte*)* null )
5 ret void
4 %tmp1 = tail call void (i8*)* (void (i8*)*)* asm "", "=r,0,~{dirflag},~{fpsr},~{flags}"( void (i8*)* null ) ; [#uses=0]
5 ret void
66 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -disable-arm-if-conversion > %t
0 ; RUN: llvm-as < %s | llc -march=arm -disable-arm-if-conversion > %t
11 ; RUN: grep bne %t
22 ; RUN: grep bge %t
33 ; RUN: grep bhs %t
44 ; RUN: grep blo %t
55
6 void %f1(int %a, int %b, int* %v) {
6 define void @f1(i32 %a, i32 %b, i32* %v) {
77 entry:
8 %tmp = seteq int %a, %b ; [#uses=1]
9 br bool %tmp, label %cond_true, label %return
8 %tmp = icmp eq i32 %a, %b ; [#uses=1]
9 br i1 %tmp, label %cond_true, label %return
1010
11 cond_true: ; preds = %entry
12 store int 0, int* %v
13 ret void
11 cond_true: ; preds = %entry
12 store i32 0, i32* %v
13 ret void
1414
15 return: ; preds = %entry
16 ret void
15 return: ; preds = %entry
16 ret void
1717 }
1818
19 void %f2(int %a, int %b, int* %v) {
19 define void @f2(i32 %a, i32 %b, i32* %v) {
2020 entry:
21 %tmp = setlt int %a, %b ; [#uses=1]
22 br bool %tmp, label %cond_true, label %return
21 %tmp = icmp slt i32 %a, %b ; [#uses=1]
22 br i1 %tmp, label %cond_true, label %return
2323
24 cond_true: ; preds = %entry
25 store int 0, int* %v
26 ret void
24 cond_true: ; preds = %entry
25 store i32 0, i32* %v
26 ret void
2727
28 return: ; preds = %entry
29 ret void
28 return: ; preds = %entry
29 ret void
3030 }
3131
32 void %f3(uint %a, uint %b, int* %v) {
32 define void @f3(i32 %a, i32 %b, i32* %v) {
3333 entry:
34 %tmp = setlt uint %a, %b ; [#uses=1]
35 br bool %tmp, label %cond_true, label %return
34 %tmp = icmp ult i32 %a, %b ; [#uses=1]
35 br i1 %tmp, label %cond_true, label %return
3636
37 cond_true: ; preds = %entry
38 store int 0, int* %v
39 ret void
37 cond_true: ; preds = %entry
38 store i32 0, i32* %v
39 ret void
4040
41 return: ; preds = %entry
42 ret void
41 return: ; preds = %entry
42 ret void
4343 }
4444
45 void %f4(uint %a, uint %b, int* %v) {
45 define void @f4(i32 %a, i32 %b, i32* %v) {
4646 entry:
47 %tmp = setlt uint %a, %b ; [#uses=1]
48 br bool %tmp, label %return, label %cond_true
47 %tmp = icmp ult i32 %a, %b ; [#uses=1]
48 br i1 %tmp, label %return, label %cond_true
4949
50 cond_true: ; preds = %entry
51 store int 0, int* %v
52 ret void
50 cond_true: ; preds = %entry
51 store i32 0, i32* %v
52 ret void
5353
54 return: ; preds = %entry
55 ret void
54 return: ; preds = %entry
55 ret void
5656 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep {mov lr, pc}
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v5t | grep blx
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mtriple=arm-linux-gnueabi\
0 ; RUN: llvm-as < %s | llc -march=arm | grep {mov lr, pc}
1 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v5t | grep blx
2 ; RUN: llvm-as < %s | llc -march=arm -mtriple=arm-linux-gnueabi\
33 ; RUN: -relocation-model=pic | grep {PLT}
44
5 %t = weak global int ()* null
6 declare void %g(int, int, int, int)
5 @t = weak global i32 ()* null ; [#uses=1]
76
8 void %f() {
9 call void %g( int 1, int 2, int 3, int 4 )
10 ret void
7 declare void @g(i32, i32, i32, i32)
8
9 define void @f() {
10 call void @g( i32 1, i32 2, i32 3, i32 4 )
11 ret void
1112 }
1213
13 void %g() {
14 %tmp = load int ()** %t
15 %tmp = tail call int %tmp( )
16 ret void
14 define void @g.upgrd.1() {
15 %tmp = load i32 ()** @t ; [#uses=1]
16 %tmp.upgrd.2 = tail call i32 %tmp( ) ; [#uses=0]
17 ret void
1718 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v5t | grep clz
0 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v5t | grep clz
11
2 declare uint %llvm.ctlz.i32(uint)
2 declare i32 @llvm.ctlz.i32(i32)
33
4 uint %test(uint %x) {
5 %tmp.1 = call uint %llvm.ctlz.i32( uint %x )
6 ret uint %tmp.1
4 define i32 @test(i32 %x) {
5 %tmp.1 = call i32 @llvm.ctlz.i32( i32 %x ) ; [#uses=1]
6 ret i32 %tmp.1
77 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6,+vfp2 | \
0 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6,+vfp2 | \
11 ; RUN: grep fcmpes
22
3 void %test3(float* %glob, int %X) {
3 define void @test3(float* %glob, i32 %X) {
44 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
5 %tmp = load float* %glob ; [#uses=1]
6 %tmp2 = getelementptr float* %glob, i32 2 ; [#uses=1]
7 %tmp3 = load float* %tmp2 ; [#uses=1]
8 %tmp.upgrd.1 = fcmp ogt float %tmp, %tmp3 ; [#uses=1]
9 br i1 %tmp.upgrd.1, label %cond_true, label %UnifiedReturnBlock
1010
11 cond_true: ; preds = %entry
12 %tmp = tail call int (...)* %bar( ) ; [#uses=0]
13 ret void
11 cond_true: ; preds = %entry
12 %tmp.upgrd.2 = tail call i32 (...)* @bar( ) ; [#uses=0]
13 ret void
1414
15 UnifiedReturnBlock: ; preds = %entry
16 ret void
15 UnifiedReturnBlock: ; preds = %entry
16 ret void
1717 }
1818
19 declare int %bar(...)
19 declare i32 @bar(...)
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
0 ; RUN: llvm-as < %s | llc -march=arm | \
11 ; RUN: grep {mov r0, #0} | count 1
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
2 ; RUN: llvm-as < %s | llc -march=arm | \
33 ; RUN: grep {mov r0, #255$} | count 1
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
4 ; RUN: llvm-as < %s | llc -march=arm | \
55 ; RUN: grep {mov r0.*256} | count 1
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
7 ; RUN: grep {orr.*256} | count 1
8 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
9 ; RUN: grep {mov r0, .*-1073741761} | count 1
10 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
11 ; RUN: grep {mov r0, .*1008} | count 1
12 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
13 ; RUN: grep {cmp r0, #1, 16} | count 1
6 ; RUN: llvm-as < %s | llc -march=arm | grep {orr.*256} | count 1
7 ; RUN: llvm-as < %s | llc -march=arm | grep {mov r0, .*-1073741761} | count 1
8 ; RUN: llvm-as < %s | llc -march=arm | grep {mov r0, .*1008} | count 1
9 ; RUN: llvm-as < %s | llc -march=arm | grep {cmp r0, #1, 16} | count 1
1410
15 uint %f1() {
16 ret uint 0
11 define i32 @f1() {
12 ret i32 0
1713 }
1814
19 uint %f2() {
20 ret uint 255
15 define i32 @f2() {
16 ret i32 255
2117 }
2218
23 uint %f3() {
24 ret uint 256
19 define i32 @f3() {
20 ret i32 256
2521 }
2622
27 uint %f4() {
28 ret uint 257
23 define i32 @f4() {
24 ret i32 257
2925 }
3026
31 uint %f5() {
32 ret uint 3221225535
27 define i32 @f5() {
28 ret i32 -1073741761
3329 }
3430
35 uint %f6() {
36 ret uint 1008
31 define i32 @f6() {
32 ret i32 1008
3733 }
3834
39 void %f7(uint %a) {
40 %b = setgt uint %a, 65536
41 br bool %b, label %r, label %r
35 define void @f7(i32 %a) {
36 %b = icmp ugt i32 %a, 65536 ; [#uses=1]
37 br i1 %b, label %r, label %r
4238
43 r:
44 ret void
39 r: ; preds = %0, %0
40 ret void
4541 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin | \
0 ; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin | \
11 ; RUN: grep {\\.mod_init_func}
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin | \
2 ; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin | \
33 ; RUN: grep {\\.mod_term_func}
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux-gnu | \
4 ; RUN: llvm-as < %s | llc -mtriple=arm-linux-gnu | \
55 ; RUN: grep {\\.section \\.ctors,"aw",.progbits}
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux-gnu | \
6 ; RUN: llvm-as < %s | llc -mtriple=arm-linux-gnu | \
77 ; RUN: grep {\\.section \\.dtors,"aw",.progbits}
8 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux-gnueabi | \
8 ; RUN: llvm-as < %s | llc -mtriple=arm-linux-gnueabi | \
99 ; RUN: grep {\\.section \\.init_array,"aw",.init_array}
10 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux-gnueabi | \
10 ; RUN: llvm-as < %s | llc -mtriple=arm-linux-gnueabi | \
1111 ; RUN: grep {\\.section \\.fini_array,"aw",.fini_array}
1212
13 %llvm.global_ctors = appending global [1 x { int, void ()* }] [ { int, void ()* } { int 65535, void ()* %__mf_init } ] ; <[1 x { int, void ()* }]*> [#uses=0]
14 %llvm.global_dtors = appending global [1 x { int, void ()* }] [ { int, void ()* } { int 65535, void ()* %__mf_fini } ] ; <[1 x { int, void ()* }]*> [#uses=0]
13 @llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @__mf_init } ] ; <[1 x { i32, void ()* }]*> [#uses=0]
14 @llvm.global_dtors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @__mf_fini } ] ; <[1 x { i32, void ()* }]*> [#uses=0]
1515
16 void %__mf_init() {
16 define void @__mf_init() {
1717 entry:
18 ret void
18 ret void
1919 }
2020
21 void %__mf_fini() {
21 define void @__mf_fini() {
2222 entry:
23 ret void
23 ret void
2424 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm > %t
0 ; RUN: llvm-as < %s | llc -march=arm > %t
11 ; RUN: grep __divsi3 %t
22 ; RUN: grep __udivsi3 %t
33 ; RUN: grep __modsi3 %t
44 ; RUN: grep __umodsi3 %t
55
6 int %f1(int %a, int %b) {
6 define i32 @f1(i32 %a, i32 %b) {
77 entry:
8 %tmp1 = div int %a, %b
9 ret int %tmp1
8 %tmp1 = sdiv i32 %a, %b ; [#uses=1]
9 ret i32 %tmp1
1010 }
1111
12 uint %f2(uint %a, uint %b) {
12 define i32 @f2(i32 %a, i32 %b) {
1313 entry:
14 %tmp1 = div uint %a, %b
15 ret uint %tmp1
14 %tmp1 = udiv i32 %a, %b ; [#uses=1]
15 ret i32 %tmp1
1616 }
1717
18 int %f3(int %a, int %b) {
18 define i32 @f3(i32 %a, i32 %b) {
1919 entry:
20 %tmp1 = rem int %a, %b
21 ret int %tmp1
20 %tmp1 = srem i32 %a, %b ; [#uses=1]
21 ret i32 %tmp1
2222 }
2323
24 uint %f4(uint %a, uint %b) {
24 define i32 @f4(i32 %a, i32 %b) {
2525 entry:
26 %tmp1 = rem uint %a, %b
27 ret uint %tmp1
26 %tmp1 = urem i32 %a, %b ; [#uses=1]
27 ret i32 %tmp1
2828 }
29
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
0 ; RUN: llvm-as < %s | llc -march=arm
1 @handler_installed.6144.b = external global i1 ; [#uses=1]
12
2 %handler_installed.6144.b = external global bool ; [#uses=1]
3 define void @__mf_sigusr1_respond() {
4 entry:
5 %tmp8.b = load i1* @handler_installed.6144.b ; [#uses=1]
6 br i1 false, label %cond_true7, label %cond_next
37
8 cond_next: ; preds = %entry
9 br i1 %tmp8.b, label %bb, label %cond_next3
410
5 void %__mf_sigusr1_respond() {
6 entry:
7 %tmp8.b = load bool* %handler_installed.6144.b ; [#uses=1]
8 br bool false, label %cond_true7, label %cond_next
11 cond_next3: ; preds = %cond_next
12 ret void
913
10 cond_next: ; preds = %entry
11 br bool %tmp8.b, label %bb, label %cond_next3
14 bb: ; preds = %cond_next
15 ret void
1216
13 cond_next3: ; preds = %cond_next
14 ret void
15
16 bb: ; preds = %cond_next
17 ret void
18
19 cond_true7: ; preds = %entry
20 ret void
17 cond_true7: ; preds = %entry
18 ret void
2119 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 > %t
0 ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 > %t
11 ; RUN: grep fmsr %t | count 4
22 ; RUN: grep fsitos %t
33 ; RUN: grep fmrs %t | count 2
99 ; RUN: grep fuitos %t
1010 ; RUN: grep 1065353216 %t
1111
12 float %f(int %a) {
12 define float @f(i32 %a) {
1313 entry:
14 %tmp = cast int %a to float ; [#uses=1]
15 ret float %tmp
14 %tmp = sitofp i32 %a to float ; [#uses=1]
15 ret float %tmp
1616 }
1717
18 double %g(int %a) {
18 define double @g(i32 %a) {
1919 entry:
20 %tmp = cast int %a to double ; [#uses=1]
20 %tmp = sitofp i32 %a to double ; [#uses=1]
2121 ret double %tmp
2222 }
2323
24 double %uint_to_double(uint %a) {
24 define double @uint_to_double(i32 %a) {
2525 entry:
26 %tmp = cast uint %a to double
27 ret double %tmp
26 %tmp = uitofp i32 %a to double ; [#uses=1]
27 ret double %tmp
2828 }
2929
30 float %uint_to_float(uint %a) {
30 define float @uint_to_float(i32 %a) {
3131 entry:
32 %tmp = cast uint %a to float
33 ret float %tmp
32 %tmp = uitofp i32 %a to float ; [#uses=1]
33 ret float %tmp
3434 }
3535
36
37 double %h(double* %v) {
36 define double @h(double* %v) {
3837 entry:
39 %tmp = load double* %v ; [#uses=1]
40 ret double %tmp
38 %tmp = load double* %v ; [#uses=1]
39 ret double %tmp
4140 }
4241
43 float %h2() {
42 define float @h2() {
4443 entry:
4544 ret float 1.000000e+00
4645 }
4746
48 double %f2(double %a) {
47 define double @f2(double %a) {
4948 ret double %a
5049 }
5150
52 void %f3() {
51 define void @f3() {
5352 entry:
54 %tmp = call double %f5() ; [#uses=1]
55 call void %f4(double %tmp )
56 ret void
53 %tmp = call double @f5( ) ; [#uses=1]
54 call void @f4( double %tmp )
55 ret void
5756 }
5857
59 declare void %f4(double)
60 declare double %f5()
58 declare void @f4(double)
59
60 declare double @f5()
61
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 > %t
0 ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 > %t
11 ; RUN: grep fadds %t
22 ; RUN: grep faddd %t
33 ; RUN: grep fmuls %t
77 ; RUN: grep fdivs %t
88 ; RUN: grep fdivd %t
99
10
11 float %f1(float %a, float %b) {
10 define float @f1(float %a, float %b) {
1211 entry:
13 %tmp = add float %a, %b
12 %tmp = add float %a, %b ; [#uses=1]
1413 ret float %tmp
1514 }
1615
17 double %f2(double %a, double %b) {
16 define double @f2(double %a, double %b) {
1817 entry:
19 %tmp = add double %a, %b
18 %tmp = add double %a, %b ; [#uses=1]
2019 ret double %tmp
2120 }
2221
23 float %f3(float %a, float %b) {
22 define float @f3(float %a, float %b) {
2423 entry:
25 %tmp = mul float %a, %b
24 %tmp = mul float %a, %b ; [#uses=1]
2625 ret float %tmp
2726 }
2827
29 double %f4(double %a, double %b) {
28 define double @f4(double %a, double %b) {
3029 entry:
31 %tmp = mul double %a, %b
30 %tmp = mul double %a, %b ; [#uses=1]
3231 ret double %tmp
3332 }
3433
35 float %f5(float %a, float %b) {
34 define float @f5(float %a, float %b) {
3635 entry:
37 %tmp = sub float %a, %b
36 %tmp = sub float %a, %b ; [#uses=1]
3837 ret float %tmp
3938 }
4039
41 double %f6(double %a, double %b) {
40 define double @f6(double %a, double %b) {
4241 entry:
43 %tmp = sub double %a, %b
42 %tmp = sub double %a, %b ; [#uses=1]
4443 ret double %tmp
4544 }
4645
47 float %f7(float %a) {
46 define float @f7(float %a) {
4847 entry:
49 %tmp1 = sub float -0.000000e+00, %a
48 %tmp1 = sub float -0.000000e+00, %a ; [#uses=1]
5049 ret float %tmp1
5150 }
5251
53 double %f8(double %a) {
52 define double @f8(double %a) {
5453 entry:
55 %tmp1 = sub double -0.000000e+00, %a
54 %tmp1 = sub double -0.000000e+00, %a ; [#uses=1]
5655 ret double %tmp1
5756 }
5857
59 float %f9(float %a, float %b) {
58 define float @f9(float %a, float %b) {
6059 entry:
61 %tmp1 = div float %a, %b
60 %tmp1 = fdiv float %a, %b ; [#uses=1]
6261 ret float %tmp1
6362 }
6463
65 double %f10(double %a, double %b) {
64 define double @f10(double %a, double %b) {
6665 entry:
67 %tmp1 = div double %a, %b
66 %tmp1 = fdiv double %a, %b ; [#uses=1]
6867 ret double %tmp1
6968 }
7069
71 float %f11(float %a) {
70 define float @f11(float %a) {
7271 entry:
73 %tmp1 = call float %fabsf(float %a)
72 %tmp1 = call float @fabsf( float %a ) ; [#uses=1]
7473 ret float %tmp1
7574 }
7675
77 declare float %fabsf(float)
76 declare float @fabsf(float)
7877
79 double %f12(double %a) {
78 define double @f12(double %a) {
8079 entry:
81 %tmp1 = call double %fabs(double %a)
80 %tmp1 = call double @fabs( double %a ) ; [#uses=1]
8281 ret double %tmp1
8382 }
8483
85 declare double %fabs(double)
84 declare double @fabs(double)
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 > %t
0 ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 > %t
11 ; RUN: grep movmi %t
22 ; RUN: grep moveq %t
33 ; RUN: grep movgt %t
66 ; RUN: grep fcmped %t | count 1
77 ; RUN: grep fcmpes %t | count 6
88
9 int %f1(float %a) {
9 define i32 @f1(float %a) {
1010 entry:
11 %tmp = setlt float %a, 1.000000e+00 ; [#uses=1]
12 %tmp = cast bool %tmp to int ; [#uses=1]
13 ret int %tmp
11 %tmp = fcmp olt float %a, 1.000000e+00 ; [#uses=1]
12 %tmp1 = zext i1 %tmp to i32 ; [#uses=1]
13 ret i32 %tmp1
1414 }
1515
16 int %f2(float %a) {
16 define i32 @f2(float %a) {
1717 entry:
18 %tmp = seteq float %a, 1.000000e+00 ; [#uses=1]
19 %tmp = cast bool %tmp to int ; [#uses=1]
20 ret int %tmp
18 %tmp = fcmp oeq float %a, 1.000000e+00 ; [#uses=1]
19 %tmp2 = zext i1 %tmp to i32 ; [#uses=1]
20 ret i32 %tmp2
2121 }
2222
23 int %f3(float %a) {
23 define i32 @f3(float %a) {
2424 entry:
25 %tmp = setgt float %a, 1.000000e+00 ; [#uses=1]
26 %tmp = cast bool %tmp to int ; [#uses=1]
27 ret int %tmp
25 %tmp = fcmp ogt float %a, 1.000000e+00 ; [#uses=1]
26 %tmp3 = zext i1 %tmp to i32 ; [#uses=1]
27 ret i32 %tmp3
2828 }
2929
30 int %f4(float %a) {
30 define i32 @f4(float %a) {
3131 entry:
32 %tmp = setge float %a, 1.000000e+00 ; [#uses=1]
33 %tmp = cast bool %tmp to int ; [#uses=1]
34 ret int %tmp
32 %tmp = fcmp oge float %a, 1.000000e+00 ; [#uses=1]
33 %tmp4 = zext i1 %tmp to i32 ; [#uses=1]
34 ret i32 %tmp4
3535 }
3636
37 int %f5(float %a) {
37 define i32 @f5(float %a) {
3838 entry:
39 %tmp = setle float %a, 1.000000e+00 ; [#uses=1]
40 %tmp = cast bool %tmp to int ; [#uses=1]
41 ret int %tmp
39 %tmp = fcmp ole float %a, 1.000000e+00 ; [#uses=1]
40 %tmp5 = zext i1 %tmp to i32 ; [#uses=1]
41 ret i32 %tmp5
4242 }
4343
44 int %f6(float %a) {
44 define i32 @f6(float %a) {
4545 entry:
46 %tmp = setne float %a, 1.000000e+00 ; [#uses=1]
47 %tmp = cast bool %tmp to int ; [#uses=1]
48 ret int %tmp
46 %tmp = fcmp une float %a, 1.000000e+00 ; [#uses=1]
47 %tmp6 = zext i1 %tmp to i32 ; [#uses=1]
48 ret i32 %tmp6
4949 }
5050
51 int %g1(double %a) {
51 define i32 @g1(double %a) {
5252 entry:
53 %tmp = setlt double %a, 1.000000e+00 ; [#uses=1]
54 %tmp = cast bool %tmp to int ; [#uses=1]
55 ret int %tmp
53 %tmp = fcmp olt double %a, 1.000000e+00 ; [#uses=1]
54 %tmp7 = zext i1 %tmp to i32 ; [#uses=1]
55 ret i32 %tmp7
5656 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 > %t
0 ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 > %t
11 ; RUN: grep fcvtsd %t
22 ; RUN: grep fcvtds %t
33 ; RUN: grep ftosizs %t
99 ; RUN: grep fuitos %t
1010 ; RUN: grep fuitod %t
1111
12 float %f1(double %x) {
12 define float @f1(double %x) {
1313 entry:
14 %tmp1 = cast double %x to float
14 %tmp1 = fptrunc double %x to float ; [#uses=1]
1515 ret float %tmp1
1616 }
1717
18 double %f2(float %x) {
18 define double @f2(float %x) {
1919 entry:
20 %tmp1 = cast float %x to double
20 %tmp1 = fpext float %x to double ; [#uses=1]
2121 ret double %tmp1
2222 }
2323
24 int %f3(float %x) {
24 define i32 @f3(float %x) {
2525 entry:
26 %tmp = cast float %x to int
27 ret int %tmp
26 %tmp = fptosi float %x to i32 ; [#uses=1]
27 ret i32 %tmp
2828 }
2929
30 uint %f4(float %x) {
30 define i32 @f4(float %x) {
3131 entry:
32 %tmp = cast float %x to uint
33 ret uint %tmp
32 %tmp = fptoui float %x to i32 ; [#uses=1]
33 ret i32 %tmp
3434 }
3535
36 int %f5(double %x) {
36 define i32 @f5(double %x) {
3737 entry:
38 %tmp = cast double %x to int
39 ret int %tmp
38 %tmp = fptosi double %x to i32 ; [#uses=1]
39 ret i32 %tmp
4040 }
4141
42 uint %f6(double %x) {
42 define i32 @f6(double %x) {
4343 entry:
44 %tmp = cast double %x to uint
45 ret uint %tmp
44 %tmp = fptoui double %x to i32 ; [#uses=1]
45 ret i32 %tmp
4646 }
4747
48 float %f7(int %a) {
48 define float @f7(i32 %a) {
4949 entry:
50 %tmp = cast int %a to float
50 %tmp = sitofp i32 %a to float ; [#uses=1]
5151 ret float %tmp
5252 }
5353
54 double %f8(int %a) {
54 define double @f8(i32 %a) {
5555 entry:
56 %tmp = cast int %a to double
57 ret double %tmp
56 %tmp = sitofp i32 %a to double ; [#uses=1]
57 ret double %tmp
5858 }
5959
60 float %f9(uint %a) {
60 define float @f9(i32 %a) {
6161 entry:
62 %tmp = cast uint %a to float
62 %tmp = uitofp i32 %a to float ; [#uses=1]
6363 ret float %tmp
6464 }
6565
66 double %f10(uint %a) {
66 define double @f10(i32 %a) {
6767 entry:
68 %tmp = cast uint %a to double
68 %tmp = uitofp i32 %a to double ; [#uses=1]
6969 ret double %tmp
7070 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
0 ; RUN: llvm-as < %s | llc -march=arm | \
11 ; RUN: grep {mov r0, #0} | count 1
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | \
2 ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
33 ; RUN: grep {flds.*\\\[} | count 1
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | \
4 ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
55 ; RUN: grep {fsts.*\\\[} | count 1
66
7 float %f1(float %a) {
8 ret float 0.000000e+00
7 define float @f1(float %a) {
8 ret float 0.000000e+00
99 }
1010
11 float %f2(float* %v, float %u) {
12 %tmp = load float* %v
13 %tmp1 = add float %tmp, %u
14 ret float %tmp1
11 define float @f2(float* %v, float %u) {
12 %tmp = load float* %v ; [#uses=1]
13 %tmp1 = add float %tmp, %u ; [#uses=1]
14 ret float %tmp1
1515 }
1616
17 void %f3(float %a, float %b, float* %v) {
18 %tmp = add float %a, %b
19 store float %tmp, float* %v
20 ret void
17 define void @f3(float %a, float %b, float* %v) {
18 %tmp = add float %a, %b ; [#uses=1]
19 store float %tmp, float* %v
20 ret void
2121 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | not grep CPI
0 ; RUN: llvm-as < %s | llc -march=arm | not grep CPI
11
2 int %test1(int %A) {
3 %B = add int %A, -268435441 ; 0xF000000F
4 ret int %B
2 define i32 @test1(i32 %A) {
3 %B = add i32 %A, -268435441 ; [#uses=1]
4 ret i32 %B
55 }
66
7 int %test2() {
8 ret int 65533
7 define i32 @test2() {
8 ret i32 65533
99 }
1010
11 int %test3(int %A) {
12 %B = or int %A, 65533
13 ret int %B
11 define i32 @test3(i32 %A) {
12 %B = or i32 %A, 65533 ; [#uses=1]
13 ret i32 %B
1414 }
1515
16
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin -mattr=+v6 |\
0 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6
1 ; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin -mattr=+v6 |\
22 ; RUN: grep mov | count 3
33
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
4 define i32 @test(i32 %x) {
5 %tmp = trunc i32 %x to i16 ; [#uses=1]
6 %tmp2 = tail call i32 @f( i32 1, i16 %tmp ) ; [#uses=1]
7 ret i32 %tmp2
88 }
99
10 declare int %f(int, short)
10 declare i32 @f(i32, i16)
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
0 ; RUN: llvm-as < %s | llc -march=arm | \
11 ; RUN: grep ldmia | count 2
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
2 ; RUN: llvm-as < %s | llc -march=arm | \
33 ; RUN: grep ldmib | count 1
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin | \
4 ; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin | \
55 ; RUN: grep {ldmfd sp\!} | count 3
66
7 %X = external global [0 x int]
7 @X = external global [0 x i32] ; <[0 x i32]*> [#uses=5]
88
9 int %t1() {
10 %tmp = load int* getelementptr ([0 x int]* %X, int 0, int 0)
11 %tmp3 = load int* getelementptr ([0 x int]* %X, int 0, int 1)
12 %tmp4 = tail call int %f1( int %tmp, int %tmp3 )
13 ret int %tmp4
9 define i32 @t1() {
10 %tmp = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 0) ; [#uses=1]
11 %tmp3 = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 1) ; [#uses=1]
12 %tmp4 = tail call i32 @f1( i32 %tmp, i32 %tmp3 ) ; [#uses=1]
13 ret i32 %tmp4
1414 }
1515
16 int %t2() {
17 %tmp = load int* getelementptr ([0 x int]* %X, int 0, int 2)
18 %tmp3 = load int* getelementptr ([0 x int]* %X, int 0, int 3)
19 %tmp5 = load int* getelementptr ([0 x int]* %X, int 0, int 4)
20 %tmp6 = tail call int %f2( int %tmp, int %tmp3, int %tmp5 )
21 ret int %tmp6
16 define i32 @t2() {
17 %tmp = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 2) ; [#uses=1]
18 %tmp3 = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 3) ; [#uses=1]
19 %tmp5 = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 4) ; [#uses=1]
20 %tmp6 = tail call i32 @f2( i32 %tmp, i32 %tmp3, i32 %tmp5 ) ; [#uses=1]
21 ret i32 %tmp6
2222 }
2323
24 int %t3() {
25 %tmp = load int* getelementptr ([0 x int]* %X, int 0, int 1)
26 %tmp3 = load int* getelementptr ([0 x int]* %X, int 0, int 2)
27 %tmp5 = load int* getelementptr ([0 x int]* %X, int 0, int 3)
28 %tmp6 = tail call int %f2( int %tmp, int %tmp3, int %tmp5 )
29 ret int %tmp6
24 define i32 @t3() {
25 %tmp = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 1) ; [#uses=1]
26 %tmp3 = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 2) ; [#uses=1]
27 %tmp5 = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 3) ; [#uses=1]
28 %tmp6 = tail call i32 @f2( i32 %tmp, i32 %tmp3, i32 %tmp5 ) ; [#uses=1]
29 ret i32 %tmp6
3030 }
3131
32 declare int %f1(int, int)
33 declare int %f2(int, int, int)
32 declare i32 @f1(i32, i32)
33
34 declare i32 @f2(i32, i32, i32)
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
0 ; RUN: llvm-as < %s | llc -march=arm | \
11 ; RUN: grep {ldr r0} | count 3
22
3 int %f1(int* %v) {
3 define i32 @f1(i32* %v) {
44 entry:
5 %tmp = load int* %v ; [#uses=1]
6 ret int %tmp
5 %tmp = load i32* %v ; [#uses=1]
6 ret i32 %tmp
77 }
88
9 int %f2(int* %v) {
9 define i32 @f2(i32* %v) {
1010 entry:
11 %tmp2 = getelementptr int* %v, int 1023 ; [#uses=1]
12 %tmp = load int* %tmp2 ; [#uses=1]
13 ret int %tmp
11 %tmp2 = getelementptr i32* %v, i32 1023 ; [#uses=1]
12 %tmp = load i32* %tmp2 ; [#uses=1]
13 ret i32 %tmp
1414 }
1515
16 int %f3(int* %v) {
16 define i32 @f3(i32* %v) {
1717 entry:
18 %tmp2 = getelementptr int* %v, int 1024 ; [#uses=1]
19 %tmp = load int* %tmp2 ; [#uses=1]
20 ret int %tmp
18 %tmp2 = getelementptr i32* %v, i32 1024 ; [#uses=1]
19 %tmp = load i32* %tmp2 ; [#uses=1]
20 ret i32 %tmp
2121 }
22
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
0 ; RUN: llvm-as < %s | llc -march=arm | \
11 ; RUN: grep {ldr.*\\\[.*\],} | count 1
22
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
3 define i32 @test(i32 %a, i32 %b, i32 %c) {
4 %tmp1 = mul i32 %a, %b ; [#uses=2]
5 %tmp2 = inttoptr i32 %tmp1 to i32* ; [#uses=1]
6 %tmp3 = load i32* %tmp2 ; [#uses=1]
7 %tmp4 = sub i32 %tmp1, %c ; [#uses=1]
8 %tmp5 = mul i32 %tmp4, %tmp3 ; [#uses=1]
9 ret i32 %tmp5
1010 }
11
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
0 ; RUN: llvm-as < %s | llc -march=arm | \
11 ; RUN: grep {ldr.*\\!} | count 2
22
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
3 define i32* @test1(i32* %X, i32* %dest) {
4 %Y = getelementptr i32* %X, i32 4 ; [#uses=2]
5 %A = load i32* %Y ; [#uses=1]
6 store i32 %A, i32* %dest
7 ret i32* %Y
88 }
99
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
10 define i32 @test2(i32 %a, i32 %b, i32 %c) {
11 %tmp1 = sub i32 %a, %b ; [#uses=2]
12 %tmp2 = inttoptr i32 %tmp1 to i32* ; [#uses=1]
13 %tmp3 = load i32* %tmp2 ; [#uses=1]
14 %tmp4 = sub i32 %tmp1, %c ; [#uses=1]
15 %tmp5 = add i32 %tmp4, %tmp3 ; [#uses=1]
16 ret i32 %tmp5
1717 }
18
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm > %t
0 ; RUN: llvm-as < %s | llc -march=arm > %t
11 ; RUN: grep ldrsb %t
22 ; RUN: grep ldrb %t
33 ; RUN: grep ldrsh %t
44 ; RUN: grep ldrh %t
55
6 int %f1(sbyte* %p) {
6
7 define i32 @f1(i8* %p) {
78 entry:
8 %tmp = load sbyte* %p ; [#uses=1]
9 %tmp = cast sbyte %tmp to int ; [#uses=1]
10 ret int %tmp
9 %tmp = load i8* %p ; [#uses=1]
10 %tmp1 = sext i8 %tmp to i32 ; [#uses=1]
11 ret i32 %tmp1
1112 }
1213
13 int %f2(ubyte* %p) {
14 define i32 @f2(i8* %p) {
1415 entry:
15 %tmp = load ubyte* %p ; [#uses=1]
16 %tmp = cast ubyte %tmp to int ; [#uses=1]
17 ret int %tmp
16 %tmp = load i8* %p ; [#uses=1]
17 %tmp2 = zext i8 %tmp to i32 ; [#uses=1]
18 ret i32 %tmp2
1819 }
1920
20 int %f3(short* %p) {
21 define i32 @f3(i16* %p) {
2122 entry:
22 %tmp = load short* %p ; [#uses=1]
23 %tmp = cast short %tmp to int ; [#uses=1]
24 ret int %tmp
23 %tmp = load i16* %p ; [#uses=1]
24 %tmp3 = sext i16 %tmp to i32 ; [#uses=1]
25 ret i32 %tmp3
2526 }
2627
27 int %f4(ushort* %p) {
28 define i32 @f4(i16* %p) {
2829 entry:
29 %tmp = load ushort* %p ; [#uses=1]
30 %tmp = cast ushort %tmp to int ; [#uses=1]
31 ret int %tmp
30 %tmp = load i16* %p ; [#uses=1]
31 %tmp4 = zext i16 %tmp to i32 ; [#uses=1]
32 ret i32 %tmp4
3233 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
0 ; RUN: llvm-as < %s | llc -march=arm | \
11 ; RUN: grep -- {-2147483648} | count 3
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | count 3
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep adds | count 1
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep adc | count 1
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep {subs } | count 1
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep sbc | count 1
7 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
2 ; RUN: llvm-as < %s | llc -march=arm | grep mvn | count 3
3 ; RUN: llvm-as < %s | llc -march=arm | grep adds | count 1
4 ; RUN: llvm-as < %s | llc -march=arm | grep adc | count 1
5 ; RUN: llvm-as < %s | llc -march=arm | grep {subs } | count 1
6 ; RUN: llvm-as < %s | llc -march=arm | grep sbc | count 1
7 ; RUN: llvm-as < %s | llc -march=arm | \
88 ; RUN: grep smull | count 1
9 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
9 ; RUN: llvm-as < %s | llc -march=arm | \
1010 ; RUN: grep umull | count 1
11 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=thumb | \
11 ; RUN: llvm-as < %s | llc -march=thumb | \
1212 ; RUN: grep mvn | count 1
13 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=thumb | \
13 ; RUN: llvm-as < %s | llc -march=thumb | \
1414 ; RUN: grep adc | count 1
15 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=thumb | \
15 ; RUN: llvm-as < %s | llc -march=thumb | \
1616 ; RUN: grep sbc | count 1
17 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=thumb | grep __muldi3
18 ; END.
17 ; RUN: llvm-as < %s | llc -march=thumb | grep __muldi3
1918
20 long %f1() {
19 define i64 @f1() {
2120 entry:
22 ret long 0
21 ret i64 0
2322 }
2423
25 long %f2() {
24 define i64 @f2() {
2625 entry:
27 ret long 1
26 ret i64 1
2827 }
2928
30 long %f3() {
29 define i64 @f3() {
3130 entry:
32 ret long 2147483647
31 ret i64 2147483647
3332 }
3433
35 long %f4() {
34 define i64 @f4() {
3635 entry:
37 ret long 2147483648
36 ret i64 2147483648
3837 }
3938
40 long %f5() {
39 define i64 @f5() {
4140 entry:
42 ret long 9223372036854775807
41 ret i64 9223372036854775807
4342 }
4443
45 ulong %f6(ulong %x, ulong %y) {
44 define i64 @f6(i64 %x, i64 %y) {
4645 entry:
47 %tmp1 = add ulong %y, 1
48 ret ulong %tmp1
46 %tmp1 = add i64 %y, 1 ; [#uses=1]
47 ret i64 %tmp1
4948 }
5049
51 void %f7() {
50 define void @f7() {
5251 entry:
53 %tmp = call long %f8()
54 ret void
55 }
56 declare long %f8()
57
58 long %f9(long %a, long %b) {
59 entry:
60 %tmp = sub long %a, %b
61 ret long %tmp
52 %tmp = call i64 @f8( ) ; [#uses=0]
53 ret void
6254 }
6355
64 long %f(int %a, int %b) {
56 declare i64 @f8()
57
58 define i64 @f9(i64 %a, i64 %b) {
6559 entry:
66 %tmp = cast int %a to long
67 %tmp1 = cast int %b to long
68 %tmp2 = mul long %tmp1, %tmp
69 ret long %tmp2
60 %tmp = sub i64 %a, %b ; [#uses=1]
61 ret i64 %tmp
7062 }
7163
72 ulong %g(uint %a, uint %b) {
64 define i64 @f(i32 %a, i32 %b) {
7365 entry:
74 %tmp = cast uint %a to ulong
75 %tmp1 = cast uint %b to ulong
76 %tmp2 = mul ulong %tmp1, %tmp
77 ret ulong %tmp2
66 %tmp = sext i32 %a to i64 ; [#uses=1]
67 %tmp1 = sext i32 %b to i64 ; [#uses=1]
68 %tmp2 = mul i64 %tmp1, %tmp ; [#uses=1]
69 ret i64 %tmp2
7870 }
7971
80 ulong %f10() {
72 define i64 @g(i32 %a, i32 %b) {
8173 entry:
82 %a = alloca ulong, align 8
83 %retval = load ulong* %a
84 ret ulong %retval
74 %tmp = zext i32 %a to i64 ; [#uses=1]
75 %tmp1 = zext i32 %b to i64 ; [#uses=1]
76 %tmp2 = mul i64 %tmp1, %tmp ; [#uses=1]
77 ret i64 %tmp2
8578 }
79
80 define i64 @f10() {
81 entry:
82 %a = alloca i64, align 8 ; [#uses=1]
83 %retval = load i64* %a ; [#uses=1]
84 ret i64 %retval
85 }
86
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep strb
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep strh
0 ; RUN: llvm-as < %s | llc -march=arm | grep strb
1 ; RUN: llvm-as < %s | llc -march=arm | grep strh
22
3 void %f1() {
3 define void @f1() {
44 entry:
5 store ubyte 0, ubyte* null
6 ret void
5 store i8 0, i8* null
6 ret void
77 }
88
9 void %f2() {
9 define void @f2() {
1010 entry:
11 store short 0, short* null
12 ret void
11 store i16 0, i16* null
12 ret void
1313 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
0 ; RUN: llvm-as < %s | llc -march=arm
11
2 void %f() {
2 define void @f() {
33 entry:
4 call void %llvm.memmove.i32( sbyte* null, sbyte* null, uint 64, uint 0 )
5 call void %llvm.memcpy.i32( sbyte* null, sbyte* null, uint 64, uint 0 )
6 call void %llvm.memset.i32( sbyte* null, ubyte 64, uint 0, uint 0 )
7 unreachable
4 call void @llvm.memmove.i32( i8* null, i8* null, i32 64, i32 0 )
5 call void @llvm.memcpy.i32( i8* null, i8* null, i32 64, i32 0 )
6 call void @llvm.memset.i32( i8* null, i8 64, i32 0, i32 0 )
7 unreachable
88 }
99
10 declare void %llvm.memmove.i32(sbyte*, sbyte*, uint, uint)
11 declare void %llvm.memcpy.i32(sbyte*, sbyte*, uint, uint)
12 declare void %llvm.memset.i32(sbyte*, ubyte, uint, uint)
10 declare void @llvm.memmove.i32(i8*, i8*, i32, i32)
11
12 declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
13
14 declare void @llvm.memset.i32(i8*, i8, i32, i32)
15
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | \
0 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6
1 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | \
22 ; RUN: grep smmul | count 1
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep umull | count 1
3 ; RUN: llvm-as < %s | llc -march=arm | grep umull | count 1
44
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
5 define i32 @smulhi(i32 %x, i32 %y) {
6 %tmp = sext i32 %x to i64 ; [#uses=1]
7 %tmp1 = sext i32 %y to i64 ; [#uses=1]
8 %tmp2 = mul i64 %tmp1, %tmp ; [#uses=1]
9 %tmp3 = lshr i64 %tmp2, 32 ; [#uses=1]
10 %tmp3.upgrd.1 = trunc i64 %tmp3 to i32 ; [#uses=1]
11 ret i32 %tmp3.upgrd.1
1212 }
1313
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
14 define i32 @umulhi(i32 %x, i32 %y) {
15 %tmp = zext i32 %x to i64 ; [#uses=1]
16 %tmp1 = zext i32 %y to i64 ; [#uses=1]
17 %tmp2 = mul i64 %tmp1, %tmp ; [#uses=1]
18 %tmp3 = lshr i64 %tmp2, 32 ; [#uses=1]
19 %tmp3.upgrd.2 = trunc i64 %tmp3 to i32 ; [#uses=1]
20 ret i32 %tmp3.upgrd.2
2121 }
22
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | count 8
1 ; END.
0 ; RUN: llvm-as < %s | llc -march=arm | grep mvn | count 8
21
3 int %f1() {
2 define i32 @f1() {
43 entry:
5 ret int -1
4 ret i32 -1
65 }
76
8 int %f2(int %a) {
7 define i32 @f2(i32 %a) {
98 entry:
10 %tmpnot = xor int %a, -1 ; [#uses=1]
11 ret int %tmpnot
9 %tmpnot = xor i32 %a, -1 ; [#uses=1]
10 ret i32 %tmpnot
1211 }
1312
14 int %f3(int %a) {
13 define i32 @f3(i32 %a) {
1514 entry:
16 %tmp1 = shl int %a, ubyte 2 ; [#uses=1]
17 %tmp1not = xor int %tmp1, -1 ; [#uses=1]
18 ret int %tmp1not
15 %tmp1 = shl i32 %a, 2 ; [#uses=1]
16 %tmp1not = xor i32 %tmp1, -1 ; [#uses=1]
17 ret i32 %tmp1not
1918 }
2019
21 int %f4(int %a, ubyte %b) {
20 define i32 @f4(i32 %a, i8 %b) {
2221 entry:
23 %tmp3 = shl int %a, ubyte %b ; [#uses=1]
24 %tmp3not = xor int %tmp3, -1 ; [#uses=1]
25 ret int %tmp3not
22 %shift.upgrd.1 = zext i8 %b to i32 ; [#uses=1]
23 %tmp3 = shl i32 %a, %shift.upgrd.1 ; [#uses=1]
24 %tmp3not = xor i32 %tmp3, -1 ; [#uses=1]
25 ret i32 %tmp3not
2626 }
2727
28 uint %f5(uint %a) {
28 define i32 @f5(i32 %a) {
2929 entry:
30 %tmp1 = lshr uint %a, ubyte 2 ; [#uses=1]
31 %tmp1not = xor uint %tmp1, 4294967295 ; [#uses=1]
32 ret uint %tmp1not
30 %tmp1 = lshr i32 %a, 2 ; [#uses=1]
31 %tmp1not = xor i32 %tmp1, -1 ; [#uses=1]
32 ret i32 %tmp1not
3333 }
3434
35 uint %f6(uint %a, ubyte %b) {
35 define i32 @f6(i32 %a, i8 %b) {
3636 entry:
37 %tmp2 = lshr uint %a, ubyte %b ; [#uses=1]
38 %tmp2not = xor uint %tmp2, 4294967295 ; [#uses=1]
39 ret uint %tmp2not
37 %shift.upgrd.2 = zext i8 %b to i32 ; [#uses=1]
38 %tmp2 = lshr i32 %a, %shift.upgrd.2 ; [#uses=1]
39 %tmp2not = xor i32 %tmp2, -1 ; [#uses=1]
40 ret i32 %tmp2not
4041 }
4142
42 int %f7(int %a) {
43 define i32 @f7(i32 %a) {
4344 entry:
44 %tmp1 = ashr int %a, ubyte 2 ; [#uses=1]
45 %tmp1not = xor int %tmp1, -1 ; [#uses=1]
46 ret int %tmp1not
45 %tmp1 = ashr i32 %a, 2 ; [#uses=1]
46 %tmp1not = xor i32 %tmp1, -1 ; [#uses=1]
47 ret i32 %tmp1not
4748 }
4849
49 int %f8(int %a, ubyte %b) {
50 define i32 @f8(i32 %a, i8 %b) {
5051 entry:
51 %tmp3 = ashr int %a, ubyte %b ; [#uses=1]
52 %tmp3not = xor int %tmp3, -1 ; [#uses=1]
53 ret int %tmp3not
52 %shift.upgrd.3 = zext i8 %b to i32 ; [#uses=1]
53 %tmp3 = ashr i32 %a, %shift.upgrd.3 ; [#uses=1]
54 %tmp3not = xor i32 %tmp3, -1 ; [#uses=1]
55 ret i32 %tmp3not
5456 }
5557
56 int %f9() {
58 define i32 @f9() {
5759 entry:
58 %tmp4845 = add int 0, 0
59 br label %cond_true4848
60 %tmp4845 = add i32 0, 0 ; [#uses=1]
61 br label %cond_true4848
6062
61 cond_true4848: ; preds = %bb4835
62 %tmp4851 = sub int -3, 0 ; [#uses=1]
63 %abc = add int %tmp4851, %tmp4845
64 ret int %abc
63 cond_true4848: ; preds = %entry
64 %tmp4851 = sub i32 -3, 0 ; [#uses=1]
65 %abc = add i32 %tmp4851, %tmp4845 ; [#uses=1]
66 ret i32 %abc
6567 }
6668
67 bool %f10(int %a) {
69 define i1 @f10(i32 %a) {
6870 entry:
69 %tmp102 = seteq int -2, %a ; [#uses=1]
70 ret bool %tmp102
71 %tmp102 = icmp eq i32 -2, %a ; [#uses=1]
72 ret i1 %tmp102
7173 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | \
0 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | \
11 ; RUN: grep pkhbt | count 5
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | \
2 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | \
33 ; RUN: grep pkhtb | count 4
4 ; END.
54
6 implementation ; Functions:
7
8 int %test1(int %X, int %Y) {
9 %tmp1 = and int %X, 65535 ; [#uses=1]
10 %tmp4 = shl int %Y, ubyte 16 ; [#uses=1]
11 %tmp5 = or int %tmp4, %tmp1 ; [#uses=1]
12 ret int %tmp5
5 define i32 @test1(i32 %X, i32 %Y) {
6 %tmp1 = and i32 %X, 65535 ; [#uses=1]
7 %tmp4 = shl i32 %Y, 16 ; [#uses=1]
8 %tmp5 = or i32 %tmp4, %tmp1 ; [#uses=1]
9 ret i32 %tmp5
1310 }
1411
15 int %test1a(int %X, int %Y) {
16 %tmp19 = and int %X, 65535 ; [#uses=1]
17 %tmp37 = shl int %Y, ubyte 16 ; [#uses=1]
18 %tmp5 = or int %tmp37, %tmp19 ; [#uses=1]
19 ret int %tmp5
12 define i32 @test1a(i32 %X, i32 %Y) {
13 %tmp19 = and i32 %X, 65535 ; [#uses=1]
14 %tmp37 = shl i32 %Y, 16 ; [#uses=1]
15 %tmp5 = or i32 %tmp37, %tmp19 ; [#uses=1]
16 ret i32 %tmp5
2017 }
2118
22 int %test2(int %X, int %Y) {
23 %tmp1 = and int %X, 65535 ; [#uses=1]
24 %tmp3 = shl int %Y, ubyte 12 ; [#uses=1]
25 %tmp4 = and int %tmp3, -65536 ; [#uses=1]
26 %tmp57 = or int %tmp4, %tmp1 ; [#uses=1]
27 ret int %tmp57
19 define i32 @test2(i32 %X, i32 %Y) {
20 %tmp1 = and i32 %X, 65535 ; [#uses=1]
21 %tmp3 = shl i32 %Y, 12 ; [#uses=1]
22 %tmp4 = and i32 %tmp3, -65536 ; [#uses=1]
23 %tmp57 = or i32 %tmp4, %tmp1 ; [#uses=1]
24 ret i32 %tmp57
2825 }
2926
30 int %test3(int %X, int %Y) {
31 %tmp19 = and int %X, 65535 ; [#uses=1]
32 %tmp37 = shl int %Y, ubyte 18 ; [#uses=1]
33 %tmp5 = or int %tmp37, %tmp19 ; [#uses=1]
34 ret int %tmp5
27 define i32 @test3(i32 %X, i32 %Y) {
28 %tmp19 = and i32 %X, 65535 ; [#uses=1]
29 %tmp37 = shl i32 %Y, 18 ; [#uses=1]
30 %tmp5 = or i32 %tmp37, %tmp19 ; [#uses=1]
31 ret i32 %tmp5
3532 }
3633
37 int %test4(int %X, int %Y) {
38 %tmp1 = and int %X, 65535 ; [#uses=1]
39 %tmp3 = and int %Y, -65536 ; [#uses=1]
40 %tmp46 = or int %tmp3, %tmp1 ; [#uses=1]
41 ret int %tmp46
34 define i32 @test4(i32 %X, i32 %Y) {
35 %tmp1 = and i32 %X, 65535 ; [#uses=1]
36 %tmp3 = and i32 %Y, -65536 ; [#uses=1]
37 %tmp46 = or i32 %tmp3, %tmp1 ; [#uses=1]
38 ret i32 %tmp46
4239 }
4340
44 int %test5(int %X, int %Y) {
45 %tmp17 = and int %X, -65536 ; [#uses=1]
46 %tmp2 = cast int %Y to uint ; [#uses=1]
47 %tmp4 = shr uint %tmp2, ubyte 16 ; [#uses=1]
48 %tmp4 = cast uint %tmp4 to int ; [#uses=1]
49 %tmp5 = or int %tmp4, %tmp17 ; [#uses=1]
50 ret int %tmp5
41 define i32 @test5(i32 %X, i32 %Y) {
42 %tmp17 = and i32 %X, -65536 ; [#uses=1]
43 %tmp2 = bitcast i32 %Y to i32 ; [#uses=1]
44 %tmp4 = lshr i32 %tmp2, 16 ; [#uses=2]
45 %tmp5 = or i32 %tmp4, %tmp17 ; [#uses=1]
46 ret i32 %tmp5
5147 }
5248
53 int %test5a(int %X, int %Y) {
54 %tmp110 = and int %X, -65536 ; [#uses=1]
55 %Y = cast int %Y to uint ; [#uses=1]
56 %tmp37 = shr uint %Y, ubyte 16 ; [#uses=1]
57 %tmp39 = cast uint %tmp37 to int ; [#uses=1]
58 %tmp5 = or int %tmp39, %tmp110 ; [#uses=1]
59 ret int %tmp5
49 define i32 @test5a(i32 %X, i32 %Y) {
50 %tmp110 = and i32 %X, -65536 ; [#uses=1]
51 %tmp37 = lshr i32 %Y, 16 ; [#uses=1]
52 %tmp39 = bitcast i32 %tmp37 to i32 ; [#uses=1]
53 %tmp5 = or i32 %tmp39, %tmp110 ; [#uses=1]
54 ret i32 %tmp5
6055 }
6156
62 int %test6(int %X, int %Y) {
63 %tmp1 = and int %X, -65536 ; [#uses=1]
64 %Y = cast int %Y to uint ; [#uses=1]
65 %tmp37 = shr uint %Y, ubyte 12 ; [#uses=1]
66 %tmp38 = cast uint %tmp37 to int ; [#uses=1]
67 %tmp4 = and int %tmp38, 65535 ; [#uses=1]
68 %tmp59 = or int %tmp4, %tmp1 ; [#uses=1]
69 ret int %tmp59
57 define i32 @test6(i32 %X, i32 %Y) {
58 %tmp1 = and i32 %X, -65536 ; [#uses=1]
59 %tmp37 = lshr i32 %Y, 12 ; [#uses=1]
60 %tmp38 = bitcast i32 %tmp37 to i32 ; [#uses=1]
61 %tmp4 = and i32 %tmp38, 65535 ; [#uses=1]
62 %tmp59 = or i32 %tmp4, %tmp1 ; [#uses=1]
63 ret i32 %tmp59
7064 }
7165
72 int %test7(int %X, int %Y) {
73 %tmp1 = and int %X, -65536 ; [#uses=1]
74 %tmp3 = shr int %Y, ubyte 18 ; [#uses=1]
75 %tmp4 = and int %tmp3, 65535 ; [#uses=1]
76 %tmp57 = or int %tmp4, %tmp1 ; [#uses=1]
77 ret int %tmp57
66 define i32 @test7(i32 %X, i32 %Y) {
67 %tmp1 = and i32 %X, -65536 ; [#uses=1]
68 %tmp3 = ashr i32 %Y, 18 ; [#uses=1]
69 %tmp4 = and i32 %tmp3, 65535 ; [#uses=1]
70 %tmp57 = or i32 %tmp4, %tmp1 ; [#uses=1]
71 ret i32 %tmp57
7872 }
79
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
1 int %test() {
2 ret int 0
0 ; RUN: llvm-as < %s | llc -march=arm
1
2 define i32 @test() {
3 ret i32 0
34 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
1 int %test(int %a1) {
2 ret int %a1
0 ; RUN: llvm-as < %s | llc -march=arm
1
2 define i32 @test(i32 %a1) {
3 ret i32 %a1
34 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
1 int %test(int %a1, int %a2) {
2 ret int %a2
0 ; RUN: llvm-as < %s | llc -march=arm
1
2 define i32 @test(i32 %a1, i32 %a2) {
3 ret i32 %a2
34 }
5
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
1 int %test(int %a1, int %a2, int %a3) {
2 ret int %a3
0 ; RUN: llvm-as < %s | llc -march=arm
1 define i32 @test(i32 %a1, i32 %a2, i32 %a3) {
2 ret i32 %a3
33 }
4
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
1 int %test(int %a1, int %a2, int %a3, int %a4) {
2 ret int %a4
0 ; RUN: llvm-as < %s | llc -march=arm
1
2 define i32 @test(i32 %a1, i32 %a2, i32 %a3, i32 %a4) {
3 ret i32 %a4
34 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
1 int %test(int %a1, int %a2, int %a3, int %a4, int %a5) {
2 ret int %a5
0 ; RUN: llvm-as < %s | llc -march=arm
1
2 define i32 @test(i32 %a1, i32 %a2, i32 %a3, i32 %a4, i32 %a5) {
3 ret i32 %a5
34 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
1 void %test() {
2 ret void
0 ; RUN: llvm-as < %s | llc -march=arm
1
2 define void @test() {
3 ret void
34 }
5
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep rev16
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep revsh
0 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | grep rev16
1 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | grep revsh
22
3 int %test1(uint %X) {
4 %tmp1 = shr uint %X, ubyte 8 ; [#uses=1]
5 %tmp1 = cast uint %tmp1 to int ; [#uses=2]
6 %X15 = cast uint %X to int ; [#uses=1]
7 %tmp4 = shl int %X15, ubyte 8 ; [#uses=2]
8 %tmp2 = and int %tmp1, 16711680 ; [#uses=1]
9 %tmp5 = and int %tmp4, -16777216 ; [#uses=1]
10 %tmp9 = and int %tmp1, 255 ; [#uses=1]
11 %tmp13 = and int %tmp4, 65280 ; [#uses=1]
12 %tmp6 = or int %tmp5, %tmp2 ; [#uses=1]
13 %tmp10 = or int %tmp6, %tmp13 ; [#uses=1]
14 %tmp14 = or int %tmp10, %tmp9 ; [#uses=1]
15 ret int %tmp14
3 define i32 @test1(i32 %X) {
4 %tmp1 = lshr i32 %X, 8 ; [#uses=3]
5 %X15 = bitcast i32 %X to i32 ; [#uses=1]
6 %tmp4 = shl i32 %X15, 8 ; [#uses=2]
7 %tmp2 = and i32 %tmp1, 16711680 ; [#uses=1]
8 %tmp5 = and i32 %tmp4, -16777216 ; [#uses=1]
9 %tmp9 = and i32 %tmp1, 255 ; [#uses=1]
10 %tmp13 = and i32 %tmp4, 65280 ; [#uses=1]
11 %tmp6 = or i32 %tmp5, %tmp2 ; [#uses=1]
12 %tmp10 = or i32 %tmp6, %tmp13 ; [#uses=1]
13 %tmp14 = or i32 %tmp10, %tmp9 ; [#uses=1]
14 ret i32 %tmp14
1615 }
1716
18 int %test2(uint %X) { ; revsh
19 %tmp1 = shr uint %X, ubyte 8 ; [#uses=1]
20 %tmp1 = cast uint %tmp1 to short ; [#uses=1]
21 %tmp3 = cast uint %X to short ; [#uses=1]
22 %tmp2 = and short %tmp1, 255 ; [#uses=1]
23 %tmp4 = shl short %tmp3, ubyte 8 ; [#uses=1]
24 %tmp5 = or short %tmp2, %tmp4 ; [#uses=1]
25 %tmp5 = cast short %tmp5 to int ; [#uses=1]
26 ret int %tmp5
17 define i32 @test2(i32 %X) {
18 %tmp1 = lshr i32 %X, 8 ; [#uses=1]
19 %tmp1.upgrd.1 = trunc i32 %tmp1 to i16 ; [#uses=1]
20 %tmp3 = trunc i32 %X to i16 ; [#uses=1]
21 %tmp2 = and i16 %tmp1.upgrd.1, 255 ; [#uses=1]
22 %tmp4 = shl i16 %tmp3, 8 ; [#uses=1]
23 %tmp5 = or i16 %tmp2, %tmp4 ; [#uses=1]
24 %tmp5.upgrd.2 = sext i16 %tmp5 to i32 ; [#uses=1]
25 ret i32 %tmp5.upgrd.2
2726 }
28
None ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux | \
0 ; RUN: llvm-as < %s | llc -mtriple=arm-linux | \
11 ; RUN: grep {__DTOR_END__:}
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux | \
2 ; RUN: llvm-as < %s | llc -mtriple=arm-linux | \
33 ; RUN: grep {.section .dtors,"aw",.progbits}
44
5 %__DTOR_END__ = internal global [1 x int] zeroinitializer, section ".dtors"
5 @__DTOR_END__ = internal global [1 x i32] zeroinitializer, section ".dtors" ; <[1 x i32]*> [#uses=0]
6
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep add | grep lsl
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep bic | grep asr
0 ; RUN: llvm-as < %s | llc -march=arm | grep add | grep lsl
1 ; RUN: llvm-as < %s | llc -march=arm | grep bic | grep asr
22
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
3
4 define i32 @test1(i32 %X, i32 %Y, i8 %sh) {
5 %shift.upgrd.1 = zext i8 %sh to i32 ; [#uses=1]
6 %A = shl i32 %Y, %shift.upgrd.1 ; [#uses=1]
7 %B = add i32 %X, %A ; [#uses=1]
8 ret i32 %B
79 }
810
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
11 define i32 @test2(i32 %X, i32 %Y, i8 %sh) {
12 %shift.upgrd.2 = zext i8 %sh to i32 ; [#uses=1]
13 %A = ashr i32 %Y, %shift.upgrd.2 ; [#uses=1]
14 %B = xor i32 %A, -1 ; [#uses=1]
15 %C = and i32 %X, %B ; [#uses=1]
16 ret i32 %C
1417 }
None ; 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 | \
0 ; RUN: llvm-as < %s | llc -march=arm
1 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v5TE
2 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v5TE | \
33 ; RUN: grep smulbt | count 1
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v5TE | \
4 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v5TE | \
55 ; RUN: grep smultt | count 1
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v5TE | \
6 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v5TE | \
77 ; RUN: grep smlabt | count 1
88
9 %x = weak global short 0
10 %y = weak global short 0
9 @x = weak global i16 0 ; [#uses=1]
10 @y = weak global i16 0 ; [#uses=0]
1111
12 int %f1(int %y) {
13 %tmp = load short* %x
14 %tmp1 = add short %tmp, 2
15 %tmp2 = cast short %tmp1 to int
16 %tmp3 = shr int %y, ubyte 16
17 %tmp4 = mul int %tmp2, %tmp3
18 ret int %tmp4
12 define i32 @f1(i32 %y) {
13 %tmp = load i16* @x ; [#uses=1]
14 %tmp1 = add i16 %tmp, 2 ; [#uses=1]
15 %tmp2 = sext i16 %tmp1 to i32 ; [#uses=1]
16 %tmp3 = ashr i32 %y, 16 ; [#uses=1]
17 %tmp4 = mul i32 %tmp2, %tmp3 ; [#uses=1]
18 ret i32 %tmp4
1919 }
2020
21 int %f2(int %x, int %y) {
22 %tmp1 = shr int %x, ubyte 16
23 %tmp3 = shr int %y, ubyte 16
24 %tmp4 = mul int %tmp3, %tmp1
25 ret int %tmp4
21 define i32 @f2(i32 %x, i32 %y) {
22 %tmp1 = ashr i32 %x, 16 ; [#uses=1]
23 %tmp3 = ashr i32 %y, 16 ; [#uses=1]
24 %tmp4 = mul i32 %tmp3, %tmp1 ; [#uses=1]
25 ret i32 %tmp4
2626 }
2727
28 int %f3(int %a, short %x, int %y) {
29 %tmp = cast short %x to int
30 %tmp2 = shr int %y, ubyte 16
31 %tmp3 = mul int %tmp2, %tmp
32 %tmp5 = add int %tmp3, %a
33 ret int %tmp5
28 define i32 @f3(i32 %a, i16 %x, i32 %y) {
29 %tmp = sext i16 %x to i32 ; [#uses=1]
30 %tmp2 = ashr i32 %y, 16 ; [#uses=1]
31 %tmp3 = mul i32 %tmp2, %tmp ; [#uses=1]
32 %tmp5 = add i32 %tmp3, %a ; [#uses=1]
33 ret i32 %tmp5
3434 }
35
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
0 ; RUN: llvm-as < %s | llc -march=arm | \
11 ; RUN: grep {strh .*\\\[.*\], #-4} | count 1
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
2 ; RUN: llvm-as < %s | llc -march=arm | \
33 ; RUN: grep {str .*\\\[.*\],} | count 1
44
5 short %test1(int *%X, short *%A) {
6 %Y = load int* %X
7 %tmp1 = cast int %Y to short
8 store short %tmp1, short* %A
9 %tmp2 = cast short* %A to short
10 %tmp3 = sub short %tmp2, 4
11 ret short %tmp3
5 define i16 @test1(i32* %X, i16* %A) {
6 %Y = load i32* %X ; [#uses=1]
7 %tmp1 = trunc i32 %Y to i16 ; [#uses=1]
8 store i16 %tmp1, i16* %A
9 %tmp2 = ptrtoint i16* %A to i16 ; [#uses=1]
10 %tmp3 = sub i16 %tmp2, 4 ; [#uses=1]
11 ret i16 %tmp3
1212 }
1313
14 int %test2(int *%X, int *%A) {
15 %Y = load int* %X
16 store int %Y, int* %A
17 %tmp1 = cast int* %A to int
18 %tmp2 = sub int %tmp1, 4
19 ret int %tmp2
14 define i32 @test2(i32* %X, i32* %A) {
15 %Y = load i32* %X ; [#uses=1]
16 store i32 %Y, i32* %A
17 %tmp1 = ptrtoint i32* %A to i32 ; [#uses=1]
18 %tmp2 = sub i32 %tmp1, 4 ; [#uses=1]
19 ret i32 %tmp2
2020 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
0 ; RUN: llvm-as < %s | llc -march=arm | \
11 ; RUN: grep {str.*\\!} | count 2
22
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
3 define void @test1(i32* %X, i32* %A, i32** %dest) {
4 %B = load i32* %A ; [#uses=1]
5 %Y = getelementptr i32* %X, i32 4 ; [#uses=2]
6 store i32 %B, i32* %Y
7 store i32* %Y, i32** %dest
88 ret void
99 }
1010
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
11 define i16* @test2(i16* %X, i32* %A) {
12 %B = load i32* %A ; [#uses=1]
13 %Y = getelementptr i16* %X, i32 4 ; [#uses=2]
14 %tmp = trunc i32 %B to i16 ; [#uses=1]
15 store i16 %tmp, i16* %Y
16 ret i16* %Y
1717 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
0 ; RUN: llvm-as < %s | llc -march=arm | \
11 ; RUN: grep strb | count 1
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
2 ; RUN: llvm-as < %s | llc -march=arm | \
33 ; RUN: grep strh | count 1
44
5 void %test1(int %v, short* %ptr) {
6 %tmp = cast int %v to short
7 store short %tmp, short* %ptr
8 ret void
5 define void @test1(i32 %v, i16* %ptr) {
6 %tmp = trunc i32 %v to i16 ; [#uses=1]
7 store i16 %tmp, i16* %ptr
8 ret void
99 }
1010
11 void %test2(int %v, ubyte* %ptr) {
12 %tmp = cast int %v to ubyte
13 store ubyte %tmp, ubyte* %ptr
14 ret void
11 define void @test2(i32 %v, i8* %ptr) {
12 %tmp = trunc i32 %v to i8 ; [#uses=1]
13 store i8 %tmp, i8* %ptr
14 ret void
1515 }
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | \
0 ; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | \
11 ; RUN: grep uxt | count 10
2 ; END.
32
4 uint %test1(uint %x) {
5 %tmp1 = and uint %x, 16711935 ; [#uses=1]
6 ret uint %tmp1
3 define i32 @test1(i32 %x) {
4 %tmp1 = and i32 %x, 16711935 ; [#uses=1]
5 ret i32 %tmp1
76 }
87
9 uint %test2(uint %x) {
10 %tmp1 = shr uint %x, ubyte 8 ; [#uses=1]
11 %tmp2 = and uint %tmp1, 16711935 ; [#uses=1]
12 ret uint %tmp2
8 define i32 @test2(i32 %x) {
9 %tmp1 = lshr i32 %x, 8 ; [#uses=1]
10 %tmp2 = and i32 %tmp1, 16711935 ; [#uses=1]
11 ret i32 %tmp2
1312 }
1413
15 uint %test3(uint %x) {
16 %tmp1 = shr uint %x, ubyte 8 ; [#uses=1]
17 %tmp2 = and uint %tmp1, 16711935 ; [#uses=1]
18 ret uint %tmp2
14 define i32 @test3(i32 %x) {
15 %tmp1 = lshr i32 %x, 8 ; [#uses=1]
16 %tmp2 = and i32 %tmp1, 16711935 ; [#uses=1]
17 ret i32 %tmp2
1918 }
2019
21 uint %test4(uint %x) {
22 %tmp1 = shr uint %x, ubyte 8 ; [#uses=1]
23 %tmp6 = and uint %tmp1, 16711935 ; [#uses=1]
24 ret uint %tmp6
20 define i32 @test4(i32 %x) {
21 %tmp1 = lshr i32 %x, 8 ; [#uses=1]
22 %tmp6 = and i32 %tmp1, 16711935 ; [#uses=1]
23 ret i32 %tmp6
2524 }
2625
27 uint %test5(uint %x) {
28 %tmp1 = shr uint %x, ubyte 8 ; [#uses=1]
29 %tmp2 = and uint %tmp1, 16711935 ; [#uses=1]
30 ret uint %tmp2
26 define i32 @test5(i32 %x) {
27 %tmp1 = lshr i32 %x, 8 ; [#uses=1]
28 %tmp2 = and i32 %tmp1, 16711935 ; [#uses=1]
29 ret i32 %tmp2
3130 }
3231
33 uint %test6(uint %x) {
34 %tmp1 = shr uint %x, ubyte 16 ; [#uses=1]
35 %tmp2 = and uint %tmp1, 255 ; [#uses=1]
36 %tmp4 = shl uint %x, ubyte 16 ; [#uses=1]
37 %tmp5 = and uint %tmp4, 16711680 ; [#uses=1]
38 %tmp6 = or uint %tmp2, %tmp5 ; [#uses=1]
39 ret uint %tmp6
32 define i32 @test6(i32 %x) {
33 %tmp1 = lshr i32 %x, 16 ; [#uses=1]
34 %tmp2 = and i32 %tmp1, 255 ; [#uses=1]
35 %tmp4 = shl i32 %x, 16 ; [#uses=1]
36 %tmp5 = and i32 %tmp4, 16711680 ; [#uses=1]
37 %tmp6 = or i32 %tmp2, %tmp5 ; [#uses=1]
38 ret i32 %tmp6
4039 }
4140
42 uint %test7(uint %x) {
43 %tmp1 = shr uint %x, ubyte 16 ; [#uses=1]
44 %tmp2 = and uint %tmp1, 255 ; [#uses=1]
45 %tmp4 = shl uint %x, ubyte 16 ; [#uses=1]
46 %tmp5 = and uint %tmp4, 16711680 ; [#uses=1]
47 %tmp6 = or uint %tmp2, %tmp5 ; [#uses=1]
48 ret uint %tmp6
41 define i32 @test7(i32 %x) {
42 %tmp1 = lshr i32 %x, 16 ; [#uses=1]
43 %tmp2 = and i32 %tmp1, 255 ; [#uses=1]
44 %tmp4 = shl i32 %x, 16 ; [#uses=1]
45 %tmp5 = and i32 %tmp4, 16711680 ; [#uses=1]
46 %tmp6 = or i32 %tmp2, %tmp5 ; [#uses=1]
47 ret i32 %tmp6
4948 }
5049
51 uint %test8(uint %x) {
52 %tmp1 = shl uint %x, ubyte 8 ; [#uses=1]
53 %tmp2 = and uint %tmp1, 16711680 ; [#uses=1]
54 %tmp5 = shr uint %x, ubyte 24 ; [#uses=1]
55 %tmp6 = or uint %tmp2, %tmp5 ; [#uses=1]
56 ret uint %tmp6
50 define i32 @test8(i32 %x) {
51 %tmp1 = shl i32 %x, 8 ; [#uses=1]
52 %tmp2 = and i32 %tmp1, 16711680 ; [#uses=1]
53 %tmp5 = lshr i32 %x, 24 ; [#uses=1]
54 %tmp6 = or i32 %tmp2, %tmp5 ; [#uses=1]
55 ret i32 %tmp6
5756 }
5857
59 uint %test9(uint %x) {
60 %tmp1 = shr uint %x, ubyte 24 ; [#uses=1]
61 %tmp4 = shl uint %x, ubyte 8 ; [#uses=1]
62 %tmp5 = and uint %tmp4, 16711680 ; [#uses=1]
63 %tmp6 = or uint %tmp5, %tmp1 ; [#uses=1]
64 ret uint %tmp6
58 define i32 @test9(i32 %x) {
59 %tmp1 = lshr i32 %x, 24 ; [#uses=1]
60 %tmp4 = shl i32 %x, 8 ; [#uses=1]
61 %tmp5 = and i32 %tmp4, 16711680 ; [#uses=1]
62 %tmp6 = or i32 %tmp5, %tmp1 ; [#uses=1]
63 ret i32 %tmp6
6564 }
6665
67 uint %test10(uint %p0) {
68 %tmp1 = shr uint %p0, ubyte 7 ; [#uses=1]
69 %tmp2 = and uint %tmp1, 16253176 ; [#uses=2]
70 %tmp4 = shr uint %tmp2, ubyte 5 ; [#uses=1]
71 %tmp5 = and uint %tmp4, 458759 ; [#uses=1]
72 %tmp7 = or uint %tmp5, %tmp2 ; [#uses=1]
73 ret uint %tmp7
66 define i32 @test10(i32 %p0) {
67 %tmp1 = lshr i32 %p0, 7 ; [#uses=1]
68 %tmp2 = and i32 %tmp1, 16253176 ; [#uses=2]
69 %tmp4 = lshr i32 %tmp2, 5 ; [#uses=1]
70 %tmp5 = and i32 %tmp4, 458759 ; [#uses=1]
71 %tmp7 = or i32 %tmp5, %tmp2 ; [#uses=1]
72 ret i32 %tmp7
7473 }
75
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
1 %str = internal constant [43 x sbyte] c"Hello World %d %d %d %d %d %d %d %d %d %d\0A\00" ; <[43 x sbyte]*> [#uses=1]
0 ; RUN: llvm-as < %s | llc -march=arm
1 @str = internal constant [43 x i8] c"Hello World %d %d %d %d %d %d %d %d %d %d\0A\00" ; <[43 x i8]*> [#uses=1]
22
3 implementation ; Functions:
4
5 int %main() {
3 define i32 @main() {
64 entry:
7 %tmp = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([43 x sbyte]* %str, int 0, uint 0), int 1, int 2, int 3, int 4, int 5, int 6, int 7, int 8, int 9, int 10 ) ; [#uses=0]
8 %tmp2 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([43 x sbyte]* %str, int 0, uint 0), int 10, int 9, int 8, int 7, int 6, int 5, int 4, int 3, int 2, int 1 ) ; [#uses=0]
9 ret int 11
5 %tmp = call i32 (i8*, ...)* @printf( i8* getelementptr ([43 x i8]* @str, i32 0, i64 0), i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10 ) ; [#uses=0]
6 %tmp2 = call i32 (i8*, ...)* @printf( i8* getelementptr ([43 x i8]* @str, i32 0, i64 0), i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1 ) ; [#uses=0]
7 ret i32 11
108 }
119
12 declare int %printf(sbyte*, ...)
10 declare i32 @printf(i8*, ...)
11
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=thumb
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=thumb | \
0 ; RUN: llvm-as < %s | llc -march=thumb
1 ; RUN: llvm-as < %s | llc -march=thumb | \
22 ; RUN: grep pop | count 2
33
4 %str = internal constant [4 x sbyte] c"%d\0A\00" ; <[4 x sbyte]*> [#uses=1]
4 @str = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
55
6 implementation ; Functions:
6 define void @f(i32 %a, ...) {
7 entry:
8 %va = alloca i8*, align 4 ; [#uses=4]
9 %va.upgrd.1 = bitcast i8** %va to i8* ; [#uses=1]
10 call void @llvm.va_start( i8* %va.upgrd.1 )
11 br label %bb
712
8 void %f(int %a, ...) {
9 entry:
10 %va = alloca sbyte*, align 4 ; [#uses=4]
11 call void %llvm.va_start( sbyte** %va )
12 br label %bb
13 bb: ; preds = %bb, %entry
14 %a_addr.0 = phi i32 [ %a, %entry ], [ %tmp5, %bb ] ; [#uses=2]
15 %tmp = volatile load i8** %va ; [#uses=2]
16 %tmp2 = getelementptr i8* %tmp, i32 4 ; [#uses=1]
17 volatile store i8* %tmp2, i8** %va
18 %tmp5 = add i32 %a_addr.0, -1 ; [#uses=1]
19 %tmp.upgrd.2 = icmp eq i32 %a_addr.0, 1 ; [#uses=1]
20 br i1 %tmp.upgrd.2, label %bb7, label %bb
1321
14 bb: ; preds = %bb, %entry
15 %a_addr.0 = phi int [ %a, %entry ], [ %tmp5, %bb ] ; [#uses=2]
16 %tmp = volatile load sbyte** %va ; [#uses=2]
17 %tmp2 = getelementptr sbyte* %tmp, int 4 ; [#uses=1]
18 volatile store sbyte* %tmp2, sbyte** %va
19 %tmp5 = add int %a_addr.0, -1 ; [#uses=1]
20 %tmp = seteq int %a_addr.0, 1 ; [#uses=1]
21 br bool %tmp, label %bb7, label %bb
22
23 bb7: ; preds = %bb
24 %tmp3 = cast sbyte* %tmp to int* ; [#uses=1]
25 %tmp = load int* %tmp3 ; [#uses=1]
26 %tmp10 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([4 x sbyte]* %str, int 0, uint 0), int %tmp ) ; [#uses=0]
27 call void %llvm.va_end( sbyte** %va )
28 ret void
22 bb7: ; preds = %bb
23 %tmp3 = bitcast i8* %tmp to i32* ; [#uses=1]
24 %tmp.upgrd.3 = load i32* %tmp3 ; [#uses=1]
25 %tmp10 = call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @str, i32 0, i64 0), i32 %tmp.upgrd.3 ) ; [#uses=0]
26 %va.upgrd.4 = bitcast i8** %va to i8* ; [#uses=1]
27 call void @llvm.va_end( i8* %va.upgrd.4 )
28 ret void
2929 }
3030
31 declare void %llvm.va_start(sbyte**)
31 declare void @llvm.va_start(i8*)
3232
33 declare int %printf(sbyte*, ...)
33 declare i32 @printf(i8*, ...)
3434
35 declare void %llvm.va_end(sbyte**)
35 declare void @llvm.va_end(i8*)
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | \
0 ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
11 ; RUN: grep fabs | count 2
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | \
2 ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
33 ; RUN: grep fmscs | count 1
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | \
4 ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
55 ; RUN: grep fcvt | count 2
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | \
6 ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
77 ; RUN: grep fuito | count 2
8 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | \
8 ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
99 ; RUN: grep fto.i | count 4
10 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | \
10 ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
1111 ; RUN: grep bmi | count 1
12 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | \
12 ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
1313 ; RUN: grep bgt | count 1
14 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | \
14 ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
1515 ; RUN: grep fcmpezs | count 1
1616
17 void %test(float *%P, double* %D) {
18 %A = load float* %P
19 %B = load double* %D
20 store float %A, float* %P
21 store double %B, double* %D
22 ret void
17 define void @test(float* %P, double* %D) {
18 %A = load float* %P ; [#uses=1]
19 %B = load double* %D ; [#uses=1]
20 store float %A, float* %P
21 store double %B, double* %D
22 ret void
2323 }
2424
25 declare float %fabsf(float)
26 declare double %fabs(double)
25 declare float @fabsf(float)
2726
28 void %test_abs(float *%P, double* %D) {
29 %a = load float* %P
30 %b = call float %fabsf(float %a)
31 store float %b, float* %P
27 declare double @fabs(double)
3228
33 %A = load double* %D
34 %B = call double %fabs(double %A)
35 store double %B, double* %D
36 ret void
29 define void @test_abs(float* %P, double* %D) {
30 %a = load float* %P ; [#uses=1]
31 %b = call float @fabsf( float %a ) ; [#uses=1]
32 store float %b, float* %P
33 %A = load double* %D ; [#uses=1]
34 %B = call double @fabs( double %A ) ; [#uses=1]
35 store double %B, double* %D
36 ret void
3737 }
3838
39 void %test_add(float *%P, double* %D) {
40 %a = load float* %P
41 %b = add float %a, %a
42 store float %b, float* %P
43
44 %A = load double* %D
45 %B = add double %A, %A
46 store double %B, double* %D
47 ret void
39 define void @test_add(float* %P, double* %D) {
40 %a = load float* %P ; [#uses=2]
41 %b = add float %a, %a ; [#uses=1]
42 store float %b, float* %P
43 %A = load double* %D ; [#uses=2]
44 %B = add double %A, %A ; [#uses=1]
45 store double %B, double* %D
46 ret void
4847 }
4948
50 void %test_ext_round(float *%P, double* %D) {
51 %a = load float* %P
52 %b = cast float %a to double
53
54 %A = load double* %D
55 %B = cast double %A to float
56
57 store double %b, double* %D
58 store float %B, float* %P
59 ret void
49 define void @test_ext_round(float* %P, double* %D) {
50 %a = load float* %P ; [#uses=1]
51 %b = fpext float %a to double ; [#uses=1]
52 %A = load double* %D ; [#uses=1]
53 %B = fptrunc double %A to float ; [#uses=1]
54 store double %b, double* %D
55 store float %B, float* %P
56 ret void
6057 }
6158
62 void %test_fma(float *%P1, float* %P2, float *%P3) {
63 %a1 = load float* %P1
64 %a2 = load float* %P2
65 %a3 = load float* %P3
66
67 %X = mul float %a1, %a2
68 %Y = sub float %X, %a3
69
70 store float %Y, float* %P1
71 ret void
59 define void @test_fma(float* %P1, float* %P2, float* %P3) {
60 %a1 = load float* %P1 ; [#uses=1]
61 %a2 = load float* %P2 ; [#uses=1]
62 %a3 = load float* %P3 ; [#uses=1]
63 %X = mul float %a1, %a2 ; [#uses=1]
64 %Y = sub float %X, %a3 ; [#uses=1]
65 store float %Y, float* %P1
66 ret void
7267 }
7368
74 int %test_ftoi(float *%P1) {
75 %a1 = load float* %P1
76 %b1 = cast float %a1 to int
77 ret int %b1
69 define i32 @test_ftoi(float* %P1) {
70 %a1 = load float* %P1 ; [#uses=1]
71 %b1 = fptosi float %a1 to i32 ; [#uses=1]
72 ret i32 %b1
7873 }
7974
80 uint %test_ftou(float *%P1) {
81 %a1 = load float* %P1
82 %b1 = cast float %a1 to uint
83 ret uint %b1
75 define i32 @test_ftou(float* %P1) {
76 %a1 = load float* %P1 ; [#uses=1]
77 %b1 = fptoui float %a1 to i32 ; [#uses=1]
78 ret i32 %b1
8479 }
8580
86 int %test_dtoi(double *%P1) {
87 %a1 = load double* %P1
88 %b1 = cast double %a1 to int
89 ret int %b1
81 define i32 @test_dtoi(double* %P1) {
82 %a1 = load double* %P1 ; [#uses=1]
83 %b1 = fptosi double %a1 to i32 ; [#uses=1]
84 ret i32 %b1
9085 }
9186
92 uint %test_dtou(double *%P1) {
93 %a1 = load double* %P1
94 %b1 = cast double %a1 to uint
95 ret uint %b1
87 define i32 @test_dtou(double* %P1) {
88 %a1 = load double* %P1 ; [#uses=1]
89 %b1 = fptoui double %a1 to i32 ; [#uses=1]
90 ret i32 %b1
9691 }
9792
98 void %test_utod(double *%P1, uint %X) {
99 %b1 = cast uint %X to double
100 store double %b1, double* %P1
101 ret void
93 define void @test_utod(double* %P1, i32 %X) {
94 %b1 = uitofp i32 %X to double ; [#uses=1]
95 store double %b1, double* %P1
96 ret void
10297 }
10398
104 void %test_utod2(double *%P1, ubyte %X) {
105 %b1 = cast ubyte %X to double
106 store double %b1, double* %P1
107 ret void
99 define void @test_utod2(double* %P1, i8 %X) {
100 %b1 = uitofp i8 %X to double ; [#uses=1]
101 store double %b1, double* %P1
102 ret void
108103 }
109104
110 void %test_cmp(float* %glob, int %X) {
105 define void @test_cmp(float* %glob, i32 %X) {
111106 entry:
112 %tmp = load float* %glob ; [#uses=2]
113 %tmp3 = getelementptr float* %glob, int 2 ; [#uses=1]
114 %tmp4 = load float* %tmp3 ; [#uses=2]
115 %tmp = seteq float %tmp, %tmp4 ; [#uses=1]
116 %tmp5 = tail call bool %llvm.isunordered.f32( float %tmp, float %tmp4 ) ; [#uses=1]
117 %tmp6 = or bool %tmp, %tmp5 ; [#uses=1]
118 br bool %tmp6, label %cond_true, label %cond_false
107 %tmp = load float* %glob ; [#uses=2]
108 %tmp3 = getelementptr float* %glob, i32 2 ; [#uses=1]
109 %tmp4 = load float* %tmp3 ; [#uses=2]
110 %tmp.upgrd.1 = fcmp oeq float %tmp, %tmp4 ; [#uses=1]
111 %tmp5 = fcmp uno float %tmp, %tmp4 ; [#uses=1]
112 %tmp6 = or i1 %tmp.upgrd.1, %tmp5 ; [#uses=1]
113 br i1 %tmp6, label %cond_true, label %cond_false
119114
120 cond_true: ; preds = %entry
121 %tmp = tail call int (...)* %bar( ) ; [#uses=0]
122 ret void
115 cond_true: ; preds = %entry
116 %tmp.upgrd.2 = tail call i32 (...)* @bar( ) ; [#uses=0]
117 ret void
123118
124 cond_false: ; preds = %entry
125 %tmp7 = tail call int (...)* %baz( ) ; [#uses=0]
126 ret void
119 cond_false: ; preds = %entry
120 %tmp7 = tail call i32 (...)* @baz( ) ; [#uses=0]
121 ret void
127122 }
128123
129 declare bool %llvm.isunordered.f32(float, float)
124 declare i1 @llvm.isunordered.f32(float, float)
130125
131 declare int %bar(...)
126 declare i32 @bar(...)
132127
133 declare int %baz(...)
128 declare i32 @baz(...)
134129
135 void %test_cmpfp0(float* %glob, int %X) {
130 define void @test_cmpfp0(float* %glob, i32 %X) {
136131 entry:
137 %tmp = load float* %glob ; [#uses=1]
138 %tmp = setgt float %tmp, 0.000000e+00 ; [#uses=1]
139 br bool %tmp, label %cond_true, label %cond_false
132 %tmp = load float* %glob ; [#uses=1]
133 %tmp.upgrd.3 = fcmp ogt float %tmp, 0.000000e+00 ; [#uses=1]
134 br i1 %tmp.upgrd.3, label %cond_true, label %cond_false
140135
141 cond_true: ; preds = %entry
142 %tmp = tail call int (...)* %bar( ) ; [#uses=0]
143 ret void
136 cond_true: ; preds = %entry
137 %tmp.upgrd.4 = tail call i32 (...)* @bar( ) ; [#uses=0]
138 ret void
144139
145 cond_false: ; preds = %entry
146 %tmp1 = tail call int (...)* %baz( ) ; [#uses=0]
147 ret void
140 cond_false: ; preds = %entry
141 %tmp1 = tail call i32 (...)* @baz( ) ; [#uses=0]
142 ret void
148143 }
149
None ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep .weak.*f
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep .weak.*h
0 ; RUN: llvm-as < %s | llc -march=arm | grep .weak.*f
1 ; RUN: llvm-as < %s | llc -march=arm | grep .weak.*h
22
3 implementation ; Functions:
4
5 weak uint %f() {
3 define weak i32 @f() {
64 entry:
7 unreachable
5 unreachable
86 }
97
10 void %g() {
8 define void @g() {
119 entry:
12 tail call void %h( )
10 tail call void @h( )
1311 ret void
1412 }
1513
16 declare extern_weak void %h()
14 declare extern_weak void @h()
15