blob: 4981d13b6df783abf3e3bb4410bc94cb4664c58b [file] [log] [blame]
Reid Spencerc6e3d5e2005-05-14 16:44:43 +00001; Test that the ToAsciiOptimizer works correctly
2; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | not grep 'call.*%ffs'
3
4declare int %ffs(int)
5declare int %ffsl(int)
6declare int %ffsll(long)
Reid Spencer9b1749b2005-05-15 21:26:59 +00007declare int %__builtin_ffs(int)
8
9%non_const = external global int
Reid Spencerc6e3d5e2005-05-14 16:44:43 +000010
11implementation ; Functions:
12
13int %main () {
Reid Spencer9b1749b2005-05-15 21:26:59 +000014 %arg = load int* %non_const
15 %val0 = call int %ffs(int %arg)
Reid Spencerc6e3d5e2005-05-14 16:44:43 +000016 %val1 = call int %ffs(int 1)
Reid Spencer9b1749b2005-05-15 21:26:59 +000017 %val2 = call int %__builtin_ffs(int 2048)
Reid Spencerc6e3d5e2005-05-14 16:44:43 +000018 %val3 = call int %ffsl(int 65536)
19 %val4 = call int %ffsll(long 1024)
20 %val5 = call int %ffsll(long 17179869184)
21 %val6 = call int %ffsll(long 1152921504606846976)
22 %rslt1 = add int %val1, %val2
23 %rslt2 = add int %val3, %val4
24 %rslt3 = add int %val5, %val6
25 %rslt4 = add int %rslt1, %rslt2
26 %rslt5 = add int %rslt4, %rslt3
Reid Spencer9b1749b2005-05-15 21:26:59 +000027 %rslt6 = add int %rslt5, %val0
Reid Spencerc6e3d5e2005-05-14 16:44:43 +000028 ret int %rslt5
29}