mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[PowerPC] Implement the 128-bit vec_[all|any]_[eq | ne | lt | gt | le | ge] builtins in Clang/LLVM
This patch implements the vec_[all|any]_[eq | ne | lt | gt | le | ge] builtins for vector signed/unsigned __int128. Differential Revision: https://reviews.llvm.org/D87910
This commit is contained in:
parent
3a1a7e4141
commit
815921d7d6
@ -370,6 +370,18 @@ let TargetPrefix = "ppc" in { // All intrinsics start with "llvm.ppc.".
|
||||
def int_ppc_altivec_vcmpgtuq : GCCBuiltin<"__builtin_altivec_vcmpgtuq">,
|
||||
Intrinsic<[llvm_v1i128_ty], [llvm_v1i128_ty, llvm_v1i128_ty],
|
||||
[IntrNoMem]>;
|
||||
def int_ppc_altivec_vcmpequq_p : GCCBuiltin<"__builtin_altivec_vcmpequq_p">,
|
||||
Intrinsic<[llvm_i32_ty],
|
||||
[llvm_i32_ty,llvm_v1i128_ty,llvm_v1i128_ty],
|
||||
[IntrNoMem]>;
|
||||
def int_ppc_altivec_vcmpgtsq_p : GCCBuiltin<"__builtin_altivec_vcmpgtsq_p">,
|
||||
Intrinsic<[llvm_i32_ty],
|
||||
[llvm_i32_ty,llvm_v1i128_ty,llvm_v1i128_ty],
|
||||
[IntrNoMem]>;
|
||||
def int_ppc_altivec_vcmpgtuq_p : GCCBuiltin<"__builtin_altivec_vcmpgtuq_p">,
|
||||
Intrinsic<[llvm_i32_ty],
|
||||
[llvm_i32_ty,llvm_v1i128_ty,llvm_v1i128_ty],
|
||||
[IntrNoMem]>;
|
||||
|
||||
// Predicate Comparisons. The first operand specifies interpretation of CR6.
|
||||
def int_ppc_altivec_vcmpbfp_p : GCCBuiltin<"__builtin_altivec_vcmpbfp_p">,
|
||||
|
@ -10358,6 +10358,26 @@ static bool getVectorCompareInfo(SDValue Intrin, int &CompareOpc,
|
||||
else
|
||||
return false;
|
||||
break;
|
||||
case Intrinsic::ppc_altivec_vcmpequq_p:
|
||||
case Intrinsic::ppc_altivec_vcmpgtsq_p:
|
||||
case Intrinsic::ppc_altivec_vcmpgtuq_p:
|
||||
if (!Subtarget.isISA3_1())
|
||||
return false;
|
||||
switch (IntrinsicID) {
|
||||
default:
|
||||
llvm_unreachable("Unknown comparison intrinsic.");
|
||||
case Intrinsic::ppc_altivec_vcmpequq_p:
|
||||
CompareOpc = 455;
|
||||
break;
|
||||
case Intrinsic::ppc_altivec_vcmpgtsq_p:
|
||||
CompareOpc = 903;
|
||||
break;
|
||||
case Intrinsic::ppc_altivec_vcmpgtuq_p:
|
||||
CompareOpc = 647;
|
||||
break;
|
||||
}
|
||||
isDot = true;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -15224,16 +15244,19 @@ void PPCTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
|
||||
case Intrinsic::ppc_altivec_vcmpequh_p:
|
||||
case Intrinsic::ppc_altivec_vcmpequw_p:
|
||||
case Intrinsic::ppc_altivec_vcmpequd_p:
|
||||
case Intrinsic::ppc_altivec_vcmpequq_p:
|
||||
case Intrinsic::ppc_altivec_vcmpgefp_p:
|
||||
case Intrinsic::ppc_altivec_vcmpgtfp_p:
|
||||
case Intrinsic::ppc_altivec_vcmpgtsb_p:
|
||||
case Intrinsic::ppc_altivec_vcmpgtsh_p:
|
||||
case Intrinsic::ppc_altivec_vcmpgtsw_p:
|
||||
case Intrinsic::ppc_altivec_vcmpgtsd_p:
|
||||
case Intrinsic::ppc_altivec_vcmpgtsq_p:
|
||||
case Intrinsic::ppc_altivec_vcmpgtub_p:
|
||||
case Intrinsic::ppc_altivec_vcmpgtuh_p:
|
||||
case Intrinsic::ppc_altivec_vcmpgtuw_p:
|
||||
case Intrinsic::ppc_altivec_vcmpgtud_p:
|
||||
case Intrinsic::ppc_altivec_vcmpgtuq_p:
|
||||
Known.Zero = ~1U; // All bits but the low one are known to be zero.
|
||||
break;
|
||||
}
|
||||
|
@ -248,3 +248,31 @@ define <1 x i128> @test_vcmpgtuq(<1 x i128> %x, <1 x i128> %y) {
|
||||
; CHECK: vcmpgtuq {{[0-9]+}}, {{[0-9]+}}, {{[0-9]+}}
|
||||
; CHECK: blr
|
||||
}
|
||||
|
||||
declare i32 @llvm.ppc.altivec.vcmpequq.p(i32, <1 x i128>, <1 x i128>) nounwind readnone
|
||||
declare i32 @llvm.ppc.altivec.vcmpgtsq.p(i32, <1 x i128>, <1 x i128>) nounwind readnone
|
||||
declare i32 @llvm.ppc.altivec.vcmpgtuq.p(i32, <1 x i128>, <1 x i128>) nounwind readnone
|
||||
|
||||
define i32 @test_vcmpequq_p(<1 x i128> %x, <1 x i128> %y) {
|
||||
%tmp = tail call i32 @llvm.ppc.altivec.vcmpequq.p(i32 2, <1 x i128> %x, <1 x i128> %y)
|
||||
ret i32 %tmp
|
||||
; CHECK-LABEL: test_vcmpequq_p:
|
||||
; CHECK: vcmpequq. {{[0-9]+}}, {{[0-9]+}}, {{[0-9]+}}
|
||||
; CHECK: blr
|
||||
}
|
||||
|
||||
define i32 @test_vcmpgtsq_p(<1 x i128> %x, <1 x i128> %y) {
|
||||
%tmp = tail call i32 @llvm.ppc.altivec.vcmpgtsq.p(i32 2, <1 x i128> %x, <1 x i128> %y)
|
||||
ret i32 %tmp
|
||||
; CHECK-LABEL: test_vcmpgtsq_p
|
||||
; CHECK: vcmpgtsq. {{[0-9]+}}, {{[0-9]+}}, {{[0-9]+}}
|
||||
; CHECK: blr
|
||||
}
|
||||
|
||||
define i32 @test_vcmpgtuq_p(<1 x i128> %x, <1 x i128> %y) {
|
||||
%tmp = tail call i32 @llvm.ppc.altivec.vcmpgtuq.p(i32 2, <1 x i128> %x, <1 x i128> %y)
|
||||
ret i32 %tmp
|
||||
; CHECK-LABEL: test_vcmpgtuq_p
|
||||
; CHECK: vcmpgtuq. {{[0-9]+}}, {{[0-9]+}}, {{[0-9]+}}
|
||||
; CHECK: blr
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user