public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/100645] New: ICE in related_vector_mode, at stor-layout.c:537
@ 2021-05-18  2:59 asolokha at gmx dot com
  2022-09-14  1:03 ` [Bug target/100645] " linkw at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: asolokha at gmx dot com @ 2021-05-18  2:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100645

            Bug ID: 100645
           Summary: ICE in related_vector_mode, at stor-layout.c:537
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---
            Target: powerpc-*-linux-gnu

gcc-12.0.0-alpha20210516 snapshot (g:4a322345cab10879162a2ddf659fb0f873ba0182)
ICEs when compiling the following testcase, extracted from
gcc/testsuite/gcc.target/i386/sse2-pr94680.c, w/ -maltivec:

typedef long long v2di __attribute__((vector_size(16)));

v2di
foo_v2di_l (v2di x)
{
  return __builtin_shuffle ((v2di) { 0, 0 }, x, (v2di) {3, 0});
}

% powerpc-e300c3-linux-gnu-gcc-12.0.0 -maltivec -c z7u847kc.c
during RTL pass: expand
z7u847kc.c: In function 'foo_v2di_l':
z7u847kc.c:6:10: internal compiler error: in related_vector_mode, at
stor-layout.c:537
    6 |   return __builtin_shuffle ((v2di) { 0, 0 }, x, (v2di) {3, 0});
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x69756e related_vector_mode(machine_mode, scalar_mode, poly_int<1u, unsigned
long>)
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_alpha20210516/work/gcc-12-20210516/gcc/stor-layout.c:537
0xd0b1e3 expand_vec_perm_const(machine_mode, rtx_def*, rtx_def*,
int_vector_builder<poly_int<1u, long> > const&, machine_mode, rtx_def*)
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_alpha20210516/work/gcc-12-20210516/gcc/optabs.c:6003
0xa8fc09 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_alpha20210516/work/gcc-12-20210516/gcc/expr.c:10033
0x964ee5 expand_gimple_stmt_1
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_alpha20210516/work/gcc-12-20210516/gcc/cfgexpand.c:3950
0x964ee5 expand_gimple_stmt
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_alpha20210516/work/gcc-12-20210516/gcc/cfgexpand.c:4011
0x96aa86 expand_gimple_basic_block
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_alpha20210516/work/gcc-12-20210516/gcc/cfgexpand.c:6053
0x96c5cf execute
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_alpha20210516/work/gcc-12-20210516/gcc/cfgexpand.c:6737

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/100645] ICE in related_vector_mode, at stor-layout.c:537
  2021-05-18  2:59 [Bug rtl-optimization/100645] New: ICE in related_vector_mode, at stor-layout.c:537 asolokha at gmx dot com
@ 2022-09-14  1:03 ` linkw at gcc dot gnu.org
  2022-09-14  8:23 ` linkw at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-09-14  1:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100645

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2022-09-14

--- Comment #1 from Kewen Lin <linkw at gcc dot gnu.org> ---
I'll have a look.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/100645] ICE in related_vector_mode, at stor-layout.c:537
  2021-05-18  2:59 [Bug rtl-optimization/100645] New: ICE in related_vector_mode, at stor-layout.c:537 asolokha at gmx dot com
  2022-09-14  1:03 ` [Bug target/100645] " linkw at gcc dot gnu.org
@ 2022-09-14  8:23 ` linkw at gcc dot gnu.org
  2022-09-26  3:24 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-09-14  8:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100645

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |linkw at gcc dot gnu.org

--- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> ---
Confirmed.

type v2di (vector(2) long long int) goes with TImode with altivec support,
which isn't a vector mode, so it fails with:

  gcc_assert (VECTOR_MODE_P (vector_mode));

The reason why veclower doesn't lower it is that: it can go with vec_shr_optab
against TImode.

       /* Also detect vec_shr pattern - VEC_PERM_EXPR with zero
         vector as VEC1 and a right element shift MASK.  */
      if (optab_handler (vec_shr_optab, TYPE_MODE (vect_type))
          != CODE_FOR_nothing
         ...

One alternative is to guard this check with VECTOR_MODE_P(TYPE_MODE
(vect_type)), but someone can argue that target shouldn't support this kind of
optab for one non vector mode. So it's more reasonable to fix it in target
code:

diff --git a/gcc/config/rs6000/vector.md b/gcc/config/rs6000/vector.md
index b87a742cca8..ed3feee2041 100644
--- a/gcc/config/rs6000/vector.md
+++ b/gcc/config/rs6000/vector.md
@@ -1532,7 +1532,7 @@ (define_expand "vec_shr_<mode>"
   [(match_operand:VEC_L 0 "vlogical_operand")
    (match_operand:VEC_L 1 "vlogical_operand")
    (match_operand:QI 2 "reg_or_short_operand")]
-  "TARGET_ALTIVEC"
+  "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
 {
   rtx bitshift = operands[2];
   rtx shift;

TImode is excluded by VECTOR_UNIT_ALTIVEC_OR_VSX_P check.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/100645] ICE in related_vector_mode, at stor-layout.c:537
  2021-05-18  2:59 [Bug rtl-optimization/100645] New: ICE in related_vector_mode, at stor-layout.c:537 asolokha at gmx dot com
  2022-09-14  1:03 ` [Bug target/100645] " linkw at gcc dot gnu.org
  2022-09-14  8:23 ` linkw at gcc dot gnu.org
@ 2022-09-26  3:24 ` cvs-commit at gcc dot gnu.org
  2022-10-19  9:05 ` cvs-commit at gcc dot gnu.org
  2022-10-19  9:08 ` linkw at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-26  3:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100645

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

