summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorKit Barton <kbarton@ca.ibm.com>2015-03-30 19:40:59 +0000
committerKit Barton <kbarton@ca.ibm.com>2015-03-30 19:40:59 +0000
commite50adcb6b1b7e8317cca7ed5f8860a40ca6b7196 (patch)
treed80aa7535947dc39e56bcbccf92a65681893f89d /clang/lib/CodeGen
parentab659fb3d03005114e176cb86449636e0635f16a (diff)
downloadbcm5719-llvm-e50adcb6b1b7e8317cca7ed5f8860a40ca6b7196.tar.gz
bcm5719-llvm-e50adcb6b1b7e8317cca7ed5f8860a40ca6b7196.zip
[PPC] Move argument range checks for HTM and crypto builtins to Sema
The argument range checks for the HTM and Crypto builtins were implemented in CGBuiltin.cpp, not in Sema. This change moves them to the appropriate location in SemaChecking.cpp. It requires the creation of a new method in the Sema class to do checks for PPC-specific builtins. http://reviews.llvm.org/D8672 llvm-svn: 233586
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGBuiltin.cpp113
1 files changed, 0 insertions, 113 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 35597fe4a0b..90ca218a837 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -6371,119 +6371,6 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
llvm::Function *F = CGM.getIntrinsic(ID);
return Builder.CreateCall(F, Ops, "");
}
-
- // P8 Crypto builtins
- case PPC::BI__builtin_altivec_crypto_vshasigmaw:
- case PPC::BI__builtin_altivec_crypto_vshasigmad:
- {
- ConstantInt *CI1 = dyn_cast<ConstantInt>(Ops[1]);
- ConstantInt *CI2 = dyn_cast<ConstantInt>(Ops[2]);
- assert(CI1 && CI2);
- if (CI1->getZExtValue() > 1) {
- CGM.Error(E->getArg(1)->getExprLoc(),
- "argument out of range (should be 0-1).");
- return llvm::UndefValue::get(Ops[0]->getType());
- }
- if (CI2->getZExtValue() > 15) {
- CGM.Error(E->getArg(2)->getExprLoc(),
- "argument out of range (should be 0-15).");
- return llvm::UndefValue::get(Ops[0]->getType());
- }
- switch (BuiltinID) {
- default: llvm_unreachable("Unsupported sigma intrinsic!");
- case PPC::BI__builtin_altivec_crypto_vshasigmaw:
- ID = Intrinsic::ppc_altivec_crypto_vshasigmaw;
- break;
- case PPC::BI__builtin_altivec_crypto_vshasigmad:
- ID = Intrinsic::ppc_altivec_crypto_vshasigmad;
- break;
- }
- llvm::Function *F = CGM.getIntrinsic(ID);
- return Builder.CreateCall(F, Ops, "");
- }
-
- // HTM builtins
- case PPC::BI__builtin_tbegin:
- case PPC::BI__builtin_tend:
- case PPC::BI__builtin_tsr: {
- unsigned int MaxValue;
- // The HTM instructions only accept one argument and with limited range.
- ConstantInt *CI = dyn_cast<ConstantInt>(Ops[0]);
- assert(CI);
- switch (BuiltinID) {
- case PPC::BI__builtin_tbegin:
- ID = Intrinsic::ppc_tbegin;
- MaxValue = 1;
- break;
- case PPC::BI__builtin_tend:
- ID = Intrinsic::ppc_tend;
- MaxValue = 1;
- break;
- case PPC::BI__builtin_tsr:
- ID = Intrinsic::ppc_tsr;
- MaxValue = 7;
- break;
- }
- if (CI->getZExtValue() > MaxValue) {
- std::stringstream ss;
- ss << "argument out of range (should be 0 or " << MaxValue << ")";
- CGM.Error(E->getArg(0)->getExprLoc(), ss.str());
- return llvm::UndefValue::get(Ops[0]->getType());
- }
-
- llvm::Function *F = CGM.getIntrinsic(ID);
- return Builder.CreateCall(F, Ops, "");
- }
- case PPC::BI__builtin_tabortdc:
- case PPC::BI__builtin_tabortwc: {
- // For wd and dc variant of tabort first argument must be a 5-bit constant
- // integer
- ConstantInt *CI = dyn_cast<ConstantInt>(Ops[0]);
- assert(CI);
- if (CI->getZExtValue() > 31) {
- CGM.ErrorUnsupported(E->getArg(0), "argument out of range (should be 0-31)");
- return llvm::UndefValue::get(Ops[0]->getType());
- }
- switch (BuiltinID) {
- case PPC::BI__builtin_tabortdc:
- ID = Intrinsic::ppc_tabortdc;
- break;
- case PPC::BI__builtin_tabortwc:
- ID = Intrinsic::ppc_tabortwc;
- break;
- }
- llvm::Function *F = CGM.getIntrinsic(ID);
- return Builder.CreateCall(F, Ops, "");
- }
- case PPC::BI__builtin_tabortdci:
- case PPC::BI__builtin_tabortwci: {
- // For wd and dc variant of tabort first and third argument must be a
- // 5-bit constant integer
- ConstantInt *CI = dyn_cast<ConstantInt>(Ops[0]);
- assert(CI);
- if (CI->getZExtValue() > 31) {
- CGM.ErrorUnsupported(E->getArg(0), "argument out of range (should be 0-31)");
- return llvm::UndefValue::get(Ops[0]->getType());
- }
- CI = dyn_cast<ConstantInt>(Ops[2]);
- assert(CI);
- if (CI->getZExtValue() > 31) {
- CGM.ErrorUnsupported(E->getArg(2), "argument out of range (should be 0-31)");
- return llvm::UndefValue::get(Ops[2]->getType());
- }
- switch (BuiltinID) {
- default: llvm_unreachable("Unsupported htm intrinsic!");
- case PPC::BI__builtin_tabortdci:
- ID = Intrinsic::ppc_tabortdci;
- break;
- case PPC::BI__builtin_tabortwci:
- ID = Intrinsic::ppc_tabortwci;
- break;
- }
- llvm::Function *F = CGM.getIntrinsic(ID);
- return Builder.CreateCall(F, Ops, "");
- }
-
}
}
OpenPOWER on IntegriCloud