public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/104666] New: [12 Regression] ICE in related_vector_mode, at stor-layout.c:537
@ 2022-02-23 17:57 gscfq@t-online.de
  2022-02-24  1:29 ` [Bug target/104666] " crazylht at gmail dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: gscfq@t-online.de @ 2022-02-23 17:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104666
           Summary: [12 Regression] ICE in related_vector_mode, at
                    stor-layout.c:537
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started between 20210627 and 20210704 :


$ cat z1.c
typedef double __m128d __attribute__((__vector_size__(16), __may_alias__));
__m128d sse4_1_blendvpd (__m128d a, __m128d b, __m128d c)
__attribute__((__target__("sse4.1")));

__m128d
generic_blendvpd (__m128d a, __m128d b, __m128d c)
{
  return __builtin_ia32_blendvpd (a, b, c);
}


$ gcc-12-20220220 -c z1.c -mno-sse
z1.c: In function 'generic_blendvpd':
z1.c:5:1: error: SSE register return with SSE disabled
    5 | generic_blendvpd (__m128d a, __m128d b, __m128d c)
      | ^~~~~~~~~~~~~~~~
during GIMPLE pass: lower
z1.c:5:1: internal compiler error: in related_vector_mode, at stor-layout.c:537
0xdb93ce related_vector_mode(machine_mode, scalar_mode, poly_int<1u, unsigned
long>)
        ../../gcc/stor-layout.c:537
0x1077b42 get_related_vectype_for_scalar_type(machine_mode, tree_node*,
poly_int<1u, unsigned long>)
        ../../gcc/tree-vect-stmts.c:11138
0x11e0cba ix86_gimple_fold_builtin(gimple_stmt_iterator*)
        ../../gcc/config/i386/i386.c:18005
0xa95391 gimple_fold_call
        ../../gcc/gimple-fold.c:5568
0xa96eab fold_stmt_1
        ../../gcc/gimple-fold.c:6265
0x1829ad7 lower_stmt
        ../../gcc/gimple-low.c:388
0x1829ad7 lower_sequence
        ../../gcc/gimple-low.c:217
0x1829759 lower_gimple_bind
        ../../gcc/gimple-low.c:473
0x182ab78 lower_function_body
        ../../gcc/gimple-low.c:110
0x182ab78 execute
        ../../gcc/gimple-low.c:195

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

* [Bug target/104666] [12 Regression] ICE in related_vector_mode, at stor-layout.c:537
  2022-02-23 17:57 [Bug c/104666] New: [12 Regression] ICE in related_vector_mode, at stor-layout.c:537 gscfq@t-online.de
@ 2022-02-24  1:29 ` crazylht at gmail dot com
  2022-02-24  3:02 ` crazylht at gmail dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: crazylht at gmail dot com @ 2022-02-24  1:29 UTC (permalink / raw)
  To: gcc-bugs

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

Hongtao.liu <crazylht at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |crazylht at gmail dot com

--- Comment #1 from Hongtao.liu <crazylht at gmail dot com> ---
Probably caused by my r12-1834

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

* [Bug target/104666] [12 Regression] ICE in related_vector_mode, at stor-layout.c:537
  2022-02-23 17:57 [Bug c/104666] New: [12 Regression] ICE in related_vector_mode, at stor-layout.c:537 gscfq@t-online.de
  2022-02-24  1:29 ` [Bug target/104666] " crazylht at gmail dot com
@ 2022-02-24  3:02 ` crazylht at gmail dot com
  2022-02-24  6:49 ` crazylht at gmail dot com
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: crazylht at gmail dot com @ 2022-02-24  3:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
So builtins are registered in the beginning, but isa checking is during
pass_expand, and gimple folding is between them, maybe we should restrict
builtin gimple folding under their required target.

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

* [Bug target/104666] [12 Regression] ICE in related_vector_mode, at stor-layout.c:537
  2022-02-23 17:57 [Bug c/104666] New: [12 Regression] ICE in related_vector_mode, at stor-layout.c:537 gscfq@t-online.de
  2022-02-24  1:29 ` [Bug target/104666] " crazylht at gmail dot com
  2022-02-24  3:02 ` crazylht at gmail dot com
