[llvm] r289035 - [X86][SSE] Add vector test for (shl (or x, c1), c2) -> (or (shl x, c2), c1 << c2) detailed in D19325
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 8 02:17:26 PST 2016
Author: rksimon
Date: Thu Dec 8 04:17:25 2016
New Revision: 289035
URL: http://llvm.org/viewvc/llvm-project?rev=289035&view=rev
Log:
[X86][SSE] Add vector test for (shl (or x, c1), c2) -> (or (shl x, c2), c1 << c2) detailed in D19325
Modified:
llvm/trunk/test/CodeGen/X86/combine-shl.ll
Modified: llvm/trunk/test/CodeGen/X86/combine-shl.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/combine-shl.ll?rev=289035&r1=289034&r2=289035&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/combine-shl.ll (original)
+++ llvm/trunk/test/CodeGen/X86/combine-shl.ll Thu Dec 8 04:17:25 2016
@@ -543,6 +543,42 @@ define <4 x i32> @combine_vec_shl_add1(<
ret <4 x i32> %2
}
+; FIXME: fold (shl (or x, c1), c2) -> (or (shl x, c2), c1 << c2)
+define <4 x i32> @combine_vec_shl_or0(<4 x i32> %x) {
+; SSE-LABEL: combine_vec_shl_or0:
+; SSE: # BB#0:
+; SSE-NEXT: por {{.*}}(%rip), %xmm0
+; SSE-NEXT: pslld $2, %xmm0
+; SSE-NEXT: retq
+;
+; AVX-LABEL: combine_vec_shl_or0:
+; AVX: # BB#0:
+; AVX-NEXT: vpbroadcastd {{.*}}(%rip), %xmm1
+; AVX-NEXT: vpor %xmm1, %xmm0, %xmm0
+; AVX-NEXT: vpslld $2, %xmm0, %xmm0
+; AVX-NEXT: retq
+ %1 = or <4 x i32> %x, <i32 5, i32 5, i32 5, i32 5>
+ %2 = shl <4 x i32> %1, <i32 2, i32 2, i32 2, i32 2>
+ ret <4 x i32> %2
+}
+
+define <4 x i32> @combine_vec_shl_or1(<4 x i32> %x) {
+; SSE-LABEL: combine_vec_shl_or1:
+; SSE: # BB#0:
+; SSE-NEXT: por {{.*}}(%rip), %xmm0
+; SSE-NEXT: pmulld {{.*}}(%rip), %xmm0
+; SSE-NEXT: retq
+;
+; AVX-LABEL: combine_vec_shl_or1:
+; AVX: # BB#0:
+; AVX-NEXT: vpor {{.*}}(%rip), %xmm0, %xmm0
+; AVX-NEXT: vpsllvd {{.*}}(%rip), %xmm0, %xmm0
+; AVX-NEXT: retq
+ %1 = or <4 x i32> %x, <i32 5, i32 6, i32 7, i32 8>
+ %2 = shl <4 x i32> %1, <i32 1, i32 2, i32 3, i32 4>
+ ret <4 x i32> %2
+}
+
; fold (shl (mul x, c1), c2) -> (mul x, c1 << c2)
define <4 x i32> @combine_vec_shl_mul0(<4 x i32> %x) {
; SSE-LABEL: combine_vec_shl_mul0:
More information about the llvm-commits
mailing list