blob: 7d089bbd653ce476b1053bff8ce143bf4c756256 [file] [log] [blame]
Chandler Carruth49589f02012-07-02 18:37:59 +00001; RUN: llc < %s -march=ppc32 -stats 2>&1 | \
Chandler Carruth4177e6f2012-07-02 12:47:22 +00002; RUN: grep "4 .*Number of machine instrs printed"
Chris Lattner603572a2007-04-11 05:02:57 +00003
4;; Integer absolute value, should produce something as good as:
5;; srawi r2, r3, 31
6;; add r3, r3, r2
7;; xor r3, r3, r2
8;; blr
9define 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