llvm / clangir

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

[CIR][CIRGen] Add CIRGen support for float16 and bfloat #571

Closed Lancern closed 3 months ago

Lancern commented 3 months ago

This PR adds two new CIR floating-point types, namely !cir.f16 and !cir.bf16, to represent the float16 format and bfloat format, respectively.

This PR converts the clang extension type _Float16 to !cir.f16, and converts the clang extension type __bf16 type to !cir.bf16. The type conversion for clang extension type __fp16 is not included in this PR since it requires additional work during CIRGen.

Only CIRGen is implemented here, LLVMIR lowering / MLIR lowering should come next.

bcardosolopes commented 3 months ago

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

Lancern commented 3 months ago

Rebased onto the latest main.

Lancern commented 3 months ago

Rebased onto the latest main and updated this PR according to the latest reviews: