blob: 7049b5a377acf6a1616fa5a101d18b935078fd1c [file] [log] [blame]
Reid Spencerc6e3d5e2005-05-14 16:44:43 +00001; Test that the ToAsciiOptimizer works correctly
Reid Spencer43b40032007-04-16 15:31:49 +00002; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | \
3; RUN: not grep {call.*%ffs}
Reid Spencerc6e3d5e2005-05-14 16:44:43 +00004
5declare int %ffs(int)
6declare int %ffsl(int)
7declare int %ffsll(long)
Reid Spencer9b1749b2005-05-15 21:26:59 +00008
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 Spencer10017622005-05-15 21:35:26 +000017 %val2 = call int %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)
Reid Spencer10017622005-05-15 21:35:26 +000022 %rslt1 = add int %val1, %val2
Reid Spencerc6e3d5e2005-05-14 16:44:43 +000023 %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}