blob: 014d261c521fa6934e43c2a2e5ecb48a03b6317f [file] [log] [blame]
Chris Lattner3c8a3b12005-05-11 04:22:47 +00001; Make sure this testcase is supported by all code generators
Reid Spencer69ccadd2006-12-02 04:23:10 +00002; RUN: llvm-upgrade < %s | llvm-as | llc
Chris Lattner3c8a3b12005-05-11 04:22:47 +00003
Reid Spencer86189a42007-04-02 00:51:15 +00004declare ulong %llvm.ctpop.i64(ulong)
Reid Spencerd05b67d2006-12-02 20:38:10 +00005declare uint %llvm.ctpop.i32(uint)
Reid Spencer86189a42007-04-02 00:51:15 +00006declare ushort %llvm.ctpop.i16(ushort)
7declare ubyte %llvm.ctpop.i8(ubyte)
Chris Lattner3c8a3b12005-05-11 04:22:47 +00008
Reid Spencerd05b67d2006-12-02 20:38:10 +00009void %ctpoptest(ubyte %A, ushort %B, uint %C, ulong %D,
Reid Spencer86189a42007-04-02 00:51:15 +000010 ubyte *%AP, ushort* %BP, uint* %CP, ulong* %DP) {
11 %a = call ubyte %llvm.ctpop.i8(ubyte %A)
12 %b = call ushort %llvm.ctpop.i16(ushort %B)
Reid Spencerd05b67d2006-12-02 20:38:10 +000013 %c = call uint %llvm.ctpop.i32(uint %C)
Reid Spencer86189a42007-04-02 00:51:15 +000014 %d = call ulong %llvm.ctpop.i64(ulong %D)
Chris Lattner3c8a3b12005-05-11 04:22:47 +000015
Reid Spencer86189a42007-04-02 00:51:15 +000016 store ubyte %a, ubyte* %AP
17 store ushort %b, ushort* %BP
18 store uint %c, uint* %CP
19 store ulong %d, ulong* %DP
Chris Lattner3c8a3b12005-05-11 04:22:47 +000020 ret void
21}
Chris Lattner07fc1732005-05-11 05:31:01 +000022
Reid Spencer86189a42007-04-02 00:51:15 +000023declare ulong %llvm.ctlz.i64(ulong)
Reid Spencerd05b67d2006-12-02 20:38:10 +000024declare uint %llvm.ctlz.i32(uint)
Reid Spencer86189a42007-04-02 00:51:15 +000025declare ushort %llvm.ctlz.i16(ushort)
26declare ubyte %llvm.ctlz.i8(ubyte)
Chris Lattner07fc1732005-05-11 05:31:01 +000027
Reid Spencerd05b67d2006-12-02 20:38:10 +000028void %ctlztest(ubyte %A, ushort %B, uint %C, ulong %D,
Reid Spencer86189a42007-04-02 00:51:15 +000029 ubyte *%AP, ushort* %BP, uint* %CP, ulong* %DP) {
30 %a = call ubyte %llvm.ctlz.i8(ubyte %A)
31 %b = call ushort %llvm.ctlz.i16(ushort %B)
Reid Spencerd05b67d2006-12-02 20:38:10 +000032 %c = call uint %llvm.ctlz.i32(uint %C)
Reid Spencer86189a42007-04-02 00:51:15 +000033 %d = call ulong %llvm.ctlz.i64(ulong %D)
Chris Lattner07fc1732005-05-11 05:31:01 +000034
Reid Spencer86189a42007-04-02 00:51:15 +000035 store ubyte %a, ubyte* %AP
36 store ushort %b, ushort* %BP
37 store uint %c, uint* %CP
38 store ulong %d, ulong* %DP
Chris Lattner07fc1732005-05-11 05:31:01 +000039 ret void
40}
41
Reid Spencer86189a42007-04-02 00:51:15 +000042declare ulong %llvm.cttz.i64(ulong)
Reid Spencerd05b67d2006-12-02 20:38:10 +000043declare uint %llvm.cttz.i32(uint)
Reid Spencer86189a42007-04-02 00:51:15 +000044declare ushort %llvm.cttz.i16(ushort)
45declare ubyte %llvm.cttz.i8(ubyte)
Chris Lattner07fc1732005-05-11 05:31:01 +000046
Reid Spencerd05b67d2006-12-02 20:38:10 +000047void %cttztest(ubyte %A, ushort %B, uint %C, ulong %D,
Reid Spencer86189a42007-04-02 00:51:15 +000048 ubyte *%AP, ushort* %BP, uint* %CP, ulong* %DP) {
49 %a = call ubyte %llvm.cttz.i8(ubyte %A)
50 %b = call ushort %llvm.cttz.i16(ushort %B)
Reid Spencerd05b67d2006-12-02 20:38:10 +000051 %c = call uint %llvm.cttz.i32(uint %C)
Reid Spencer86189a42007-04-02 00:51:15 +000052 %d = call ulong %llvm.cttz.i64(ulong %D)
Chris Lattner07fc1732005-05-11 05:31:01 +000053
Reid Spencer86189a42007-04-02 00:51:15 +000054 store ubyte %a, ubyte* %AP
55 store ushort %b, ushort* %BP
56 store uint %c, uint* %CP
57 store ulong %d, ulong* %DP
Chris Lattner07fc1732005-05-11 05:31:01 +000058 ret void
59}