Re: [PATCH : RL78] Disable interrupts during hardware multiplication routines

2016-05-09 Thread Nick Clifton
Hi Kaushik, > gcc/ChangeLog > 2016-05-04 Kaushik Phatak > > * config/rl78/rl78.c (rl78_expand_prologue): Save the MDUC related > registers in all interrupt handlers if necessary. > (rl78_option_override): Add warning. > (MUST_SAVE_MDUC_REGISTERS): New macro. > (rl

RE: [PATCH : RL78] Disable interrupts during hardware multiplication routines

2016-05-04 Thread Kaushik Phatak
Specifies that interrupt handler functions should preserve the +MDUC registers. This is only necessary if normal code might use +the MDUC registers, for example because it performs multiplication +and division operations. The default is to ignore the MDUC registers +as this makes the interrupt han

Re: [PATCH : RL78] Disable interrupts during hardware multiplication routines

2016-01-12 Thread Mike Stump
On Jan 11, 2016, at 11:20 PM, Kaushik M Phatak wrote: > Kindly review the updated patch and let me know if it is OK. My review comment is still outstanding.

Re: [PATCH : RL78] Disable interrupts during hardware multiplication routines

2016-01-12 Thread Nick Clifton
Hi Kaushik, +/* Structure for G13 MDUC registers. */ +struct mduc_reg_type +{ + unsigned int address; + enum machine_mode mode; + bool is_volatile; +}; + +struct mduc_reg_type mduc_regs[NUM_OF_MDUC_REGS] = + {{0xf00e8, QImode, true}, + {0x0, HImode, true}, + {0x2, HImode, true}

Re: [PATCH : RL78] Disable interrupts during hardware multiplication routines

2016-01-11 Thread Kaushik M Phatak
rations. The default is to ignore the MDUC registers +as this makes the interrupt handlers faster. The target option -mg13 +needs to be passed for this to work as this feature is only available +on the G13 target (S2 core). The option will not have any effect if +the target does not have multiply h

Re: [PATCH : RL78] Disable interrupts during hardware multiplication routines

2016-01-07 Thread Nick Clifton
Hi Kaushik, Just a few comments on the patch itself: +/* Check if the block uses mul/div insns. */ +int +check_mduc_usage () I would suggest: static bool check_mduc_usage (void) instead, since this is a boolean function, only used in the rl78.c file, and it takes no arguments. +

Re: [PATCH : RL78] Disable interrupts during hardware multiplication routines

2016-01-07 Thread Kaushik M Phatak
Hi Mike, Thanks for the feedback regarding the ABI. I have added Nick and DJ in the loop to see if they can review this patch posted last month, https://gcc.gnu.org/ml/gcc-patches/2015-12/msg00733.html Best Regards, Kaushik On Wed, Dec 9, 2015 at 10:23 PM, Mike Stump wrote: > On Dec 9, 2015,

RE: [PATCH : RL78] Disable interrupts during hardware multiplication routines

2015-12-07 Thread Kaushik Phatak
Hi DJ, Please find attached an updated patch which tries to address the points raised by you in my earlier attempt, https://gcc.gnu.org/ml/gcc-patches/2015-08/msg01729.html 1. Added an option for -msave.. and -mno-save.. The default will be to save the MDUC registers for the g13 target in the

Re: [PATCH : RL78] Disable interrupts during hardware multiplication routines

2015-08-27 Thread DJ Delorie
> 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 d

Re: [PATCH : RL78] Disable interrupts during hardware multiplication routines

2015-08-27 Thread Mike Stump
On Aug 27, 2015, at 6:13 AM, Kaushik Phatak wrote:Hi DJ, > 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. So, I may have missed t

RE: [PATCH : RL78] Disable interrupts during hardware multiplication routines

2015-08-27 Thread Kaushik Phatak
7 @@ mes0 Target Mask(ES0) Assume ES is zero throughout program execution, use ES: for read-only data. + +msave-mduc-in-interrupts +Target Mask(SAVE_MDUC_REGISTER) +Specifies whether interrupt functions should save and restore the MDUC register. Index: gcc/doc/invoke.texi === --- gcc/doc/invoke.texi (revision 227024) +++ gcc/doc/invoke.texi (working copy) @@ -19026,6 +19026,14 @@ or 32 bits (@option{-m32bit-doubles}) in size. The default is @option{-m32bit-doubles}. +@item -msave-mduc-in-interrupts +@opindex msave-mduc-in-interrupts +Specifies that interrupt handler functions should preserve the +MDUC registers. This is only necessary if normal code might use +the MDUC register, for example because it performs multiplication +and division operations. The default is to ignore the MDUC registers +as this makes the interrupt handlers faster. The target option -mg13 + @end table @node RS/6000 and PowerPC Options -Original Message- From: DJ Delorie [mailto:d...@redhat.com] Sent: Friday, June 05, 2015 12:15 PM To: Kaushik Phatak Cc: gcc-patches@gcc.gnu.org; ni...@redhat.com Subject: Re: [PATCH : RL78] Disable interrupts during hardware multiplication routines

Re: [PATCH : RL78] Disable interrupts during hardware multiplication routines

2015-06-04 Thread DJ Delorie
Have you compared the latency of the multiply instructions to the overhead of saving those registers in the interrupt handler? What about the case where performance is priority, and the developer knows that the interrupt handlers don't use the multiply registers? Also, your code doesn't properly

[PATCH : RL78] Disable interrupts during hardware multiplication routines

2015-06-04 Thread Kaushik Phatak
Hi, Please find attached a patch which disables interrupts during inline hardware multiplication routines. These routines use up several control registers which are not saved/restored in interrupt routines. This causes corruption of result in case multiplication/division registers are used in ma