Page MenuHomePhabricator

RFC [clang] Add support for option -ffp-eval-method and extend #pragma float_control similarly
Needs ReviewPublic

Authored by mibintc on Wed, Dec 23, 9:50 AM.



The Intel compiler supports the option "-fp-model=(source|double|extended)" which causes the compiler to use a wider type for intermediate floating point calculations. Also supported is a way to embed this effect in the source program with #pragma float_control(source|double|extended). This patch proposes to extend pragma float_control syntax, and also to support a new floating point option via "-ffp-eval-method=(source|double|extended)"

Note that the C floating point working group has proposed nearly identical pragma semantics in like this
I would like to add support for this also, but it's not in this patch.

I'm going to add an inline question about how to redefine FLT_EVAL_METHOD macro

The ICL option with description of semantics is at this url,

Diff Detail

Event Timeline

mibintc created this revision.Wed, Dec 23, 9:50 AM
mibintc requested review of this revision.Wed, Dec 23, 9:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptWed, Dec 23, 9:50 AM
mibintc edited the summary of this revision. (Show Details)Wed, Dec 23, 9:51 AM
mibintc edited the summary of this revision. (Show Details)
mibintc added inline comments.Wed, Dec 23, 10:00 AM

@rjmccall I would like to push a new value for FLT_EVAL_METHOD at the start of the scope of this pragma, then pop that value of the macro to restore the previous setting when the scope is exited, should I do that in ParsePragma? Can I do that by injecting "pragma push_macro(...)" into the token stream, do you have other suggestion or is there something similar in clang that I can study how to do this?

@rjmccall Hoping you can take a look at this patch