@ 2022-02-24  6:49 ` crazylht at gmail dot com
  2022-02-24  6:50 ` crazylht at gmail dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: crazylht at gmail dot com @ 2022-02-24  6:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Hongtao.liu from comment #2)
> So builtins are registered in the beginning, but isa checking is during
> pass_expand, and gimple folding is between them, maybe we should restrict
> builtin gimple folding under their required target.

I'm testing this.

+         /* Avoid ICE in get_same_size_vectype which assumes real vector
+            mode, and it depends on vector_mode_supported_p, E_BLKmode
+            means target isa mismatch.  */
+         if (TYPE_MODE (type) == E_BLKmode)
+           break;

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

* [Bug target/104666] [12 Regression] ICE in related_vector_mode, at stor-layout.c:537
  2022-02-23 17:57 [Bug c/104666] New: [12 Regression] ICE in related_vector_mode, at stor-layout.c:537 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-02-24  6:49 ` crazylht at gmail dot com
@ 2022-02-24  6:50 ` crazylht at gmail dot com
  2022-02-24  9:34 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: crazylht at gmail dot com @ 2022-02-24  6:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Hongtao.liu <crazylht at gmail dot com> ---
Same ICE exists for

__builtin_ia32_blendvpd
__builtin_ia32_blendvps
__builtin_ia32_blendvpd256
__builtin_ia32_blendvps256
__builtin_ia32_pblendvb128
__builtin_ia32_pblenddvb256

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

* [Bug target/104666] [12 Regression] ICE in related_vector_mode, at stor-layout.c:537
  2022-02-23 17:57 [Bug c/104666] New: [12 Regression] ICE in related_vector_mode, at stor-layout.c:537 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-02-24  6:50 ` crazylht at gmail dot com
@ 2022-02-24  9:34 ` jakub at gcc dot gnu.org
  2022-02-24  9:58 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-02-24  9:34 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Wouldn't the right fix be instead to move the ix86_expand_builtin
  HOST_WIDE_INT isa = ix86_isa_flags;
  HOST_WIDE_INT isa2 = ix86_isa_flags2;
  HOST_WIDE_INT bisa = ix86_builtins_isa[fcode].isa;
  HOST_WIDE_INT bisa2 = ix86_builtins_isa[fcode].isa2;
...
  if ((bisa & OPTION_MASK_ISA_MMX) && !TARGET_MMX && TARGET_MMX_WITH_SSE
      /* __builtin_ia32_maskmovq requires MMX registers.  */
      && fcode != IX86_BUILTIN_MASKMOVQ)
    {
      bisa &= ~OPTION_MASK_ISA_MMX;
      bisa |= OPTION_MASK_ISA_SSE2;
    }

  if ((bisa & isa) != bisa || (bisa2 & isa2) != bisa2)
code into a helper function and simply return early in
ix86_fold_builtin and ix86_gimple_fold_builtin if there is a mismatch (so
effectively keep those md builtins as calls for the cases of mismatch and
during expansion diagnose it?

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

* [Bug target/104666] [12 Regression] ICE in related_vector_mode, at stor-layout.c:537
  2022-02-23 17:57 [Bug c/104666] New: [12 Regression] ICE in related_vector_mode, at stor-layout.c:537 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2022-02-24  9:34 ` jakub at gcc dot gnu.org
@ 2022-02-24  9:58 ` rguenth at gcc dot gnu.org
  2022-02-25  1:13 ` crazylht at gmail dot com
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-24  9:58 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

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

* [Bug target/104666] [12 Regression] ICE in related_vector_mode, at stor-layout.c:537
  2022-02-23 17:57 [Bug c/104666] New: [12 Regression] ICE in related_vector_mode, at stor-layout.c:537 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2022-02-24  9:58 ` rguenth at gcc dot gnu.org
@ 2022-02-25  1:13 ` crazylht at gmail dot com
  2022-03-09 13:01 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: crazylht at gmail dot com @ 2022-02-25  1:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Jakub Jelinek from comment #5)
> Wouldn't the right fix be instead to move the ix86_expand_builtin
Good idea!

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

* [Bug target/104666] [12 Regression] ICE in related_vector_mode, at stor-layout.c:537
  2022-02-23 17:57 [Bug c/104666] New: [12 Regression] ICE in related_vector_mode, at stor-layout.c:537 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2022-02-25  1:13 ` crazylht at gmail dot com
@ 2022-03-09 13:01 ` rguenth at gcc dot gnu.org
  2022-03-14  1:22 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-03-09 13:01 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-03-09
           Priority|P3                          |P1
     Ever confirmed|0                           |1

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

* [Bug target/104666] [12 Regression] ICE in related_vector_mode, at stor-layout.c:537
  2022-02-23 17:57 [Bug c/104666] New: [12 Regression] ICE in related_vector_mode, at stor-layout.c:537 gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2022-03-09 13:01 ` rguenth at gcc dot gnu.org
@ 2022-03-14  1:22 ` cvs-commit at gcc dot gnu.org
  2022-03-14  1:23 ` crazylht at gmail dot com
  2022-03-15 13:09 ` jakub at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-14  1:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuhongt@gcc.gnu.org>:

https://gcc.gnu.org/g:823b3b79cd2b137f1023742ee1ba93e8712cef0a

commit r12-7638-g823b3b79cd2b137f1023742ee1ba93e8712cef0a
Author: liuhongt <hongtao.liu@intel.com>
Date:   Thu Feb 24 14:42:14 2022 +0800

    Don't fold builtin into gimple when isa mismatches.

    The patch fixes ICE in ix86_gimple_fold_builtin.

    gcc/ChangeLog:

            PR target/104666
            * config/i386/i386-expand.cc
            (ix86_check_builtin_isa_match): New func.
            (ix86_expand_builtin): Move code to
            ix86_check_builtin_isa_match and call it.
            * config/i386/i386-protos.h
            (ix86_check_builtin_isa_match): Declare.
            * config/i386/i386.cc (ix86_gimple_fold_builtin): Don't fold
            builtin into gimple when isa mismatches.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr104666.c: New test.

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

* [Bug target/104666] [12 Regression] ICE in related_vector_mode, at stor-layout.c:537
  2022-02-23 17:57 [Bug c/104666] New: [12 Regression] ICE in related_vector_mode, at stor-layout.c:537 gscfq@t-online.de
                   ` (8 preceding siblings ...)
  2022-03-14  1:22 ` cvs-commit at gcc dot gnu.org
@ 2022-03-14  1:23 ` crazylht at gmail dot com
  2022-03-15 13:09 ` jakub at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: crazylht at gmail dot com @ 2022-03-14  1:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Hongtao.liu <crazylht at gmail dot com> ---
Fixed in GCC12.

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

* [Bug target/104666] [12 Regression] ICE in related_vector_mode, at stor-layout.c:537
  2022-02-23 17:57 [Bug c/104666] New: [12 Regression] ICE in related_vector_mode, at stor-layout.c:537 gscfq@t-online.de
                   ` (9 preceding siblings ...)
  2022-03-14  1:23 ` crazylht at gmail dot com
@ 2022-03-15 13:09 ` jakub at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-15 13:09 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
.

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

end of thread, other threads:[~2022-03-15 13:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-23 17:57 [Bug c/104666] New: [12 Regression] ICE in related_vector_mode, at stor-layout.c:537 gscfq@t-online.de
2022-02-24  1:29 ` [Bug target/104666] " crazylht at gmail dot com
2022-02-24  3:02 ` crazylht at gmail dot com
2022-02-24  6:49 ` crazylht at gmail dot com
2022-02-24  6:50 ` crazylht at gmail dot com
2022-02-24  9:34 ` jakub at gcc dot gnu.org
2022-02-24  9:58 ` rguenth at gcc dot gnu.org
2022-02-25  1:13 ` crazylht at gmail dot com
2022-03-09 13:01 ` rguenth at gcc dot gnu.org
2022-03-14  1:22 ` cvs-commit at gcc dot gnu.org
2022-03-14  1:23 ` crazylht at gmail dot com
2022-03-15 13:09 ` jakub 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).