================ @@ -5254,7 +5250,11 @@ bool CheckAllArgsHaveFloatRepresentation(Sema *S, CallExpr *TheCall) { QualType ExpectedType = S->Context.FloatTy; for (unsigned i = 0; i < TheCall->getNumArgs(); ++i) { QualType PassedType = TheCall->getArg(i)->getType(); - if (!PassedType->hasFloatingRepresentation()) { + ExpectedType = PassedType->isHalfType() && S->getLangOpts().NativeHalfType + ? S->Context.HalfTy + : S->Context.FloatTy; + if (PassedType == S->Context.DoubleTy || + !PassedType->hasFloatingRepresentation()) { ---------------- farzonl wrote:
1. This was originally just a check to make sure args were floats and I shoehorned in the double case to handle the type promotions caused by `DefaultVariadicArgumentPromotion` when calling the builtin directly. There are no type promotions for BFloat16 or Ibm128 and we don't define those types in hlsl so i'm not able to test for these other floating point types. 2. The name should probably change. 3. I was hoping to avoid triggering the error on api calls of half\vector<half> ie. lerp(half,half,half). There is likely a better way for me to structure this to make it look more correct. 4. It can't be tested I added a test for it on line 91 of `lerp-builtin.hlsl` and the original type is lost by the time we call the builtin. I added a note to explain why it was `float` and not `half`. https://github.com/llvm/llvm-project/pull/84526 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits