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

Zahira Ammarguellat via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 17 10:45:20 PDT 2022


zahiraam added inline comments.


================
Comment at: clang/lib/CodeGen/CGExprScalar.cpp:3140
+      return CGF.Builder.CreateFPExt(result, ConvertType(E->getType()));
+  }
+  return result;
----------------
rjmccall wrote:
> zahiraam wrote:
> > rjmccall wrote:
> > > Please extract this block out as:
> > > 
> > > ```
> > > llvm::Value *EmitPromotedValue(llvm::Value *result, QualType PromotionType);
> > > ```
> > These changes you are proposing is when the argument of the unary __imag / __real is of type _Complex Float16. I would think that this new method EmitPromotedValue would be replacing the equivalent code in ComplexEmitter::EmitPromoted instead,  not in the scalar emitter, right?
> I probably mixed up which emitter I commented on.  The upshot is that I would like there to be `EmitPromotedValue` and `EmitUnpromotedValue` helper functions on both emitters (which of course would take/return an `llvm::Value*` on the scalar emitter and a `CGComplexPair` on the complex emitter), just so that we have all the value promotion/unpromotion logic for each emitter in one place.
Let's see if what I have done is satisfactory! It's not quite "symmetrical" for scalar and complex. Let me know. Thanks.


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

https://reviews.llvm.org/D113107



More information about the cfe-commits mailing list