Bug 103894 - [12 Regression] ICE: in emit_move_multi_word, at expr.c:3870 with -mno-sse2
Summary: [12 Regression] ICE: in emit_move_multi_word, at expr.c:3870 with -mno-sse2
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 12.0
: P1 normal
Target Milestone: 12.0
Assignee: Uroš Bizjak
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2022-01-03 05:32 UTC by Zdenek Sojka
Modified: 2022-01-03 20:28 UTC (History)
3 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build:
Known to work:
Known to fail: 12.0
Last reconfirmed: 2022-01-03 00:00:00


Attachments
reduced testcase (130 bytes, text/plain)
2022-01-03 05:32 UTC, Zdenek Sojka
Details
Proposed patch (707 bytes, patch)
2022-01-03 11:04 UTC, Uroš Bizjak
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2022-01-03 05:32:29 UTC
Created attachment 52110 [details]
reduced testcase

This seems to be a recent regression.

Compiler output:
$ x86_64-pc-linux-gnu-gcc -mno-sse2 testcase.c 
during RTL pass: reload
testcase.c: In function 'foo':
testcase.c:9:1: internal compiler error: in emit_move_multi_word, at expr.c:3870
    9 | }
      | ^
0x6c6c3b emit_move_multi_word
        /repo/gcc-trunk/gcc/expr.c:3870
0xfa3d0b gen_move_insn(rtx_def*, rtx_def*)
        /repo/gcc-trunk/gcc/expr.c:4145
0x11ade8d curr_insn_transform
        /repo/gcc-trunk/gcc/lra-constraints.c:4214
0x11af026 lra_constraints(bool)
        /repo/gcc-trunk/gcc/lra-constraints.c:5161
0x1199994 lra(_IO_FILE*)
        /repo/gcc-trunk/gcc/lra.c:2336
0x114c429 do_reload
        /repo/gcc-trunk/gcc/ira.c:5932
0x114c429 execute
        /repo/gcc-trunk/gcc/ira.c:6118
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r12-6173-20220102211314-g9ff206d3865-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++ --enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra --with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld --with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-r12-6173-20220102211314-g9ff206d3865-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20220102 (experimental) (GCC)
Comment 1 Jakub Jelinek 2022-01-03 08:50:20 UTC
Started with r12-6173-g9ff206d3865df5cb8407490aa9481029beac087f
Comment 2 Uroš Bizjak 2022-01-03 11:04:01 UTC
Created attachment 52111 [details]
Proposed patch

Patch in testing.
Comment 3 CVS Commits 2022-01-03 19:59:35 UTC
The master branch has been updated by Uros Bizjak <uros@gcc.gnu.org>:

https://gcc.gnu.org/g:1096ab1775636f35de9c6661f8f71f03299af998

commit r12-6194-g1096ab1775636f35de9c6661f8f71f03299af998
Author: Uros Bizjak <ubizjak@gmail.com>
Date:   Mon Jan 3 20:58:16 2022 +0100

    i386: Always enable mov<V_32:mode> patterns [PR103894]
    
    Middle end tries to generate V4QImode moves to implement V2QImode inserts
    and calls emit_move_multi_word when V4QImode moves are unavailable, as is
    the case with 32-bit vector moves, constrainted with TARGET_SSE2.
    
    However, this triggers
    
      gcc_assert (mode_size >= UNITS_PER_WORD);
    
    in emit_move_multi_word, since mode_size of V4QImode operand is less than
    UNITS_PER_WORD of 64-bit targets.
    
    The patch unconditionally enables 32-bit vector moves to match 16-bit
    vector moves.  This also enables implementation of 32-bit vector logic
    operations with GPR in a follow-up patch.
    
    2022-01-03  Uroš Bizjak  <ubizjak@gmail.com>
    
    gcc/ChangeLog:
    
            PR target/103894
            * config/i386/mmx.md (mov<V_32:mode>): Remove TARGET_SSE2 constraint.
            (mov<V_32:mode>_internal): Ditto.
            (*push<V_32:mode>_rex64): Ditto.
            (movmisalign<V_32:mode>): Ditto.
            (*push<V_32:mode>_rex64 splitter): Enable for
            TARGET_64BIT && TARGET_SSE.
            (*push<V_32:mode>2): Remove insn pattern.
    
    gcc/testsuite/ChangeLog:
    
            PR target/103894
            * gcc.target/i386/pr103894.c: New test.
Comment 4 Uroš Bizjak 2022-01-03 20:28:41 UTC
Fixed.