Hello!

> Over at RTEMS, we have had a report that this very old code has quit
> compiling:
>
> #ifdef __SSE__
> #define _CPU_Context_restore_fp(fp_context_pp) \
>  do {                                         \
>    __asm__ __volatile__(                      \
>      "fldcw %0"                               \
>      ::"m"((*(fp_context_pp))->fpucw)         \
>      :"fpcr"                                  \
>    );                                         \
>    __builtin_ia32_ldmxcsr(_Thread_Executing->fp_context->mxcsr);  \
>  } while (0)
> #else
>
> The error is "error: unknown register name 'fpcr' in 'asm'"

Just remove the fpcr clobber. FP control register was never properly handled.

Please also note gcc manual section "6.47.2.1 Volatile", where the
manual discusses similar case of a system register that controls the
rounding mode of floating-point operations. You have to add an
artificial dependency to the asm by referencing a variable in the
subsequent code, otherwise the compiler may move the access to system
register across the arithmetic insn.

Uros.

Reply via email to