Re: RFA: RL78: Fix multiply costs when optimizing for size

2015-08-05 Thread DJ Delorie
> OK to apply ? Ok. Thanks! > gcc/ChangeLog > 2015-08-05 Nick Clifton > > * config/rl78/rl78.c (rl78_rtx_costs): Treat MULT insns as cheap > if optimizing for size. > > Index: gcc/config/rl78/rl78.c > === > RCS f

Re: RFA: RL78: Remove far operand optimization in rl78_force_nonfar_3

2015-08-05 Thread Nick Clifton
Hi DJ, This is OK, but note that it prevents some operations like: __far int i; foo() { i ++; } from being implemented with a minimum set of opcodes. This might be particularly troublesome for volatile far things. Right - it is something I will have to look into. Cheers Nick

RFA: RL78: Fix multiply costs when optimizing for size

2015-08-05 Thread Nick Clifton
Hi DJ, The patch below fixes a small problem with the RL78 backend. When optimizing for size it is better to use a slow multiply instruction than a faster, but larger, shift sequence. So the patch tweaks the rtx costs for MULT insns when speed is not a priority. Tested with no regress

Re: RFA: RL78: Remove far operand optimization in rl78_force_nonfar_3

2015-08-04 Thread DJ Delorie
This is OK, but note that it prevents some operations like: __far int i; foo() { i ++; } from being implemented with a minimum set of opcodes. This might be particularly troublesome for volatile far things.

RFA: RL78: Remove far operand optimization in rl78_force_nonfar_3

2015-08-04 Thread Nick Clifton
Hi DJ, It turns out that the optimization in rl78_force_nonfar_3 to allow some special cases to be kept in far pointers does not always work. The test case included with this patch will trigger ICEs if the optimization is allowed to persist. So, may I check this patch in please ? Cheer

Re: RFA: RL78: Add an optimization to the addsi3 pattern

2015-07-27 Thread DJ Delorie
Ok, but please don't put non-public issue numbers in the comments.

RFA: RL78: Add an optimization to the addsi3 pattern

2015-07-27 Thread Nick Clifton
Hi DJ, This patch adds a small optimization to the RL78 addsi3 pattern so that it can skip adding in the high part of a constant symbolic address when -mes0 is active. Under these circumstances we know that the address has to be in low memory and that it is invalid to attempt to access

Re: RFA: RL78: With -mes0 put read only data in the .frodata section

2015-06-08 Thread DJ Delorie
Ok. Thanks!

RFA: RL78: With -mes0 put read only data in the .frodata section

2015-06-08 Thread Nick Clifton
Hi DJ, The -mes0 option for the RL78 backend should put read only data into a special .frodata section, but unfortunately my recent update to the rl78_select_section function broke this behaviour. Below is a patch to fix this. Tested with no regressions on an rl78-elf toolchain. OK to

Re: RFA: RL78:

2015-06-02 Thread DJ Delorie
Ok. Thanks!

RFA: RL78:

2015-06-02 Thread Nick Clifton
Hi DJ, This patch contains two small improvements for the RL78 compiler: 1. A peephole to match: movwax, ! movwbc, ax callbc with: movwax, ! callax 2. A change to avoid pushing the frame pointer register in an interru

Re: RFA: RL78: Place zero-initialised data into the .bss section

2015-05-14 Thread Nicholas Clifton
Hi DJ, Ok but.. +case SECCAT_TBSS: + return default_select_section (decl, reloc, align); + +default: + gcc_unreachable (); Would it be better to just "default:" everything to default_select_section, instead of enumerating everything we know about today? Yes it would. :-}

Re: RFA: RL78: Place zero-initialised data into the .bss section

2015-05-13 Thread DJ Delorie
> OK to apply ? Ok but.. > +case SECCAT_TBSS: > + return default_select_section (decl, reloc, align); > + > +default: > + gcc_unreachable (); Would it be better to just "default:" everything to default_select_section, instead of enumerating everything we know about today?

RFA: RL78: Place zero-initialised data into the .bss section

