[llvm] r370464 - [X86] Add tests for rotate matching. NFC
Amaury Sechet via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 30 04:35:29 PDT 2019
Author: deadalnix
Date: Fri Aug 30 04:35:28 2019
New Revision: 370464
URL: http://llvm.org/viewvc/llvm-project?rev=370464&view=rev
Log:
[X86] Add tests for rotate matching. NFC
Modified:
llvm/trunk/test/CodeGen/X86/rotate-extract-vector.ll
llvm/trunk/test/CodeGen/X86/rotate-extract.ll
Modified: llvm/trunk/test/CodeGen/X86/rotate-extract-vector.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/rotate-extract-vector.ll?rev=370464&r1=370463&r2=370464&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/rotate-extract-vector.ll (original)
+++ llvm/trunk/test/CodeGen/X86/rotate-extract-vector.ll Fri Aug 30 04:35:28 2019
@@ -294,3 +294,29 @@ define <4 x i32> @extract_add_1(<4 x i32
%out = or <4 x i32> %ii, %rhs
ret <4 x i32> %out
}
+
+define <4 x i32> @extract_add_1_comut(<4 x i32> %i) nounwind {
+; CHECK-LABEL: extract_add_1_comut:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vpaddd %xmm0, %xmm0, %xmm1
+; CHECK-NEXT: vpsrld $31, %xmm0, %xmm0
+; CHECK-NEXT: vpor %xmm1, %xmm0, %xmm0
+; CHECK-NEXT: ret{{[l|q]}}
+ %ii = add <4 x i32> %i, %i
+ %lhs = lshr <4 x i32> %i, <i32 31, i32 31, i32 31, i32 31>
+ %out = or <4 x i32> %lhs, %ii
+ ret <4 x i32> %out
+}
+
+define <4 x i32> @no_extract_add_1(<4 x i32> %i) nounwind {
+; CHECK-LABEL: no_extract_add_1:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vpaddd %xmm0, %xmm0, %xmm1
+; CHECK-NEXT: vpsrld $27, %xmm0, %xmm0
+; CHECK-NEXT: vpor %xmm0, %xmm1, %xmm0
+; CHECK-NEXT: ret{{[l|q]}}
+ %ii = add <4 x i32> %i, %i
+ %rhs = lshr <4 x i32> %i, <i32 27, i32 27, i32 27, i32 27>
+ %out = or <4 x i32> %ii, %rhs
+ ret <4 x i32> %out
+}
Modified: llvm/trunk/test/CodeGen/X86/rotate-extract.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/rotate-extract.ll?rev=370464&r1=370463&r2=370464&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/rotate-extract.ll (original)
+++ llvm/trunk/test/CodeGen/X86/rotate-extract.ll Fri Aug 30 04:35:28 2019
@@ -288,3 +288,47 @@ define i32 @extract_add_1(i32 %i) nounwi
%out = or i32 %ii, %rhs
ret i32 %out
}
+
+define i32 @extract_add_1_comut(i32 %i) nounwind {
+; X86-LABEL: extract_add_1_comut:
+; X86: # %bb.0:
+; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: leal (%eax,%eax), %ecx
+; X86-NEXT: shrl $31, %eax
+; X86-NEXT: orl %ecx, %eax
+; X86-NEXT: retl
+;
+; X64-LABEL: extract_add_1_comut:
+; X64: # %bb.0:
+; X64-NEXT: # kill: def $edi killed $edi def $rdi
+; X64-NEXT: leal (%rdi,%rdi), %eax
+; X64-NEXT: shrl $31, %edi
+; X64-NEXT: orl %edi, %eax
+; X64-NEXT: retq
+ %ii = add i32 %i, %i
+ %lhs = lshr i32 %i, 31
+ %out = or i32 %lhs, %ii
+ ret i32 %out
+}
+
+define i32 @no_extract_add_1(i32 %i) nounwind {
+; X86-LABEL: no_extract_add_1:
+; X86: # %bb.0:
+; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT: leal (%ecx,%ecx), %eax
+; X86-NEXT: shrl $27, %ecx
+; X86-NEXT: orl %ecx, %eax
+; X86-NEXT: retl
+;
+; X64-LABEL: no_extract_add_1:
+; X64: # %bb.0:
+; X64-NEXT: # kill: def $edi killed $edi def $rdi
+; X64-NEXT: leal (%rdi,%rdi), %eax
+; X64-NEXT: shrl $27, %edi
+; X64-NEXT: orl %edi, %eax
+; X64-NEXT: retq
+ %ii = add i32 %i, %i
+ %rhs = lshr i32 %i, 27
+ %out = or i32 %ii, %rhs
+ ret i32 %out
+}
More information about the llvm-commits
mailing list