• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -march=x86-64 -stats  |& \
2; RUN:   grep {5 .*Number of machine instrs printed}
3
4;; Integer absolute value, should produce something at least as good as:
5;;       movl %edi, %ecx
6;;       sarl $31, %ecx
7;;       leal (%rdi,%rcx), %eax
8;;       xorl %ecx, %eax
9;;       ret
10define i32 @test(i32 %a) nounwind {
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
17