[llvm] deb3ecf - [SLP][NFC]Add a test with the reduction of strided load, NFC.

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 05:06:58 PDT 2024


Author: Alexey Bataev
Date: 2024-08-02T05:06:44-07:00
New Revision: deb3ecf09fa30391bd22f890d2885c3d4816ca15

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

LOG: [SLP][NFC]Add a test with the reduction of strided load, NFC.

Added: 
    

Modified: 
    llvm/test/Transforms/SLPVectorizer/RISCV/reductions.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/SLPVectorizer/RISCV/reductions.ll b/llvm/test/Transforms/SLPVectorizer/RISCV/reductions.ll
index 0f633dba1f792..77bd894eb78f1 100644
--- a/llvm/test/Transforms/SLPVectorizer/RISCV/reductions.ll
+++ b/llvm/test/Transforms/SLPVectorizer/RISCV/reductions.ll
@@ -142,6 +142,108 @@ entry:
   ret i64 %add.15
 }
 
+
+define i64 @red_strided_ld_16xi64(ptr %ptr) {
+; CHECK-LABEL: @red_strided_ld_16xi64(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[LD0:%.*]] = load i64, ptr [[PTR:%.*]], align 8
+; CHECK-NEXT:    [[GEP:%.*]] = getelementptr inbounds i64, ptr [[PTR]], i64 2
+; CHECK-NEXT:    [[LD1:%.*]] = load i64, ptr [[GEP]], align 8
+; CHECK-NEXT:    [[ADD_1:%.*]] = add nuw nsw i64 [[LD0]], [[LD1]]
+; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds i64, ptr [[PTR]], i64 4
+; CHECK-NEXT:    [[LD2:%.*]] = load i64, ptr [[GEP_1]], align 8
+; CHECK-NEXT:    [[ADD_2:%.*]] = add nuw nsw i64 [[ADD_1]], [[LD2]]
+; CHECK-NEXT:    [[GEP_2:%.*]] = getelementptr inbounds i64, ptr [[PTR]], i64 6
+; CHECK-NEXT:    [[LD3:%.*]] = load i64, ptr [[GEP_2]], align 8
+; CHECK-NEXT:    [[ADD_3:%.*]] = add nuw nsw i64 [[ADD_2]], [[LD3]]
+; CHECK-NEXT:    [[GEP_3:%.*]] = getelementptr inbounds i64, ptr [[PTR]], i64 8
+; CHECK-NEXT:    [[LD4:%.*]] = load i64, ptr [[GEP_3]], align 8
+; CHECK-NEXT:    [[ADD_4:%.*]] = add nuw nsw i64 [[ADD_3]], [[LD4]]
+; CHECK-NEXT:    [[GEP_4:%.*]] = getelementptr inbounds i64, ptr [[PTR]], i64 10
+; CHECK-NEXT:    [[LD5:%.*]] = load i64, ptr [[GEP_4]], align 8
+; CHECK-NEXT:    [[ADD_5:%.*]] = add nuw nsw i64 [[ADD_4]], [[LD5]]
+; CHECK-NEXT:    [[GEP_5:%.*]] = getelementptr inbounds i64, ptr [[PTR]], i64 12
+; CHECK-NEXT:    [[LD6:%.*]] = load i64, ptr [[GEP_5]], align 8
+; CHECK-NEXT:    [[ADD_6:%.*]] = add nuw nsw i64 [[ADD_5]], [[LD6]]
+; CHECK-NEXT:    [[GEP_6:%.*]] = getelementptr inbounds i64, ptr [[PTR]], i64 14
+; CHECK-NEXT:    [[LD7:%.*]] = load i64, ptr [[GEP_6]], align 8
+; CHECK-NEXT:    [[ADD_7:%.*]] = add nuw nsw i64 [[ADD_6]], [[LD7]]
+; CHECK-NEXT:    [[GEP_7:%.*]] = getelementptr inbounds i64, ptr [[PTR]], i64 16
+; CHECK-NEXT:    [[LD8:%.*]] = load i64, ptr [[GEP_7]], align 8
+; CHECK-NEXT:    [[ADD_8:%.*]] = add nuw nsw i64 [[ADD_7]], [[LD8]]
+; CHECK-NEXT:    [[GEP_8:%.*]] = getelementptr inbounds i64, ptr [[PTR]], i64 18
+; CHECK-NEXT:    [[LD9:%.*]] = load i64, ptr [[GEP_8]], align 8
+; CHECK-NEXT:    [[ADD_9:%.*]] = add nuw nsw i64 [[ADD_8]], [[LD9]]
+; CHECK-NEXT:    [[GEP_9:%.*]] = getelementptr inbounds i64, ptr [[PTR]], i64 20
+; CHECK-NEXT:    [[LD10:%.*]] = load i64, ptr [[GEP_9]], align 8
+; CHECK-NEXT:    [[ADD_10:%.*]] = add nuw nsw i64 [[ADD_9]], [[LD10]]
+; CHECK-NEXT:    [[GEP_10:%.*]] = getelementptr inbounds i64, ptr [[PTR]], i64 22
+; CHECK-NEXT:    [[LD11:%.*]] = load i64, ptr [[GEP_10]], align 8
+; CHECK-NEXT:    [[ADD_11:%.*]] = add nuw nsw i64 [[ADD_10]], [[LD11]]
+; CHECK-NEXT:    [[GEP_11:%.*]] = getelementptr inbounds i64, ptr [[PTR]], i64 24
+; CHECK-NEXT:    [[LD12:%.*]] = load i64, ptr [[GEP_11]], align 8
+; CHECK-NEXT:    [[ADD_12:%.*]] = add nuw nsw i64 [[ADD_11]], [[LD12]]
+; CHECK-NEXT:    [[GEP_12:%.*]] = getelementptr inbounds i64, ptr [[PTR]], i64 26
+; CHECK-NEXT:    [[LD13:%.*]] = load i64, ptr [[GEP_12]], align 8
+; CHECK-NEXT:    [[ADD_13:%.*]] = add nuw nsw i64 [[ADD_12]], [[LD13]]
+; CHECK-NEXT:    [[GEP_13:%.*]] = getelementptr inbounds i64, ptr [[PTR]], i64 28
+; CHECK-NEXT:    [[LD14:%.*]] = load i64, ptr [[GEP_13]], align 8
+; CHECK-NEXT:    [[ADD_14:%.*]] = add nuw nsw i64 [[ADD_13]], [[LD14]]
+; CHECK-NEXT:    [[GEP_14:%.*]] = getelementptr inbounds i64, ptr [[PTR]], i64 30
+; CHECK-NEXT:    [[LD15:%.*]] = load i64, ptr [[GEP_14]], align 8
+; CHECK-NEXT:    [[ADD_15:%.*]] = add nuw nsw i64 [[ADD_14]], [[LD15]]
+; CHECK-NEXT:    ret i64 [[ADD_15]]
+;
+entry:
+  %ld0 = load i64, ptr %ptr
+  %gep = getelementptr inbounds i64, ptr %ptr, i64 2
+  %ld1 = load i64, ptr %gep
+  %add.1 = add nuw nsw i64 %ld0, %ld1
+  %gep.1 = getelementptr inbounds i64, ptr %ptr, i64 4
+  %ld2 = load i64, ptr %gep.1
+  %add.2 = add nuw nsw i64 %add.1, %ld2
+  %gep.2 = getelementptr inbounds i64, ptr %ptr, i64 6
+  %ld3 = load i64, ptr %gep.2
+  %add.3 = add nuw nsw i64 %add.2, %ld3
+  %gep.3 = getelementptr inbounds i64, ptr %ptr, i64 8
+  %ld4 = load i64, ptr %gep.3
+  %add.4 = add nuw nsw i64 %add.3, %ld4
+  %gep.4 = getelementptr inbounds i64, ptr %ptr, i64 10
+  %ld5 = load i64, ptr %gep.4
+  %add.5 = add nuw nsw i64 %add.4, %ld5
+  %gep.5 = getelementptr inbounds i64, ptr %ptr, i64 12
+  %ld6 = load i64, ptr %gep.5
+  %add.6 = add nuw nsw i64 %add.5, %ld6
+  %gep.6 = getelementptr inbounds i64, ptr %ptr, i64 14
+  %ld7 = load i64, ptr %gep.6
+  %add.7 = add nuw nsw i64 %add.6, %ld7
+  %gep.7 = getelementptr inbounds i64, ptr %ptr, i64 16
+  %ld8 = load i64, ptr %gep.7
+  %add.8 = add nuw nsw i64 %add.7, %ld8
+  %gep.8 = getelementptr inbounds i64, ptr %ptr, i64 18
+  %ld9 = load i64, ptr %gep.8
+  %add.9 = add nuw nsw i64 %add.8, %ld9
+  %gep.9 = getelementptr inbounds i64, ptr %ptr, i64 20
+  %ld10 = load i64, ptr %gep.9
+  %add.10 = add nuw nsw i64 %add.9, %ld10
+  %gep.10 = getelementptr inbounds i64, ptr %ptr, i64 22
+  %ld11 = load i64, ptr %gep.10
+  %add.11 = add nuw nsw i64 %add.10, %ld11
+  %gep.11 = getelementptr inbounds i64, ptr %ptr, i64 24
+  %ld12 = load i64, ptr %gep.11
+  %add.12 = add nuw nsw i64 %add.11, %ld12
+  %gep.12 = getelementptr inbounds i64, ptr %ptr, i64 26
+  %ld13 = load i64, ptr %gep.12
+  %add.13 = add nuw nsw i64 %add.12, %ld13
+  %gep.13 = getelementptr inbounds i64, ptr %ptr, i64 28
+  %ld14 = load i64, ptr %gep.13
+  %add.14 = add nuw nsw i64 %add.13, %ld14
+  %gep.14 = getelementptr inbounds i64, ptr %ptr, i64 30
+  %ld15 = load i64, ptr %gep.14
+  %add.15 = add nuw nsw i64 %add.14, %ld15
+  ret i64 %add.15
+}
+
 ; Next batch test 
diff eren reductions kinds
 
 %struct.buf = type { [8 x i8] }


        


More information about the llvm-commits mailing list