[llvm] r316160 - [X86] Add scalar (abs (abs x)) -> (abs x) combine test.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 19 07:59:26 PDT 2017
Author: rksimon
Date: Thu Oct 19 07:59:26 2017
New Revision: 316160
URL: http://llvm.org/viewvc/llvm-project?rev=316160&view=rev
Log:
[X86] Add scalar (abs (abs x)) -> (abs x) combine test.
Before landing D38895
Modified:
llvm/trunk/test/CodeGen/X86/combine-abs.ll
Modified: llvm/trunk/test/CodeGen/X86/combine-abs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/combine-abs.ll?rev=316160&r1=316159&r2=316160&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/combine-abs.ll (original)
+++ llvm/trunk/test/CodeGen/X86/combine-abs.ll Thu Oct 19 07:59:26 2017
@@ -23,6 +23,25 @@ define <16 x i16> @combine_v16i16_abs_co
}
; fold (abs (abs x)) -> (abs x)
+define i32 @combine_i32_abs_abs(i32 %a) {
+; CHECK-LABEL: combine_i32_abs_abs:
+; CHECK: # BB#0:
+; CHECK-NEXT: movl %edi, %ecx
+; CHECK-NEXT: negl %ecx
+; CHECK-NEXT: cmovll %edi, %ecx
+; CHECK-NEXT: movl %ecx, %eax
+; CHECK-NEXT: negl %eax
+; CHECK-NEXT: cmovll %ecx, %eax
+; CHECK-NEXT: retq
+ %n1 = sub i32 zeroinitializer, %a
+ %b1 = icmp slt i32 %a, zeroinitializer
+ %a1 = select i1 %b1, i32 %n1, i32 %a
+ %n2 = sub i32 zeroinitializer, %a1
+ %b2 = icmp sgt i32 %a1, zeroinitializer
+ %a2 = select i1 %b2, i32 %a1, i32 %n2
+ ret i32 %a2
+}
+
define <8 x i16> @combine_v8i16_abs_abs(<8 x i16> %a) {
; CHECK-LABEL: combine_v8i16_abs_abs:
; CHECK: # BB#0:
More information about the llvm-commits
mailing list