• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -march=thumb -stats 2>&1 | \
2; RUN:   grep "4 .*Number of machine instrs printed"
3
4;; Integer absolute value, should produce something as good as:
5;; Thumb:
6;;   movs r0, r0
7;;   bpl
8;;   rsb r0, r0, #0 (with opitmization, bpl + rsb is if-converted into rsbmi)
9;;   bx lr
10
11define i32 @test(i32 %a) {
12        %tmp1neg = sub i32 0, %a
13        %b = icmp sgt i32 %a, -1
14        %abs = select i1 %b, i32 %a, i32 %tmp1neg
15        ret i32 %abs
16; CHECK:  movs r0, r0
17; CHECK:  bpl
18; CHECK:  rsb r0, r0, #0
19; CHECK:  bx lr
20}
21
22
23