search for: fesetround

Displaying 18 results from an estimated 18 matches for "fesetround".

2015 Aug 21
2
The semantics of the fptrunc instruction with an example of incorrect optimisation
...value (which would be equivalent to rounding towards zero) but this seems to be very misleading because on the target I'm using (x86_64) that **is not** what happens. Consider the following example in C ``` #include <stdio.h> #include <fenv.h> int main() { double x = 0.3; fesetround(FE_TONEAREST); float y = (float) x; printf("y (nearest):%a\n", y); fesetround(FE_UPWARD); y = (float) x; printf("y (upward):%a\n", y); fesetround(FE_DOWNWARD); y = (float) x; printf("y (downward):%a\n", y); return (int) y; } ``` If...
2017 Nov 03
2
FW: clarification needed for the constrained fp implementation.
...g implementation defined. In clang the default state will be off. The C99 standard states that accessing the FP environment (testing FP status flags, changing FP control modes, etc.) when FENV_ACCESS is off is undefined behavior. The C99 standard provides library calls to access the environment (fesetround, fegetround, fetestexcept, etc.) but you can only safely use these if you have set FENV_ACCESS to the "on" state. A typical usage might look like this: #include <fenv.h> double someFunc(double A, double B, bool ForceRoundUp) { #pragma STDC FENV_ACCESS ON double Result; if (...
2017 Nov 04
2
FW: clarification needed for the constrained fp implementation.
...default state will be off. The C99 standard states that accessing > the FP environment (testing FP status flags, changing FP control > modes, etc.) when FENV_ACCESS is off is undefined behavior. The > C99 standard provides library calls to access the environment > (fesetround, fegetround, fetestexcept, etc.) but you can only > safely use these if you have set FENV_ACCESS to the “on” state. A > typical usage might look like this: > > #include <fenv.h> > > double someFunc(double A, double B, bool ForceRoundUp) { > > #pr...
2019 Nov 15
3
RFC: token arguments and operand bundles
...front ends should define clear circumstances under which such changes are permitted, but the mechanism for making such changes is independent of the constrained FP intrinsics. For example, consider the following C function. double foo(double A, double B, double C) { int OrigRM = fegetround(); fesetround(FE_TOWARDZERO); double tmp = A + B; fesetround(OrigRM); return tmp + C; } Assuming the compiler was in a state where it knew fenv access was enabled, I would expect that to get translated to something like this (after SROA cleanup): define double @foo(double %A, double %B, double %C) { %o...
2016 Aug 18
5
fenv.h vs the optimizer
...at, currently, the LLVM compiler does not regard to the exception-flag side-effects of floating point operations? When run on my macbook, the example code on http://en.cppreference.com/w/c/numeric/fenv/FE_exceptions does not print all the expected exceptions. Other examples: void foo() { fesetround(FE_DOWNWARD); printf("foo downward: %f\n", rint(0.5)); fesetround(FE_UPWARD); printf("foo upward: %f\n", rint(0.5)); } If compiled with optimization, only one call to rint() is made and the result is reused. void bar(double a, double b) { feclearexcept(FE_...
2019 Oct 03
2
[RFC] Using basic block attributes to implement non-default floating point environment
On 10/03, Kaylor, Andrew via llvm-dev wrote: > I’d like to emphasize that the constrained intrinsics prevent > optimizations *by default*. We have a plan to go back and teach > individual optimizations how to handle these intrinsics. The idea is > that if an optimization knows nothing about the constrained intrinsics > then it won’t try to transform them, but if an optimization has
2020 Sep 09
3
constrained cosine rounding mode behavior
Hi: I am trying to implement interval arithmetic through llvm. I have a problem with the rounding mode with llvm.experimental.constrained.cos I have two pieces of codes: ; Function Attrs: norecurse nounwind readnone ssp uwtable define double @cosine_down(double returned) local_unnamed_addr #0 {   ; call the llvm intrinsic to perform downward cosine
2020 Jan 18
2
Combining fast math flags with constrained intrinsics
...methingVague(double X, double Y, double Z) { // Some operation that doesn't need to be precise. if (X/Y > SomeThreshold) return doSomethingPrecise(X, Y); else return Z; } #pragma STDC FENV_ACCESS ON double doSomethingPrecise(double X, double Y) { int SaveRM = fegetround(); fesetround(FE_DOWNWARD); feclearexcept(FE_ALL_EXCEPT); double Temp = X * Y + Z; if (fetestexcept(FE_ALL_EXCEPT)) std::cerr << "Something happened.\n"; fesetround(SaveRM); return Temp; } -=-=-=-=-=-=-=-= Now suppose I compile that with "-O2 -ffp-contract=fast". We will...
2019 Nov 14
3
RFC: token arguments and operand bundles
Let me clarify. These aren’t intended to be exposed to the user. The user code that leads to the generation of these intrinsics will be normal floating point operations combined with either pragmas (such as “STDC FENV_ACCESS ON”) or command line options (such as the recently introduced “-fp-model=strict”). The reason I’ve been avoiding normal constant values is that it provides no information when
2017 Jul 20
0
Wine release 2.0.2
...@@QAE at XZ 42239 Kontact 5.6 needs api-ms-win-crt-time-l1-1-0.dll._Wcsftime 42240 Kontact 5.6 needs concrt140.dll.??0_ReentrantBlockingLock at details@Concurrency@@QEAA at XZ 42271 Final Fantasy X needs msvcr110.dll.__crtUnhandledException 42449 Multiple apps need function msvcr120.dll.fesetround (0 A.D., BeamNG.drive) 42463 ZmLearn crash at startup: "Assertion 'm->state == STATE_PASSIVE' failed at pulse/mainloop.c:787, function pa_mainloop_prepare(). Aborting." 42465 winhttp set_cookies() violates RFC6265 string comparison rules 42487 Free Devanagari font Sama...
2018 Mar 06
1
[cfe-dev] Why is #pragma STDC FENV_ACCESS not supported?
...n *get* at that data in the first place, since > it is just thown away when lowering the intrinsics to STRICT_... nodes. > In fact, I'm also not sure how the front-end is even supposed to be > *setting* those metadata flags -- is the compiler supposed to track > calls to fesetround and the like, and thereby determine which rounding > and exception modes apply to any given block of code? In fact, was the > original intention even that the back-end actually implements different > behavior based on this level of detail, or was the back-end supposed to > s...
2018 Jan 09
2
[cfe-dev] Why is #pragma STDC FENV_ACCESS not supported?
I think we're going to need to create a new mechanism to communicate strict FP modes to the backend. I think we need to avoid doing anything that will require re-inventing or duplicating all of the pattern matching that goes on in instruction selection (which is the reason we're currently dropping that information). I'm out of my depth on this transition, but I think maybe we could
2018 Feb 09
1
[cfe-dev] Why is #pragma STDC FENV_ACCESS not supported?
...w the back-end doesn't even *get* at that data in the first place, since it is just thown away when lowering the intrinsics to STRICT_... nodes. In fact, I'm also not sure how the front-end is even supposed to be *setting* those metadata flags -- is the compiler supposed to track calls to fesetround and the like, and thereby determine which rounding and exception modes apply to any given block of code? In fact, was the original intention even that the back-end actually implements different behavior based on this level of detail, or was the back-end supposed to support only two modes, the defa...
2017 Apr 13
0
Wine release 2.6
...i 2.0.1: No window content shown (just title bar) 41774 Rogue operatives - only white screen in game with HUD 41995 Neverwinter Online broken graphics and game crash with DX11 42352 The Solus Project: Backend can't handle opcode gather4 42449 Multiple apps need function msvcr120.dll.fesetround (0 A.D., BeamNG.drive) 42655 Aliens vs. Predator (2010) needs d3dx11_42.dll.D3DX11FilterTexture 42707 World of Warships: Cannot display inventory and clan screens 42736 scanf doesn't work as expected when using format string contains non-ascii chars 42747 DevExpress .NET Installer n...
2017 Mar 31
0
Wine release 2.5
...on. msvcrt: Add CurrentScheduler::Detach implementation. msvcrt: Add CurrentScheduler::Id implementation. msvcr100: Fix ThreadScheduler virtual table. msvcrt/tests: Add initial Scheduler tests. msvcrt: Fix handling of unsigned chars in scanf format. msvcr120: Add fesetround implementation. Viktor Semykin (1): shlwapi: Add SHCreateMemStream shlwapi.h. Vitaly Lipatov (2): include: Add PERF_DATA_BLOCK struct definition. advapi32/tests: Add test prototype for RegQueryValueEx HKEY_PERFORMANCE_DATA. Zebediah Figura (3): user32/tests: Add tests for...
2017 Apr 19
3
[cfe-dev] FE_INEXACT being set for an exact conversion from float to unsigned long long
Changing the list from cfe-dev to llvm-dev > On 20 Apr 2017, at 4:52 AM, Michael Clark <michaeljclark at mac.com> wrote: > > I’m getting close. I think it may be an issue with an individual intrinsic. I’m looking for the X86 lowering of Instruction::FPToUI. > > I found a comment around the rationale for using a conditional move versus a branch. I believe the predicate logic
2018 Jan 09
5
[cfe-dev] Why is #pragma STDC FENV_ACCESS not supported?
Andrew Kaylor wrote: >In general, the current "strict FP" handling stops at instruction >selection. At the MachineIR level we don't currently have a mechanism >to prevent inappropriate optimizations based on floating point >constraints, or indeed to convey such constraints to the backend. >Implicit register use modeling may provide some restriction on some
2020 Jan 27
11
Floating point semantic modes
Hi all, I'm trying to put together a set of rules for how the various floating point semantic modes should be handled in clang. A lot of this information will be relevant to other front ends, but the details are necessarily bound to a front end implementation so I'm framing the discussion here in terms of clang. Other front ends can choose to follow clang or not. The existence of this set