Skip to content

Commit 28f15d5

Browse files
committed
add support and test for v2i64
1 parent 819e8ee commit 28f15d5

File tree

2 files changed

+85
-30
lines changed

2 files changed

+85
-30
lines changed

llvm/lib/Target/PowerPC/PPCInstrFuture.td

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,22 @@ let Predicates = [HasVSX, IsISAFuture] in {
8383
}
8484
}
8585

86-
// Load VSX Vector with Right Length Left-justified.
87-
def : Pat<(v4i32 (int_ppc_vsx_lxvrl addr:$RA, i64:$RB)), (LXVRL $RA, $RB)>;
88-
def : Pat<(v4i32 (int_ppc_vsx_lxvrll addr:$RA, i64:$RB)), (LXVRLL $RA, $RB)>;
89-
def : Pat<(v256i1 (int_ppc_vsx_lxvprl addr:$RA, i64:$RB)), (LXVPRL $RA, $RB)>;
90-
def : Pat<(v256i1 (int_ppc_vsx_lxvprll addr:$RA, i64:$RB)), (LXVPRLL $RA, $RB)>;
86+
// Load/Store VSX Vector with Right Length Left-justified.
87+
// foreach Ty = [v4i32, v2i64, v128i1] in {
88+
foreach Ty = [v4i32, v2i64] in {
89+
def : Pat<(Ty (int_ppc_vsx_lxvrl addr:$RA, i64:$RB)),
90+
(LXVRL memr:$RA, g8rc:$RB)>;
91+
def : Pat<(Ty (int_ppc_vsx_lxvrll addr:$RA, i64:$RB)),
92+
(LXVRLL $RA, $RB)>;
93+
def : Pat<(int_ppc_vsx_stxvrl Ty:$XT, addr:$RA, i64:$RB),
94+
(STXVRL $XT, $RA, $RB)>;
95+
def : Pat<(int_ppc_vsx_stxvrll Ty:$XT, addr:$RA, i64:$RB),
96+
(STXVRLL $XT, $RA, $RB)>;
97+
}
9198

92-
// Store VSX Vector with Right Length Left-justified.
93-
def : Pat<(int_ppc_vsx_stxvrl v4i32:$XT, addr:$RA, i64:$RB),
94-
(STXVRL $XT, $RA, $RB)>;
95-
def : Pat<(int_ppc_vsx_stxvrll v4i32:$XT, addr:$RA, i64:$RB),
96-
(STXVRLL $XT, $RA, $RB)>;
99+
// Load/Store VSX Vector pair with Right Length Left-justified.
100+
def : Pat<(v256i1(int_ppc_vsx_lxvprl addr:$RA, i64:$RB)), (LXVPRL $RA, $RB)>;
101+
def : Pat<(v256i1(int_ppc_vsx_lxvprll addr:$RA, i64:$RB)), (LXVPRLL $RA, $RB)>;
97102
def : Pat<(int_ppc_vsx_stxvprl v256i1:$XTp, addr:$RA, i64:$RB),
98103
(STXVPRL $XTp, $RA, $RB)>;
99104
def : Pat<(int_ppc_vsx_stxvprll v256i1:$XTp, addr:$RA, i64:$RB),

llvm/test/CodeGen/PowerPC/vsx-ldst-with-length.ll

Lines changed: 70 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
; RUN: -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr -mcpu=future < %s | \
66
; RUN: FileCheck %s
77

8+
; Test for load/store to/from v4i32.
9+
810
define <4 x i32> @testLXVRL(ptr %a, i64 %b) {
911
; CHECK-LABEL: testLXVRL:
1012
; CHECK: # %bb.0: # %entry
@@ -27,49 +29,97 @@ entry:
2729
}
2830
declare <4 x i32> @llvm.ppc.vsx.lxvrll(ptr, i64)
2931

