[llvm-commits] [Patch] Optimize integer ABS on X86

Manman Ren mren at apple.com
Thu Jun 7 15:40:54 PDT 2012


Removed "CHECK-NOT: sar" and committed as r158175.

Thanks,
Manman

On Jun 7, 2012, at 3:18 PM, Chandler Carruth wrote:

> LGTM as well, just trying to give some tips on minimizing file check predicates, nothing important:
> 
> --- test/CodeGen/X86/iabs.ll	(revision 158160)
> +++ test/CodeGen/X86/iabs.ll	(working copy)
> @@ -1,13 +1,18 @@
> -; RUN: llc < %s -march=x86-64 -stats  |& \
> -; RUN:   grep {5 .*Number of machine instrs printed}
> +; RUN: llc < %s -march=x86-64 | FileCheck %s
>  
>  ;; Integer absolute value, should produce something at least as good as:
> -;;       movl %edi, %ecx
> -;;       sarl $31, %ecx
> -;;       leal (%rdi,%rcx), %eax
> -;;       xorl %ecx, %eax
> +;;       movl   %edi, %eax
> +;;       negl   %eax
> +;;       cmovll %edi, %eax
>  ;;       ret
> +; rdar://10695237
>  define i32 @test(i32 %a) nounwind {
> +; CHECK: test:
> +; CHECK: mov
> +; CHECK-NEXT: neg
> +; CHECK-NEXT: cmov
> +; CHECK-NEXT: ret
> +; CHECK-NOT: sar
> 
> You don't really need the 'sar' -NOT assertion here. Once you hit 'ret', game's over. =] Generally, you'll need -NOT when you don't check everything in-between the start of the interesting pattern ('mov' here), and the end (usually 'ret').




More information about the llvm-commits mailing list