[PATCH] D112094: Add support for floating-point option `ffp-eval-method` and for `pragma clang fp eval_method`.
Zahira Ammarguellat via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 27 07:13:53 PDT 2021
zahiraam added a comment.
In D112094#3087531 <https://reviews.llvm.org/D112094#3087531>, @aaron.ballman wrote:
> One thing I think we need additional test coverage for is constant expression evaluation. Should the pragma impact the resulting value stored into `f`:
>
> constexpr long double whatever(float x, float y) {
> #pragma clang fp eval_method(extended)
> return x / y;
> }
>
> constexpr long double f = whatever(4.2f, 1.0f/3.0f);
>
> Ping @andrew.w.kaylor on this question. (My intuition is that it should impact constant expression evaluation.)
>
> Also, @zahiraam -- is there a reason this is not a public review? (When you protect the review like this, CI precommit testing doesn't happen and community doesn't know about the proposal.)
@aaron.ballman thanks for the review.
This is the IR of the test constexpr test case.
With the pragma:
define dso_local i32 @main() #0 {
entry:
%f = alloca x86_fp80, align 16
store x86_fp80 0xK4002C999989B3333B266, x86_fp80* %f, align 16
ret i32 0
}
With no pragma:
define dso_local i32 @main() #0 {
entry:
%f = alloca x86_fp80, align 16
store x86_fp80 0xK4002C999990000000000, x86_fp80* %f, align 16
ret i32 0
}
@andrew.w.kaylor your thoughts about this? Thanks.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112094/new/
https://reviews.llvm.org/D112094
More information about the cfe-commits
mailing list