This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix SH Interrupt Handler ICE

> The call insn has "use fpscr" so interrupt handler sees FPSCR as live on all 
> targets and there are no push/pop patterns in for FPSCR.

Thanks for finding this.

There are some technical details in the patch that could be inproved.

> @@ -4445,7 +4449,9 @@ calc_live_regs (count_ptr, live_regs_mas
>                 && pr_live))
>            && reg != STACK_POINTER_REGNUM && reg != ARG_POINTER_REGNUM
>            && reg != RETURN_ADDRESS_POINTER_REGNUM
> -          && reg != T_REG && reg != GBR_REG)
> +          && reg != T_REG && reg != GBR_REG
> +          /* Push fpscr only on targets which have FPU */
> +          && (TARGET_FPU_ANY || reg != FPSCR_REG))
>         : (/* Only push those regs which are used and need to be saved.  */
>            (TARGET_SHCOMPACT
>             && flag_pic

The tests should in general be arranged so that cheap tests and tests that will
eliminate other tests in most cases come first, i.e. it should be:

&& (reg != FPSCR_REG || TARGET_FPU_ANY))

>         (push): Generate push_fpscr RTX
>         (pop): Generate pop_fpscr RTX
>         * gcc/config/sh/ : Add push_fpscr and pop_fpscr patterns

This introduces incorrect scheduling information.  The fpu_switch pattern already
has the correct information for pop (in the c/> alternative), it just needs
another alternative for push: </c, sts fpscr,%0, length 2, type store.
Incidentally, immediately after the fpu_switch pattern in, there
is a splitter that does generates a post-increment read of fpscr; to get
code to generate a pop, just substitute stack_pointer_rtx for operands[0].
Note that the REG_INC note will take care of the hit_stack attribute.

SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]