1 ; RUN: llc -mtriple=arm-eabi -mattr=+v4t %s -o - | FileCheck %s
3 ;; Integer absolute value, should produce something as good as: ARM:
8 define i32 @test(i32 %a) {
9 %tmp1neg = sub i32 0, %a
10 %b = icmp sgt i32 %a, -1
11 %abs = select i1 %b, i32 %a, i32 %tmp1neg
14 ; CHECK: rsbmi r0, r0, #0
19 ;; 3 instructions will be generated for abs(a-b):
23 define i32 @test2(i32 %a, i32 %b) nounwind readnone ssp {
29 %sub = sub nsw i32 %a, %b
30 %cmp = icmp sgt i32 %sub, -1
31 %sub1 = sub nsw i32 0, %sub
32 %cond = select i1 %cmp, i32 %sub, i32 %sub1