]> granicus.if.org Git - llvm/commitdiff
[X86][SSE] Add shift combine 'out of range' tests with UNDEFs
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 18 Dec 2018 13:37:04 +0000 (13:37 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 18 Dec 2018 13:37:04 +0000 (13:37 +0000)
Shows failure to simplify out of range shift amounts to UNDEF if any element is UNDEF.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349483 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGen/X86/combine-shl.ll
test/CodeGen/X86/combine-sra.ll
test/CodeGen/X86/combine-srl.ll

index 8e3b03e9a4b0683836b375a2014c0fa9cec5f60a..3cb1dd65e9ce925dced13c6789851dd027d10e53 100644 (file)
@@ -45,6 +45,20 @@ define <4 x i32> @combine_vec_shl_outofrange2(<4 x i32> %a0) {
   ret <4 x i32> %2
 }
 
+define <4 x i32> @combine_vec_shl_outofrange3(<4 x i32> %a0) {
+; SSE-LABEL: combine_vec_shl_outofrange3:
+; SSE:       # %bb.0:
+; SSE-NEXT:    xorps %xmm0, %xmm0
+; SSE-NEXT:    retq
+;
+; AVX-LABEL: combine_vec_shl_outofrange3:
+; AVX:       # %bb.0:
+; AVX-NEXT:    vpsllvd {{.*}}(%rip), %xmm0, %xmm0
+; AVX-NEXT:    retq
+  %1 = shl <4 x i32> %a0, <i32 33, i32 34, i32 35, i32 undef>
+  ret <4 x i32> %1
+}
+
 ; fold (shl x, 0) -> x
 define <4 x i32> @combine_vec_shl_by_zero(<4 x i32> %x) {
 ; CHECK-LABEL: combine_vec_shl_by_zero:
index 9bce1a7c3b654313648ca13033988382c6fc8660..f8b536ac553ae8569167be8f942d100c3c96fd75 100644 (file)
@@ -50,6 +50,19 @@ define <4 x i32> @combine_vec_ashr_outofrange1(<4 x i32> %x) {
   ret <4 x i32> %1
 }
 
+define <4 x i32> @combine_vec_ashr_outofrange2(<4 x i32> %x) {
+; SSE-LABEL: combine_vec_ashr_outofrange2:
+; SSE:       # %bb.0:
+; SSE-NEXT:    retq
+;
+; AVX-LABEL: combine_vec_ashr_outofrange2:
+; AVX:       # %bb.0:
+; AVX-NEXT:    vpsravd {{.*}}(%rip), %xmm0, %xmm0
+; AVX-NEXT:    retq
+  %1 = ashr <4 x i32> %x, <i32 33, i32 34, i32 35, i32 undef>
+  ret <4 x i32> %1
+}
+
 ; fold (sra x, 0) -> x
 define <4 x i32> @combine_vec_ashr_by_zero(<4 x i32> %x) {
 ; CHECK-LABEL: combine_vec_ashr_by_zero:
index 1cecc680c769043516036eae9fc96f9af1f5907b..2dd1fa74871af05e2952b0e098cccb1550149795 100644 (file)
@@ -35,6 +35,19 @@ define <4 x i32> @combine_vec_lshr_outofrange1(<4 x i32> %x) {
   ret <4 x i32> %1
 }
 
+define <4 x i32> @combine_vec_lshr_outofrange2(<4 x i32> %x) {
+; SSE-LABEL: combine_vec_lshr_outofrange2:
+; SSE:       # %bb.0:
+; SSE-NEXT:    retq
+;
+; AVX-LABEL: combine_vec_lshr_outofrange2:
+; AVX:       # %bb.0:
+; AVX-NEXT:    vpsrlvd {{.*}}(%rip), %xmm0, %xmm0
+; AVX-NEXT:    retq
+  %1 = lshr <4 x i32> %x, <i32 33, i32 34, i32 35, i32 undef>
+  ret <4 x i32> %1
+}
+
 ; fold (srl x, 0) -> x
 define <4 x i32> @combine_vec_lshr_by_zero(<4 x i32> %x) {
 ; CHECK-LABEL: combine_vec_lshr_by_zero: