From a005570e2ca18626a11212dc55d9942f95eaccac Mon Sep 17 00:00:00 2001 From: Jozef Lawrynowicz Date: Wed, 14 Feb 2018 07:21:11 +0000 Subject: [PATCH] re PR target/79242 (ICE in simplify_subreg, at simplify-rtx.c:6029) 2018-02-14 Jozef Lawrynowicz PR target/79242 * machmode.def: Define a complex mode for PARTIAL_INT. * genmodes.c (complex_class): Return MODE_COMPLEX_INT for MODE_PARTIAL_INT. * doc/rtl.texi: Document CSPImode. * config/msp430/msp430.c (msp430_hard_regno_nregs): Add CPSImode handling. (msp430_hard_regno_nregs_with_padding): Likewise. PR target/79242 * gcc.target/msp430/pr79242.c: New test. From-SVN: r257653 --- gcc/ChangeLog | 11 +++++++++++ gcc/config/msp430/msp430.c | 4 ++++ gcc/doc/rtl.texi | 5 +++-- gcc/genmodes.c | 1 + gcc/machmode.def | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/msp430/pr79242.c | 11 +++++++++++ 7 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/msp430/pr79242.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3ddfff6564b..bcaf137e461 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2018-02-14 Jozef Lawrynowicz + + PR target/79242 + * machmode.def: Define a complex mode for PARTIAL_INT. + * genmodes.c (complex_class): Return MODE_COMPLEX_INT for + MODE_PARTIAL_INT. + * doc/rtl.texi: Document CSPImode. + * config/msp430/msp430.c (msp430_hard_regno_nregs): Add CPSImode + handling. + (msp430_hard_regno_nregs_with_padding): Likewise. + 2018-02-13 Peter Bergner PR target/84279 diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index 83e9e38af4c..a8fed123f7a 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -914,6 +914,8 @@ msp430_hard_regno_nregs (unsigned int, machine_mode mode) { if (mode == PSImode && msp430x) return 1; + if (mode == CPSImode && msp430x) + return 2; return ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD); } @@ -936,6 +938,8 @@ msp430_hard_regno_nregs_with_padding (int regno ATTRIBUTE_UNUSED, { if (mode == PSImode) return 2; + if (mode == CPSImode) + return 4; return msp430_hard_regno_nregs (regno, mode); } diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi index 43d5405ddb4..b5410f9689d 100644 --- a/gcc/doc/rtl.texi +++ b/gcc/doc/rtl.texi @@ -1303,10 +1303,11 @@ point values. The floating point values are in @code{QFmode}, @findex CDImode @findex CTImode @findex COImode -@item CQImode, CHImode, CSImode, CDImode, CTImode, COImode +@findex CPSImode +@item CQImode, CHImode, CSImode, CDImode, CTImode, COImode, CPSImode These modes stand for a complex number represented as a pair of integer values. The integer values are in @code{QImode}, @code{HImode}, -@code{SImode}, @code{DImode}, @code{TImode}, and @code{OImode}, +@code{SImode}, @code{DImode}, @code{TImode}, @code{OImode}, and @code{PSImode}, respectively. @findex BND32mode diff --git a/gcc/genmodes.c b/gcc/genmodes.c index a70f0967859..af0d280e208 100644 --- a/gcc/genmodes.c +++ b/gcc/genmodes.c @@ -119,6 +119,7 @@ complex_class (enum mode_class c) switch (c) { case MODE_INT: return MODE_COMPLEX_INT; + case MODE_PARTIAL_INT: return MODE_COMPLEX_INT; case MODE_FLOAT: return MODE_COMPLEX_FLOAT; default: error ("no complex class for class %s", mode_class_names[c]); diff --git a/gcc/machmode.def b/gcc/machmode.def index d5d5efc22ab..9505cc3e6df 100644 --- a/gcc/machmode.def +++ b/gcc/machmode.def @@ -260,6 +260,7 @@ UACCUM_MODE (UTA, 16, 64, 64); /* 64.64 */ /* Complex modes. */ COMPLEX_MODES (INT); +COMPLEX_MODES (PARTIAL_INT); COMPLEX_MODES (FLOAT); /* Decimal floating point modes. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0a2203185ef..a8dc606ad35 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-02-14 Jozef Lawrynowicz + + PR target/79242 + * gcc.target/msp430/pr79242.c: New test. + 2018-02-13 Peter Bergner PR target/84372 diff --git a/gcc/testsuite/gcc.target/msp430/pr79242.c b/gcc/testsuite/gcc.target/msp430/pr79242.c new file mode 100644 index 00000000000..d7ff8d38a3f --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/pr79242.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { "*-*-*" } { "-mcpu=msp430" "-msmall" } { "" } } */ +/* { dg-options "-mcpu=msp430x" } */ + +typedef _Complex __int20 C; + +C +foo (C x, C y) +{ + return x + y; +} -- 2.30.2