1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
3; RUN:   -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
4; RUN:   FileCheck %s --check-prefix=LE-PAIRED
5; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
6; RUN:   -mcpu=pwr10 -ppc-asm-full-reg-names \
7; RUN:   -ppc-vsr-nums-as-vr < %s | FileCheck %s --check-prefix=BE-PAIRED
8
9@f = common dso_local local_unnamed_addr global <512 x i1> zeroinitializer, align 16
10@g = common dso_local local_unnamed_addr global <256 x i1> zeroinitializer, align 16
11
12define dso_local void @testLdSt(i64 %SrcIdx, i64 %DstIdx) {
13; LE-PAIRED-LABEL: testLdSt:
14; LE-PAIRED:       # %bb.0: # %entry
15; LE-PAIRED-NEXT:    plxv vs1, f@PCREL+96(0), 1
16; LE-PAIRED-NEXT:    plxv vs0, f@PCREL+112(0), 1
17; LE-PAIRED-NEXT:    plxv vs3, f@PCREL+64(0), 1
18; LE-PAIRED-NEXT:    plxv vs2, f@PCREL+80(0), 1
19; LE-PAIRED-NEXT:    pstxv vs0, f@PCREL+176(0), 1
20; LE-PAIRED-NEXT:    pstxv vs1, f@PCREL+160(0), 1
21; LE-PAIRED-NEXT:    pstxv vs2, f@PCREL+144(0), 1
22; LE-PAIRED-NEXT:    pstxv vs3, f@PCREL+128(0), 1
23; LE-PAIRED-NEXT:    blr
24;
25; BE-PAIRED-LABEL: testLdSt:
26; BE-PAIRED:       # %bb.0: # %entry
27; BE-PAIRED-NEXT:    addis r3, r2, f@toc@ha
28; BE-PAIRED-NEXT:    addi r3, r3, f@toc@l
29; BE-PAIRED-NEXT:    lxv vs1, 80(r3)
30; BE-PAIRED-NEXT:    lxv vs0, 64(r3)
31; BE-PAIRED-NEXT:    lxv vs3, 112(r3)
32; BE-PAIRED-NEXT:    lxv vs2, 96(r3)
33; BE-PAIRED-NEXT:    stxv vs1, 144(r3)
34; BE-PAIRED-NEXT:    stxv vs0, 128(r3)
35; BE-PAIRED-NEXT:    stxv vs3, 176(r3)
36; BE-PAIRED-NEXT:    stxv vs2, 160(r3)
37; BE-PAIRED-NEXT:    blr
38entry:
39  %arrayidx = getelementptr inbounds <512 x i1>, <512 x i1>* @f, i64 1
40  %0 = load <512 x i1>, <512 x i1>* %arrayidx, align 64
41  %arrayidx1 = getelementptr inbounds <512 x i1>, <512 x i1>* @f, i64 2
42  store <512 x i1> %0, <512 x i1>* %arrayidx1, align 64
43  ret void
44}
45
46define dso_local void @testXLdSt(i64 %SrcIdx, i64 %DstIdx) {
47; LE-PAIRED-LABEL: testXLdSt:
48; LE-PAIRED:       # %bb.0: # %entry
49; LE-PAIRED-NEXT:    sldi r3, r3, 6
50; LE-PAIRED-NEXT:    paddi r5, 0, f@PCREL, 1
51; LE-PAIRED-NEXT:    add r6, r5, r3
52; LE-PAIRED-NEXT:    lxv vs1, 32(r6)
53; LE-PAIRED-NEXT:    lxv vs0, 48(r6)
54; LE-PAIRED-NEXT:    lxvx vs3, r5, r3
55; LE-PAIRED-NEXT:    lxv vs2, 16(r6)
56; LE-PAIRED-NEXT:    sldi r3, r4, 6
57; LE-PAIRED-NEXT:    stxvx vs3, r5, r3
58; LE-PAIRED-NEXT:    add r3, r5, r3
59; LE-PAIRED-NEXT:    stxv vs0, 48(r3)
60; LE-PAIRED-NEXT:    stxv vs1, 32(r3)
61; LE-PAIRED-NEXT:    stxv vs2, 16(r3)
62; LE-PAIRED-NEXT:    blr
63;
64; BE-PAIRED-LABEL: testXLdSt:
65; BE-PAIRED:       # %bb.0: # %entry
66; BE-PAIRED-NEXT:    addis r5, r2, f@toc@ha
67; BE-PAIRED-NEXT:    sldi r3, r3, 6
68; BE-PAIRED-NEXT:    addi r5, r5, f@toc@l
69; BE-PAIRED-NEXT:    add r6, r5, r3
70; BE-PAIRED-NEXT:    lxvx vs0, r5, r3
71; BE-PAIRED-NEXT:    sldi r3, r4, 6
72; BE-PAIRED-NEXT:    lxv vs1, 16(r6)
73; BE-PAIRED-NEXT:    lxv vs3, 48(r6)
74; BE-PAIRED-NEXT:    lxv vs2, 32(r6)
75; BE-PAIRED-NEXT:    stxvx vs0, r5, r3
76; BE-PAIRED-NEXT:    add r3, r5, r3
77; BE-PAIRED-NEXT:    stxv vs1, 16(r3)
78; BE-PAIRED-NEXT:    stxv vs3, 48(r3)
79; BE-PAIRED-NEXT:    stxv vs2, 32(r3)
80; BE-PAIRED-NEXT:    blr
81entry:
82  %arrayidx = getelementptr inbounds <512 x i1>, <512 x i1>* @f, i64 %SrcIdx
83  %0 = load <512 x i1>, <512 x i1>* %arrayidx, align 64
84  %arrayidx1 = getelementptr inbounds <512 x i1>, <512 x i1>* @f, i64 %DstIdx
85  store <512 x i1> %0, <512 x i1>* %arrayidx1, align 64
86  ret void
87}
88
89define dso_local void @testUnalignedLdSt() {
90; LE-PAIRED-LABEL: testUnalignedLdSt:
91; LE-PAIRED:       # %bb.0: # %entry
92; LE-PAIRED-NEXT:    plxv vs1, f@PCREL+43(0), 1
93; LE-PAIRED-NEXT:    plxv vs0, f@PCREL+59(0), 1
94; LE-PAIRED-NEXT:    plxv vs3, f@PCREL+11(0), 1
95; LE-PAIRED-NEXT:    plxv vs2, f@PCREL+27(0), 1
96; LE-PAIRED-NEXT:    pstxv vs0, f@PCREL+67(0), 1
97; LE-PAIRED-NEXT:    pstxv vs1, f@PCREL+51(0), 1
98; LE-PAIRED-NEXT:    pstxv vs2, f@PCREL+35(0), 1
99; LE-PAIRED-NEXT:    pstxv vs3, f@PCREL+19(0), 1
100; LE-PAIRED-NEXT:    blr
101;
102; BE-PAIRED-LABEL: testUnalignedLdSt:
103; BE-PAIRED:       # %bb.0: # %entry
104; BE-PAIRED-NEXT:    addis r3, r2, f@toc@ha
105; BE-PAIRED-NEXT:    li r4, 11
106; BE-PAIRED-NEXT:    addi r3, r3, f@toc@l
107; BE-PAIRED-NEXT:    lxvx vs0, r3, r4
108; BE-PAIRED-NEXT:    li r4, 27
109; BE-PAIRED-NEXT:    lxvx vs1, r3, r4
110; BE-PAIRED-NEXT:    li r4, 43
111; BE-PAIRED-NEXT:    lxvx vs2, r3, r4
112; BE-PAIRED-NEXT:    li r4, 59
113; BE-PAIRED-NEXT:    lxvx vs3, r3, r4
114; BE-PAIRED-NEXT:    li r4, 35
115; BE-PAIRED-NEXT:    stxvx vs1, r3, r4
116; BE-PAIRED-NEXT:    li r4, 19
117; BE-PAIRED-NEXT:    stxvx vs0, r3, r4
118; BE-PAIRED-NEXT:    li r4, 67
119; BE-PAIRED-NEXT:    stxvx vs3, r3, r4
120; BE-PAIRED-NEXT:    li r4, 51
121; BE-PAIRED-NEXT:    stxvx vs2, r3, r4
122; BE-PAIRED-NEXT:    blr
123entry:
124  %0 = bitcast <512 x i1>* @f to i8*
125  %add.ptr = getelementptr inbounds i8, i8* %0, i64 11
126  %add.ptr1 = getelementptr inbounds i8, i8* %0, i64 19
127  %1 = bitcast i8* %add.ptr to <512 x i1>*
128  %2 = bitcast i8* %add.ptr1 to <512 x i1>*
129  %3 = load <512 x i1>, <512 x i1>* %1, align 64
130  store <512 x i1> %3, <512 x i1>* %2, align 64
131  ret void
132}
133
134define dso_local void @testLdStPair(i64 %SrcIdx, i64 %DstIdx) {
135; LE-PAIRED-LABEL: testLdStPair:
136; LE-PAIRED:       # %bb.0: # %entry
137; LE-PAIRED-NEXT:    plxv v3, g@PCREL+32(0), 1
138; LE-PAIRED-NEXT:    plxv v2, g@PCREL+48(0), 1
139; LE-PAIRED-NEXT:    pstxv v3, g@PCREL+64(0), 1
140; LE-PAIRED-NEXT:    pstxv v2, g@PCREL+80(0), 1
141; LE-PAIRED-NEXT:    blr
142;
143; BE-PAIRED-LABEL: testLdStPair:
144; BE-PAIRED:       # %bb.0: # %entry
145; BE-PAIRED-NEXT:    addis r3, r2, g@toc@ha
146; BE-PAIRED-NEXT:    addi r3, r3, g@toc@l
147; BE-PAIRED-NEXT:    lxv v3, 48(r3)
148; BE-PAIRED-NEXT:    lxv v2, 32(r3)
149; BE-PAIRED-NEXT:    stxv v3, 80(r3)
150; BE-PAIRED-NEXT:    stxv v2, 64(r3)
151; BE-PAIRED-NEXT:    blr
152entry:
153  %arrayidx = getelementptr inbounds <256 x i1>, <256 x i1>* @g, i64 1
154  %0 = load <256 x i1>, <256 x i1>* %arrayidx, align 64
155  %arrayidx1 = getelementptr inbounds <256 x i1>, <256 x i1>* @g, i64 2
156  store <256 x i1> %0, <256 x i1>* %arrayidx1, align 64
157  ret void
158}
159
160define dso_local void @testXLdStPair(i64 %SrcIdx, i64 %DstIdx) {
161; LE-PAIRED-LABEL: testXLdStPair:
162; LE-PAIRED:       # %bb.0: # %entry
163; LE-PAIRED-NEXT:    sldi r3, r3, 5
164; LE-PAIRED-NEXT:    paddi r5, 0, g@PCREL, 1
165; LE-PAIRED-NEXT:    add r6, r5, r3
166; LE-PAIRED-NEXT:    lxvx v3, r5, r3
167; LE-PAIRED-NEXT:    sldi r3, r4, 5
168; LE-PAIRED-NEXT:    lxv v2, 16(r6)
169; LE-PAIRED-NEXT:    add r4, r5, r3
170; LE-PAIRED-NEXT:    stxvx v3, r5, r3
171; LE-PAIRED-NEXT:    stxv v2, 16(r4)
172; LE-PAIRED-NEXT:    blr
173;
174; BE-PAIRED-LABEL: testXLdStPair:
175; BE-PAIRED:       # %bb.0: # %entry
176; BE-PAIRED-NEXT:    addis r5, r2, g@toc@ha
177; BE-PAIRED-NEXT:    sldi r3, r3, 5
178; BE-PAIRED-NEXT:    addi r5, r5, g@toc@l
179; BE-PAIRED-NEXT:    add r6, r5, r3
180; BE-PAIRED-NEXT:    lxvx v2, r5, r3
181; BE-PAIRED-NEXT:    sldi r3, r4, 5
182; BE-PAIRED-NEXT:    lxv v3, 16(r6)
183; BE-PAIRED-NEXT:    add r4, r5, r3
184; BE-PAIRED-NEXT:    stxvx v2, r5, r3
185; BE-PAIRED-NEXT:    stxv v3, 16(r4)
186; BE-PAIRED-NEXT:    blr
187entry:
188  %arrayidx = getelementptr inbounds <256 x i1>, <256 x i1>* @g, i64 %SrcIdx
189  %0 = load <256 x i1>, <256 x i1>* %arrayidx, align 64
190  %arrayidx1 = getelementptr inbounds <256 x i1>, <256 x i1>* @g, i64 %DstIdx
191  store <256 x i1> %0, <256 x i1>* %arrayidx1, align 64
192  ret void
193}
194
195define dso_local void @testUnalignedLdStPair() {
196; LE-PAIRED-LABEL: testUnalignedLdStPair:
197; LE-PAIRED:       # %bb.0: # %entry
198; LE-PAIRED-NEXT:    plxv v3, g@PCREL+11(0), 1
199; LE-PAIRED-NEXT:    plxv v2, g@PCREL+27(0), 1
200; LE-PAIRED-NEXT:    pstxv v3, g@PCREL+19(0), 1
201; LE-PAIRED-NEXT:    pstxv v2, g@PCREL+35(0), 1
202; LE-PAIRED-NEXT:    blr
203;
204; BE-PAIRED-LABEL: testUnalignedLdStPair:
205; BE-PAIRED:       # %bb.0: # %entry
206; BE-PAIRED-NEXT:    addis r3, r2, g@toc@ha
207; BE-PAIRED-NEXT:    li r4, 11
208; BE-PAIRED-NEXT:    addi r3, r3, g@toc@l
209; BE-PAIRED-NEXT:    lxvx v2, r3, r4
210; BE-PAIRED-NEXT:    li r4, 27
211; BE-PAIRED-NEXT:    lxvx v3, r3, r4
212; BE-PAIRED-NEXT:    li r4, 35
213; BE-PAIRED-NEXT:    stxvx v3, r3, r4
214; BE-PAIRED-NEXT:    li r4, 19
215; BE-PAIRED-NEXT:    stxvx v2, r3, r4
216; BE-PAIRED-NEXT:    blr
217entry:
218  %0 = bitcast <256 x i1>* @g to i8*
219  %add.ptr = getelementptr inbounds i8, i8* %0, i64 11
220  %add.ptr1 = getelementptr inbounds i8, i8* %0, i64 19
221  %1 = bitcast i8* %add.ptr to <256 x i1>*
222  %2 = bitcast i8* %add.ptr1 to <256 x i1>*
223  %3 = load <256 x i1>, <256 x i1>* %1, align 64
224  store <256 x i1> %3, <256 x i1>* %2, align 64
225  ret void
226}
227