Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 790687f

Browse files
committed
[PowerPC] Implement vector shift builtins - llvm portion
This patch corresponds to review https://reviews.llvm.org/D26095. Committing on behalf of Tony Jiang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285681 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 3cf18de commit 790687f

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

include/llvm/IR/IntrinsicsPowerPC.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,8 @@ def int_ppc_altivec_vsl : PowerPC_Vec_WWW_Intrinsic<"vsl">;
622622
def int_ppc_altivec_vslo : PowerPC_Vec_WWW_Intrinsic<"vslo">;
623623

624624
def int_ppc_altivec_vslb : PowerPC_Vec_BBB_Intrinsic<"vslb">;
625+
def int_ppc_altivec_vslv : PowerPC_Vec_BBB_Intrinsic<"vslv">;
626+
def int_ppc_altivec_vsrv : PowerPC_Vec_BBB_Intrinsic<"vsrv">;
625627
def int_ppc_altivec_vslh : PowerPC_Vec_HHH_Intrinsic<"vslh">;
626628
def int_ppc_altivec_vslw : PowerPC_Vec_WWW_Intrinsic<"vslw">;
627629

lib/Target/PowerPC/PPCInstrAltivec.td

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,8 +1342,10 @@ def VRLDNM : VX1_VT5_VA5_VB5<453, "vrldnm", []>;
13421342
def VRLDMI : VX1_VT5_VA5_VB5<197, "vrldmi", []>;
13431343

13441344
// Vector Shift Left/Right
1345-
def VSLV : VX1_VT5_VA5_VB5<1860, "vslv", []>;
1346-
def VSRV : VX1_VT5_VA5_VB5<1796, "vsrv", []>;
1345+
def VSLV : VX1_VT5_VA5_VB5<1860, "vslv",
1346+
[(set v16i8 : $vD, (int_ppc_altivec_vslv v16i8 : $vA, v16i8 : $vB))]>;
1347+
def VSRV : VX1_VT5_VA5_VB5<1796, "vsrv",
1348+
[(set v16i8 : $vD, (int_ppc_altivec_vsrv v16i8 : $vA, v16i8 : $vB))]>;
13471349

13481350
// Vector Multiply-by-10 (& Write Carry) Unsigned Quadword
13491351
def VMUL10UQ : VXForm_BX<513, (outs vrrc:$vD), (ins vrrc:$vA),

test/CodeGen/PowerPC/vsx-p9.ll

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,27 @@ entry:
167167
; Function Attrs: nounwind readnone
168168
declare <2 x double> @llvm.ppc.vsx.xviexpdp(<2 x i64>, <2 x i64>)
169169

170+
define <16 x i8> @testVSLV(<16 x i8> %a, <16 x i8> %b) {
171+
entry:
172+
%0 = tail call <16 x i8> @llvm.ppc.altivec.vslv(<16 x i8> %a, <16 x i8> %b)
173+
ret <16 x i8> %0
174+
; CHECK-LABEL: testVSLV
175+
; CHECK: vslv 2, 2, 3
176+
; CHECK: blr
177+
}
178+
; Function Attrs: nounwind readnone
179+
declare <16 x i8> @llvm.ppc.altivec.vslv(<16 x i8>, <16 x i8>)
180+
181+
; Function Attrs: nounwind readnone
182+
define <16 x i8> @testVSRV(<16 x i8> %a, <16 x i8> %b) {
183+
entry:
184+
%0 = tail call <16 x i8> @llvm.ppc.altivec.vsrv(<16 x i8> %a, <16 x i8> %b)
185+
ret <16 x i8> %0
186+
; CHECK-LABEL: testVSRV
187+
; CHECK: vsrv 2, 2, 3
188+
; CHECK: blr
189+
}
190+
; Function Attrs: nounwind readnone
191+
declare <16 x i8> @llvm.ppc.altivec.vsrv(<16 x i8>, <16 x i8>)
192+
170193
declare void @sink(...)

0 commit comments

Comments
 (0)