[flang-commits] [PATCH] D113273: [fir] TargetRewrite: Rewrite COMPLEX values
Jean Perier via Phabricator via flang-commits
flang-commits at lists.llvm.org
Mon Nov 8 02:01:05 PST 2021
jeanPerier added a comment.
> The IR you posted is confusing because it contains both complex<f32> and fir.complex<4>. Are both valid, or are we moving away from one of them?
Yes they are both valid types, but are not exactly the same thing. `complex<f32>` is the mlir complex type that is used to represent C++ std::complex types, while `fir.complex<4>` represents Fortran complex type. The nuance is subtle but essential because C++ std::complex and Fortran complex type (same as C99 complex) may not be compatible in function interface [*], so we want to keep them as distinct types in function signatures.
It is OK to cast a `fir.ref<complex<f32>>` to a `fir.ref<fir.complex<4>` because std::complex and Fortran complex are memory layout compatible (since std::complex guarantees this with the C99 complex type).
[X] For instance Fortran complex and std::complex are not returned the same way on X86 32 bits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113273/new/
https://reviews.llvm.org/D113273
More information about the flang-commits
mailing list