llvm.org GIT mirror llvm / a3c533a
For PR1297: Update these test cases to use proper signatures for bswap which is now and overloaded intrinsic. Its name must be of the form llvm.bswap.i32.i32 since both the parameter and the result or of type "iAny". Also, the bit counting intrinsics changed to always return i32. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35548 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Spencer 13 years ago
7 changed file(s) with 76 addition(s) and 78 deletion(s). Raw diff Collapse all Expand all
0 ; Make sure this testcase is supported by all code generators
11 ; RUN: llvm-upgrade < %s | llvm-as | llc
22
3 declare ulong %llvm.ctpop.i64(ulong)
3 declare uint %llvm.ctpop.i64(ulong)
44 declare uint %llvm.ctpop.i32(uint)
5 declare ushort %llvm.ctpop.i16(ushort)
6 declare ubyte %llvm.ctpop.i8(ubyte)
5 declare uint %llvm.ctpop.i16(ushort)
6 declare uint %llvm.ctpop.i8(ubyte)
77
88 void %ctpoptest(ubyte %A, ushort %B, uint %C, ulong %D,
9 ubyte *%AP, ushort* %BP, uint* %CP, ulong* %DP) {
10 %a = call ubyte %llvm.ctpop.i8(ubyte %A)
11 %b = call ushort %llvm.ctpop.i16(ushort %B)
9 uint *%AP, uint* %BP, uint* %CP, uint* %DP) {
10 %a = call uint %llvm.ctpop.i8(ubyte %A)
11 %b = call uint %llvm.ctpop.i16(ushort %B)
1212 %c = call uint %llvm.ctpop.i32(uint %C)
13 %d = call ulong %llvm.ctpop.i64(ulong %D)
13 %d = call uint %llvm.ctpop.i64(ulong %D)
1414
15 store ubyte %a, ubyte* %AP
16 store ushort %b, ushort* %BP
17 store uint %c, uint* %CP
18 store ulong %d, ulong* %DP
15 store uint %a, uint* %AP
16 store uint %b, uint* %BP
17 store uint %c, uint* %CP
18 store uint %d, uint* %DP
1919 ret void
2020 }
2121
22 declare ulong %llvm.ctlz.i64(ulong)
22 declare uint %llvm.ctlz.i64(ulong)
2323 declare uint %llvm.ctlz.i32(uint)
24 declare ushort %llvm.ctlz.i16(ushort)
25 declare ubyte %llvm.ctlz.i8(ubyte)
24 declare uint %llvm.ctlz.i16(ushort)
25 declare uint %llvm.ctlz.i8(ubyte)
2626
2727 void %ctlztest(ubyte %A, ushort %B, uint %C, ulong %D,
28 ubyte *%AP, ushort* %BP, uint* %CP, ulong* %DP) {
29 %a = call ubyte %llvm.ctlz.i8(ubyte %A)
30 %b = call ushort %llvm.ctlz.i16(ushort %B)
28 uint *%AP, uint* %BP, uint* %CP, uint* %DP) {
29 %a = call uint %llvm.ctlz.i8(ubyte %A)
30 %b = call uint %llvm.ctlz.i16(ushort %B)
3131 %c = call uint %llvm.ctlz.i32(uint %C)
32 %d = call ulong %llvm.ctlz.i64(ulong %D)
32 %d = call uint %llvm.ctlz.i64(ulong %D)
3333
34 store ubyte %a, ubyte* %AP
35 store ushort %b, ushort* %BP
36 store uint %c, uint* %CP
37 store ulong %d, ulong* %DP
34 store uint %a, uint* %AP
35 store uint %b, uint* %BP
36 store uint %c, uint* %CP
37 store uint %d, uint* %DP
3838 ret void
3939 }
4040
41 declare ulong %llvm.cttz.i64(ulong)
41 declare uint %llvm.cttz.i64(ulong)
4242 declare uint %llvm.cttz.i32(uint)
43 declare ushort %llvm.cttz.i16(ushort)
44 declare ubyte %llvm.cttz.i8(ubyte)
43 declare uint %llvm.cttz.i16(ushort)
44 declare uint %llvm.cttz.i8(ubyte)
4545
4646 void %cttztest(ubyte %A, ushort %B, uint %C, ulong %D,
47 ubyte *%AP, ushort* %BP, uint* %CP, ulong* %DP) {
48 %a = call ubyte %llvm.cttz.i8(ubyte %A)
49 %b = call ushort %llvm.cttz.i16(ushort %B)
47 uint *%AP, uint* %BP, uint* %CP, uint* %DP) {
48 %a = call uint %llvm.cttz.i8(ubyte %A)
49 %b = call uint %llvm.cttz.i16(ushort %B)
5050 %c = call uint %llvm.cttz.i32(uint %C)
51 %d = call ulong %llvm.cttz.i64(ulong %D)
51 %d = call uint %llvm.cttz.i64(ulong %D)
5252
53 store ubyte %a, ubyte* %AP
54 store ushort %b, ushort* %BP
55 store uint %c, uint* %CP
56 store ulong %d, ulong* %DP
53 store uint %a, uint* %AP
54 store uint %b, uint* %BP
55 store uint %c, uint* %CP
56 store uint %d, uint* %DP
5757 ret void
5858 }
11
22 void %img2buf(int %symbol_size_in_bytes, ushort* %ui16) {
33 %tmp93 = load ushort* null ; [#uses=1]
4 %tmp99 = call ushort %llvm.bswap.i16( ushort %tmp93 ) ; [#uses=1]
4 %tmp99 = call ushort %llvm.bswap.i16.i16( ushort %tmp93 ) ; [#uses=1]
55 store ushort %tmp99, ushort* %ui16
66 ret void
77 }
88
9 declare ushort %llvm.bswap.i16(ushort)
9 declare ushort %llvm.bswap.i16.i16(ushort)
11
22 define i32 @_ZNK4llvm5APInt17countLeadingZerosEv(i64 *%t) {
33 %tmp19 = load i64* %t
4 %tmp23 = tail call i64 @llvm.ctlz.i64( i64 %tmp19 ) ; [#uses=1]
5 %tmp2324 = trunc i64 %tmp23 to i32 ; [#uses=1]
6 %tmp89 = add i32 %tmp2324, -64 ; [#uses=1]
7 %tmp90 = add i32 %tmp89, 0 ; > [#uses=1]
4 %tmp23 = tail call i32 @llvm.ctlz.i64( i64 %tmp19 ) ; > [#uses=1]
5 %tmp89 = add i32 %tmp23, -64 ; [#uses=1]
6 %tmp90 = add i32 %tmp89, 0 ; [#uses=1]
87 ret i32 %tmp90
98 }
109
11 declare i64 @llvm.ctlz.i64(i64)
12
10 declare i32 @llvm.ctlz.i64(i64)
77 void %STWBRX(uint %i, sbyte* %ptr, int %off) {
88 %tmp1 = getelementptr sbyte* %ptr, int %off
99 %tmp1 = cast sbyte* %tmp1 to uint*
10 %tmp13 = tail call uint %llvm.bswap.i32(uint %i)
10 %tmp13 = tail call uint %llvm.bswap.i32.i32(uint %i)
1111 store uint %tmp13, uint* %tmp1
1212 ret void
1313 }
1616 %tmp1 = getelementptr sbyte* %ptr, int %off
1717 %tmp1 = cast sbyte* %tmp1 to uint*
1818 %tmp = load uint* %tmp1
19 %tmp14 = tail call uint %llvm.bswap.i32( uint %tmp )
19 %tmp14 = tail call uint %llvm.bswap.i32.i32( uint %tmp )
2020 ret uint %tmp14
2121 }
2222
2323 void %STHBRX(ushort %s, sbyte* %ptr, int %off) {
2424 %tmp1 = getelementptr sbyte* %ptr, int %off
2525 %tmp1 = cast sbyte* %tmp1 to ushort*
26 %tmp5 = call ushort %llvm.bswap.i16( ushort %s )
26 %tmp5 = call ushort %llvm.bswap.i16.i16( ushort %s )
2727 store ushort %tmp5, ushort* %tmp1
2828 ret void
2929 }
3232 %tmp1 = getelementptr sbyte* %ptr, int %off
3333 %tmp1 = cast sbyte* %tmp1 to ushort*
3434 %tmp = load ushort* %tmp1
35 %tmp6 = call ushort %llvm.bswap.i16(ushort %tmp)
35 %tmp6 = call ushort %llvm.bswap.i16.i16(ushort %tmp)
3636 ret ushort %tmp6
3737 }
3838
39 declare uint %llvm.bswap.i32(uint)
39 declare uint %llvm.bswap.i32.i32(uint)
4040
41 declare ushort %llvm.bswap.i16(ushort)
41 declare ushort %llvm.bswap.i16.i16(ushort)
22 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep bswapl | wc -l | grep 3 &&
33 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep rolw | wc -l | grep 1
44
5 declare ushort %llvm.bswap.i16(ushort)
6 declare uint %llvm.bswap.i32(uint)
7 declare ulong %llvm.bswap.i64(ulong)
5 declare ushort %llvm.bswap.i16.i16(ushort)
6 declare uint %llvm.bswap.i32.i32(uint)
7 declare ulong %llvm.bswap.i64.i64(ulong)
88
99 ushort %W(ushort %A) {
10 %Z = call ushort %llvm.bswap.i16(ushort %A)
10 %Z = call ushort %llvm.bswap.i16.i16(ushort %A)
1111 ret ushort %Z
1212 }
1313
1414 uint %X(uint %A) {
15 %Z = call uint %llvm.bswap.i32(uint %A)
15 %Z = call uint %llvm.bswap.i32.i32(uint %A)
1616 ret uint %Z
1717 }
1818
1919 ulong %Y(ulong %A) {
20 %Z = call ulong %llvm.bswap.i64(ulong %A)
20 %Z = call ulong %llvm.bswap.i64.i64(ulong %A)
2121 ret ulong %Z
2222 }
77
88 declare void %llvm.prefetch(sbyte*, uint, uint)
99
10 declare ubyte %llvm.ctpop.i8(ubyte)
11 declare ushort %llvm.ctpop.i16(ushort)
10 declare uint %llvm.ctpop.i8(ubyte)
11 declare uint %llvm.ctpop.i16(ushort)
1212 declare uint %llvm.ctpop.i32(uint)
13 declare ulong %llvm.ctpop.i64(ulong)
13 declare uint %llvm.ctpop.i64(ulong)
1414
15 declare ubyte %llvm.cttz.i8(ubyte)
16 declare ushort %llvm.cttz.i16(ushort)
15 declare uint %llvm.cttz.i8(ubyte)
16 declare uint %llvm.cttz.i16(ushort)
1717 declare uint %llvm.cttz.i32(uint)
18 declare ulong %llvm.cttz.i64(ulong)
18 declare uint %llvm.cttz.i64(ulong)
1919
20 declare ubyte %llvm.ctlz.i8(ubyte)
21 declare ushort %llvm.ctlz.i16(ushort)
20 declare uint %llvm.ctlz.i8(ubyte)
21 declare uint %llvm.ctlz.i16(ushort)
2222 declare uint %llvm.ctlz.i32(uint)
23 declare ulong %llvm.ctlz.i64(ulong)
23 declare uint %llvm.ctlz.i64(ulong)
2424
2525 declare float %llvm.sqrt.f32(float)
2626 declare double %llvm.sqrt.f64(double)
3838 call float %llvm.sqrt.f32(float 5.0)
3939 call double %llvm.sqrt.f64(double 6.0)
4040
41 call ubyte %llvm.ctpop.i8(ubyte 10)
42 call ushort %llvm.ctpop.i16(ushort 11)
41 call uint %llvm.ctpop.i8(ubyte 10)
42 call uint %llvm.ctpop.i16(ushort 11)
4343 call uint %llvm.ctpop.i32(uint 12)
44 call ulong %llvm.ctpop.i64(ulong 13)
44 call uint %llvm.ctpop.i64(ulong 13)
4545
46 call ubyte %llvm.ctlz.i8(ubyte 14)
47 call ushort %llvm.ctlz.i16(ushort 15)
46 call uint %llvm.ctlz.i8(ubyte 14)
47 call uint %llvm.ctlz.i16(ushort 15)
4848 call uint %llvm.ctlz.i32(uint 16)
49 call ulong %llvm.ctlz.i64(ulong 17)
49 call uint %llvm.ctlz.i64(ulong 17)
5050
51 call ubyte %llvm.cttz.i8(ubyte 18)
52 call ushort %llvm.cttz.i16(ushort 19)
51 call uint %llvm.cttz.i8(ubyte 18)
52 call uint %llvm.cttz.i16(ushort 19)
5353 call uint %llvm.cttz.i32(uint 20)
54 call ulong %llvm.cttz.i64(ulong 21)
54 call uint %llvm.cttz.i64(ulong 21)
5555 ret void
5656 }
5757
11 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep 'call.*bswap'
22
33 bool %test1(ushort %tmp2) {
4 %tmp10 = call ushort %llvm.bswap.i16( ushort %tmp2 )
4 %tmp10 = call ushort %llvm.bswap.i16.i16( ushort %tmp2 )
55 %tmp = seteq ushort %tmp10, 1
66 ret bool %tmp
77 }
88
99 bool %test2(uint %tmp) {
10 %tmp34 = tail call uint %llvm.bswap.i32( uint %tmp )
10 %tmp34 = tail call uint %llvm.bswap.i32.i32( uint %tmp )
1111 %tmp = seteq uint %tmp34, 1
1212 ret bool %tmp
1313 }
1414
15 declare uint %llvm.bswap.i32(uint)
16
1715 bool %test3(ulong %tmp) {
18 %tmp34 = tail call ulong %llvm.bswap.i64( ulong %tmp )
16 %tmp34 = tail call ulong %llvm.bswap.i64.i64( ulong %tmp )
1917 %tmp = seteq ulong %tmp34, 1
2018 ret bool %tmp
2119 }
2220
23 declare ulong %llvm.bswap.i64(ulong)
21 declare ulong %llvm.bswap.i64.i64(ulong)
2422
25 declare ushort %llvm.bswap.i16(ushort)
23 declare ushort %llvm.bswap.i16.i16(ushort)
24
25 declare uint %llvm.bswap.i32.i32(uint)