New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CIR] Extend support for floating point attributes #572
base: main
Are you sure you want to change the base?
Conversation
Upstream patch: llvm/llvm-project#90442 |
c4db6d0
to
e197d4e
Compare
Nathan just did a rebase, can you please update? Sorry for the churn |
Parsing support for floating point types was missing a few features: 1. Parsing floating point attributes from integer literals was supported only for types with bitwidth smaller or equal to 64. 2. Downstream users could not use `AsmParser::parseFloat` to parse float types which are printed as integer literals. This commit addresses both these points. It extends `Parser::parseFloatFromIntegerLiteral` to support arbitrary bitwidth, and exposes a new API to parse arbitrary floating point given an fltSemantics as input. The usage of this new API is introduced in the Test Dialect.
This commit extends the support for floating point attributes parsing by using the new `AsmParser::parseFloat(fltSemnatics, APFloat&)` interface. As a drive-by, this commit also harmonizes the cir.fp print/parse namespace usage, and adds the constraint of supporting only "CIRFPType"s for cir.fp in tablegen instead of verifying it manually in the parsing logic.
Rebased 🙏 |
Thanks for going the extra length to make sure this works! |
Merged upstream 🎉 |
@bcardosolopes - is there any planned rebase anytime soon? This PR is blocked by getting the upstream patch. Alternatively, I assume we can cherry-pick it here and there's a 95% chance that it will dissolve on the next rebase. Let me know what you prefer 🙏🏼 |
@lanza wdyt? |
This commit extends the support for floating point attributes parsing by using
the new
AsmParser::parseFloat(fltSemnatics, APFloat&)
interface.As a drive-by, this commit also harmonizes the cir.fp print/parse namespace
usage, and adds the constraint of supporting only "CIRFPType"s for cir.fp in
tablegen instead of verifying it manually in the parsing logic.
This commit is based on top of a to-be-upstreamed commit which extends the upstream MLIR float type parsing. Upstream parsing of float type has full capability only through parsing the Builtin Dialect's
FloatAttr
. Thos commit exposes the same capabilities to downstream users.This PR should resolve (at least)
GCC-C-execute-ieee-fp-cmp-2
andGCC-C-execute-ieee-fp-cmp-4
, paving the way to otherGCC-C-execute-ieee-*
tests passing from the SingleSource suite. It resolves #559 .