llvm / clangir

A new (MLIR based) high-level IR for clang.
https://clangir.org
Other
327 stars 86 forks source link

[CIR] Extend support for floating point attributes #572

Open orbiri opened 3 months ago

orbiri commented 3 months ago

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 and GCC-C-execute-ieee-fp-cmp-4, paving the way to other GCC-C-execute-ieee-* tests passing from the SingleSource suite. It resolves #559 .

orbiri commented 3 months ago

@Lancern - may be related to work that you are working on 🙏 (e.g. #536 #571 ).

orbiri commented 3 months ago

Upstream patch: https://github.com/llvm/llvm-project/pull/90442

bcardosolopes commented 3 months ago

Nathan just did a rebase, can you please update? Sorry for the churn

orbiri commented 3 months ago

Rebased 🙏 Update on upstream commit: PR was approved, tying to wait a bit more for the core developers who most recently touched that code (Jeff & River) to take a look. Will merge by Friday if no further comments arise.

bcardosolopes commented 3 months ago

Thanks for going the extra length to make sure this works!

orbiri commented 3 months ago

Upstream patch: llvm/llvm-project#90442

Merged upstream 🎉 Waiting for the next CIR rebase and I'll update this one.

orbiri commented 3 months ago

@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 🙏🏼

bcardosolopes commented 3 months ago

@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?

lanza commented 1 month ago

I pushed a rebase just now. Should be good to go :p