public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit
@ 2023-12-01 21:12 a.elovikov at gmail dot com
  2023-12-01 21:17 ` [Bug target/112816] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
                   ` (21 more replies)
  0 siblings, 22 replies; 23+ messages in thread
From: a.elovikov at gmail dot com @ 2023-12-01 21:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112816
           Summary: internal compiler error: in extract_insn, at
                    recog.cc:2804, unrecognizable_insn for
                    __builtin_signbit
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: a.elovikov at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/3vzejjWcq

constexpr int N = 4;

template <typename T>
struct S {
    T x[N];
    T& operator[](int idx) { return x[idx]; }
};
auto foo(S<float> x) {
  S<int> res;
  for (int i = 0; i < 4; ++i)
    res[i] = __builtin_signbit(x[i]) ? -1 : 0;
  return res;
}

Copy-pasting "x86-64 gcc (trunk)" output from the godbolt link above (-O3
-std=c++17 options used):
<source>: In function 'auto foo(S<float>)':
<source>:13:1: error: unrecognizable insn:
   13 | }
      | ^
(insn 20 19 21 2 (set (reg:V4SI 99 [ vect__2.11 ])
        (lshiftrt:V4SI (subreg:V4SI (subreg:V4SF (reg/v:TI 105 [ x ]) 0) 0)
            (const_int 31 [0x1f]))) "<source>":11:31 discrim 1 -1
     (nil))
during RTL pass: vregs
<source>:13:1: internal compiler error: in extract_insn, at recog.cc:2804
0x26c14fe internal_error(char const*, ...)
        ???:0
0xb125b9 fancy_abort(char const*, int, char const*)
        ???:0
0x925e6a _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ???:0
0x925e8c _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

Also reproducible with (the version I discovered it with)

$ g++ --version
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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

* [Bug target/112816] [11/12/13/14 Regression] internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
@ 2023-12-01 21:17 ` pinskia at gcc dot gnu.org
  2023-12-01 21:19 ` pinskia at gcc dot gnu.org
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-01 21:17 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|internal compiler error: in |[11/12/13/14 Regression]
                   |extract_insn, at            |internal compiler error: in
                   |recog.cc:2804,              |extract_insn, at
                   |unrecognizable_insn for     |recog.cc:2804,
                   |__builtin_signbit           |unrecognizable_insn for
                   |                            |__builtin_signbit
   Target Milestone|---                         |11.5

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

* [Bug target/112816] [11/12/13/14 Regression] internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
  2023-12-01 21:17 ` [Bug target/112816] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
@ 2023-12-01 21:19 ` pinskia at gcc dot gnu.org
  2023-12-01 21:20 ` [Bug target/112816] [11/12/13/14 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4] pinskia at gcc dot gnu.org
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-01 21:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 56760
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56760&action=edit
C testcase

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

* [Bug target/112816] [11/12/13/14 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
  2023-12-01 21:17 ` [Bug target/112816] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
  2023-12-01 21:19 ` pinskia at gcc dot gnu.org
@ 2023-12-01 21:20 ` pinskia at gcc dot gnu.org
  2023-12-02  9:05 ` jakub at gcc dot gnu.org
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-01 21:20 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-12-01
            Summary|[11/12/13/14 Regression]    |[11/12/13/14 Regression]
                   |internal compiler error: in |ICE unrecognizable_insn
                   |extract_insn, at            |with __builtin_signbit and
                   |recog.cc:2804,              |returning struct with
                   |unrecognizable_insn for     |int[4]
                   |__builtin_signbit           |
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug target/112816] [11/12/13/14 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (2 preceding siblings ...)
  2023-12-01 21:20 ` [Bug target/112816] [11/12/13/14 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4] pinskia at gcc dot gnu.org
@ 2023-12-02  9:05 ` jakub at gcc dot gnu.org
  2023-12-02  9:10 ` jakub at gcc dot gnu.org
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-02  9:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 56767
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56767&action=edit
gcc14-pr112816.patch