30-
define <256 x i1> @testLXVPRL(ptr %vpp, i64 %b) {
31-
; CHECK-LABEL: testLXVPRL:
32+
define void @testSTXVRL(<4 x i32> %a, ptr %b, i64 %c) {
33+
; CHECK-LABEL: testSTXVRL:
3234
; CHECK: # %bb.0: # %entry
33-
; CHECK-NEXT: lxvprl vsp34, r4, r5
35+
; CHECK-NEXT: stxvrl v2, [[REG:r[0-9]+]], [[REG1:r[0-9]+]]
3436
; CHECK: blr
3537
entry:
36-
%0 = tail call <256 x i1> @llvm.ppc.vsx.lxvprl(ptr %vpp, i64 %b)
37-
ret <256 x i1> %0
38+
tail call void @llvm.ppc.vsx.stxvrl(<4 x i32> %a, ptr %b, i64 %c)
39+
ret void
3840
}
39-
declare <256 x i1> @llvm.ppc.vsx.lxvprl(ptr, i64)
41+
declare void @llvm.ppc.vsx.stxvrl(<4 x i32>, ptr, i64)
4042

41-
define <256 x i1> @testLXVPRLL(ptr %vpp, i64 %b) {
42-
; CHECK-LABEL: testLXVPRLL:
43+
define void @testSTXVRLL(<4 x i32> %a, ptr %b, i64 %c) {
44+
; CHECK-LABEL: testSTXVRLL:
4345
; CHECK: # %bb.0: # %entry
44-
; CHECK-NEXT: lxvprll vsp34, r4, r5
46+
; CHECK-NEXT: stxvrll v2, [[REG:r[0-9]+]], [[REG1:r[0-9]+]]
4547
; CHECK: blr
4648
entry:
47-
%0 = tail call <256 x i1> @llvm.ppc.vsx.lxvprll(ptr %vpp, i64 %b)
48-
ret <256 x i1> %0
49+
tail call void @llvm.ppc.vsx.stxvrll(<4 x i32> %a, ptr %b, i64 %c)
50+
ret void
4951
}
50-
declare <256 x i1> @llvm.ppc.vsx.lxvprll(ptr, i64)
52+
declare void @llvm.ppc.vsx.stxvrll(<4 x i32>, ptr, i64)
5153

52-
define void @testSTXVRL(<4 x i32> %a, ptr %b, i64 %c) {
53-
; CHECK-LABEL: testSTXVRL:
54+
; Test for load/store to/from v2i64.
55+
56+
define <2 x i64> @testLXVRL2(ptr %a, i64 %b) {
57+
; CHECK-LABEL: testLXVRL2:
58+
; CHECK: # %bb.0: # %entry
59+
; CHECK-NEXT: lxvrl v2, r3, r4
60+
; CHECK-NEXT: blr
61+
entry:
62+
%0 = tail call <2 x i64> @llvm.ppc.vsx.lxvrl.v2i64(ptr %a, i64 %b)
63+
ret <2 x i64> %0
64+
}
65+
declare <2 x i64> @llvm.ppc.vsx.lxvrl.v2i64(ptr, i64)
66+
67+
define <2 x i64> @testLXVRLL2(ptr %a, i64 %b) {
68+
; CHECK-LABEL: testLXVRLL2:
69+
; CHECK: # %bb.0: # %entry
70+
; CHECK-NEXT: lxvrll v2, r3, r4
71+
; CHECK-NEXT: blr
72+
entry:
73+
%0 = tail call <2 x i64> @llvm.ppc.vsx.lxvrll.v2i64(ptr %a, i64 %b)
74+
ret <2 x i64> %0
75+
}
76+
declare <2 x i64> @llvm.ppc.vsx.lxvrll.v2i64(ptr, i64)
77+
78+
define void @testSTXVRL2(<2 x i64> %a, ptr %b, i64 %c) {
79+
; CHECK-LABEL: testSTXVRL2:
5480
; CHECK: # %bb.0: # %entry
5581
; CHECK-NEXT: stxvrl v2, [[REG:r[0-9]+]], [[REG1:r[0-9]+]]
5682
; CHECK: blr
5783
entry:
58-
tail call void @llvm.ppc.vsx.stxvrl(<4 x i32> %a, ptr %b, i64 %c)
84+
tail call void @llvm.ppc.vsx.stxvrl.v2i64(<2 x i64> %a, ptr %b, i64 %c)
5985
ret void
6086
}
61-
declare void @llvm.ppc.vsx.stxvrl(<4 x i32>, ptr, i64)
87+
declare void @llvm.ppc.vsx.stxvrl.v2i64(<2 x i64>, ptr, i64)
6288

63-
define void @testSTXVRLL(<4 x i32> %a, ptr %b, i64 %c) {
64-
; CHECK-LABEL: testSTXVRLL:
89+
define void @testSTXVRLL2(<2 x i64> %a, ptr %b, i64 %c) {
90+
; CHECK-LABEL: testSTXVRLL2:
6591
; CHECK: # %bb.0: # %entry
6692
; CHECK-NEXT: stxvrll v2, [[REG:r[0-9]+]], [[REG1:r[0-9]+]]
6793
; CHECK: blr
6894
entry:
69-
tail call void @llvm.ppc.vsx.stxvrll(<4 x i32> %a, ptr %b, i64 %c)
95+
tail call void @llvm.ppc.vsx.stxvrll.v2i64(<2 x i64> %a, ptr %b, i64 %c)
7096
ret void
7197
}
72-
declare void @llvm.ppc.vsx.stxvrll(<4 x i32>, ptr, i64)
98+
declare void @llvm.ppc.vsx.stxvrll.v2i64(<2 x i64>, ptr, i64)
99+
100+
; Test for load/store vectore pair.
101+
102+
define <256 x i1> @testLXVPRL(ptr %vpp, i64 %b) {
103+
; CHECK-LABEL: testLXVPRL:
104+
; CHECK: # %bb.0: # %entry
105+
; CHECK-NEXT: lxvprl vsp34, r4, r5
106+
; CHECK: blr
107+
entry:
108+
%0 = tail call <256 x i1> @llvm.ppc.vsx.lxvprl(ptr %vpp, i64 %b)
109+
ret <256 x i1> %0
110+
}
111+
declare <256 x i1> @llvm.ppc.vsx.lxvprl(ptr, i64)
112+
113+
define <256 x i1> @testLXVPRLL(ptr %vpp, i64 %b) {
114+
; CHECK-LABEL: testLXVPRLL:
115+
; CHECK: # %bb.0: # %entry
116+
; CHECK-NEXT: lxvprll vsp34, r4, r5
117+
; CHECK: blr
118+
entry:
119+
%0 = tail call <256 x i1> @llvm.ppc.vsx.lxvprll(ptr %vpp, i64 %b)
120+
ret <256 x i1> %0
121+
}
122+
declare <256 x i1> @llvm.ppc.vsx.lxvprll(ptr, i64)
73123

74124
define void @testSTXVPRL(ptr %v, ptr %vp, i64 %len) {
75125
; CHECK-LABEL: testSTXVPRL:

0 commit comments

Comments
 (0)