From: Simon Pilgrim Date: Fri, 24 Mar 2017 17:25:47 +0000 (+0000) Subject: [X86][SSE] Add ashr + mask test cases. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ab5b354a110423d9316c6bd7c9787bc5de8dddaf;p=llvm [X86][SSE] Add ashr + mask test cases. Test cases showing cases where we're missing an opportunity to lshr a value with an extended sign to avoid loading a mask git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298716 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGen/X86/combine-and.ll b/test/CodeGen/X86/combine-and.ll index 6f310d9b7b1..00e5f8f847a 100644 --- a/test/CodeGen/X86/combine-and.ll +++ b/test/CodeGen/X86/combine-and.ll @@ -245,3 +245,29 @@ define <4 x i32> @and_or_zext_v4i16(<4 x i16> %a0) { %3 = and <4 x i32> %2, ret <4 x i32> %3 } + +; +; known sign bits folding +; + +define <8 x i16> @ashr_mask1_v8i16(<8 x i16> %a0) { +; CHECK-LABEL: ashr_mask1_v8i16: +; CHECK: # BB#0: +; CHECK-NEXT: psraw $15, %xmm0 +; CHECK-NEXT: pand {{.*}}(%rip), %xmm0 +; CHECK-NEXT: retq + %1 = ashr <8 x i16> %a0, + %2 = and <8 x i16> %1, + ret <8 x i16> %2 +} + +define <4 x i32> @ashr_mask7_v4i32(<4 x i32> %a0) { +; CHECK-LABEL: ashr_mask7_v4i32: +; CHECK: # BB#0: +; CHECK-NEXT: psrad $31, %xmm0 +; CHECK-NEXT: pand {{.*}}(%rip), %xmm0 +; CHECK-NEXT: retq + %1 = ashr <4 x i32> %a0, + %2 = and <4 x i32> %1, + ret <4 x i32> %2 +}