[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-22 Thread Serge Pavlov via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG706e89db97d3: Fix interaction of pragma FENV_ACCESS with other pragmas (authored by sepavloff). Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-20 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision. efriedma added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126364/new/ https://reviews.llvm.org/D126364 ___

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-17 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added inline comments. Comment at: clang/include/clang/Basic/LangOptions.h:622 setFPContractMode(LangOptions::FPM_Off); setRoundingMode(static_cast(LangOptions::FPR_ToNearest)); setFPExceptionMode(LangOptions::FPE_Ignore); efriedma wrote:

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-17 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff updated this revision to Diff 437807. sepavloff added a comment. Remade the patch according to the review notes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126364/new/ https://reviews.llvm.org/D126364 Files: clang/include/clang/Basic

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-09 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments. Comment at: clang/include/clang/Basic/LangOptions.h:622 setFPContractMode(LangOptions::FPM_Off); setRoundingMode(static_cast(LangOptions::FPR_ToNearest)); setFPExceptionMode(LangOptions::FPE_Ignore); sepavloff wrote:

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-08 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added inline comments. Comment at: clang/include/clang/Basic/LangOptions.h:622 setFPContractMode(LangOptions::FPM_Off); setRoundingMode(static_cast(LangOptions::FPR_ToNearest)); setFPExceptionMode(LangOptions::FPE_Ignore); efriedma wrote:

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-07 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments. Comment at: clang/include/clang/Basic/LangOptions.h:622 setFPContractMode(LangOptions::FPM_Off); setRoundingMode(static_cast(LangOptions::FPR_ToNearest)); setFPExceptionMode(LangOptions::FPE_Ignore); sepavloff wrote:

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-07 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added inline comments. Comment at: clang/include/clang/Basic/LangOptions.h:622 setFPContractMode(LangOptions::FPM_Off); setRoundingMode(static_cast(LangOptions::FPR_ToNearest)); setFPExceptionMode(LangOptions::FPE_Ignore); efriedma wrote:

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-07 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments. Comment at: clang/include/clang/Basic/LangOptions.h:622 setFPContractMode(LangOptions::FPM_Off); setRoundingMode(static_cast(LangOptions::FPR_ToNearest)); setFPExceptionMode(LangOptions::FPE_Ignore); sepavloff wrote:

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-07 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added inline comments. Comment at: clang/include/clang/Basic/LangOptions.h:622 setFPContractMode(LangOptions::FPM_Off); setRoundingMode(static_cast(LangOptions::FPR_ToNearest)); setFPExceptionMode(LangOptions::FPE_Ignore); efriedma wrote:

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-06 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments. Comment at: clang/include/clang/Basic/LangOptions.h:622 setFPContractMode(LangOptions::FPM_Off); setRoundingMode(static_cast(LangOptions::FPR_ToNearest)); setFPExceptionMode(LangOptions::FPE_Ignore); sepavloff wrote:

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-06 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added inline comments. Comment at: clang/include/clang/Basic/LangOptions.h:622 setFPContractMode(LangOptions::FPM_Off); setRoundingMode(static_cast(LangOptions::FPR_ToNearest)); setFPExceptionMode(LangOptions::FPE_Ignore); efriedma wrote:

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-06 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments. Comment at: clang/include/clang/Basic/LangOptions.h:622 setFPContractMode(LangOptions::FPM_Off); setRoundingMode(static_cast(LangOptions::FPR_ToNearest)); setFPExceptionMode(LangOptions::FPE_Ignore); I'm suggesting t

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-06 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added a comment. In D126364#3560997 , @efriedma wrote: > In D126364#3560984 , @sepavloff > wrote: > >> In D126364#3560877 , @efriedma >> wrote: >> >>> Shouldn'

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-06 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. In D126364#3560984 , @sepavloff wrote: > In D126364#3560877 , @efriedma > wrote: > >> Shouldn't the rounding mode be FE_DYNAMIC by default? > > According to the standard it must be FE_TO

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-06 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added a comment. In D126364#3560877 , @efriedma wrote: > Shouldn't the rounding mode be FE_DYNAMIC by default? According to the standard it must be FE_TONEAREST: F.8.3p1: At program startup the dynamic floating-point environment is initial

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-06 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. Shouldn't the rounding mode be FE_DYNAMIC by default? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126364/new/ https://reviews.llvm.org/D126364 ___ cfe-commits mailing list cfe

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-06 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added a comment. In D126364#3556943 , @efriedma wrote: > Given we have getEffectiveRoundingMode(), I think the calls to > setRoundingModeOverride shouldn't be necessary? And if we drop those calls, > we can also drop the IsRoundingModeSet var

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-03 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. Given we have getEffectiveRoundingMode(), I think the calls to setRoundingModeOverride shouldn't be necessary? And if we drop those calls, we can also drop the IsRoundingModeSet variable. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://revi

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-02 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added a comment. In D126364#3548815 , @efriedma wrote: > The way I see it, there are two possibilities here: > > 1. In Sema, we have two rounding modes that correspond to FE_DYNAMIC: > llvm::RoundingMode::Dynamic, and llvm::RoundingMode::Neares

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-02 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff updated this revision to Diff 433963. sepavloff added a comment. Update the patch - Add a flag to reflect rounding mode change by FENV_ROUND, - Keep dynamic mode in AST and change it later in CodeGen, - Add new tests. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-01 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. > Constrained intrinsics don't change the rounding mode. The standard text for FENV_ROUND requires that when we see a floating point operation, we have to perform it using the specified rounding mode. "floating-point operators [...] shall be evaluated according to the

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-06-01 Thread Kevin P. Neal via Phabricator via cfe-commits
kpn added a comment. >> On targets that support static rounding mode (like RISCV) dynamic and >> constant rounding modes may be different and the behavior changes if default >> mode is replaced by dynamic. > > Whether a target supports static rounding modes on floating-point > instructions is c

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-05-31 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. The way I see it, there are two possibilities here: 1. In Sema, we have two rounding modes that correspond to FE_DYNAMIC: llvm::RoundingMode::Dynamic, and llvm::RoundingMode::NearestTiesToEven, plus some boolean to indicate whether the user actually explicitly specifie

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-05-30 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added a comment. In D126364#3546173 , @efriedma wrote: >> setRoundingMode definitely should not call getAllowFEnvAccess() and it does >> not > > Yes, it does? > > // C2x: 7.6.2p3 If the FE_DYNAMIC mode is specified and FENV_ACCESS is > "off

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-05-30 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. > setRoundingMode definitely should not call getAllowFEnvAccess() and it does > not Yes, it does? // C2x: 7.6.2p3 If the FE_DYNAMIC mode is specified and FENV_ACCESS is "off", // the translator may assume that the default rounding mode is in effect. if (FPR == l

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-05-30 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added a comment. In D126364#3542917 , @efriedma wrote: > I mean that ActOnPragmaFEnvAccess shouldn't call > hasRoundingModeOverride()/setRoundingModeOverride(), and setRoundingMode > shouldn't call getAllowFEnvAccess(). setRoundingMode defini

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-05-27 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. I mean that ActOnPragmaFEnvAccess shouldn't call hasRoundingModeOverride()/setRoundingModeOverride(), and setRoundingMode shouldn't call getAllowFEnvAccess(). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126364/new/ htt

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-05-27 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added a comment. In D126364#3540673 , @efriedma wrote: > For FENV_ROUND, I think we should try to stick to the standard as closely as > possible in Sema; since the standard models FENV_ROUND as a separate state, > Sema should also model it as

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-05-26 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. For FENV_ROUND, I think we should try to stick to the standard as closely as possible in Sema; since the standard models FENV_ROUND as a separate state, Sema should also model it as a separate state. If CodeGen decides it needs to modify the FP environment to actually

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-05-26 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added a comment. In D126364#3537964 , @efriedma wrote: > Could you lay out the expected interaction between "STDC FENV_ACCESS", "clang > fp exceptions", "float_control", and "fenv_access"? If there's some way to > map everything to "#pragma c

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-05-25 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. Could you lay out the expected interaction between "STDC FENV_ACCESS", "clang fp exceptions", "float_control", and "fenv_access"? If there's some way to map everything to "#pragma clang fp", please lay that out; if that isn't possible, please explain why. As far as I

[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

2022-05-25 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff created this revision. sepavloff added reviewers: aaron.ballman, andrew.w.kaylor, rjmccall, efriedma, kpn. Herald added a project: All. sepavloff requested review of this revision. Herald added a project: clang. Previously `#pragma STDC FENV_ACCESS ON` always set dynamic rounding mode a