aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
authorJohn Brawn <john.brawn@arm.com>2024-12-04 10:53:04 +0000
committerGitHub <noreply@github.com>2024-12-04 10:53:04 +0000
commitecbe4d1e360e25c0634a3a62fbd01e8df5bb0c1b (patch)
treeac8568fcdcbbb3e430a3f552df8118170d94c87c /llvm/lib/AsmParser/LLParser.cpp
parenta30f7e190b8a4b6cdb9d9c050be4af660f237931 (diff)
downloadllvm-ecbe4d1e360e25c0634a3a62fbd01e8df5bb0c1b.zip
llvm-ecbe4d1e360e25c0634a3a62fbd01e8df5bb0c1b.tar.gz
llvm-ecbe4d1e360e25c0634a3a62fbd01e8df5bb0c1b.tar.bz2
[IR] Allow fast math flags on fptrunc and fpext (#115894)
This consists of: * Make these instructions part of FPMathOperator. * Adjust bitcode/ir readers/writers to expect fast math flags on these instructions. * Make IRBuilder set the fast math flags on these instructions. * Update langref and release notes. * Update a bunch of tests. Some of these are due to InstCombineCasts incorrectly adding fast math flags to fptrunc, which will be fixed in a later patch.
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index dd72d46..3431149 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -7004,8 +7004,6 @@ int LLParser::parseInstruction(Instruction *&Inst, BasicBlock *BB,
return false;
}
case lltok::kw_sext:
- case lltok::kw_fptrunc:
- case lltok::kw_fpext:
case lltok::kw_bitcast:
case lltok::kw_addrspacecast:
case lltok::kw_sitofp:
@@ -7014,6 +7012,16 @@ int LLParser::parseInstruction(Instruction *&Inst, BasicBlock *BB,
case lltok::kw_inttoptr:
case lltok::kw_ptrtoint:
return parseCast(Inst, PFS, KeywordVal);
+ case lltok::kw_fptrunc:
+ case lltok::kw_fpext: {
+ FastMathFlags FMF = EatFastMathFlagsIfPresent();
+ if (parseCast(Inst, PFS, KeywordVal))
+ return true;
+ if (FMF.any())
+ Inst->setFastMathFlags(FMF);
+ return false;
+ }
+
// Other.
case lltok::kw_select: {
FastMathFlags FMF = EatFastMathFlagsIfPresent();