• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -march=x86-64 | FileCheck %s
2
3;; Integer absolute value, should produce something at least as good as:
4;;       movl   %edi, %eax
5;;       negl   %eax
6;;       cmovll %edi, %eax
7;;       ret
8; rdar://10695237
9define i32 @test(i32 %a) nounwind {
10; CHECK-LABEL: test:
11; CHECK: mov
12; CHECK-NEXT: neg
13; CHECK-NEXT: cmov
14; CHECK-NEXT: ret
15        %tmp1neg = sub i32 0, %a
16        %b = icmp sgt i32 %a, -1
17        %abs = select i1 %b, i32 %a, i32 %tmp1neg
18        ret i32 %abs
19}
20
21