2015-05-13 Thread Nick Clifton
Hi DJ, Currently the RL78 port does not place zero-initialised data in the .bss section. This is because of the rl78_select_section() function which does not handle bss data. The patch below updates the function to handle that and other types of data so that they end up in the expected

Re: RFA: RL78: Save the frame pointer if it is used.

2015-05-06 Thread Nicholas Clifton
Hi DJ, OK to apply ? Ok, but... Thanks - committed. - if (regno == FRAME_POINTER_REGNUM && frame_pointer_needed) + if (regno == FRAME_POINTER_REGNUM + && (frame_pointer_needed || df_regs_ever_live_p (regno))) Do we want regs_ever_live or regs_ever_written_to ? I seem to recall

Re: RFA: RL78: Save the frame pointer if it is used.

2015-05-05 Thread DJ Delorie
> OK to apply ? Ok, but... > - if (regno == FRAME_POINTER_REGNUM && frame_pointer_needed) > + if (regno == FRAME_POINTER_REGNUM > + && (frame_pointer_needed || df_regs_ever_live_p (regno))) Do we want regs_ever_live or regs_ever_written_to ? I seem to recall changing a port... mep per

RFA: RL78: Save the frame pointer if it is used.

2015-05-05 Thread Nick Clifton
Hi DJ, Below is a small patch to fix a small problem with the need_to_save() function in the RL78 backend. It was only marking the frame pointer register as needing a save if the frame pointer was in use. But since the frame pointer is call-saved it needs to be saved any time it is use

Re: [BUILDROBOT] RFA: RL78: Add support for G13 and G14 multiply and divide

2015-04-23 Thread Nicholas Clifton
Hi Jan-Benedict. ../../../gcc/gcc/config/rl78/rl78.c:390:14: error: enumeration value ‘MUL_RL78’ not handled in switch [-Werror=switch] switch (rl78_mul_type) ../../../gcc/gcc/config/rl78/rl78.c:4649:34: error: unused parameter ‘x’ [-Werror=unused-parameter] rl78_preferred_reload_

Re: RFA: RL78: Add support for G13 and G14 multiply and divide

