Reid Spencer | c6e3d5e | 2005-05-14 16:44:43 +0000 | [diff] [blame] | 1 | ; Test that the ToAsciiOptimizer works correctly |
| 2 | ; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | not grep 'call.*%ffs' |
| 3 | |
| 4 | declare int %ffs(int) |
| 5 | declare int %ffsl(int) |
| 6 | declare int %ffsll(long) |
Reid Spencer | 9b1749b | 2005-05-15 21:26:59 +0000 | [diff] [blame^] | 7 | declare int %__builtin_ffs(int) |
| 8 | |
| 9 | %non_const = external global int |
Reid Spencer | c6e3d5e | 2005-05-14 16:44:43 +0000 | [diff] [blame] | 10 | |
| 11 | implementation ; Functions: |
| 12 | |
| 13 | int %main () { |
Reid Spencer | 9b1749b | 2005-05-15 21:26:59 +0000 | [diff] [blame^] | 14 | %arg = load int* %non_const |
| 15 | %val0 = call int %ffs(int %arg) |
Reid Spencer | c6e3d5e | 2005-05-14 16:44:43 +0000 | [diff] [blame] | 16 | %val1 = call int %ffs(int 1) |
Reid Spencer | 9b1749b | 2005-05-15 21:26:59 +0000 | [diff] [blame^] | 17 | %val2 = call int %__builtin_ffs(int 2048) |
Reid Spencer | c6e3d5e | 2005-05-14 16:44:43 +0000 | [diff] [blame] | 18 | %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 Spencer | 9b1749b | 2005-05-15 21:26:59 +0000 | [diff] [blame^] | 27 | %rslt6 = add int %rslt5, %val0 |
Reid Spencer | c6e3d5e | 2005-05-14 16:44:43 +0000 | [diff] [blame] | 28 | ret int %rslt5 |
| 29 | } |