================
@@ -7444,9 +7444,12 @@ isArithmeticArgumentPromotion(Sema &S, const 
ImplicitCastExpr *ICE) {
     From = VecTy->getElementType();
   if (const auto *VecTy = To->getAs<ExtVectorType>())
     To = VecTy->getElementType();
-  // It's a floating promotion if the source type is a lower rank.
-  return ICE->getCastKind() == CK_FloatingCast &&
-         S.Context.getFloatingTypeOrder(From, To) < 0;
+  // It's a floating promotion if the source type is float.
+  // [7.3.8p1][conv.fpprom] A prvalue of type float can be converted to a
+  // prvalue of type double. The value is unchanged.
+  return (ICE->getCastKind() == CK_FloatingCast &&
+          S.Context.isPromotableFloatingType(From) &&
+          S.Context.getPromotedFloatingType(From) == To);
----------------
jcranmer-intel wrote:

Given that the *only* floating-point promotion is `float` -> `double`, and 
we've just seen C++23 add a slew of new types without any other promotions, I'm 
not sure these helper methods are helpful to understanding what's going on 
here, over just hard-coding the `float`->`double` check here.

https://github.com/llvm/llvm-project/pull/78503
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to