Reid Spencer | 4cda190 | 2007-04-16 15:15:52 +0000 | [diff] [blame] | 1 | ; RUN: llvm-as < %s | llc -march=arm -stats |& \ |
| 2 | ; RUN: grep {3 .*Number of machine instrs printed} |
Chris Lattner | 603572a | 2007-04-11 05:02:57 +0000 | [diff] [blame] | 3 | |
| 4 | ;; Integer absolute value, should produce something as good as: ARM: |
| 5 | ;; add r3, r0, r0, asr #31 |
| 6 | ;; eor r0, r3, r0, asr #31 |
| 7 | ;; bx lr |
Chris Lattner | 603572a | 2007-04-11 05:02:57 +0000 | [diff] [blame] | 8 | |
| 9 | define i32 @test(i32 %a) { |
| 10 | %tmp1neg = sub i32 0, %a |
| 11 | %b = icmp sgt i32 %a, -1 |
| 12 | %abs = select i1 %b, i32 %a, i32 %tmp1neg |
| 13 | ret i32 %abs |
| 14 | } |
| 15 | |