> I have worked out an updated patch, which would save the MDUC specific 
> registers
> in the interrupt routine when the option '-msave-mduc-in-interrupts' is 
> passed.
> This gets active only for the G13 targets.

Perhaps we should have both a -msave... and -mno-save... (gcc provides
these by default) with the default if neither is provided, to be "save
if g13"?

As an optimization, gcc could test the interrupt function to see if it
has any multiplcation or call insns, and if not, don't bother with the
(determined to be unneeded) saves.

> +(define_insn "movqi_from_mduc"
> +  [(set (match_operand:QI 0 "register_operand" "=a")
> +(unspec_volatile:QI [(match_operand:QI 1 "" "")] UNS_BUILTIN_MDUC))]
> +  ""
> +  "mov\t%0, !0xf00e8"
> +)

You shouldn't need special move insns for these; they're regular
variables.  Just generate the RTL for the memory references (make sure
they're volatile) and use the standard movhi patterns.

Unspec patterns are typically used for unknown *opcodes*, not special
registers or memory locations.

> @@ -1273,6 +1280,7 @@
>    int i, fs;
>    rtx sp = gen_rtx_REG (HImode, STACK_POINTER_REGNUM);
>    rtx ax = gen_rtx_REG (HImode, AX_REG);
> +  rtx operand1;
>    int rb = 0;
> 
>    if (rl78_is_naked_func ())
> @@ -1330,6 +1338,39 @@
>        F (emit_insn (gen_push (ax)));
>      }
> 
> +  /* Save MDUC register from interrupt routine.  */
> +  if (MUST_SAVE_MDUC_REGISTER)
> +    {
> +      emit_insn (gen_movqi_from_mduc (gen_rtx_REG (QImode, A_REG),
> +      gen_rtx_UNSPEC_VOLATILE (QImode, gen_rtvec (1, operand1),
> +       UNS_BUILTIN_MDUC)));

You never set operand1 to anything.  Since you never use it, you don't
really need it in the patterns either (just put [(const_int 0)] in the
unspec).  (but better to use a regular movhi as described above).

> +as this makes the interrupt handlers faster. The target option -mg13

That last bit is not a complete sentence.

> This message contains information that may be privileged or
> confidential . . .

Reminder that such notices are inappropriate for public mailing lists.

Reply via email to