mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[PowerPC] Implement Vector Blend Builtins in LLVM/Clang
Implements vec_blendv() Differential Revision: https://reviews.llvm.org/D82774
This commit is contained in:
parent
d13ebe32f6
commit
d6caac3195
@ -1024,6 +1024,19 @@ def int_ppc_vsx_xxpermx :
|
||||
Intrinsic<[llvm_v16i8_ty],
|
||||
[llvm_v16i8_ty,llvm_v16i8_ty,llvm_v16i8_ty,llvm_i32_ty],
|
||||
[IntrNoMem, ImmArg<ArgIndex<3>>]>;
|
||||
// P10 VSX Vector Blend Variable.
|
||||
def int_ppc_vsx_xxblendvb: GCCBuiltin<"__builtin_vsx_xxblendvb">,
|
||||
Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty],
|
||||
[IntrNoMem]>;
|
||||
def int_ppc_vsx_xxblendvh: GCCBuiltin<"__builtin_vsx_xxblendvh">,
|
||||
Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty,llvm_v8i16_ty],
|
||||
[IntrNoMem]>;
|
||||
def int_ppc_vsx_xxblendvw: GCCBuiltin<"__builtin_vsx_xxblendvw">,
|
||||
Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
|
||||
[IntrNoMem]>;
|
||||
def int_ppc_vsx_xxblendvd: GCCBuiltin<"__builtin_vsx_xxblendvd">,
|
||||
Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty],
|
||||
[IntrNoMem]>;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -891,5 +891,19 @@ let Predicates = [PrefixInstrs] in {
|
||||
(COPY_TO_REGCLASS (XXPERMX (COPY_TO_REGCLASS $A, VSRC),
|
||||
(COPY_TO_REGCLASS $B, VSRC),
|
||||
(COPY_TO_REGCLASS $C, VSRC), $D), VSRC)>;
|
||||
def : Pat<(v16i8 (int_ppc_vsx_xxblendvb v16i8:$A, v16i8:$B, v16i8:$C)),
|
||||
(COPY_TO_REGCLASS
|
||||
(XXBLENDVB (COPY_TO_REGCLASS $A, VSRC),
|
||||
(COPY_TO_REGCLASS $B, VSRC),
|
||||
(COPY_TO_REGCLASS $C, VSRC)), VSRC)>;
|
||||
def : Pat<(v8i16 (int_ppc_vsx_xxblendvh v8i16:$A, v8i16:$B, v8i16:$C)),
|
||||
(COPY_TO_REGCLASS
|
||||
(XXBLENDVH (COPY_TO_REGCLASS $A, VSRC),
|
||||
(COPY_TO_REGCLASS $B, VSRC),
|
||||
(COPY_TO_REGCLASS $C, VSRC)), VSRC)>;
|
||||
def : Pat<(int_ppc_vsx_xxblendvw v4i32:$A, v4i32:$B, v4i32:$C),
|
||||
(XXBLENDVW $A, $B, $C)>;
|
||||
def : Pat<(int_ppc_vsx_xxblendvd v2i64:$A, v2i64:$B, v2i64:$C),
|
||||
(XXBLENDVD $A, $B, $C)>;
|
||||
}
|
||||
|
||||
|
@ -37,3 +37,47 @@ entry:
|
||||
ret <16 x i8> %0
|
||||
}
|
||||
declare <16 x i8> @llvm.ppc.vsx.xxpermx(<16 x i8>, <16 x i8>, <16 x i8>, i32 immarg)
|
||||
|
||||
define <16 x i8> @testXXBLENDVB(<16 x i8> %a, <16 x i8> %b, <16 x i8> %c) {
|
||||
; CHECK-LABEL: testXXBLENDVB:
|
||||
; CHECK: # %bb.0: # %entry
|
||||
; CHECK-NEXT: xxblendvb v2, v2, v3, v4
|
||||
; CHECK-NEXT: blr
|
||||
entry:
|
||||
%0 = tail call <16 x i8> @llvm.ppc.vsx.xxblendvb(<16 x i8> %a, <16 x i8> %b, <16 x i8> %c)
|
||||
ret <16 x i8> %0
|
||||
}
|
||||
declare <16 x i8> @llvm.ppc.vsx.xxblendvb(<16 x i8>, <16 x i8>, <16 x i8>)
|
||||
|
||||
define <8 x i16> @testXXBLENDVH(<8 x i16> %a, <8 x i16> %b, <8 x i16> %c) {
|
||||
; CHECK-LABEL: testXXBLENDVH:
|
||||
; CHECK: # %bb.0: # %entry
|
||||
; CHECK-NEXT: xxblendvh v2, v2, v3, v4
|
||||
; CHECK-NEXT: blr
|
||||
entry:
|
||||
%0 = tail call <8 x i16> @llvm.ppc.vsx.xxblendvh(<8 x i16> %a, <8 x i16> %b, <8 x i16> %c)
|
||||
ret <8 x i16> %0
|
||||
}
|
||||
declare <8 x i16> @llvm.ppc.vsx.xxblendvh(<8 x i16>, <8 x i16>, <8 x i16>)
|
||||
|
||||
define <4 x i32> @testXXBLENDVW(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c) {
|
||||
; CHECK-LABEL: testXXBLENDVW:
|
||||
; CHECK: # %bb.0: # %entry
|
||||
; CHECK-NEXT: xxblendvw v2, v2, v3, v4
|
||||
; CHECK-NEXT: blr
|
||||
entry:
|
||||
%0 = tail call <4 x i32> @llvm.ppc.vsx.xxblendvw(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c)
|
||||
ret <4 x i32> %0
|
||||
}
|
||||
declare <4 x i32> @llvm.ppc.vsx.xxblendvw(<4 x i32>, <4 x i32>, <4 x i32>)
|
||||
|
||||
define <2 x i64> @testXXBLENDVD(<2 x i64> %a, <2 x i64> %b, <2 x i64> %c) {
|
||||
; CHECK-LABEL: testXXBLENDVD:
|
||||
; CHECK: # %bb.0: # %entry
|
||||
; CHECK-NEXT: xxblendvd v2, v2, v3, v4
|
||||
; CHECK-NEXT: blr
|
||||
entry:
|
||||
%0 = tail call <2 x i64> @llvm.ppc.vsx.xxblendvd(<2 x i64> %a, <2 x i64> %b, <2 x i64> %c)
|
||||
ret <2 x i64> %0
|
||||
}
|
||||
declare <2 x i64> @llvm.ppc.vsx.xxblendvd(<2 x i64>, <2 x i64>, <2 x i64>)
|
||||
|
Loading…
x
Reference in New Issue
Block a user