On 14/02/18 07:25, Jeff Law wrote:
On 02/08/2018 09:54 AM, Jozef Lawrynowicz wrote:
ping x1

Complex Partial Integers are unimplemented, resulting in an ICE when
attempting to use them. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79242
This results in GCC7/8 for msp430-elf failing to build.

typedef _Complex __int20 C;

foo (C x, C y)
   return x + y;

(Thanks Jakub - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79242#c2)

../../gcc/testsuite/gcc.target/msp430/pr79242.c: In function 'foo':
../../gcc/testsuite/gcc.target/msp430/pr79242.c:8:1: internal compiler
error: in make_decl_rtl, at varasm.c:1304
  foo (C x, C y)
0xc07b29 make_decl_rtl(tree_node*)
0x67523c set_parm_rtl(tree_node*, rtx_def*)
0x79ffb9 expand_function_start(tree_node*)
0x6800e1 execute

The attached patch defines a new complex mode for PARTIAL_INT.
You may notice that genmodes.c:complex_class returns MODE_COMPLEX_INT for
MODE_PARTIAL_INT rather than MODE_COMPLEX_PARTIAL_INT. I reviewed the uses of
MODE_COMPLEX_INT and it doesn't looked like a Complex Partial Int requires any
different behaviour to MODE_COMPLEX_INT.

msp430_hard_regno_nregs now returns 2 for CPSImode, but I feel like this may be
better handled in the front-end. PSImode is already defined to only use 1
register, so for a CPSI shouldn't the front-end should be able to work out that
double the amount of registers are required? Thoughts?
Without the definition for CPSI in msp430_hard_regno_nregs,
rtlanal.c:subreg_get_info thinks that a CPSI requires 4 registers of size 2,
instead of 2 registers of size 4.

Successfully bootstrapped and tested for c,c++,fortran,lto,objc on
x86_64-pc-linux-gnu with no regressions on gcc-7-branch.

With this patch gcc-7-branch now builds for msp430-elf. A further bug prevents
trunk from building for msp430-elf.

If the attached patch is acceptable, I would appreciate if someone would commit
it for me (to trunk and gcc-7-branch), as I do not have write access.


 From 31d8554ebb6afeb2d8f235cf3d3c262236aa5e32 Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozefl....@gmail.com>
Date: Fri, 12 Jan 2018 13:23:40 +0000
Subject: [PATCH] Add support for Complex Partial Integers - CPSImode

2018-01-XX  Jozef Lawrynowicz <jozefl....@gmail.com>

   PR target/79242
   * machmode.def: Define a complex mode for PARTIAL_INT.
   * genmodes.c (complex_class): Return MODE_COMPLEX_INT for
   * doc/rtl.texi: Document CSPImode.
   * config/msp430/msp430.c (msp430_hard_regno_nregs): Add CPSImode
     (msp430_hard_regno_nregs_with_padding): Likewise.

   PR target/79242
   * gcc.target/msp430/pr79242.c: New test.
Thanks.  Installed.


Thanks! Do you mind applying to gcc-7-branch as well?


Reply via email to