[llvm] 6c2a781 - [InstCombine] add test for splat-of-binop; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 22 16:24:41 PST 2023


Author: Sanjay Patel
Date: 2023-02-22T19:20:32-05:00
New Revision: 6c2a7817f8206d06101e4aa6950a113da395de38

URL: https://github.com/llvm/llvm-project/commit/6c2a7817f8206d06101e4aa6950a113da395de38
DIFF: https://github.com/llvm/llvm-project/commit/6c2a7817f8206d06101e4aa6950a113da395de38.diff

LOG: [InstCombine] add test for splat-of-binop; NFC

This shows a missing extra use check.

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/shuffle-binop.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/shuffle-binop.ll b/llvm/test/Transforms/InstCombine/shuffle-binop.ll
index 0be6a5bf9918..74aa70cc0bc7 100644
--- a/llvm/test/Transforms/InstCombine/shuffle-binop.ll
+++ b/llvm/test/Transforms/InstCombine/shuffle-binop.ll
@@ -186,7 +186,6 @@ define <vscale x 4 x i32> @vscale_splat_binop_splat_x_splat_y_calls(<vscale x 4
 }
 
 define <2 x double> @shuffle_op2_0th_element_mask(ptr %a, ptr %b) {
-  ;%0 = load <2 x double>, ptr @d, align 16
 ; CHECK-LABEL: @shuffle_op2_0th_element_mask(
 ; CHECK-NEXT:    [[TMP1:%.*]] = load <2 x double>, ptr [[A:%.*]], align 16
 ; CHECK-NEXT:    [[TMP2:%.*]] = load <2 x double>, ptr [[B:%.*]], align 16
@@ -202,5 +201,21 @@ define <2 x double> @shuffle_op2_0th_element_mask(ptr %a, ptr %b) {
   ret <2 x double> %shuffle
 }
 
+define <2 x i4> @splat_binop_splat_uses(<2 x i4> %x, <2 x i4> %y) {
+; CHECK-LABEL: @splat_binop_splat_uses(
+; CHECK-NEXT:    [[XSPLAT:%.*]] = shufflevector <2 x i4> [[X:%.*]], <2 x i4> poison, <2 x i32> zeroinitializer
+; CHECK-NEXT:    [[XY:%.*]] = mul <2 x i4> [[XSPLAT]], [[Y:%.*]]
+; CHECK-NEXT:    [[TMP1:%.*]] = mul <2 x i4> [[X]], [[Y]]
+; CHECK-NEXT:    [[MSPLAT:%.*]] = shufflevector <2 x i4> [[TMP1]], <2 x i4> poison, <2 x i32> zeroinitializer
+; CHECK-NEXT:    [[RES:%.*]] = add <2 x i4> [[XY]], [[MSPLAT]]
+; CHECK-NEXT:    ret <2 x i4> [[RES]]
+;
+  %xsplat = shufflevector <2 x i4> %x, <2 x i4> poison, <2 x i32> zeroinitializer
+  %xy = mul <2 x i4> %xsplat, %y
+  %msplat = shufflevector <2 x i4> %xy, <2 x i4> poison, <2 x i32> zeroinitializer
+  %res = add <2 x i4> %xy, %msplat
+  ret <2 x i4> %res
+}
+
 declare void @use(<4 x i8>)
 declare void @use_v(<vscale x 4 x i32>)


        


More information about the llvm-commits mailing list