https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53513

--- Comment #36 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Oleg Endo from comment #35)
> Created attachment 33745 [details]
> Use SImode for FPSCR, add __builtin_sh_get_fpscr, __builtin_sh_set_fpscr
> 
> So I ended up removing the usage of PSImode for FPSCR and using SImode
> instead.  I've tested this patch on r216173, together with the already
> applied attachment 33727 [details] patch, with -m4 -ml and -m4 -mb.  There
> is one new failure:
> 
> FAIL: gcc.c-torture/execute/20021120-1.c   -O2 -flto -fuse-linker-plugin
> -fno-fat-lto-objects  (internal compiler error)
> 
> error: insn does not satisfy its constraints:
> (insn 1491 1489 1176 5 (set (reg:SI 12 r12)
>         (plus:SI (reg:SI 13 r13)
>             (const_int 24 [0x18]))) 20021120-1.c:39 76 {*addsi3_compact}
>      (nil))
> 
> 
> Summary:
> 
> insn 1173 stores the fpscr to r12
> 
> the mode switch (xor op) is done on r12
> 
> insn 1489 writes r12 (new fpscr value) on the stack
> 
> insn 1491 tries to recalculate the stack address and put it into r12, to
> satisfy the memory constraints of fpu_switch (which now accepts post-inc
> load and simple register address).
> 
> insn 1776 tries to load it from the stack
> 
> 
> Reload generates a wrong insn addsi3 insn.  Something similar was happening
> in PR 55212, too.

Disallowing memory operands (except pre-dec store, post-inc load for push,pop)
in the fpu_switch pattern fixes that failure.  Although it might result in less
optimal code in some cases where user code wants to store the current fpscr in
memory.  On the other hand, the generated memory address code in such cases is
not very good anyway.  Thus it's probably better to drop that for now.

Reply via email to