2015-04-15 Thread DJ Delorie
> OK to apply ? Ok. > gcc/ChangeLog > 2015-04-15 Nick Clifton > > * config/rl78/rl78-opts.h (enum rl78_mul_types): Add MUL_G14 and > MUL_UNINIT. > (enum rl78_cpu_type): New. > * config/rl78/rl78-virt.md (attr valloc): Add divhi and divsi. > (umulhi3_shift_virt

RFA: RL78: Add support for G13 and G14 multiply and divide

2015-04-15 Thread Nick Clifton
Hi DJ, The attached patch adds support for the RL78 divide and modulus capabilities (both as an instruction in G14 cores and as a hardware peripheral in G13 cores). It also updates the multiply patterns to add clobbers of the AX and BC registers, which helps fix some reload problems wit

Re: RFA: RL78:

2015-04-14 Thread DJ Delorie
> OK to apply ? Ok! > 2015-04-14 Nick Clifton > > * config/rl78/rl78.c (rl78_expand_prologue): Mark large stack > decrement instruction as being frame related. > (rl78_print_operand_1): Handle 'p' modifier to add +0 to HL > based addresses. > If zero extendi

RFA: RL78:

2015-04-14 Thread Nick Clifton
Hi DJ, I would like permission to apply this patch to the RL78 backend. It tidies up a few minor bugs, specifically: * The prologue instruction to increment the stack pointer by a large amount was not being marked as frame related. * The %p operand operator was not using %code

Re: RFA: RL78: Add muladdhi3 pattern

2015-03-03 Thread DJ Delorie
> The problem appears to be that GCC will create a multiply-plus-add > instruction to access the table regardless of whether the backend > supports such an instruction. I could not work out where in the > middle end this was occurring, so instead I created the patch below > which contai

Re: RFA: RL78: Fix register constraints in rl78-real.md

2015-03-03 Thread DJ Delorie
> OK to apply ? Ok.

RFA: RL78: Add muladdhi3 pattern

2015-03-03 Thread Nick Clifton
Hi DJ, Compiling this test case with the RL78 toolchain results in an ICE: unsigned char g_X; unsigned char g_Y; const __far unsigned char TabA[2][2] = { { 3, 0 }, { 4, 5 } }; void main (void) { g_X = 1; g_Y = TabA[g_X][g_X]; } The problem appears to be that GCC will create a

RFA: RL78: Fix register constraints in rl78-real.md

2015-03-03 Thread Nick Clifton
Hi DJ, Compiling a program with one of the real RL78 registers marked as call-used (eg via -fcall-used-ax), can trigger an internal compiler error. Although modifying the ABI in this way may not be a good idea, it is still wrong that the compiler generates an ICE. The patch below fixes

Re: RFA: RL78: Fix gcc testsuite failures

2015-02-10 Thread Nicholas Clifton
Hi Jan-Benedict, Seems you accidentally committed quite some more code you're currently working on in that very commit, which is now breaking Doh! Yes, sorry about that. I have now reverted the DIV attribute part of the patch. (I am hoping that this work will be ready for contributing soo

Re: RFA: RL78: Fix gcc testsuite failures

2015-02-07 Thread Jan-Benedict Glaw
On Wed, 2015-02-04 11:14:16 +, Nick Clifton wrote: > Please can I apply the patch below to fix some RL78 gcc testsuite > failures ? [...] > The second fix is to the RL78 specific dead-code elimination pass > which was failing to note the REGs inside a MEM are used when that MEM > is

Re: RFA: RL78: Fix gcc testsuite failures

2015-02-04 Thread DJ Delorie
Ok.

RFA: RL78: Fix gcc testsuite failures

2015-02-04 Thread Nick Clifton
Hi DJ, Please can I apply the patch below to fix some RL78 gcc testsuite failures ? The patch does two things: Firstly in the RL78 assembler version of the __addsf3 function it fixes a corner case where rounding up the fraction results in an overflow into an unused bit. The problem h

Re: RFA: RL78: Minor prologue and epilogue enhancements

2015-01-26 Thread DJ Delorie
> OK to apply ? Ok.

Re: RFA: RL78: Add assembler versions of some libgcc functions.

2015-01-26 Thread DJ Delorie
> OK to apply ? Ok.

RFA: RL78: Add assembler versions of some libgcc functions.

2015-01-26 Thread Nick Clifton
Hi DJ, The attached patch provides some enhancements to libgcc for the RL78. It includes faster and smaller versions of the bit counting and simple floating point functions, and a version of the integer multiply support function designed to work on the G10. Tested on an rl78-elf toolcha

RFA: RL78: Minor prologue and epilogue enhancements

2015-01-26 Thread Nick Clifton
Hi DJ, The patch below contains two minor enhancements for the RL78 prologue and epilogue code. The first is for when a large amount of local stack space needs to be allocated. Rather than generating a long sequence of SUB SP, # instructions, the patched codes moves SP into AX, perform

Re: RFA: RL78: Scan inside PARALLELs when looking for dead code

2015-01-20 Thread DJ Delorie
> Here is a small patch to fix a code-gen problem for the RL78. The bug > was that the register death pass was not looking inside PARALLELs, and > thus missing some USE and SET cases. I considered adding code to scan > all of the elements in the PARALLEL, but the only ones that can be >

RFA: RL78: Scan inside PARALLELs when looking for dead code

2015-01-20 Thread Nick Clifton
Hi DJ, Here is a small patch to fix a code-gen problem for the RL78. The bug was that the register death pass was not looking inside PARALLELs, and thus missing some USE and SET cases. I considered adding code to scan all of the elements in the PARALLEL, but the only ones that can be g

Re: RFA: RL78: Fix handling of (SUBREG (SYMBOL_REF))

2014-04-02 Thread DJ Delorie
This is OK. Thanks!

RFA: RL78: Fix handling of (SUBREG (SYMBOL_REF))

2014-04-02 Thread Nick Clifton
Hi DJ, The patch below is to fix a snafu I made whilst fixing some problems with the RL78 port a while ago. GCC was generating (SUBREG (SYMBOL_REF) ) which made no sense to me, so I had the movqi expander just fail when it encountered them. Now that I have more idea about why they are

Re: RFA: RL78: Add missing instruction patterns

2014-02-28 Thread DJ Delorie
> * config/rl78/rl78-real.md (cbranchsi4_real_signed): Add > anti-cacnonical alternatives. > (negandhi3_real): New pattern. > * config/rl78/rl78-virt.md (negandhi3_virt): New pattern. These are fine, although I don't know why gcc would require a negandhi3 pattern...

Re: RFA: RL78: Add missing instruction patterns

2014-02-18 Thread nick clifton
Hi DJ, I'm OK with adding patterns in general, but I wonder if gcc would produce better code if they were split into QImode ops earlier? Probably. In fact I double checked and I can no longer find the tests that triggered the need for the new "andhi3" and "xorhi3" patterns, so the revised p

Re: RFA: RL78: Add missing instruction patterns

2014-02-14 Thread DJ Delorie
I'm OK with adding patterns in general, but I wonder if gcc would produce better code if they were split into QImode ops earlier? + [(set (match_operand:HI 0 "register_operand" "=Av") + (and:HI (match_operand:HI 1 "register_operand" "0") + (match_operand:HI 2 "immed

RFA: RL78: Add missing instruction patterns

2014-02-14 Thread Nick Clifton
Hi DJ, The patch below adds some missing instruction patterns to the RL78 backend. Missing in the sense that gcc generates the RTL even if the patterns are not present in the backend and then triggers an ICE because they cannot be matched. It is not clear to me why this should be happe

Re: RFA: RL78: Fix UMUL and $FP size

2014-01-29 Thread DJ Delorie
Yup, these are OK. Thanks!

RFA: RL78: Fix UMUL and $FP size

2014-01-29 Thread Nick Clifton
Hi DJ, I noticed a couple of RL78 patches in our local tree that ought to be upstream, so here they are. The first is for the size of the frame pointer register and the second is for the UMUL instruction when both input operands are in the same register. OK to apply ? Cheers Nick g

Re: RFA: RL78: Add support for naked function attribute.

2013-05-16 Thread DJ Delorie
This one is OK. > 2013-05-16 Nick Clifton > > * config/rl78/rl78.c (rl78_attribute_table): Add naked. > (rl78_is_naked_func): New function. > (rl78_expand_prologue): Skip prologue generation for naked > functions. > (rl78_expand_epilogue): Skip epilogue g

RFA: RL78: Add support for naked function attribute.

2013-05-16 Thread Nick Clifton
Hi DJ, OK, I am abandoning my RL78 interrupt prologue patch for now. There are just too many complications to make it work. Instead here is a much simpler patch to add support for a naked function attribute. OK to apply ? Cheers Nick gcc/ChangeLog 2013-05-16 Nick Clifton

Re: RFA: RL78: Improve interrupt function generation

2013-05-08 Thread DJ Delorie
> Yes - in fact this appears to be a general problem with RL78 interrupt > handlers. There are no instructions to push/pop the current bank > selection, so in order for nested interrupt handlers to work they would > have to do something like: The bank select bits are in PSW, which is automati

Re: RFA: RL78: Improve interrupt function generation

2013-05-08 Thread nick clifton
Hi DJ, * Uses register bank 3 instead of register bank 0 inside the handler. I wonder if nested interrupts will cause problems, since the second interrupt will occur with RB3 already selected. Yes - in fact this appears to be a general problem with RL78 interrupt handlers. Ther

Re: RFA: RL78: Improve interrupt function generation

2013-05-06 Thread DJ Delorie
> * Uses register bank 3 instead of register bank 0 inside the > handler. I wonder if nested interrupts will cause problems, since the second interrupt will occur with RB3 already selected. Also, there are some hand-coded routines in libgloss/libgcc that manually swap banks, they'd hav

RFA: RL78: Improve interrupt function generation

2013-05-01 Thread Nick Clifton
Hi DJ, The patch below makes some changes to the way the RL78 backend handles the generation of interrupt functions. Specifically it: * Uses register bank 3 instead of register bank 0 inside the handler. * Tweaks the need_to_save() function so only those registers that w

Re: RFA: RL78: Improve prologues for interrupt handlers

2013-03-26 Thread DJ Delorie
The problem is, devirt hasn't happened yet when we compute the frame size, so we *can't* know if bank 0 registers are used yet. Also, I've had problems recomputing the frame size after reload. If the frame size changes for *any* reason between reload and prologue, you get corrupt code, as the el

RFA: RL78: Improve prologues for interrupt handlers

2013-03-26 Thread Nick Clifton
Hi DJ, I am submitting a patch on behalf of Renesas and KPIT. They found a way to improve the prologues for interrupt handlers so that only the registers that actually need to be saved are pushed onto the stack. The patch has been tested with no regressions in the gcc testsuite for an

Re: RFA: RL78: Allow SP to be used as a base register

2013-01-28 Thread DJ Delorie
> Please may I apply the patch below. It fixes the RL78 backend so that > the stack register can be used as a base address register. Yes, please. Thanks!

RFA: RL78: Allow SP to be used as a base register

2013-01-28 Thread Nick Clifton
Hi DJ, Please may I apply the patch below. It fixes the RL78 backend so that the stack register can be used as a base address register. Tested with no regressions on an rl78-elf toolchain. Cheers Nick PS. I am currently investigating allow r8-r15 to be used as base registers. gcc/Cha

Re: RFA: RL78: Correct values of the MDBL and MDBH registers

2013-01-07 Thread DJ Delorie
I did notice that the hardware didn't work the same way as the documentation... this would explain it. Yes, please apply it :-)

Re: RFA: RL78: Always select register bank 0 at the start of an ISR

2013-01-07 Thread DJ Delorie
I think that's right, since the ISR return restores the flag register, which has the bank select bits in it.

RFA: RL78: Correct values of the MDBL and MDBH registers

2013-01-03 Thread Nick Clifton
Hi DJ, There is a error in the RL78 G13 hardware manual. Section 14, Figure 14-3 lists the values of the MDBL registers as 4H, 5H and the MDBH registers as 6H, 7H. This is incorrect. The correct values are shown in Section 3, Table 3-5: MDBL => 6H, 7H, MDBH =>

RFA: RL78: Always select register bank 0 at the start of an ISR

2013-01-03 Thread Nick Clifton
Hi DJ, Since interrupts can happen at any time, it is possible for a ISR to be called when register bank 0 is not the currently selected bank. Hence the prologue for an interrupt handler should always select bank 0 before saving any registers. The patch below makes sure that this happen

Re: RFA: RL78: Add -fstack-usage support

2012-04-05 Thread DJ Delorie
> OK for mainline/4.7 branch ? Ok with me

Re: RFA: RL78: Add -fstack-usage support

2012-04-04 Thread nick clifton
Hi Eric, > On 04/04/12 12:24, Eric Botcazou wrote: You probably need to adjust gcc.dg/stack-usage-1.c too. s/flag_stack_usage/flag_stack_usage_info/ Thanks for the corrections. Revised patch attached. OK for mainline/4.7 branch ? Cheers Nick gcc/ChangeLog 2012-04-04 Nick Clifton

Re: RFA: RL78: Add -fstack-usage support

2012-04-04 Thread Eric Botcazou
> Please could I apply the patch below to the RL78 port ? It adds > support for generating stack use info with the -fstack-usage option. You probably need to adjust gcc.dg/stack-usage-1.c too. > Index: gcc/config/rl78/rl78.c > =

RFA: RL78: Add -fstack-usage support

2012-04-04 Thread Nick Clifton
Hi DJ, Please could I apply the patch below to the RL78 port ? It adds support for generating stack use info with the -fstack-usage option. Also - may I apply this patch to the 4.7 branch as well please ? Cheers Nick gcc/ChangeLog 2012-04-04 Nick Clifton * config/rl78/rl78.