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

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D131899
This commit is contained in:
Zain Jaffal 2022-08-16 09:40:51 +01:00 committed by Florian Hahn
parent 662c1c2881
commit 94d21a94d9
No known key found for this signature in database
GPG Key ID: EEF712BB5E80EBBA
1 changed files with 243 additions and 0 deletions

View File

@ -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}