1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -basicaa -slp-vectorizer -dce < %s | FileCheck %s
3 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
4 target triple = "arm64-apple-ios5.0.0"
6 define void @foo(float* noalias %a, float* noalias %b, float* noalias %c) {
9 ; CHECK-NEXT: [[TMP0:%.*]] = bitcast float* [[B:%.*]] to <4 x float>*
10 ; CHECK-NEXT: [[TMP1:%.*]] = load <4 x float>, <4 x float>* [[TMP0]], align 4, !nontemporal !0
11 ; CHECK-NEXT: [[TMP2:%.*]] = bitcast float* [[C:%.*]] to <4 x float>*
12 ; CHECK-NEXT: [[TMP3:%.*]] = load <4 x float>, <4 x float>* [[TMP2]], align 4
13 ; CHECK-NEXT: [[TMP4:%.*]] = fadd <4 x float> [[TMP1]], [[TMP3]]
14 ; CHECK-NEXT: [[TMP5:%.*]] = bitcast float* [[A:%.*]] to <4 x float>*
15 ; CHECK-NEXT: store <4 x float> [[TMP4]], <4 x float>* [[TMP5]], align 4, !nontemporal !0
16 ; CHECK-NEXT: ret void
19 ; Check that we don't lose !nontemporal hint when vectorizing loads.
20 %b1 = load float, float* %b, align 4, !nontemporal !0
21 %arrayidx.1 = getelementptr inbounds float, float* %b, i64 1
22 %b2 = load float, float* %arrayidx.1, align 4, !nontemporal !0
23 %arrayidx.2 = getelementptr inbounds float, float* %b, i64 2
24 %b3 = load float, float* %arrayidx.2, align 4, !nontemporal !0
25 %arrayidx.3 = getelementptr inbounds float, float* %b, i64 3
26 %b4 = load float, float* %arrayidx.3, align 4, !nontemporal !0
28 ; Check that we don't introduce !nontemporal hint when the original scalar loads didn't have it.
29 %c1 = load float, float* %c, align 4
30 %arrayidx2.1 = getelementptr inbounds float, float* %c, i64 1
31 %c2 = load float, float* %arrayidx2.1, align 4
32 %arrayidx2.2 = getelementptr inbounds float, float* %c, i64 2
33 %c3 = load float, float* %arrayidx2.2, align 4
34 %arrayidx2.3 = getelementptr inbounds float, float* %c, i64 3
35 %c4 = load float, float* %arrayidx2.3, align 4
37 %a1 = fadd float %b1, %c1
38 %a2 = fadd float %b2, %c2
39 %a3 = fadd float %b3, %c3
40 %a4 = fadd float %b4, %c4
42 ; Check that we don't lose !nontemporal hint when vectorizing stores.
43 store float %a1, float* %a, align 4, !nontemporal !0
44 %arrayidx3.1 = getelementptr inbounds float, float* %a, i64 1
45 store float %a2, float* %arrayidx3.1, align 4, !nontemporal !0
46 %arrayidx3.2 = getelementptr inbounds float, float* %a, i64 2
47 store float %a3, float* %arrayidx3.2, align 4, !nontemporal !0
48 %arrayidx3.3 = getelementptr inbounds float, float* %a, i64 3
49 store float %a4, float* %arrayidx3.3, align 4, !nontemporal !0
54 define void @foo2(float* noalias %a, float* noalias %b) {
57 ; CHECK-NEXT: [[TMP0:%.*]] = bitcast float* [[B:%.*]] to <4 x float>*
58 ; CHECK-NEXT: [[TMP1:%.*]] = load <4 x float>, <4 x float>* [[TMP0]], align 4
59 ; CHECK-NEXT: [[TMP2:%.*]] = bitcast float* [[A:%.*]] to <4 x float>*
60 ; CHECK-NEXT: store <4 x float> [[TMP1]], <4 x float>* [[TMP2]], align 4
61 ; CHECK-NEXT: ret void
64 ; Check that we don't mark vector load with !nontemporal attribute if some of
65 ; the original scalar loads don't have it.
66 %b1 = load float, float* %b, align 4, !nontemporal !0
67 %arrayidx.1 = getelementptr inbounds float, float* %b, i64 1
68 %b2 = load float, float* %arrayidx.1, align 4
69 %arrayidx.2 = getelementptr inbounds float, float* %b, i64 2
70 %b3 = load float, float* %arrayidx.2, align 4
71 %arrayidx.3 = getelementptr inbounds float, float* %b, i64 3
72 %b4 = load float, float* %arrayidx.3, align 4, !nontemporal !0
74 ; Check that we don't mark vector store with !nontemporal attribute if some of
75 ; the original scalar stores don't have it.
76 store float %b1, float* %a, align 4, !nontemporal !0
77 %arrayidx3.1 = getelementptr inbounds float, float* %a, i64 1
78 store float %b2, float* %arrayidx3.1, align 4
79 %arrayidx3.2 = getelementptr inbounds float, float* %a, i64 2
80 store float %b3, float* %arrayidx3.2, align 4
81 %arrayidx3.3 = getelementptr inbounds float, float* %a, i64 3
82 store float %b4, float* %arrayidx3.3, align 4, !nontemporal !0