Jan Wen Voung | 4323665 | 2013-03-12 16:27:52 +0000 | [diff] [blame] | 1 | ; REQUIRES: asserts |
Chandler Carruth | 49589f0 | 2012-07-02 18:37:59 +0000 | [diff] [blame] | 2 | ; RUN: llc < %s -march=ppc32 -stats 2>&1 | \ |
Chandler Carruth | 4177e6f | 2012-07-02 12:47:22 +0000 | [diff] [blame] | 3 | ; RUN: grep "4 .*Number of machine instrs printed" |
Chris Lattner | 603572a | 2007-04-11 05:02:57 +0000 | [diff] [blame] | 4 | |
| 5 | ;; Integer absolute value, should produce something as good as: |
| 6 | ;; srawi r2, r3, 31 |
| 7 | ;; add r3, r3, r2 |
| 8 | ;; xor r3, r3, r2 |
| 9 | ;; blr |
| 10 | define i32 @test(i32 %a) { |
| 11 | %tmp1neg = sub i32 0, %a |
| 12 | %b = icmp sgt i32 %a, -1 |
| 13 | %abs = select i1 %b, i32 %a, i32 %tmp1neg |
| 14 | ret i32 %abs |
| 15 | } |
| 16 | |