For PR1297:
[oota-llvm.git] / test / CodeGen / Generic / llvm-ct-intrinsics.ll
1 ; Make sure this testcase is supported by all code generators
2 ; RUN: llvm-upgrade < %s | llvm-as | llc
3
4 declare uint %llvm.ctpop.i64(ulong)
5 declare uint %llvm.ctpop.i32(uint)
6 declare uint %llvm.ctpop.i16(ushort)
7 declare uint %llvm.ctpop.i8(ubyte)
8
9 void %ctpoptest(ubyte %A, ushort %B, uint %C, ulong %D, 
10                 uint *%AP, uint* %BP, uint* %CP, uint* %DP) {
11         %a = call uint %llvm.ctpop.i8(ubyte %A)
12         %b = call uint %llvm.ctpop.i16(ushort %B)
13         %c = call uint %llvm.ctpop.i32(uint %C)
14         %d = call uint %llvm.ctpop.i64(ulong %D)
15
16         store uint %a, uint* %AP
17         store uint %b, uint* %BP
18         store uint %c, uint* %CP
19         store uint %d, uint* %DP
20         ret void
21 }
22
23 declare uint %llvm.ctlz.i64(ulong)
24 declare uint %llvm.ctlz.i32(uint)
25 declare uint %llvm.ctlz.i16(ushort)
26 declare uint %llvm.ctlz.i8(ubyte)
27
28 void %ctlztest(ubyte %A, ushort %B, uint %C, ulong %D, 
29                uint *%AP, uint* %BP, uint* %CP, uint* %DP) {
30         %a = call uint %llvm.ctlz.i8(ubyte %A)
31         %b = call uint %llvm.ctlz.i16(ushort %B)
32         %c = call uint %llvm.ctlz.i32(uint %C)
33         %d = call uint %llvm.ctlz.i64(ulong %D)
34
35         store uint %a, uint* %AP
36         store uint %b, uint* %BP
37         store uint %c, uint* %CP
38         store uint %d, uint* %DP
39         ret void
40 }
41
42 declare uint %llvm.cttz.i64(ulong)
43 declare uint %llvm.cttz.i32(uint)
44 declare uint %llvm.cttz.i16(ushort)
45 declare uint %llvm.cttz.i8(ubyte)
46
47 void %cttztest(ubyte %A, ushort %B, uint %C, ulong %D, 
48                uint *%AP, uint* %BP, uint* %CP, uint* %DP) {
49         %a = call uint %llvm.cttz.i8(ubyte %A)
50         %b = call uint %llvm.cttz.i16(ushort %B)
51         %c = call uint %llvm.cttz.i32(uint %C)
52         %d = call uint %llvm.cttz.i64(ulong %D)
53
54         store uint %a, uint* %AP
55         store uint %b, uint* %BP
56         store uint %c, uint* %CP
57         store uint %d, uint* %DP
58         ret void
59 }