================
@@ -794,8 +834,10 @@ ComplexPairTy ComplexExprEmitter::EmitBinMul(const 
BinOpInfo &Op) {
       ResR = Builder.CreateFSub(AC, BD, "mul_r");
       ResI = Builder.CreateFAdd(AD, BC, "mul_i");
 
-      if (Op.FPFeatures.getComplexRange() == LangOptions::CX_Limited ||
-          Op.FPFeatures.getComplexRange() == LangOptions::CX_Fortran)
+      if (Op.FPFeatures.getComplexRange() == LangOptions::CX_Basic ||
+          Op.FPFeatures.getComplexRange() == LangOptions::CX_Improved ||
+          Op.FPFeatures.getComplexRange() == LangOptions::CX_Promoted ||
+          CGF.getLangOpts().NoHonorInfs || CGF.getLangOpts().NoHonorNaNs)
----------------
zahiraam wrote:

This code is in `EmitBinMul` and your `godbolt` link has a `div` operation.
At any case the `complex-range` is **not** set when `-ffinite-math-only` is 
used on the command line. The function `applyFastMath` sets the range only when 
`ffast-math` or `fp-model` are used. With `CGF.getLangOpts().NoHonorInfs || 
CGF.getLangOpts().NoHonorNaNs` we would get the same behavior than `gcc` for a` 
mul` operation: algebraic  implementation with no `nan` testing.
If you don't want this condition  here. then `applyFastMath` needs to be called 
when `ffinite-math-only` is on the command line.
WDYT?

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

Reply via email to