| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6 | |
| ; RUN: opt -passes=slp-vectorizer -S -mtriple=x86_64-unknown-linux-gnu -mcpu=znver4 < %s | FileCheck %s --implicit-check-not=mem.cache_hint | |
| define void @load_identical_hints(ptr noalias %src, ptr noalias %dst) { | |
| ; CHECK-LABEL: define void @load_identical_hints( | |
| ; CHECK-SAME: ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]]) #[[ATTR0:[0-9]+]] { | |
| ; CHECK-NEXT: [[TMP1:%.*]] = load <2 x double>, ptr [[SRC]], align 8, !mem.cache_hint [[META0:![0-9]+]] | |
| ; CHECK-NEXT: store <2 x double> [[TMP1]], ptr [[DST]], align 8 | |
| ; CHECK-NEXT: ret void | |
| ; | |
| %src1 = getelementptr inbounds double, ptr %src, i64 1 | |
| %dst1 = getelementptr inbounds double, ptr %dst, i64 1 | |
| %v0 = load double, ptr %src, align 8, !mem.cache_hint !0 | |
| %v1 = load double, ptr %src1, align 8, !mem.cache_hint !0 | |
| store double %v0, ptr %dst, align 8 | |
| store double %v1, ptr %dst1, align 8 | |
| ret void | |
| } | |
| define void @load_missing_first_hint(ptr noalias %src, ptr noalias %dst) { | |
| ; CHECK-LABEL: define void @load_missing_first_hint( | |
| ; CHECK-SAME: ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]]) #[[ATTR0]] { | |
| ; CHECK-NEXT: [[TMP1:%.*]] = load <2 x double>, ptr [[SRC]], align 8 | |
| ; CHECK-NEXT: store <2 x double> [[TMP1]], ptr [[DST]], align 8 | |
| ; CHECK-NEXT: ret void | |
| ; | |
| %src1 = getelementptr inbounds double, ptr %src, i64 1 | |
| %dst1 = getelementptr inbounds double, ptr %dst, i64 1 | |
| %v0 = load double, ptr %src, align 8 | |
| %v1 = load double, ptr %src1, align 8, !mem.cache_hint !0 | |
| store double %v0, ptr %dst, align 8 | |
| store double %v1, ptr %dst1, align 8 | |
| ret void | |
| } | |
| define void @load_missing_last_hint(ptr noalias %src, ptr noalias %dst) { | |
| ; CHECK-LABEL: define void @load_missing_last_hint( | |
| ; CHECK-SAME: ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]]) #[[ATTR0]] { | |
| ; CHECK-NEXT: [[TMP1:%.*]] = load <2 x double>, ptr [[SRC]], align 8 | |
| ; CHECK-NEXT: store <2 x double> [[TMP1]], ptr [[DST]], align 8 | |
| ; CHECK-NEXT: ret void | |
| ; | |
| %src1 = getelementptr inbounds double, ptr %src, i64 1 | |
| %dst1 = getelementptr inbounds double, ptr %dst, i64 1 | |
| %v0 = load double, ptr %src, align 8, !mem.cache_hint !0 | |
| %v1 = load double, ptr %src1, align 8 | |
| store double %v0, ptr %dst, align 8 | |
| store double %v1, ptr %dst1, align 8 | |
| ret void | |
| } | |
| define void @load_conflicting_hints(ptr noalias %src, ptr noalias %dst) { | |
| ; CHECK-LABEL: define void @load_conflicting_hints( | |
| ; CHECK-SAME: ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]]) #[[ATTR0]] { | |
| ; CHECK-NEXT: [[TMP1:%.*]] = load <2 x double>, ptr [[SRC]], align 8 | |
| ; CHECK-NEXT: store <2 x double> [[TMP1]], ptr [[DST]], align 8 | |
| ; CHECK-NEXT: ret void | |
| ; | |
| %src1 = getelementptr inbounds double, ptr %src, i64 1 | |
| %dst1 = getelementptr inbounds double, ptr %dst, i64 1 | |
| %v0 = load double, ptr %src, align 8, !mem.cache_hint !0 | |
| %v1 = load double, ptr %src1, align 8, !mem.cache_hint !1 | |
| store double %v0, ptr %dst, align 8 | |
| store double %v1, ptr %dst1, align 8 | |
| ret void | |
| } | |
| define void @store_identical_hints(ptr noalias %src, ptr noalias %dst) { | |
| ; CHECK-LABEL: define void @store_identical_hints( | |
| ; CHECK-SAME: ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]]) #[[ATTR0]] { | |
| ; CHECK-NEXT: [[TMP1:%.*]] = load <2 x double>, ptr [[SRC]], align 8 | |
| ; CHECK-NEXT: store <2 x double> [[TMP1]], ptr [[DST]], align 8, !mem.cache_hint [[META2:![0-9]+]] | |
| ; CHECK-NEXT: ret void | |
| ; | |
| %src1 = getelementptr inbounds double, ptr %src, i64 1 | |
| %dst1 = getelementptr inbounds double, ptr %dst, i64 1 | |
| %v0 = load double, ptr %src, align 8 | |
| %v1 = load double, ptr %src1, align 8 | |
| store double %v0, ptr %dst, align 8, !mem.cache_hint !2 | |
| store double %v1, ptr %dst1, align 8, !mem.cache_hint !2 | |
| ret void | |
| } | |
| define void @store_missing_first_hint(ptr noalias %src, ptr noalias %dst) { | |
| ; CHECK-LABEL: define void @store_missing_first_hint( | |
| ; CHECK-SAME: ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]]) #[[ATTR0]] { | |
| ; CHECK-NEXT: [[TMP1:%.*]] = load <2 x double>, ptr [[SRC]], align 8 | |
| ; CHECK-NEXT: store <2 x double> [[TMP1]], ptr [[DST]], align 8 | |
| ; CHECK-NEXT: ret void | |
| ; | |
| %src1 = getelementptr inbounds double, ptr %src, i64 1 | |
| %dst1 = getelementptr inbounds double, ptr %dst, i64 1 | |
| %v0 = load double, ptr %src, align 8 | |
| %v1 = load double, ptr %src1, align 8 | |
| store double %v0, ptr %dst, align 8 | |
| store double %v1, ptr %dst1, align 8, !mem.cache_hint !2 | |
| ret void | |
| } | |
| define void @store_missing_last_hint(ptr noalias %src, ptr noalias %dst) { | |
| ; CHECK-LABEL: define void @store_missing_last_hint( | |
| ; CHECK-SAME: ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]]) #[[ATTR0]] { | |
| ; CHECK-NEXT: [[TMP1:%.*]] = load <2 x double>, ptr [[SRC]], align 8 | |
| ; CHECK-NEXT: store <2 x double> [[TMP1]], ptr [[DST]], align 8 | |
| ; CHECK-NEXT: ret void | |
| ; | |
| %src1 = getelementptr inbounds double, ptr %src, i64 1 | |
| %dst1 = getelementptr inbounds double, ptr %dst, i64 1 | |
| %v0 = load double, ptr %src, align 8 | |
| %v1 = load double, ptr %src1, align 8 | |
| store double %v0, ptr %dst, align 8, !mem.cache_hint !2 | |
| store double %v1, ptr %dst1, align 8 | |
| ret void | |
| } | |
| define void @store_conflicting_hints(ptr noalias %src, ptr noalias %dst) { | |
| ; CHECK-LABEL: define void @store_conflicting_hints( | |
| ; CHECK-SAME: ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]]) #[[ATTR0]] { | |
| ; CHECK-NEXT: [[TMP1:%.*]] = load <2 x double>, ptr [[SRC]], align 8 | |
| ; CHECK-NEXT: store <2 x double> [[TMP1]], ptr [[DST]], align 8 | |
| ; CHECK-NEXT: ret void | |
| ; | |
| %src1 = getelementptr inbounds double, ptr %src, i64 1 | |
| %dst1 = getelementptr inbounds double, ptr %dst, i64 1 | |
| %v0 = load double, ptr %src, align 8 | |
| %v1 = load double, ptr %src1, align 8 | |
| store double %v0, ptr %dst, align 8, !mem.cache_hint !2 | |
| store double %v1, ptr %dst1, align 8, !mem.cache_hint !3 | |
| ret void | |
| } | |
| define void @gather_identical_hints(ptr noalias %src, ptr noalias %dst) { | |
| ; CHECK-LABEL: define void @gather_identical_hints( | |
| ; CHECK-SAME: ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]]) #[[ATTR0]] { | |
| ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <8 x ptr> poison, ptr [[SRC]], i64 0 | |
| ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <8 x ptr> [[TMP1]], <8 x ptr> poison, <8 x i32> zeroinitializer | |
| ; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds [8 x i8], <8 x ptr> [[TMP2]], <8 x i64> <i64 0, i64 3, i64 7, i64 11, i64 18, i64 21, i64 27, i64 32> | |
| ; CHECK-NEXT: [[DST0:%.*]] = getelementptr inbounds double, ptr [[DST]], i64 0 | |
| ; CHECK-NEXT: [[TMP4:%.*]] = call <8 x double> @llvm.masked.gather.v8f64.v8p0(<8 x ptr> align 8 [[TMP3]], <8 x i1> splat (i1 true), <8 x double> poison), !mem.cache_hint [[META0]] | |
| ; CHECK-NEXT: [[TMP5:%.*]] = fadd <8 x double> [[TMP4]], splat (double 1.000000e+00) | |
| ; CHECK-NEXT: store <8 x double> [[TMP5]], ptr [[DST0]], align 8 | |
| ; CHECK-NEXT: ret void | |
| ; | |
| %src0 = getelementptr inbounds [8 x i8], ptr %src, i64 0 | |
| %v0 = load double, ptr %src0, align 8, !mem.cache_hint !0 | |
| %src1 = getelementptr inbounds [8 x i8], ptr %src, i64 3 | |
| %v1 = load double, ptr %src1, align 8, !mem.cache_hint !0 | |
| %src2 = getelementptr inbounds [8 x i8], ptr %src, i64 7 | |
| %v2 = load double, ptr %src2, align 8, !mem.cache_hint !0 | |
| %src3 = getelementptr inbounds [8 x i8], ptr %src, i64 11 | |
| %v3 = load double, ptr %src3, align 8, !mem.cache_hint !0 | |
| %src4 = getelementptr inbounds [8 x i8], ptr %src, i64 18 | |
| %v4 = load double, ptr %src4, align 8, !mem.cache_hint !0 | |
| %src5 = getelementptr inbounds [8 x i8], ptr %src, i64 21 | |
| %v5 = load double, ptr %src5, align 8, !mem.cache_hint !0 | |
| %src6 = getelementptr inbounds [8 x i8], ptr %src, i64 27 | |
| %v6 = load double, ptr %src6, align 8, !mem.cache_hint !0 | |
| %src7 = getelementptr inbounds [8 x i8], ptr %src, i64 32 | |
| %v7 = load double, ptr %src7, align 8, !mem.cache_hint !0 | |
| %a0 = fadd double %v0, 1.0 | |
| %a1 = fadd double %v1, 1.0 | |
| %a2 = fadd double %v2, 1.0 | |
| %a3 = fadd double %v3, 1.0 | |
| %a4 = fadd double %v4, 1.0 | |
| %a5 = fadd double %v5, 1.0 | |
| %a6 = fadd double %v6, 1.0 | |
| %a7 = fadd double %v7, 1.0 | |
| %dst0 = getelementptr inbounds double, ptr %dst, i64 0 | |
| store double %a0, ptr %dst0, align 8 | |
| %dst1 = getelementptr inbounds double, ptr %dst, i64 1 | |
| store double %a1, ptr %dst1, align 8 | |
| %dst2 = getelementptr inbounds double, ptr %dst, i64 2 | |
| store double %a2, ptr %dst2, align 8 | |
| %dst3 = getelementptr inbounds double, ptr %dst, i64 3 | |
| store double %a3, ptr %dst3, align 8 | |
| %dst4 = getelementptr inbounds double, ptr %dst, i64 4 | |
| store double %a4, ptr %dst4, align 8 | |
| %dst5 = getelementptr inbounds double, ptr %dst, i64 5 | |
| store double %a5, ptr %dst5, align 8 | |
| %dst6 = getelementptr inbounds double, ptr %dst, i64 6 | |
| store double %a6, ptr %dst6, align 8 | |
| %dst7 = getelementptr inbounds double, ptr %dst, i64 7 | |
| store double %a7, ptr %dst7, align 8 | |
| ret void | |
| } | |
| define void @masked_store_identical_hints(ptr noalias %src, ptr noalias %dst) { | |
| ; CHECK-LABEL: define void @masked_store_identical_hints( | |
| ; CHECK-SAME: ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]]) #[[ATTR0]] { | |
| ; CHECK-NEXT: [[V:%.*]] = load <8 x i32>, ptr [[SRC]], align 4 | |
| ; CHECK-NEXT: [[DST0:%.*]] = getelementptr inbounds i32, ptr [[DST]], i64 0 | |
| ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <8 x i32> [[V]], <8 x i32> poison, <15 x i32> <i32 0, i32 poison, i32 1, i32 poison, i32 2, i32 poison, i32 3, i32 poison, i32 4, i32 poison, i32 5, i32 poison, i32 6, i32 poison, i32 7> | |
| ; CHECK-NEXT: call void @llvm.masked.store.v15i32.p0(<15 x i32> [[TMP1]], ptr align 4 [[DST0]], <15 x i1> <i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true>), !mem.cache_hint [[META2]] | |
| ; CHECK-NEXT: ret void | |
| ; | |
| %v = load <8 x i32>, ptr %src, align 4 | |
| %e0 = extractelement <8 x i32> %v, i32 0 | |
| %dst0 = getelementptr inbounds i32, ptr %dst, i64 0 | |
| %e1 = extractelement <8 x i32> %v, i32 1 | |
| %dst1 = getelementptr inbounds i32, ptr %dst, i64 2 | |
| %e2 = extractelement <8 x i32> %v, i32 2 | |
| %dst2 = getelementptr inbounds i32, ptr %dst, i64 4 | |
| %e3 = extractelement <8 x i32> %v, i32 3 | |
| %dst3 = getelementptr inbounds i32, ptr %dst, i64 6 | |
| %e4 = extractelement <8 x i32> %v, i32 4 | |
| %dst4 = getelementptr inbounds i32, ptr %dst, i64 8 | |
| %e5 = extractelement <8 x i32> %v, i32 5 | |
| %dst5 = getelementptr inbounds i32, ptr %dst, i64 10 | |
| %e6 = extractelement <8 x i32> %v, i32 6 | |
| %dst6 = getelementptr inbounds i32, ptr %dst, i64 12 | |
| %e7 = extractelement <8 x i32> %v, i32 7 | |
| %dst7 = getelementptr inbounds i32, ptr %dst, i64 14 | |
| store i32 %e0, ptr %dst0, align 4, !mem.cache_hint !2 | |
| store i32 %e1, ptr %dst1, align 4, !mem.cache_hint !2 | |
| store i32 %e2, ptr %dst2, align 4, !mem.cache_hint !2 | |
| store i32 %e3, ptr %dst3, align 4, !mem.cache_hint !2 | |
| store i32 %e4, ptr %dst4, align 4, !mem.cache_hint !2 | |
| store i32 %e5, ptr %dst5, align 4, !mem.cache_hint !2 | |
| store i32 %e6, ptr %dst6, align 4, !mem.cache_hint !2 | |
| store i32 %e7, ptr %dst7, align 4, !mem.cache_hint !2 | |
| ret void | |
| } | |
| !0 = !{i32 0, !4} | |
| !1 = !{i32 0, !5} | |
| !2 = !{i32 1, !4} | |
| !3 = !{i32 1, !5} | |
| !4 = !{!"nvvm.l1_eviction", !"last"} | |
| !5 = !{!"nvvm.l1_eviction", !"first"} | |
| ;. | |
| ; CHECK: [[META0]] = !{i32 0, [[META1:![0-9]+]]} | |
| ; CHECK: [[META1]] = !{!"nvvm.l1_eviction", !"last"} | |
| ; CHECK: [[META2]] = !{i32 1, [[META1]]} | |
| ;. |