This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH : RL78] Disable interrupts during hardware multiplication routines
- From: DJ Delorie <dj at redhat dot com>
- To: Kaushik Phatak <Kaushik dot Phatak at kpit dot com>
- Cc: gcc-patches at gcc dot gnu dot org, nickc at redhat dot com
- Date: Thu, 27 Aug 2015 13:11:28 -0400
- Subject: Re: [PATCH : RL78] Disable interrupts during hardware multiplication routines
- Authentication-results: sourceware.org; auth=none
- References: <HKXPR03MB08064371B4EA243BB847C833FCB20 at HKXPR03MB0806 dot apcprd03 dot prod dot outlook dot com> <201506050644 dot t556igDi027743 at greed dot delorie dot com> <HK2PR03MB138012713E3B01220DD3E2DEFC6F0 at HK2PR03MB1380 dot apcprd03 dot prod dot outlook dot com>
> 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.