[llvm] 94d21a9 - [AArch64] Add tests to check for loop vectorization of non temporal loads

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 16 01:41:18 PDT 2022


Author: Zain Jaffal
Date: 2022-08-16T09:40:51+01:00
New Revision: 94d21a94d90db8bc0e983bde672790843f81ddca

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

LOG: [AArch64] Add tests to check for loop vectorization of non temporal loads

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D131899

Added: 
    

Modified: 
    llvm/test/Transforms/LoopVectorize/AArch64/nontemporal-load-store.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/LoopVectorize/AArch64/nontemporal-load-store.ll b/llvm/test/Transforms/LoopVectorize/AArch64/nontemporal-load-store.ll
index a9c1f6c5cd1d..9df651ae4e15 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/nontemporal-load-store.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/nontemporal-load-store.ll
@@ -256,4 +256,247 @@ for.cond.cleanup:                                 ; preds = %for.body
   ret void
 }
 
+define i4 @test_i4_load(i4* %ddst) {
+; CHECK-LABEL: define i4 @test_i4_load
+; CHECK-LABEL: vector.body:
+; CHECK:         [[LOAD:%.*]] = load i4, i4* {{.*}}, align 1, !nontemporal !0
+; CHECk: ret i4 %{{.*}}
+;
+entry:
+  br label %for.body
+
+for.body:                                         ; preds = %entry, %for.body
+  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+  %acc.08 = phi i4 [ 0, %entry ], [ %add, %for.body ]
+  %arrayidx = getelementptr inbounds i4, i4* %ddst, i64 %indvars.iv
+  %l = load i4, i4* %arrayidx, align 1, !nontemporal !8
+  %add = add i4 %l, %acc.08
+  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+  %exitcond.not = icmp eq i64 %indvars.iv.next, 4092
+  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
+
+for.cond.cleanup:                                 ; preds = %for.body
+  ret i4 %add
+}
+
+define i8 @test_load_i8(i8* %ddst) {
+; CHECK-LABEL: @test_load_i8(
+; CHECK-NOT:   vector.body:
+; CHECk: ret i8 %{{.*}}
+;
+entry:
+  br label %for.body
+
+for.body:                                         ; preds = %entry, %for.body
+  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+  %acc.08 = phi i8 [ 0, %entry ], [ %add, %for.body ]
+  %arrayidx = getelementptr inbounds i8, i8* %ddst, i64 %indvars.iv
+  %l = load i8, i8* %arrayidx, align 1, !nontemporal !8
+  %add = add i8 %l, %acc.08
+  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+  %exitcond.not = icmp eq i64 %indvars.iv.next, 4092
+  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
+
+for.cond.cleanup:                                 ; preds = %for.body
+  ret i8 %add
+}
+
+define half @test_half_load(half* %ddst) {
+; CHECK-LABEL: @test_half_load
+; CHECK-NOT:   vector.body:
+; CHECk: ret half %{{.*}}
+;
+entry:
+  br label %for.body
+
+for.body:                                         ; preds = %entry, %for.body
+  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+  %acc.08 = phi half [ 0.0, %entry ], [ %add, %for.body ]
+  %arrayidx = getelementptr inbounds half, half* %ddst, i64 %indvars.iv
+  %l = load half, half* %arrayidx, align 2, !nontemporal !8
+  %add = fadd half %l, %acc.08
+  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+  %exitcond.not = icmp eq i64 %indvars.iv.next, 4092
+  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
+
+for.cond.cleanup:                                 ; preds = %for.body
+  ret half %add
+}
+
+define i16 @test_i16_load(i16* %ddst) {
+; CHECK-LABEL: @test_i16_load
+; CHECK-NOT:   vector.body:
+; CHECk: ret i16 %{{.*}}
+;
+entry:
+  br label %for.body
+
+for.body:                                         ; preds = %entry, %for.body
+  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+  %acc.08 = phi i16 [ 0, %entry ], [ %add, %for.body ]
+  %arrayidx = getelementptr inbounds i16, i16* %ddst, i64 %indvars.iv
+  %l = load i16, i16* %arrayidx, align 2, !nontemporal !8
+  %add = add i16 %l, %acc.08
+  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+  %exitcond.not = icmp eq i64 %indvars.iv.next, 4092
+  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
+
+for.cond.cleanup:                                 ; preds = %for.body
+  ret i16 %add
+}
+
+define i32 @test_i32_load(i32* %ddst) {
+; CHECK-LABEL: @test_i32_load
+; CHECK-NOT:   vector.body:
+; CHECk: ret i32 %{{.*}}
+;
+entry:
+  br label %for.body
+
+for.body:                                         ; preds = %entry, %for.body
+  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+  %acc.08 = phi i32 [ 0, %entry ], [ %add, %for.body ]
+  %arrayidx = getelementptr inbounds i32, i32* %ddst, i64 %indvars.iv
+  %l = load i32, i32* %arrayidx, align 4, !nontemporal !8
+  %add = add i32 %l, %acc.08
+  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+  %exitcond.not = icmp eq i64 %indvars.iv.next, 4092
+  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
+
+for.cond.cleanup:                                 ; preds = %for.body
+  ret i32 %add
+}
+
+define i33 @test_i33_load(i33* %ddst) {
+; CHECK-LABEL: @test_i33_load
+; CHECK-NOT:   vector.body:
+; CHECk: ret i33 %{{.*}}
+;
+entry:
+  br label %for.body
+
+for.body:                                         ; preds = %entry, %for.body
+  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+  %acc.08 = phi i33 [ 0, %entry ], [ %add, %for.body ]
+  %arrayidx = getelementptr inbounds i33, i33* %ddst, i64 %indvars.iv
+  %l = load i33, i33* %arrayidx, align 4, !nontemporal !8
+  %add = add i33 %l, %acc.08
+  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+  %exitcond.not = icmp eq i64 %indvars.iv.next, 4092
+  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
+
+for.cond.cleanup:                                 ; preds = %for.body
+  ret i33 %add
+}
+
+define i40 @test_i40_load(i40* %ddst) {
+; CHECK-LABEL: @test_i40_load
+; CHECK-NOT:   vector.body:
+; CHECk: ret i40 %{{.*}}
+;
+entry:
+  br label %for.body
+
+for.body:                                         ; preds = %entry, %for.body
+  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+  %acc.08 = phi i40 [ 0, %entry ], [ %add, %for.body ]
+  %arrayidx = getelementptr inbounds i40, i40* %ddst, i64 %indvars.iv
+  %l = load i40, i40* %arrayidx, align 4, !nontemporal !8
+  %add = add i40 %l, %acc.08
+  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+  %exitcond.not = icmp eq i64 %indvars.iv.next, 4092
+  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
+
+for.cond.cleanup:                                 ; preds = %for.body
+  ret i40 %add
+}
+
+define i64 @test_i64_load(i64* %ddst) {
+; CHECK-LABEL: @test_i64_load
+; CHECK-NOT:   vector.body:
+; CHECk: ret i64 %{{.*}}
+;
+entry:
+  br label %for.body
+
+for.body:                                         ; preds = %entry, %for.body
+  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+  %acc.08 = phi i64 [ 0, %entry ], [ %add, %for.body ]
+  %arrayidx = getelementptr inbounds i64, i64* %ddst, i64 %indvars.iv
+  %l = load i64, i64* %arrayidx, align 4, !nontemporal !8
+  %add = add i64 %l, %acc.08
+  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+  %exitcond.not = icmp eq i64 %indvars.iv.next, 4092
+  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
+
+for.cond.cleanup:                                 ; preds = %for.body
+  ret i64 %add
+}
+
+define double @test_double_load(double* %ddst) {
+; CHECK-LABEL: @test_double_load
+; CHECK-NOT:   vector.body:
+; CHECk: ret double %{{.*}}
+;
+entry:
+  br label %for.body
+
+for.body:                                         ; preds = %entry, %for.body
+  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+  %acc.08 = phi double [ 0.0, %entry ], [ %add, %for.body ]
+  %arrayidx = getelementptr inbounds double, double* %ddst, i64 %indvars.iv
+  %l = load double, double* %arrayidx, align 4, !nontemporal !8
+  %add = fadd double %l, %acc.08
+  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+  %exitcond.not = icmp eq i64 %indvars.iv.next, 4092
+  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
+
+for.cond.cleanup:                                 ; preds = %for.body
+  ret double %add
+}
+
+define i128 @test_i128_load(i128* %ddst) {
+; CHECK-LABEL: @test_i128_load
+; CHECK-NOT:   vector.body:
+; CHECk: ret i128 %{{.*}}
+;
+entry:
+  br label %for.body
+
+for.body:                                         ; preds = %entry, %for.body
+  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+  %acc.08 = phi i128 [ 0, %entry ], [ %add, %for.body ]
+  %arrayidx = getelementptr inbounds i128, i128* %ddst, i64 %indvars.iv
+  %l = load i128, i128* %arrayidx, align 4, !nontemporal !8
+  %add = add i128 %l, %acc.08
+  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+  %exitcond.not = icmp eq i64 %indvars.iv.next, 4092
+  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
+
+for.cond.cleanup:                                 ; preds = %for.body
+  ret i128 %add
+}
+
+define i256 @test_256_load(i256* %ddst) {
+; CHECK-LABEL: @test_256_load
+; CHECK-NOT:   vector.body:
+; CHECk: ret i256 %{{.*}}
+;
+entry:
+  br label %for.body
+
+for.body:                                         ; preds = %entry, %for.body
+  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+  %acc.08 = phi i256 [ 0, %entry ], [ %add, %for.body ]
+  %arrayidx = getelementptr inbounds i256, i256* %ddst, i64 %indvars.iv
+  %l = load i256, i256* %arrayidx, align 4, !nontemporal !8
+  %add = add i256 %l, %acc.08
+  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+  %exitcond.not = icmp eq i64 %indvars.iv.next, 4092
+  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
+
+for.cond.cleanup:                                 ; preds = %for.body
+  ret i256 %add
+}
+
 !8 = !{i32 1}


        


More information about the llvm-commits mailing list