1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Work around a gcc bug. This fixes feholdexcept() et al. at -O1.

Symptoms of the problem included assembler warnings and
nondeterministic runtime behavior when a fe*() call that affects the
fpsr is closely followed by a float point op.

The bug (at least, I think it's a bug) is that gcc does not insert a
break between a volatile asm and a dependent instruction if the
volatile asm came from an inlined function.  Volatile asms seem to be
fine in other circumstances, even without -mvolatile-asm-stop, so
perhaps the compiler adds the stop bits before inlining takes place.
The problem does not occur at -O0 because inlining is disabled, and it
doesn't happen at -O2 because -fschedule-insns2 knows better.
This commit is contained in:
David Schultz 2005-03-05 20:34:45 +00:00
parent 494f3ca182
commit f4a5643005
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=143165

View File

@ -61,7 +61,7 @@ extern const fenv_t __fe_dfl_env;
#define _FPUSW_SHIFT 13
#define __stfpsr(__r) __asm __volatile("mov %0=ar.fpsr" : "=r" (*(__r)))
#define __ldfpsr(__r) __asm __volatile("mov ar.fpsr=%0" : : "r" (__r))
#define __ldfpsr(__r) __asm __volatile("mov ar.fpsr=%0;;" : : "r" (__r))
static __inline int
feclearexcept(int __excepts)