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

Zahira Ammarguellat via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 17 10:29:10 PDT 2022


zahiraam marked 2 inline comments as done.
zahiraam added inline comments.


================
Comment at: clang/lib/CodeGen/CGExprComplex.cpp:896
+
+ComplexPairTy ComplexExprEmitter::EmitPromoted(const Expr *E) {
+  if (auto *BinOp = dyn_cast<BinaryOperator>(E->IgnoreParens())) {
----------------
rjmccall wrote:
> `EmitPromoted` should take the promotion type.
> 
> You are missing the logic in this file which handles *unpromoted* emission (where you have a binary operator but the context wants an unpromoted value) by recognizing that you need to do a promoted operation and then truncate.
Sorry but not sure what you mean here. A case where we don't want any promotion would be:

float _Complex add(float _Complex a, float _Complex b) {
  return a + b;
}

In this case, getPromotionType would return the null type and EmitBinOps would just go through the  "older" control path where there is no promotion.
Unless I misunderstood your comment?




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

https://reviews.llvm.org/D113107



More information about the cfe-commits mailing list