blob: 6733e3711948e505411b022accf48470c209906b [file] [log] [blame]
Tanya Lattner3f7706b2004-11-07 06:08:43 +00001; 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
Chris Lattner86ee7762004-06-11 02:29:57 +00005
Alkis Evlogimenos96853722004-06-12 19:19:14 +00006declare bool %llvm.isunordered(float, float)
7declare bool %llvm.isunordered(double, double)
Reid Spencerfd57ad72006-01-19 01:17:06 +00008declare bool %llvm.isunordered.f32(float,float)
9declare bool %llvm.isunordered.f64(double,double)
Alkis Evlogimenos96853722004-06-12 19:19:14 +000010
Chris Lattner47adf212005-02-28 19:31:42 +000011declare void %llvm.prefetch(sbyte*, uint, uint)
12
Andrew Lenharthf166ec62005-05-03 17:00:48 +000013declare uint %llvm.ctpop(uint)
Reid Spencerfd57ad72006-01-19 01:17:06 +000014declare ubyte %llvm.ctpop.i8(ubyte)
15declare ushort %llvm.ctpop.i16(ushort)
16declare uint %llvm.ctpop.i32(uint)
17declare ulong %llvm.ctpop.i64(ulong)
18
Andrew Lenharthf166ec62005-05-03 17:00:48 +000019declare ushort %llvm.cttz(ushort)
Reid Spencerfd57ad72006-01-19 01:17:06 +000020declare ubyte %llvm.cttz.i8(ubyte)
21declare ushort %llvm.cttz.i16(ushort)
22declare uint %llvm.cttz.i32(uint)
23declare ulong %llvm.cttz.i64(ulong)
24
Andrew Lenharthf166ec62005-05-03 17:00:48 +000025declare ulong %llvm.ctlz(ulong)
Reid Spencerfd57ad72006-01-19 01:17:06 +000026declare ubyte %llvm.ctlz.i8(ubyte)
27declare ushort %llvm.ctlz.i16(ushort)
28declare uint %llvm.ctlz.i32(uint)
29declare ulong %llvm.ctlz.i64(ulong)
30
31declare float %llvm.sqrt(float)
32declare double %llvm.sqrt(double)
33declare float %llvm.sqrt.f32(float)
34declare double %llvm.sqrt.f64(double)
Andrew Lenharth279a7b22005-05-03 16:49:48 +000035
Alkis Evlogimenosfd39b302004-06-11 01:06:40 +000036implementation
37
38; Test llvm intrinsics
39;
Chris Lattner86ee7762004-06-11 02:29:57 +000040void %libm() {
Alkis Evlogimenos96853722004-06-12 19:19:14 +000041 call bool %llvm.isunordered(float 0.0, float 1.0)
Chris Lattner5e9a7ca2004-06-15 21:29:40 +000042 call bool %llvm.isunordered(double 0.0, double 0x7FF8000000000000)
Reid Spencerfd57ad72006-01-19 01:17:06 +000043 call bool %llvm.isunordered.f32(float 1.0, float 2.0)
44 call bool %llvm.isunordered.f64(double 3.0, double 4.0)
45
Chris Lattner47adf212005-02-28 19:31:42 +000046 call void %llvm.prefetch(sbyte* null, uint 1, uint 3)
Reid Spencerfd57ad72006-01-19 01:17:06 +000047
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
Andrew Lenharth279a7b22005-05-03 16:49:48 +000053 call uint %llvm.ctpop(uint 3)
Reid Spencerfd57ad72006-01-19 01:17:06 +000054 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
Andrew Lenharth279a7b22005-05-03 16:49:48 +000059 call ulong %llvm.ctlz(ulong 65000)
Reid Spencerfd57ad72006-01-19 01:17:06 +000060 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)
Alkis Evlogimenosfd39b302004-06-11 01:06:40 +000070 ret void
Chris Lattner86ee7762004-06-11 02:29:57 +000071}
Reid Spencer87bb7c62005-05-09 04:47:32 +000072
73; FIXME: test ALL the intrinsics in this file.