Expand test to cover the non-overloaded variants of the arithmetic and
[oota-llvm.git] / test / Feature / intrinsics.ll
1 ; RUN: llvm-as %s -o - | llvm-dis > %t1.ll
2 ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
3 ; RUN: diff %t1.ll %t2.ll
4
5
6 declare bool %llvm.isunordered(float, float)
7 declare bool %llvm.isunordered(double, double)
8 declare bool %llvm.isunordered.f32(float,float)
9 declare bool %llvm.isunordered.f64(double,double)
10
11 declare void %llvm.prefetch(sbyte*, uint, uint)
12
13 declare uint %llvm.ctpop(uint)
14 declare ubyte %llvm.ctpop.i8(ubyte)
15 declare ushort %llvm.ctpop.i16(ushort)
16 declare uint %llvm.ctpop.i32(uint)
17 declare ulong %llvm.ctpop.i64(ulong)
18
19 declare ushort %llvm.cttz(ushort)
20 declare ubyte %llvm.cttz.i8(ubyte)
21 declare ushort %llvm.cttz.i16(ushort)
22 declare uint %llvm.cttz.i32(uint)
23 declare ulong %llvm.cttz.i64(ulong)
24
25 declare ulong %llvm.ctlz(ulong)
26 declare ubyte %llvm.ctlz.i8(ubyte)
27 declare ushort %llvm.ctlz.i16(ushort)
28 declare uint %llvm.ctlz.i32(uint)
29 declare ulong %llvm.ctlz.i64(ulong)
30
31 declare float %llvm.sqrt(float)
32 declare double %llvm.sqrt(double)
33 declare float %llvm.sqrt.f32(float)
34 declare double %llvm.sqrt.f64(double)
35
36 implementation
37
38 ; Test llvm intrinsics
39 ;
40 void %libm() {
41         call bool %llvm.isunordered(float 0.0, float 1.0)
42         call bool %llvm.isunordered(double 0.0, double 0x7FF8000000000000)
43         call bool %llvm.isunordered.f32(float 1.0, float 2.0)
44         call bool %llvm.isunordered.f64(double 3.0, double 4.0)
45
46         call void %llvm.prefetch(sbyte* null, uint 1, uint 3)
47
48         call float %llvm.sqrt(float 4.0)
49         call double %llvm.sqrt(double 4.0)
50         call float %llvm.sqrt.f32(float 5.0)
51         call double %llvm.sqrt.f64(double 6.0)
52
53         call uint %llvm.ctpop(uint 3)
54         call ubyte %llvm.ctpop.i8(ubyte 10)
55         call ushort %llvm.ctpop.i16(ushort 11)
56         call uint %llvm.ctpop.i32(uint 12)
57         call ulong %llvm.ctpop.i64(ulong 13)
58
59         call ulong %llvm.ctlz(ulong 65000)
60         call ubyte %llvm.ctlz.i8(ubyte 14)
61         call ushort %llvm.ctlz.i16(ushort 15)
62         call uint %llvm.ctlz.i32(uint 16)
63         call ulong %llvm.ctlz.i64(ulong 17)
64
65         call ushort %llvm.cttz(ushort 7)
66         call ubyte %llvm.cttz.i8(ubyte 18)
67         call ushort %llvm.cttz.i16(ushort 19)
68         call uint %llvm.cttz.i32(uint 20)
69         call ulong %llvm.cttz.i64(ulong 21)
70         ret void
71 }
72
73 ; FIXME: test ALL the intrinsics in this file.