sepavloff added inline comments.
================
Comment at: clang/test/CodeGen/fp-floatcontrol-pragma.cpp:154
+ if (i<0)
+ return 1.0 + 2.0;
+ // Check that floating point constant folding doesn't occur if
----------------
In this particular case we know for sure that the result does not depend on
rounding mode and no FP exceptions occurs, so it is safe to constfold the
expression.
Expressions like `1.0 / 0.0` or `1.0F + 0x0.000001p0F` indeed may require
execution in runtime, depending on the required exception handling. I would
propose to connect their const-evaluability with `FPExceptionMode` and set the
latter to `strict` whenever `AllowFEnvAccess` is set to `true`.
================
Comment at: clang/test/CodeGen/pragma-fenv_access.c:9
+// CHECK-LABEL: @func_01
+// CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}},
float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
+
----------------
Shall the rounding mode be `dynamic` rather than `tonearest`? If `#pragma STDC
FENV_ACCESS ON` is specified, it means FP environment may be changed in
arbitrary way and we cannot expect any particular rounding mode. Probably the
environment was changed in the caller of `func_01`.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87528/new/
https://reviews.llvm.org/D87528
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits