mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[PowerPC][Power10] Implement VSX PCV Generate Operations in LLVM/Clang
This patch implements builtins for the following prototypes for the VSX Permute Control Vector Generate with Mask Instructions: vector unsigned char vec_genpcvm (vector unsigned char, const int); vector unsigned short vec_genpcvm (vector unsigned short, const int); vector unsigned int vec_genpcvm (vector unsigned int, const int); vector unsigned long long vec_genpcvm (vector unsigned long long, const int); Differential Revision: https://reviews.llvm.org/D81774
This commit is contained in:
parent
d6c0ccc19e
commit
999d7986df
@ -953,6 +953,18 @@ def int_ppc_vsx_xxinsertw :
|
|||||||
PowerPC_VSX_Intrinsic<"xxinsertw",[llvm_v4i32_ty],
|
PowerPC_VSX_Intrinsic<"xxinsertw",[llvm_v4i32_ty],
|
||||||
[llvm_v4i32_ty,llvm_v2i64_ty,llvm_i32_ty],
|
[llvm_v4i32_ty,llvm_v2i64_ty,llvm_i32_ty],
|
||||||
[IntrNoMem]>;
|
[IntrNoMem]>;
|
||||||
|
def int_ppc_vsx_xxgenpcvbm :
|
||||||
|
PowerPC_VSX_Intrinsic<"xxgenpcvbm", [llvm_v16i8_ty],
|
||||||
|
[llvm_v16i8_ty, llvm_i32_ty], [IntrNoMem]>;
|
||||||
|
def int_ppc_vsx_xxgenpcvhm :
|
||||||
|
PowerPC_VSX_Intrinsic<"xxgenpcvhm", [llvm_v8i16_ty],
|
||||||
|
[llvm_v8i16_ty, llvm_i32_ty], [IntrNoMem]>;
|
||||||
|
def int_ppc_vsx_xxgenpcvwm :
|
||||||
|
PowerPC_VSX_Intrinsic<"xxgenpcvwm", [llvm_v4i32_ty],
|
||||||
|
[llvm_v4i32_ty, llvm_i32_ty], [IntrNoMem]>;
|
||||||
|
def int_ppc_vsx_xxgenpcvdm :
|
||||||
|
PowerPC_VSX_Intrinsic<"xxgenpcvdm", [llvm_v2i64_ty],
|
||||||
|
[llvm_v2i64_ty, llvm_i32_ty], [IntrNoMem]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -161,6 +161,22 @@ class 8LS_DForm_R_SI34_XT6_RA5<bits<5> opcode, dag OOL, dag IOL, string asmstr,
|
|||||||
let Inst{48-63} = D_RA{15-0}; // d1
|
let Inst{48-63} = D_RA{15-0}; // d1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// X-Form: [PO T IMM VRB XO TX]
|
||||||
|
class XForm_XT6_IMM5_VB5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
|
||||||
|
string asmstr, InstrItinClass itin, list<dag> pattern>
|
||||||
|
: I<opcode, OOL, IOL, asmstr, itin> {
|
||||||
|
bits<6> XT;
|
||||||
|
bits<5> VRB;
|
||||||
|
bits<5> IMM;
|
||||||
|
|
||||||
|
let Pattern = pattern;
|
||||||
|
let Inst{6-10} = XT{4-0};
|
||||||
|
let Inst{11-15} = IMM;
|
||||||
|
let Inst{16-20} = VRB;
|
||||||
|
let Inst{21-30} = xo;
|
||||||
|
let Inst{31} = XT{5};
|
||||||
|
}
|
||||||
|
|
||||||
multiclass MLS_DForm_R_SI34_RTA5_MEM_p<bits<6> opcode, dag OOL, dag IOL,
|
multiclass MLS_DForm_R_SI34_RTA5_MEM_p<bits<6> opcode, dag OOL, dag IOL,
|
||||||
dag PCRel_IOL, string asmstr,
|
dag PCRel_IOL, string asmstr,
|
||||||
InstrItinClass itin> {
|
InstrItinClass itin> {
|
||||||
@ -516,6 +532,18 @@ let Predicates = [IsISA3_1] in {
|
|||||||
def PEXTD : XForm_6<31, 188, (outs g8rc:$rA), (ins g8rc:$rS, g8rc:$rB),
|
def PEXTD : XForm_6<31, 188, (outs g8rc:$rA), (ins g8rc:$rS, g8rc:$rB),
|
||||||
"pextd $rA, $rS, $rB", IIC_IntGeneral,
|
"pextd $rA, $rS, $rB", IIC_IntGeneral,
|
||||||
[(set i64:$rA, (int_ppc_pextd i64:$rS, i64:$rB))]>;
|
[(set i64:$rA, (int_ppc_pextd i64:$rS, i64:$rB))]>;
|
||||||
|
def XXGENPCVBM :
|
||||||
|
XForm_XT6_IMM5_VB5<60, 916, (outs vsrc:$XT), (ins vrrc:$VRB, s5imm:$IMM),
|
||||||
|
"xxgenpcvbm $XT, $VRB, $IMM", IIC_VecGeneral, []>;
|
||||||
|
def XXGENPCVHM :
|
||||||
|
XForm_XT6_IMM5_VB5<60, 917, (outs vsrc:$XT), (ins vrrc:$VRB, s5imm:$IMM),
|
||||||
|
"xxgenpcvhm $XT, $VRB, $IMM", IIC_VecGeneral, []>;
|
||||||
|
def XXGENPCVWM :
|
||||||
|
XForm_XT6_IMM5_VB5<60, 948, (outs vsrc:$XT), (ins vrrc:$VRB, s5imm:$IMM),
|
||||||
|
"xxgenpcvwm $XT, $VRB, $IMM", IIC_VecGeneral, []>;
|
||||||
|
def XXGENPCVDM :
|
||||||
|
XForm_XT6_IMM5_VB5<60, 949, (outs vsrc:$XT), (ins vrrc:$VRB, s5imm:$IMM),
|
||||||
|
"xxgenpcvdm $XT, $VRB, $IMM", IIC_VecGeneral, []>;
|
||||||
def VCLRLB : VXForm_1<397, (outs vrrc:$vD), (ins vrrc:$vA, gprc:$rB),
|
def VCLRLB : VXForm_1<397, (outs vrrc:$vD), (ins vrrc:$vA, gprc:$rB),
|
||||||
"vclrlb $vD, $vA, $rB", IIC_VecGeneral,
|
"vclrlb $vD, $vA, $rB", IIC_VecGeneral,
|
||||||
[(set v16i8:$vD,
|
[(set v16i8:$vD,
|
||||||
@ -525,3 +553,15 @@ let Predicates = [IsISA3_1] in {
|
|||||||
[(set v16i8:$vD,
|
[(set v16i8:$vD,
|
||||||
(int_ppc_altivec_vclrrb v16i8:$vA, i32:$rB))]>;
|
(int_ppc_altivec_vclrrb v16i8:$vA, i32:$rB))]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------- Anonymous Patterns ----------------------------//
|
||||||
|
let Predicates = [IsISA3_1] in {
|
||||||
|
def : Pat<(v16i8 (int_ppc_vsx_xxgenpcvbm v16i8:$VRB, imm:$IMM)),
|
||||||
|
(v16i8 (COPY_TO_REGCLASS (XXGENPCVBM $VRB, imm:$IMM), VRRC))>;
|
||||||
|
def : Pat<(v8i16 (int_ppc_vsx_xxgenpcvhm v8i16:$VRB, imm:$IMM)),
|
||||||
|
(v8i16 (COPY_TO_REGCLASS (XXGENPCVHM $VRB, imm:$IMM), VRRC))>;
|
||||||
|
def : Pat<(v4i32 (int_ppc_vsx_xxgenpcvwm v4i32:$VRB, imm:$IMM)),
|
||||||
|
(v4i32 (COPY_TO_REGCLASS (XXGENPCVWM $VRB, imm:$IMM), VRRC))>;
|
||||||
|
def : Pat<(v2i64 (int_ppc_vsx_xxgenpcvdm v2i64:$VRB, imm:$IMM)),
|
||||||
|
(v2i64 (COPY_TO_REGCLASS (XXGENPCVDM $VRB, imm:$IMM), VRRC))>;
|
||||||
|
}
|
||||||
|
51
test/CodeGen/PowerPC/p10-vsx-pcv.ll
Normal file
51
test/CodeGen/PowerPC/p10-vsx-pcv.ll
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||||
|
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
|
||||||
|
; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
|
||||||
|
; RUN: FileCheck %s
|
||||||
|
|
||||||
|
; These test cases aim to test the VSX PCV Generate Operations on Power10.
|
||||||
|
|
||||||
|
declare <16 x i8> @llvm.ppc.vsx.xxgenpcvbm(<16 x i8>, i32)
|
||||||
|
declare <8 x i16> @llvm.ppc.vsx.xxgenpcvhm(<8 x i16>, i32)
|
||||||
|
declare <4 x i32> @llvm.ppc.vsx.xxgenpcvwm(<4 x i32>, i32)
|
||||||
|
declare <2 x i64> @llvm.ppc.vsx.xxgenpcvdm(<2 x i64>, i32)
|
||||||
|
|
||||||
|
define <16 x i8> @test_xxgenpcvbm(<16 x i8> %a) {
|
||||||
|
; CHECK-LABEL: test_xxgenpcvbm:
|
||||||
|
; CHECK: # %bb.0: # %entry
|
||||||
|
; CHECK-NEXT: xxgenpcvbm v2, v2, 1
|
||||||
|
; CHECK-NEXT: blr
|
||||||
|
entry:
|
||||||
|
%gen = tail call <16 x i8> @llvm.ppc.vsx.xxgenpcvbm(<16 x i8> %a, i32 1)
|
||||||
|
ret <16 x i8> %gen
|
||||||
|
}
|
||||||
|
|
||||||
|
define <8 x i16> @test_xxgenpcvhm(<8 x i16> %a) {
|
||||||
|
; CHECK-LABEL: test_xxgenpcvhm:
|
||||||
|
; CHECK: # %bb.0: # %entry
|
||||||
|
; CHECK-NEXT: xxgenpcvhm v2, v2, 1
|
||||||
|
; CHECK-NEXT: blr
|
||||||
|
entry:
|
||||||
|
%gen = tail call <8 x i16> @llvm.ppc.vsx.xxgenpcvhm(<8 x i16> %a, i32 1)
|
||||||
|
ret <8 x i16> %gen
|
||||||
|
}
|
||||||
|
|
||||||
|
define <4 x i32> @test_xxgenpcvwm(<4 x i32> %a) {
|
||||||
|
; CHECK-LABEL: test_xxgenpcvwm:
|
||||||
|
; CHECK: # %bb.0: # %entry
|
||||||
|
; CHECK-NEXT: xxgenpcvwm v2, v2, 1
|
||||||
|
; CHECK-NEXT: blr
|
||||||
|
entry:
|
||||||
|
%gen = tail call <4 x i32> @llvm.ppc.vsx.xxgenpcvwm(<4 x i32> %a, i32 1)
|
||||||
|
ret <4 x i32> %gen
|
||||||
|
}
|
||||||
|
|
||||||
|
define <2 x i64> @test_xxgenpcvdm(<2 x i64> %a) {
|
||||||
|
; CHECK-LABEL: test_xxgenpcvdm:
|
||||||
|
; CHECK: # %bb.0: # %entry
|
||||||
|
; CHECK-NEXT: xxgenpcvdm v2, v2, 1
|
||||||
|
; CHECK-NEXT: blr
|
||||||
|
entry:
|
||||||
|
%gen = tail call <2 x i64> @llvm.ppc.vsx.xxgenpcvdm(<2 x i64> %a, i32 1)
|
||||||
|
ret <2 x i64> %gen
|
||||||
|
}
|
@ -13,6 +13,18 @@
|
|||||||
# CHECK: pextd 1, 2, 4
|
# CHECK: pextd 1, 2, 4
|
||||||
0x7c 0x41 0x21 0x78
|
0x7c 0x41 0x21 0x78
|
||||||
|
|
||||||
|
# CHECK xxgenpcvbm 0, 1, 2
|
||||||
|
0xf0 0x02 0x0f 0x28
|
||||||
|
|
||||||
|
# CHECK xxgenpcvhm 0, 1, 2
|
||||||
|
0xf0 0x02 0x0f 0x2a
|
||||||
|
|
||||||
|
# CHECK xxgenpcvwm 0, 1, 2
|
||||||
|
0xf0 0x02 0x0f 0x68
|
||||||
|
|
||||||
|
# CHECK xxgenpcvdm 0, 1, 2
|
||||||
|
0xf0 0x02 0x0f 0x6a
|
||||||
|
|
||||||
# CHECK: vclrlb 1, 4, 3
|
# CHECK: vclrlb 1, 4, 3
|
||||||
0x10 0x24 0x19 0x8d
|
0x10 0x24 0x19 0x8d
|
||||||
|
|
||||||
|
@ -15,6 +15,18 @@
|
|||||||
# CHECK-BE: pextd 1, 2, 4 # encoding: [0x7c,0x41,0x21,0x78]
|
# CHECK-BE: pextd 1, 2, 4 # encoding: [0x7c,0x41,0x21,0x78]
|
||||||
# CHECK-LE: pextd 1, 2, 4 # encoding: [0x78,0x21,0x41,0x7c]
|
# CHECK-LE: pextd 1, 2, 4 # encoding: [0x78,0x21,0x41,0x7c]
|
||||||
pextd 1, 2, 4
|
pextd 1, 2, 4
|
||||||
|
# CHECK-BE: xxgenpcvbm 0, 1, 2 # encoding: [0xf0,0x02,0x0f,0x28]
|
||||||
|
# CHECK-LE: xxgenpcvbm 0, 1, 2 # encoding: [0x28,0x0f,0x02,0xf0]
|
||||||
|
xxgenpcvbm 0, 1, 2
|
||||||
|
# CHECK-BE: xxgenpcvhm 0, 1, 2 # encoding: [0xf0,0x02,0x0f,0x2a]
|
||||||
|
# CHECK-LE: xxgenpcvhm 0, 1, 2 # encoding: [0x2a,0x0f,0x02,0xf0]
|
||||||
|
xxgenpcvhm 0, 1, 2
|
||||||
|
# CHECK-BE: xxgenpcvwm 0, 1, 2 # encoding: [0xf0,0x02,0x0f,0x68]
|
||||||
|
# CHECK-LE: xxgenpcvwm 0, 1, 2 # encoding: [0x68,0x0f,0x02,0xf0]
|
||||||
|
xxgenpcvwm 0, 1, 2
|
||||||
|
# CHECK-BE: xxgenpcvdm 0, 1, 2 # encoding: [0xf0,0x02,0x0f,0x6a]
|
||||||
|
# CHECK-LE: xxgenpcvdm 0, 1, 2 # encoding: [0x6a,0x0f,0x02,0xf0]
|
||||||
|
xxgenpcvdm 0, 1, 2
|
||||||
# CHECK-BE: vclrlb 1, 4, 3 # encoding: [0x10,0x24,0x19,0x8d]
|
# CHECK-BE: vclrlb 1, 4, 3 # encoding: [0x10,0x24,0x19,0x8d]
|
||||||
# CHECK-LE: vclrlb 1, 4, 3 # encoding: [0x8d,0x19,0x24,0x10]
|
# CHECK-LE: vclrlb 1, 4, 3 # encoding: [0x8d,0x19,0x24,0x10]
|
||||||
vclrlb 1, 4, 3
|
vclrlb 1, 4, 3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user