blob: 335274ac45dda19225e881979bc30aa719d489c8 [file] [log] [blame]
Reid Spencerc6e3d5e2005-05-14 16:44:43 +00001; Test that the ToAsciiOptimizer works correctly
Reid Spencer69ccadd2006-12-02 04:23:10 +00002; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | not grep 'call.*%ffs'
Reid Spencerc6e3d5e2005-05-14 16:44:43 +00003
4declare int %ffs(int)
5declare int %ffsl(int)
6declare int %ffsll(long)
Reid Spencer9b1749b2005-05-15 21:26:59 +00007
8%non_const = external global int
Reid Spencerc6e3d5e2005-05-14 16:44:43 +00009
10implementation ; Functions:
11
12int %main () {
Reid Spencer9b1749b2005-05-15 21:26:59 +000013 %arg = load int* %non_const
14 %val0 = call int %ffs(int %arg)
Reid Spencerc6e3d5e2005-05-14 16:44:43 +000015 %val1 = call int %ffs(int 1)
Reid Spencer10017622005-05-15 21:35:26 +000016 %val2 = call int %ffs(int 2048)
Reid Spencerc6e3d5e2005-05-14 16:44:43 +000017 %val3 = call int %ffsl(int 65536)
18 %val4 = call int %ffsll(long 1024)
19 %val5 = call int %ffsll(long 17179869184)
20 %val6 = call int %ffsll(long 1152921504606846976)
Reid Spencer10017622005-05-15 21:35:26 +000021 %rslt1 = add int %val1, %val2
Reid Spencerc6e3d5e2005-05-14 16:44:43 +000022 %rslt2 = add int %val3, %val4
23 %rslt3 = add int %val5, %val6
24 %rslt4 = add int %rslt1, %rslt2
25 %rslt5 = add int %rslt4, %rslt3
Reid Spencer9b1749b2005-05-15 21:26:59 +000026 %rslt6 = add int %rslt5, %val0
Reid Spencerc6e3d5e2005-05-14 16:44:43 +000027 ret int %rslt5
28}