summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-05-03 22:44:19 +0000
committerDan Gohman <gohman@apple.com>2010-05-03 22:44:19 +0000
commita2414ea1909405a998eddc8e6990ceee8b46e60e (patch)
tree4e831b0f8c2ce78a17bc79b811d2a4ca160c0254 /llvm/lib/AsmParser/LLParser.cpp
parentf4e4e84115a5663c95175a09cef52384711f0213 (diff)
downloadbcm5719-llvm-a2414ea1909405a998eddc8e6990ceee8b46e60e.tar.gz
bcm5719-llvm-a2414ea1909405a998eddc8e6990ceee8b46e60e.zip
Remove the API compatibility layer which converted add, sub, and mul
to fadd, fsub, and fmul, when used with a floating-point type. LLVM has supported the new instructions since 2.6, so it's time to get on board. llvm-svn: 102971
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 45b88cc2a55..3b08ca18053 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -2351,11 +2351,28 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
if (NSW)
return Error(ModifierLoc, "nsw only applies to integer operations");
}
- // API compatibility: Accept either integer or floating-point types with
- // add, sub, and mul.
- if (!Val0->getType()->isIntOrIntVectorTy() &&
- !Val0->getType()->isFPOrFPVectorTy())
- return Error(ID.Loc,"constexpr requires integer, fp, or vector operands");
+ // Check that the type is valid for the operator.
+ switch (Opc) {
+ case Instruction::Add:
+ case Instruction::Sub:
+ case Instruction::Mul:
+ case Instruction::UDiv:
+ case Instruction::SDiv:
+ case Instruction::URem:
+ case Instruction::SRem:
+ if (!Val0->getType()->isIntOrIntVectorTy())
+ return Error(ID.Loc, "constexpr requires integer operands");
+ break;
+ case Instruction::FAdd:
+ case Instruction::FSub:
+ case Instruction::FMul:
+ case Instruction::FDiv:
+ case Instruction::FRem:
+ if (!Val0->getType()->isFPOrFPVectorTy())
+ return Error(ID.Loc, "constexpr requires fp operands");
+ break;
+ default: llvm_unreachable("Unknown binary operator!");
+ }
unsigned Flags = 0;
if (NUW) Flags |= OverflowingBinaryOperator::NoUnsignedWrap;
if (NSW) Flags |= OverflowingBinaryOperator::NoSignedWrap;
@@ -3000,8 +3017,7 @@ int LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB,
if (EatIfPresent(lltok::kw_nuw))
NUW = true;
}
- // API compatibility: Accept either integer or floating-point types.
- bool Result = ParseArithmetic(Inst, PFS, KeywordVal, 0);
+ bool Result = ParseArithmetic(Inst, PFS, KeywordVal, 1);
if (!Result) {
if (!Inst->getType()->isIntOrIntVectorTy()) {
if (NUW)
OpenPOWER on IntegriCloud