[PATCH] D113107: Support of expression granularity for _Float16.

Zahira Ammarguellat via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 19 08:13:28 PDT 2022


zahiraam marked 3 inline comments as done.
zahiraam added a comment.





================
Comment at: clang/test/CodeGen/X86/Float16-complex.c:1184
+// X86-NEXT:    store float [[NEG_I]], ptr [[RETVAL_IMAGP]], align 2
+// X86-NEXT:    [[TMP0:%.*]] = load <2 x half>, ptr [[RETVAL]], align 2
+// X86-NEXT:    ret <2 x half> [[TMP0]]
----------------
rjmccall wrote:
> This code pattern is definitely wrong, and it's a sign that the expression evaluator returned the wrong type.  This is coercing a `_Complex float` into a `_Complex _Float16` through memory, which is essentially reinterpreting the first float as a pair of `_Float16`s.  You should go through your tests and make sure you don't see other instances of this.
I think the issue here is that in ComplexExprEmitter::EmitStoreOfComplex, we are computing the Ptr from lvalue which elementype is halfty instead of float. I think the code there needs to change when there is a getPromotionType. We need to compute a Ptr with float as elementype .
The Val argument returned by the complex emitter has the right type (Float). 



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113107/new/

https://reviews.llvm.org/D113107



More information about the cfe-commits mailing list