Untested fix.

Another issue is that the emitted code is terrible:
        pxor    %xmm1, %xmm1
        psrld   $31, %xmm0
        pcmpeqd %xmm1, %xmm0
        pcmpeqd %xmm1, %xmm0
Why not just
        psrad   $31, %xmm0
instead of all this?

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

* [Bug target/112816] [11/12/13/14 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (3 preceding siblings ...)
  2023-12-02  9:05 ` jakub at gcc dot gnu.org
@ 2023-12-02  9:10 ` jakub at gcc dot gnu.org
  2023-12-02  9:16 ` jakub at gcc dot gnu.org
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-02  9:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think we want to add some patterns for combine which would match
(set (reg:V4SI 115)
    (eq:V4SI (lshiftrt:V4SI (subreg:V4SI (reg:V2DI 110) 0)
            (const_int 31 [0x1f]))
        (const_vector:V4SI [
                (const_int 0 [0]) repeated x4
            ])))
(and ditto for ashiftrt, in both cases with just match_operand:V4SI for the
register_operand and obviously iterators over 16/32-byte integral vector modes)
and
turn that into ashiftrt by the same count.

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

* [Bug target/112816] [11/12/13/14 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (4 preceding siblings ...)
  2023-12-02  9:10 ` jakub at gcc dot gnu.org
@ 2023-12-02  9:16 ` jakub at gcc dot gnu.org
  2023-12-04  4:12 ` liuhongt at gcc dot gnu.org
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-02  9:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-bisection             |

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
BTW, with -O2 the ICE started with r12-4240, with -O3 with
r10-2804-gbf05a3bbb58b355899ccabe861a06e85b7abe6e4
and guess it has been latent before that.

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

* [Bug target/112816] [11/12/13/14 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (5 preceding siblings ...)
  2023-12-02  9:16 ` jakub at gcc dot gnu.org
@ 2023-12-04  4:12 ` liuhongt at gcc dot gnu.org
  2023-12-04  8:01 ` cvs-commit at gcc dot gnu.org
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: liuhongt at gcc dot gnu.org @ 2023-12-04  4:12 UTC (permalink / raw)
  To: gcc-bugs

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

liuhongt at gcc dot gnu.org changed:

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

--- Comment #6 from liuhongt at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #3)
> Created attachment 56767 [details]
> gcc14-pr112816.patch
> 
> Untested fix.
> 
> Another issue is that the emitted code is terrible:
>         pxor    %xmm1, %xmm1
>         psrld   $31, %xmm0
>         pcmpeqd %xmm1, %xmm0
>         pcmpeqd %xmm1, %xmm0
> Why not just
>         psrad   $31, %xmm0
> instead of all this?

We have optimization in ix86_expand_int_vcond.
 5090  /* Try to optimize x < 0 ? -1 : 0 into (signed) x >> 31
 5091     and x < 0 ? 1 : 0 into (unsigned) x >> 31.  */

But for signbit case, it's 

  vect__1.10_4 = MEM <vector(4) float> [(float *)&x];
  vect__2.11_3 = .SIGNBIT (vect__1.10_4);
  mask__11.12_22 = vect__2.11_3 != { 0, 0, 0, 0 };
  vect__13.14_26 = VIEW_CONVERT_EXPR<vector(4) int>(mask__11.12_22);

I'm curious, can we move all of those to the middle-end, like match.pd?

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

* [Bug target/112816] [11/12/13/14 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (6 preceding siblings ...)
  2023-12-04  4:12 ` liuhongt at gcc dot gnu.org
@ 2023-12-04  8:01 ` cvs-commit at gcc dot gnu.org
  2023-12-04  8:02 ` [Bug target/112816] [11/12/13 " jakub at gcc dot gnu.org
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-04  8:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:994d6dc64435d6b7c50accca9941ee7decd92a22

commit r14-6108-g994d6dc64435d6b7c50accca9941ee7decd92a22
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Dec 4 09:00:18 2023 +0100

    i386: Fix up signbit<mode>2 expander [PR112816]

    The following testcase ICEs, because the signbit<mode>2 expander uses an
    explicit SUBREG in the pattern around match_operand with register_operand
    predicate.  If we are unlucky enough that expansion tries to expand it
    with some SUBREG as operands[1], we have two nested SUBREGs in the IL,
    which is not valid and causes ICE later.

    2023-12-04  Jakub Jelinek  <jakub@redhat.com>

            PR target/112816
            * config/i386/sse.md (signbit<mode>2): Force operands[1] into a
REG.

            * gcc.target/i386/sse2-pr112816.c: New test.

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

* [Bug target/112816] [11/12/13 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (7 preceding siblings ...)
  2023-12-04  8:01 ` cvs-commit at gcc dot gnu.org
@ 2023-12-04  8:02 ` jakub at gcc dot gnu.org
  2023-12-04 17:04 ` a.elovikov at gmail dot com
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-04  8:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12/13/14 Regression]    |[11/12/13 Regression] ICE
                   |ICE unrecognizable_insn     |unrecognizable_insn with
                   |with __builtin_signbit and  |__builtin_signbit and
                   |returning struct with       |returning struct with
                   |int[4]                      |int[4]

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.

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

* [Bug target/112816] [11/12/13 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (8 preceding siblings ...)
  2023-12-04  8:02 ` [Bug target/112816] [11/12/13 " jakub at gcc dot gnu.org
@ 2023-12-04 17:04 ` a.elovikov at gmail dot com
  2023-12-05  8:09 ` cvs-commit at gcc dot gnu.org
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: a.elovikov at gmail dot com @ 2023-12-04 17:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Andrei Elovikov <a.elovikov at gmail dot com> ---
Created attachment 56789
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56789&action=edit
Another reproducer, now using short instead of int

Once the fix is ready, please verify the "uint16_t" version of it passes as
well. I'm not familiar with GCC internals to understand if it's a single crash
or two different issues. Godbolt link (same as the attached file):
https://godbolt.org/z/cEh1W7PdG .

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

* [Bug target/112816] [11/12/13 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (9 preceding siblings ...)
  2023-12-04 17:04 ` a.elovikov at gmail dot com
@ 2023-12-05  8:09 ` cvs-commit at gcc dot gnu.org
  2023-12-05 16:32 ` cvs-commit at gcc dot gnu.org
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-05  8:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

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

commit r14-6136-gbf418db27c0b48abb8203dd9e08135793cd9ce18
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Dec 5 09:08:45 2023 +0100

    i386: Improve code generation for vector __builtin_signbit (x.x[i]) ? -1 :
0 [PR112816]

    On the testcase I've recently fixed I've noticed bad code generation,
    we emit
            pxor    %xmm1, %xmm1
            psrld   $31, %xmm0
            pcmpeqd %xmm1, %xmm0
            pcmpeqd %xmm1, %xmm0
    or
            vpxor   %xmm1, %xmm1, %xmm1
            vpsrld  $31, %xmm0, %xmm0
            vpcmpeqd        %xmm1, %xmm0, %xmm0
            vpcmpeqd        %xmm1, %xmm0, %xmm2
    rather than
            psrad   $31, %xmm2
    or
            vpsrad  $31, %xmm1, %xmm2
    The following patch fixes that using a combiner splitter.

    2023-12-05  Jakub Jelinek  <jakub@redhat.com>

            PR target/112816
            * config/i386/sse.md ((eq (eq (lshiftrt x elt_bits-1) 0) 0)): New
            splitter to turn psrld $31; pcmpeq; pcmpeq into psrad $31.

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

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

* [Bug target/112816] [11/12/13 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (10 preceding siblings ...)
  2023-12-05  8:09 ` cvs-commit at gcc dot gnu.org
@ 2023-12-05 16:32 ` cvs-commit at gcc dot gnu.org
  2023-12-05 17:02 ` [Bug target/112816] [11/12 " jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-05 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:05d8dec0f9f9660b1f437d52252852a2f86d3ac8

commit r13-8125-g05d8dec0f9f9660b1f437d52252852a2f86d3ac8
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Dec 4 09:00:18 2023 +0100

    i386: Fix up signbit<mode>2 expander [PR112816]

    The following testcase ICEs, because the signbit<mode>2 expander uses an
    explicit SUBREG in the pattern around match_operand with register_operand
    predicate.  If we are unlucky enough that expansion tries to expand it
    with some SUBREG as operands[1], we have two nested SUBREGs in the IL,
    which is not valid and causes ICE later.

    2023-12-04  Jakub Jelinek  <jakub@redhat.com>

            PR target/112816
            * config/i386/sse.md (signbit<mode>2): Force operands[1] into a
REG.

            * gcc.target/i386/sse2-pr112816.c: New test.

    (cherry picked from commit 994d6dc64435d6b7c50accca9941ee7decd92a22)

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

* [Bug target/112816] [11/12 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (11 preceding siblings ...)
  2023-12-05 16:32 ` cvs-commit at gcc dot gnu.org
@ 2023-12-05 17:02 ` jakub at gcc dot gnu.org
  2023-12-16  0:38 ` cvs-commit at gcc dot gnu.org
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-05 17:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12/13 Regression] ICE   |[11/12 Regression] ICE
                   |unrecognizable_insn with    |unrecognizable_insn with
                   |__builtin_signbit and       |__builtin_signbit and
                   |returning struct with       |returning struct with
                   |int[4]                      |int[4]

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Now fixed for 13.3 as well.

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

* [Bug target/112816] [11/12 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (12 preceding siblings ...)
  2023-12-05 17:02 ` [Bug target/112816] [11/12 " jakub at gcc dot gnu.org
@ 2023-12-16  0:38 ` cvs-commit at gcc dot gnu.org
  2023-12-17 13:55 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-16  0:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:0246a37ebdef4ffc863fe4c56e812c0614026e02

commit r12-10052-g0246a37ebdef4ffc863fe4c56e812c0614026e02
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Dec 4 09:00:18 2023 +0100

    i386: Fix up signbit<mode>2 expander [PR112816]

    The following testcase ICEs, because the signbit<mode>2 expander uses an
    explicit SUBREG in the pattern around match_operand with register_operand
    predicate.  If we are unlucky enough that expansion tries to expand it
    with some SUBREG as operands[1], we have two nested SUBREGs in the IL,
    which is not valid and causes ICE later.

    2023-12-04  Jakub Jelinek  <jakub@redhat.com>

            PR target/112816
            * config/i386/sse.md (signbit<mode>2): Force operands[1] into a
REG.

            * gcc.target/i386/sse2-pr112816.c: New test.

    (cherry picked from commit 994d6dc64435d6b7c50accca9941ee7decd92a22)

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

* [Bug target/112816] [11/12 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (13 preceding siblings ...)
  2023-12-16  0:38 ` cvs-commit at gcc dot gnu.org
@ 2023-12-17 13:55 ` cvs-commit at gcc dot gnu.org
  2023-12-18 19:30 ` a.elovikov at gmail dot com
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-17 13:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:531d80228d85624c0e2eac40cd525dc75686ba95

commit r11-11152-g531d80228d85624c0e2eac40cd525dc75686ba95
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Dec 4 09:00:18 2023 +0100

    i386: Fix up signbit<mode>2 expander [PR112816]

    The following testcase ICEs, because the signbit<mode>2 expander uses an
    explicit SUBREG in the pattern around match_operand with register_operand
    predicate.  If we are unlucky enough that expansion tries to expand it
    with some SUBREG as operands[1], we have two nested SUBREGs in the IL,
    which is not valid and causes ICE later.

    2023-12-04  Jakub Jelinek  <jakub@redhat.com>

            PR target/112816
            * config/i386/sse.md (signbit<mode>2): Force operands[1] into a
REG.

            * gcc.target/i386/sse2-pr112816.c: New test.

    (cherry picked from commit 994d6dc64435d6b7c50accca9941ee7decd92a22)

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

* [Bug target/112816] [11/12 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (14 preceding siblings ...)
  2023-12-17 13:55 ` cvs-commit at gcc dot gnu.org
@ 2023-12-18 19:30 ` a.elovikov at gmail dot com
  2023-12-18 20:03 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: a.elovikov at gmail dot com @ 2023-12-18 19:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Andrei Elovikov <a.elovikov at gmail dot com> ---
I'd like to point out that while the first reproducer
(https://godbolt.org/z/3vzejjWcq) started to pass now on godbolt, the second
(https://godbolt.org/z/cEh1W7PdG) still fails with an ICE. Please let me know
if you'd prefer me to submit a separate report for it.

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

* [Bug target/112816] [11/12 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (15 preceding siblings ...)
  2023-12-18 19:30 ` a.elovikov at gmail dot com
@ 2023-12-18 20:03 ` jakub at gcc dot gnu.org
  2023-12-19  9:25 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-18 20:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 56903
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56903&action=edit
gcc14-pr112816-3.patch

Ah, forgot some expanders in mmx.md.

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

* [Bug target/112816] [11/12 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (16 preceding siblings ...)
  2023-12-18 20:03 ` jakub at gcc dot gnu.org
@ 2023-12-19  9:25 ` cvs-commit at gcc dot gnu.org
  2023-12-19  9:33 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-19  9:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:80e1375ed7a7a05a5a60a57e72c5ad5eba005798

commit r14-6679-g80e1375ed7a7a05a5a60a57e72c5ad5eba005798
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Dec 19 10:24:33 2023 +0100

    i386: Fix mmx.md signbit expanders [PR112816]

    Apparently when looking for "signbit<mode>2" vector expanders, I've only
    looked at sse.md and forgot mmx.md, which has two further ones and the
    following patch still ICEd.

    2023-12-19  Jakub Jelinek  <jakub@redhat.com>

            PR target/112816
            * config/i386/mmx.md (signbitv2sf2, signbit<mode>2): Force
operands[1]
            into a REG.

            * gcc.target/i386/sse2-pr112816-2.c: New test.

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

* [Bug target/112816] [11/12 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (17 preceding siblings ...)
  2023-12-19  9:25 ` cvs-commit at gcc dot gnu.org
@ 2023-12-19  9:33 ` cvs-commit at gcc dot gnu.org
  2023-12-19  9:37 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-19  9:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:0cf251fba0f0a374225a81021af5ec6c6ccceb5b

commit r13-8167-g0cf251fba0f0a374225a81021af5ec6c6ccceb5b
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Dec 19 10:24:33 2023 +0100

    i386: Fix mmx.md signbit expanders [PR112816]

    Apparently when looking for "signbit<mode>2" vector expanders, I've only
    looked at sse.md and forgot mmx.md, which has another one and the
    following patch still ICEd.

    2023-12-19  Jakub Jelinek  <jakub@redhat.com>

            PR target/112816
            * config/i386/mmx.md (signbitv2sf2): Force operands[1] into a REG.

            * gcc.target/i386/sse2-pr112816-2.c: New test.

    (cherry picked from commit 80e1375ed7a7a05a5a60a57e72c5ad5eba005798)

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

* [Bug target/112816] [11/12 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (18 preceding siblings ...)
  2023-12-19  9:33 ` cvs-commit at gcc dot gnu.org
@ 2023-12-19  9:37 ` cvs-commit at gcc dot gnu.org
  2023-12-19  9:45 ` cvs-commit at gcc dot gnu.org
  2023-12-19  9:46 ` jakub at gcc dot gnu.org
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-19  9:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:08a9df82bc2958df1c5508a0352d31a29c0ebe74

commit r12-10061-g08a9df82bc2958df1c5508a0352d31a29c0ebe74
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Dec 19 10:24:33 2023 +0100

    i386: Fix mmx.md signbit expanders [PR112816]

    Apparently when looking for "signbit<mode>2" vector expanders, I've only
    looked at sse.md and forgot mmx.md, which has another one and the
    following patch still ICEd.

    2023-12-19  Jakub Jelinek  <jakub@redhat.com>

            PR target/112816
            * config/i386/mmx.md (signbitv2sf2): Force operands[1] into a REG.

            * gcc.target/i386/sse2-pr112816-2.c: New test.

    (cherry picked from commit 80e1375ed7a7a05a5a60a57e72c5ad5eba005798)

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

* [Bug target/112816] [11/12 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (19 preceding siblings ...)
  2023-12-19  9:37 ` cvs-commit at gcc dot gnu.org
@ 2023-12-19  9:45 ` cvs-commit at gcc dot gnu.org
  2023-12-19  9:46 ` jakub at gcc dot gnu.org
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-19  9:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

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

commit r11-11159-gd9b7e78dae13945dd9b296f2cca67650da0f869d
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Dec 19 10:24:33 2023 +0100

    i386: Fix mmx.md signbit expanders [PR112816]

    Apparently when looking for "signbit<mode>2" vector expanders, I've only
    looked at sse.md and forgot mmx.md, which has another one and the
    following patch still ICEd.

    2023-12-19  Jakub Jelinek  <jakub@redhat.com>

            PR target/112816
            * config/i386/mmx.md (signbitv2sf2): Force operands[1] into a REG.

            * gcc.target/i386/sse2-pr112816-2.c: New test.

    (cherry picked from commit 80e1375ed7a7a05a5a60a57e72c5ad5eba005798)

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

* [Bug target/112816] [11/12 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4]
  2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
                   ` (20 preceding siblings ...)
  2023-12-19  9:45 ` cvs-commit at gcc dot gnu.org
@ 2023-12-19  9:46 ` jakub at gcc dot gnu.org
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-19  9:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #21 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Should be fixed now.

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

end of thread, other threads:[~2023-12-19  9:46 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-01 21:12 [Bug middle-end/112816] New: internal compiler error: in extract_insn, at recog.cc:2804, unrecognizable_insn for __builtin_signbit a.elovikov at gmail dot com
2023-12-01 21:17 ` [Bug target/112816] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2023-12-01 21:19 ` pinskia at gcc dot gnu.org
2023-12-01 21:20 ` [Bug target/112816] [11/12/13/14 Regression] ICE unrecognizable_insn with __builtin_signbit and returning struct with int[4] pinskia at gcc dot gnu.org
2023-12-02  9:05 ` jakub at gcc dot gnu.org
2023-12-02  9:10 ` jakub at gcc dot gnu.org
2023-12-02  9:16 ` jakub at gcc dot gnu.org
2023-12-04  4:12 ` liuhongt at gcc dot gnu.org
2023-12-04  8:01 ` cvs-commit at gcc dot gnu.org
2023-12-04  8:02 ` [Bug target/112816] [11/12/13 " jakub at gcc dot gnu.org
2023-12-04 17:04 ` a.elovikov at gmail dot com
2023-12-05  8:09 ` cvs-commit at gcc dot gnu.org
2023-12-05 16:32 ` cvs-commit at gcc dot gnu.org
2023-12-05 17:02 ` [Bug target/112816] [11/12 " jakub at gcc dot gnu.org
2023-12-16  0:38 ` cvs-commit at gcc dot gnu.org
2023-12-17 13:55 ` cvs-commit at gcc dot gnu.org
2023-12-18 19:30 ` a.elovikov at gmail dot com
2023-12-18 20:03 ` jakub at gcc dot gnu.org
2023-12-19  9:25 ` cvs-commit at gcc dot gnu.org
2023-12-19  9:33 ` cvs-commit at gcc dot gnu.org
2023-12-19  9:37 ` cvs-commit at gcc dot gnu.org
2023-12-19  9:45 ` cvs-commit at gcc dot gnu.org
2023-12-19  9:46 ` 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).