https://gcc.gnu.org/g:bfad7069b74c97000b698191c1945f07a6192db5

commit r13-2844-gbfad7069b74c97000b698191c1945f07a6192db5
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Sun Sep 25 22:01:50 2022 -0500

    rs6000: Fix condition of define_expand vec_shr_<mode> [PR100645]

    PR100645 exposes one latent bug in define_expand vec_shr_<mode>
    that the current condition TARGET_ALTIVEC is too loose.  The
    mode iterator VEC_L contains a few modes, they are not always
    supported as vector mode, VECTOR_UNIT_ALTIVEC_OR_VSX_P should
    be used like some other VEC_L usages.

            PR target/100645

    gcc/ChangeLog:

            * config/rs6000/vector.md (vec_shr_<mode>): Replace condition
            TARGET_ALTIVEC with VECTOR_UNIT_ALTIVEC_OR_VSX_P.

    gcc/testsuite/ChangeLog:

            * gcc.target/powerpc/pr100645.c: New test.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/100645] ICE in related_vector_mode, at stor-layout.c:537
  2021-05-18  2:59 [Bug rtl-optimization/100645] New: ICE in related_vector_mode, at stor-layout.c:537 asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2022-09-26  3:24 ` cvs-commit at gcc dot gnu.org
@ 2022-10-19  9:05 ` cvs-commit at gcc dot gnu.org
  2022-10-19  9:08 ` linkw at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-19  9:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100645

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

https://gcc.gnu.org/g:6db4ba9750ffd65c80995425db0d5f1020a04b28

commit r12-8845-g6db4ba9750ffd65c80995425db0d5f1020a04b28
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Sun Sep 25 22:01:50 2022 -0500

    rs6000: Fix condition of define_expand vec_shr_<mode> [PR100645]

    PR100645 exposes one latent bug in define_expand vec_shr_<mode>
    that the current condition TARGET_ALTIVEC is too loose.  The
    mode iterator VEC_L contains a few modes, they are not always
    supported as vector mode, VECTOR_UNIT_ALTIVEC_OR_VSX_P should
    be used like some other VEC_L usages.

            PR target/100645

    gcc/ChangeLog:

            * config/rs6000/vector.md (vec_shr_<mode>): Replace condition
            TARGET_ALTIVEC with VECTOR_UNIT_ALTIVEC_OR_VSX_P.

    gcc/testsuite/ChangeLog:

            * gcc.target/powerpc/pr100645.c: New test.

    (cherry picked from commit bfad7069b74c97000b698191c1945f07a6192db5)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/100645] ICE in related_vector_mode, at stor-layout.c:537
  2021-05-18  2:59 [Bug rtl-optimization/100645] New: ICE in related_vector_mode, at stor-layout.c:537 asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2022-10-19  9:05 ` cvs-commit at gcc dot gnu.org
@ 2022-10-19  9:08 ` linkw at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-10-19  9:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100645

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from Kewen Lin <linkw at gcc dot gnu.org> ---
Should be fixed on trunk and gcc12.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-10-19  9:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18  2:59 [Bug rtl-optimization/100645] New: ICE in related_vector_mode, at stor-layout.c:537 asolokha at gmx dot com
2022-09-14  1:03 ` [Bug target/100645] " linkw at gcc dot gnu.org
2022-09-14  8:23 ` linkw at gcc dot gnu.org
2022-09-26  3:24 ` cvs-commit at gcc dot gnu.org
2022-10-19  9:05 ` cvs-commit at gcc dot gnu.org
2022-10-19  9:08 ` linkw at gcc dot gnu.org

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).