* [PATCH,rs6000] PR80103: Fix ICE with cross compiler
@ 2017-03-24 22:10 Kelvin Nilsen
2017-03-24 23:23 ` Segher Boessenkool
0 siblings, 1 reply; 4+ messages in thread
From: Kelvin Nilsen @ 2017-03-24 22:10 UTC (permalink / raw)
To: gcc-patches; +Cc: Segher Boessenkool
PR 80103 provides a test case which results in an internal
compiler error when invoked with -mno-direct-move -mpower9-dform-
vector target options. The internal compiler error results because
these two target options are incompatible with each other.
The enclosed patch simply disables this particular combination of
target options, terminating gcc with an error message instead of
producing an internal compiler error. Additionally, this patch
includes new comments to address omissions from a patch committed
on 2017/03/23 which deals with conflicts between the
-mno-power9-vector and -mcpu=power9 target options.
This patch has been bootstrapped and tested with no regressions on
both powerpc64-unknown-linux-gnu and powerpc64le-unknown-linux-gnu.
Is this ok for the trunk?
gcc/testsuite/ChangeLog:
2017-03-24 Kelvin Nilsen <kelvin@gcc.gnu.org>
PR target/80103
* gcc.target/powerpc/pr80103-1.c: New test.
gcc/ChangeLog:
2017-03-24 Kelvin Nilsen <kelvin@gcc.gnu.org>
PR target/80103
* config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Edit and
add comments.
* config/rs6000/rs6000.c (rs6000_option_override_internal): Add
special handling for target option conflicts between dform
options (-mpower9-dform, -mpower9-dform-vector,
-mpower9-dform-scalar) and -mno-direct-move.
Index: gcc/config/rs6000/rs6000-c.c
===================================================================
--- gcc/config/rs6000/rs6000-c.c (revision 246406)
+++ gcc/config/rs6000/rs6000-c.c (working copy)
@@ -429,6 +429,12 @@ rs6000_target_modify_macros (bool define_p, HOST_W
if ((flags & OPTION_MASK_POPCNTD) != 0)
rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR7");
/* Note that the OPTION_MASK_DIRECT_MOVE flag is automatically
+ turned on in the following condition:
+ 1. TARGET_P9_DFORM_SCALAR or TARGET_P9_DFORM_VECTOR are enabled
+ and OPTION_MASK_DIRECT_MOVE is not explicitly disabled.
+ Hereafter, the OPTION_MASK_DIRECT_MOVE flag is considered to
+ have been turned on explicitly.
+ Note that the OPTION_MASK_DIRECT_MOVE flag is automatically
turned off in any of the following conditions:
1. TARGET_HARD_FLOAT, TARGET_ALTIVEC, or TARGET_VSX is explicitly
disabled and OPTION_MASK_DIRECT_MOVE was not explicitly
@@ -473,8 +479,13 @@ rs6000_target_modify_macros (bool define_p, HOST_W
if (!flag_iso)
rs6000_define_or_undefine_macro (define_p, "__APPLE_ALTIVEC__");
}
- /* Note that the OPTION_MASK_VSX flag is automatically turned off in
+ /* Note that the OPTION_MASK_VSX flag is automatically turned on in
the following conditions:
+ 1. TARGET_P8_VECTOR is explicitly turned on and the OPTION_MASK_VSX
+ was not explicitly turned off. Hereafter, the OPTION_MASK_VSX
+ flag is considered to have been explicitly turned on.
+ Note that the OPTION_MASK_VSX flag is automatically turned off in
+ the following conditions:
1. The operating system does not support saving of AltiVec
registers (OS_MISSING_ALTIVEC).
2. If any of the options TARGET_HARD_FLOAT, TARGET_FPRS,
@@ -507,6 +518,12 @@ rs6000_target_modify_macros (bool define_p, HOST_W
rs6000_define_or_undefine_macro (define_p, "__TM_FENCE__");
}
/* Note that the OPTION_MASK_P8_VECTOR flag is automatically turned
+ on in the following conditions:
+ 1. TARGET_P9_VECTOR is explicitly turned on and
+ OPTION_MASK_P8_VECTOR is not explicitly turned off.
+ Hereafter, the OPTION_MASK_P8_VECTOR flag is considered to
+ have been turned off explicitly.
+ Note that the OPTION_MASK_P8_VECTOR flag is automatically turned
off in the following conditions:
1. If any of TARGET_HARD_FLOAT, TARGET_ALTIVEC, or TARGET_VSX
were turned off explicitly and OPTION_MASK_P8_VECTOR flag was
@@ -514,15 +531,24 @@ rs6000_target_modify_macros (bool define_p, HOST_W
2. If TARGET_ALTIVEC is turned off. Hereafter, the
OPTION_MASK_P8_VECTOR flag is considered to have been turned off
explicitly.
- 3. If TARGET_VSX is turned off. Hereafter, the OPTION_MASK_P8_VECTOR
- flag is considered to have been turned off explicitly. */
+ 3. If TARGET_VSX is turned off and OPTION_MASK_P8_VECTOR was not
+ explicitly enabled. If TARGET_VSX is explicitly enabled, the
+ OPTION_MASK_P8_VECTOR flag is hereafter also considered to
+ have been turned off explicitly. */
if ((flags & OPTION_MASK_P8_VECTOR) != 0)
rs6000_define_or_undefine_macro (define_p, "__POWER8_VECTOR__");
/* Note that the OPTION_MASK_P9_VECTOR flag is automatically turned
off in the following conditions:
- 1. If TARGET_P8_VECTOR is turned off. Hereafter, the
- OPTION_MASK_P9_VECTOR flag is considered to have been turned off
- explicitly. */
+ 1. If TARGET_P8_VECTOR is turned off and OPTION_MASK_P9_VECTOR is
+ not turned on explicitly. Hereafter, if OPTION_MASK_P8_VECTOR
+ was turned on explicitly, the OPTION_MASK_P9_VECTOR flag is
+ also considered to have been turned off explicitly.
+ Note that the OPTION_MASK_P9_VECTOR is automatically turned on
+ in the following conditions:
+ 1. If TARGET_P9_DFORM_SCALAR or TARGET_P9_DFORM_VECTOR and
+ OPTION_MASK_P9_VECTOR was not turned off explicitly.
+ Hereafter, THE OPTION_MASK_P9_VECTOR flag is considered to
+ have been turned on explicitly. */
if ((flags & OPTION_MASK_P9_VECTOR) != 0)
rs6000_define_or_undefine_macro (define_p, "__POWER9_VECTOR__");
/* Note that the OPTION_MASK_QUAD_MEMORY flag is automatically
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 246406)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -4549,6 +4549,33 @@ rs6000_option_override_internal (bool global_init_
| OPTION_MASK_P9_DFORM_VECTOR);
}
+ if ((TARGET_P9_DFORM_SCALAR || TARGET_P9_DFORM_VECTOR)
+ && !TARGET_DIRECT_MOVE)
+ {
+ /* We prefer to not mention undocumented options in
+ error messages. However, if users have managed to select
+ power9-dform without selecting power9-vector, they
+ already know about undocumented flags. */
+ if ((rs6000_isa_flags_explicit & OPTION_MASK_DIRECT_MOVE)
+ && ((rs6000_isa_flags_explicit & OPTION_MASK_P9_DFORM_VECTOR) ||
+ (rs6000_isa_flags_explicit & OPTION_MASK_P9_DFORM_SCALAR) ||
+ (TARGET_P9_DFORM_BOTH == 1)))
+ error ("-mpower9-dform, -mpower9-dform-vector, -mpower9-dform-scalar"
+ " require -mdirect-move");
+ else if ((rs6000_isa_flags_explicit & OPTION_MASK_DIRECT_MOVE) == 0)
+ {
+ rs6000_isa_flags |= OPTION_MASK_DIRECT_MOVE;
+ rs6000_isa_flags_explicit |= OPTION_MASK_DIRECT_MOVE;
+ }
+ else
+ {
+ rs6000_isa_flags &=
+ ~(OPTION_MASK_P9_DFORM_SCALAR | OPTION_MASK_P9_DFORM_VECTOR);
+ rs6000_isa_flags_explicit |=
+ (OPTION_MASK_P9_DFORM_SCALAR | OPTION_MASK_P9_DFORM_VECTOR);
+ }
+ }
+
if (TARGET_P9_DFORM_SCALAR && !TARGET_UPPER_REGS_DF)
{
/* We prefer to not mention undocumented options in
Index: gcc/testsuite/gcc.target/powerpc/pr80103-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/pr80103-1.c (revision 0)
+++ gcc/testsuite/gcc.target/powerpc/pr80103-1.c (working copy)
@@ -0,0 +1,16 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-options "-mpower9-dform-vector -mno-direct-move" } */
+/* { dg-excess-errors "expect error due to conflicting target options" } */
+/* Since the error message is not associated with a particular line
+ number, we cannot use the dg-error directive and cannot specify a
+ regexp to describe the expected error message. The expected error
+ message is: "-mpower9-dform, -mpower9-dform-vector,
+ -mpower9-dform-scalar require -mdirect-move" */
+
+int a;
+void b (__attribute__ ((__vector_size__ (16))) char c)
+{
+ a = ((__attributes__ ((__vector_size__ (2 * sizeof (long)))) long) c)[0];
+}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH,rs6000] PR80103: Fix ICE with cross compiler
2017-03-24 22:10 [PATCH,rs6000] PR80103: Fix ICE with cross compiler Kelvin Nilsen
@ 2017-03-24 23:23 ` Segher Boessenkool
2017-06-28 15:42 ` Backport " Kelvin Nilsen
0 siblings, 1 reply; 4+ messages in thread
From: Segher Boessenkool @ 2017-03-24 23:23 UTC (permalink / raw)
To: Kelvin Nilsen; +Cc: gcc-patches
On Fri, Mar 24, 2017 at 04:04:33PM -0600, Kelvin Nilsen wrote:
> PR 80103 provides a test case which results in an internal
> compiler error when invoked with -mno-direct-move -mpower9-dform-
> vector target options. The internal compiler error results because
> these two target options are incompatible with each other.
>
> The enclosed patch simply disables this particular combination of
> target options, terminating gcc with an error message instead of
> producing an internal compiler error. Additionally, this patch
> includes new comments to address omissions from a patch committed
> on 2017/03/23 which deals with conflicts between the
> -mno-power9-vector and -mcpu=power9 target options.
>
> This patch has been bootstrapped and tested with no regressions on
> both powerpc64-unknown-linux-gnu and powerpc64le-unknown-linux-gnu.
> Is this ok for the trunk?
This looks good, please apply. Thanks,
Segher
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Backport [PATCH,rs6000] PR80103: Fix ICE with cross compiler
2017-03-24 23:23 ` Segher Boessenkool
@ 2017-06-28 15:42 ` Kelvin Nilsen
2017-06-28 22:10 ` Segher Boessenkool
0 siblings, 1 reply; 4+ messages in thread
From: Kelvin Nilsen @ 2017-06-28 15:42 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: gcc-patches
Is the attached refinement of this patch previously applied to mainline
ok for backport to gcc 6? I have bootstrapped and tested without
regressions on powerpc64le-unknown-linux-gnu.
This patch differs from the original mainline patch in the following
regards:
1. Certain commentary changes are omitted because the context to which
they applied is missing from GCC 6.
2. A typo in a test case has been corrected. The typo was discovered
during scrutiny of the backport regression testing results. I will
momentarily submit a patch to correct the same test case on main line.
On 03/24/2017 04:14 PM, Segher Boessenkool wrote:
> On Fri, Mar 24, 2017 at 04:04:33PM -0600, Kelvin Nilsen wrote:
>> PR 80103 provides a test case which results in an internal
>> compiler error when invoked with -mno-direct-move -mpower9-dform-
>> vector target options. The internal compiler error results because
>> these two target options are incompatible with each other.
>>
>> The enclosed patch simply disables this particular combination of
>> target options, terminating gcc with an error message instead of
>> producing an internal compiler error. Additionally, this patch
>> includes new comments to address omissions from a patch committed
>> on 2017/03/23 which deals with conflicts between the
>> -mno-power9-vector and -mcpu=power9 target options.
>>
>> This patch has been bootstrapped and tested with no regressions on
>> both powerpc64-unknown-linux-gnu and powerpc64le-unknown-linux-gnu.
>> Is this ok for the trunk?
>
> This looks good, please apply. Thanks,
>
>
> Segher
>
>
gcc/ChangeLog:
2017-06-28 Kelvin Nilsen <kelvin@gcc.gnu.org>
Backport from mainline
2017-03-27 Kelvin Nilsen <kelvin@gcc.gnu.org>
PR target/80103
* config/rs6000/rs6000.c (rs6000_option_override_internal): Add
special handling for target option conflicts between dform options
(-mpower9-dform, -mpower9-dform-vector, -mpower9-dform-scalar) and
-mno-direct-move.
gcc/testsuite/ChangeLog:
2017-06-28 Kelvin Nilsen <kelvin@gcc.gnu.org>
Backport from mainline
2017-03-27 Kelvin Nilsen <kelvin@gcc.gnu.org>
PR target/80103
* gcc.target/powerpc/pr80103-1.c: New test.
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 249572)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -4295,6 +4295,33 @@ rs6000_option_override_internal (bool global_init_
| OPTION_MASK_P9_DFORM_VECTOR);
}
+ if ((TARGET_P9_DFORM_SCALAR || TARGET_P9_DFORM_VECTOR)
+ && !TARGET_DIRECT_MOVE)
+ {
+ /* We prefer to not mention undocumented options in
+ error messages. However, if users have managed to select
+ power9-dform without selecting power9-vector, they
+ already know about undocumented flags. */
+ if ((rs6000_isa_flags_explicit & OPTION_MASK_DIRECT_MOVE)
+ && ((rs6000_isa_flags_explicit & OPTION_MASK_P9_DFORM_VECTOR) ||
+ (rs6000_isa_flags_explicit & OPTION_MASK_P9_DFORM_SCALAR) ||
+ (TARGET_P9_DFORM_BOTH == 1)))
+ error ("-mpower9-dform, -mpower9-dform-vector, -mpower9-dform-scalar"
+ " require -mdirect-move");
+ else if ((rs6000_isa_flags_explicit & OPTION_MASK_DIRECT_MOVE) == 0)
+ {
+ rs6000_isa_flags |= OPTION_MASK_DIRECT_MOVE;
+ rs6000_isa_flags_explicit |= OPTION_MASK_DIRECT_MOVE;
+ }
+ else
+ {
+ rs6000_isa_flags &=
+ ~(OPTION_MASK_P9_DFORM_SCALAR | OPTION_MASK_P9_DFORM_VECTOR);
+ rs6000_isa_flags_explicit |=
+ (OPTION_MASK_P9_DFORM_SCALAR | OPTION_MASK_P9_DFORM_VECTOR);
+ }
+ }
+
if (TARGET_P9_DFORM_SCALAR && !TARGET_UPPER_REGS_DF)
{
/* We prefer to not mention undocumented options in
Index: gcc/testsuite/gcc.target/powerpc/pr80103-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/pr80103-1.c (revision 0)
+++ gcc/testsuite/gcc.target/powerpc/pr80103-1.c (working copy)
@@ -0,0 +1,16 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-options "-mpower9-dform-vector -mno-direct-move" } */
+/* { dg-excess-errors "expect error due to conflicting target options" } */
+/* Since the error message is not associated with a particular line
+ number, we cannot use the dg-error directive and cannot specify a
+ regexp to describe the expected error message. The expected error
+ message is: "-mpower9-dform, -mpower9-dform-vector,
+ -mpower9-dform-scalar require -mdirect-move" */
+
+int a;
+void b (__attribute__ ((__vector_size__ (16))) char c)
+{
+ a = ((__attribute__ ((__vector_size__ (2 * sizeof (long)))) long) c)[0];
+}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Backport [PATCH,rs6000] PR80103: Fix ICE with cross compiler
2017-06-28 15:42 ` Backport " Kelvin Nilsen
@ 2017-06-28 22:10 ` Segher Boessenkool
0 siblings, 0 replies; 4+ messages in thread
From: Segher Boessenkool @ 2017-06-28 22:10 UTC (permalink / raw)
To: Kelvin Nilsen; +Cc: gcc-patches
On Wed, Jun 28, 2017 at 09:42:46AM -0600, Kelvin Nilsen wrote:
> Is the attached refinement of this patch previously applied to mainline
> ok for backport to gcc 6? I have bootstrapped and tested without
> regressions on powerpc64le-unknown-linux-gnu.
After 6.4 please.
Segher
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-06-28 22:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-24 22:10 [PATCH,rs6000] PR80103: Fix ICE with cross compiler Kelvin Nilsen
2017-03-24 23:23 ` Segher Boessenkool
2017-06-28 15:42 ` Backport " Kelvin Nilsen
2017-06-28 22:10 ` Segher Boessenkool
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).