Bug 83623 - [8 Regression] ICE: in convert_move, at expr.c:248 with -march=knl and 16bit vector bswap/rotate
Summary: [8 Regression] ICE: in convert_move, at expr.c:248 with -march=knl and 16bit ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: 6.5
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code
: 86166 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-12-29 22:03 UTC by Zdenek Sojka
Modified: 2018-06-20 13:27 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: 6.4.0, 8.0
Last reconfirmed: 2017-12-30 00:00:00


Attachments
reduced testcase (96 bytes, text/plain)
2017-12-29 22:03 UTC, Zdenek Sojka
Details
gcc8-pr83623.patch (681 bytes, patch)
2017-12-30 10:58 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2017-12-29 22:03:59 UTC
Created attachment 42982 [details]
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -march=knl testcase.c    
during RTL pass: expand
testcase.c: In function 'foo':
testcase.c:6:14: internal compiler error: in convert_move, at expr.c:248
   x = x << 8 | x >> 8;
       ~~~~~~~^~~~~~~~
0x9858cc convert_move(rtx_def*, rtx_def*, int)
        /repo/gcc-trunk/gcc/expr.c:248
0x985d25 convert_modes(machine_mode, machine_mode, rtx_def*, int)
        /repo/gcc-trunk/gcc/expr.c:706
0xbf7f21 maybe_legitimize_operand
        /repo/gcc-trunk/gcc/optabs.c:7096
0xbf7f21 maybe_legitimize_operands(insn_code, unsigned int, unsigned int, expand_operand*)
        /repo/gcc-trunk/gcc/optabs.c:7145
0xbf8589 maybe_gen_insn(insn_code, unsigned int, expand_operand*)
        /repo/gcc-trunk/gcc/optabs.c:7163
0xc0265f expand_unop_direct
        /repo/gcc-trunk/gcc/optabs.c:2694
0xc00786 expand_unop(machine_mode, optab_tag, rtx_def*, rtx_def*, int)
        /repo/gcc-trunk/gcc/optabs.c:2736
0x96cd23 expand_variable_shift(tree_code, machine_mode, rtx_def*, tree_node*, rtx_def*, int)
        /repo/gcc-trunk/gcc/expmed.c:2661
0x995dbf expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier)
        /repo/gcc-trunk/gcc/expr.c:9310
0x8486e3 expand_gimple_stmt_1
        /repo/gcc-trunk/gcc/cfgexpand.c:3729
0x8486e3 expand_gimple_stmt
        /repo/gcc-trunk/gcc/cfgexpand.c:3790
0x84a29d expand_gimple_basic_block
        /repo/gcc-trunk/gcc/cfgexpand.c:5797
0x84fe06 execute
        /repo/gcc-trunk/gcc/cfgexpand.c:6403
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-256032-checking-yes-rtl-df-extra-nobootstrap-nographite-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/8.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 --disable-bootstrap --without-cloog --without-ppl --without-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-256032-checking-yes-rtl-df-extra-nobootstrap-nographite-amd64
Thread model: posix
gcc version 8.0.0 20171229 (experimental) (GCC)
Comment 1 Jakub Jelinek 2017-12-30 10:45:37 UTC
Started with r254967, but is a middle-end bug.  I have a patch.
Comment 2 Jakub Jelinek 2017-12-30 10:46:54 UTC
The real bug has been actually introduced in r217302.
Comment 3 Jakub Jelinek 2017-12-30 10:58:03 UTC
Created attachment 42984 [details]
gcc8-pr83623.patch

Untested fix.
Comment 4 Jakub Jelinek 2017-12-31 23:51:03 UTC
Author: jakub
Date: Sun Dec 31 23:50:32 2017
New Revision: 256051

URL: https://gcc.gnu.org/viewcvs?rev=256051&root=gcc&view=rev
Log:
	PR middle-end/83623
	* expmed.c (expand_shift_1): For 2-byte rotates by BITS_PER_UNIT,
	check for bswap in mode rather than HImode and use that in expand_unop
	too.

	* gcc.dg/pr83623.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr83623.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/expmed.c
    trunk/gcc/testsuite/ChangeLog
Comment 5 Jakub Jelinek 2018-01-01 11:10:08 UTC
Fixed.
Comment 6 Jakub Jelinek 2018-01-01 11:27:49 UTC
Author: jakub
Date: Mon Jan  1 11:27:17 2018
New Revision: 256061

URL: https://gcc.gnu.org/viewcvs?rev=256061&root=gcc&view=rev
Log:
	PR middle-end/83623
	* expmed.c (expand_shift_1): For 2-byte rotates by BITS_PER_UNIT,
	check for bswap in mode rather than HImode and use that in expand_unop
	too.

	* gcc.dg/pr83623.c: New test.

Added:
    branches/gcc-7-branch/gcc/testsuite/gcc.dg/pr83623.c
Modified:
    branches/gcc-7-branch/gcc/ChangeLog
    branches/gcc-7-branch/gcc/expmed.c
    branches/gcc-7-branch/gcc/testsuite/ChangeLog
Comment 7 Richard Biener 2018-06-20 08:44:15 UTC
*** Bug 86166 has been marked as a duplicate of this bug. ***
Comment 8 Ramana Radhakrishnan 2018-06-20 09:06:07 UTC
Seems to need a fix for gcc 6 branch based on PR86166
Comment 9 Richard Biener 2018-06-20 11:09:59 UTC
Author: rguenth
Date: Wed Jun 20 11:09:28 2018
New Revision: 261799

URL: https://gcc.gnu.org/viewcvs?rev=261799&root=gcc&view=rev
Log:
2018-06-20  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2018-01-01  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/83623
	* expmed.c (expand_shift_1): For 2-byte rotates by BITS_PER_UNIT,
	check for bswap in mode rather than HImode and use that in expand_unop
	too.

	* gcc.dg/pr83623.c: New test.

	2017-09-26  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-09-20  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82264
	* tree-ssa-sccvn.c (vn_phi_eq): Use safe_dyn_cast to check
	for GIMPLE_CONDs.
	(vn_phi_lookup): Likewise.
	(vn_phi_insert): Likewise.
	* is-a.h (safe_dyn_cast): New.

	* gcc.dg/torture/pr82264.c: New testcase.

	2017-09-25  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82285
	* tree-vect-patterns.c (vect_recog_bool_pattern): Also handle
	enumeral types.

	* gcc.dg/torture/pr82285.c: New testcase.

	2017-11-24  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82402
	* tree-vect-loop-manip.c (create_lcssa_for_virtual_phi): Properly
	set SSA_NAME_OCCURS_IN_ABNORMAL_PHI.

	* gcc.dg/torture/pr82402.c: New testcase.

	2017-10-24  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82697
	* tree-ssa-phiopt.c (cond_store_replacement): Use alias-set
	zero for conditional load and unconditional store.

	* gcc.dg/torture/pr82697.c: New testcase.

	2017-11-02  Richard Biener  <rguenther@suse.de>

	PR middle-end/82765
	* varasm.c (decode_addr_const): Make offset HOST_WIDE_INT.
	Truncate ARRAY_REF index and element size.

	* gcc.dg/pr82765.c: New testcase.

	2018-01-08  Richard Biener  <rguenther@suse.de>

	PR middle-end/83713
	* convert.c (do_narrow): Properly guard TYPE_OVERFLOW_WRAPS checks.

	* g++.dg/torture/pr83713.C: New testcase.

Added:
    branches/gcc-6-branch/gcc/testsuite/g++.dg/torture/pr83713.C
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/pr82765.c
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/pr83623.c
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr82264.c
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr82285.c
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr82402.c
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr82697.c
Modified:
    branches/gcc-6-branch/gcc/ChangeLog
    branches/gcc-6-branch/gcc/convert.c
    branches/gcc-6-branch/gcc/expmed.c
    branches/gcc-6-branch/gcc/is-a.h
    branches/gcc-6-branch/gcc/testsuite/ChangeLog
    branches/gcc-6-branch/gcc/tree-ssa-alias.c
    branches/gcc-6-branch/gcc/tree-ssa-phiopt.c
    branches/gcc-6-branch/gcc/tree-ssa-sccvn.c
    branches/gcc-6-branch/gcc/tree-vect-loop-manip.c
    branches/gcc-6-branch/gcc/tree-vect-patterns.c
    branches/gcc-6-branch/gcc/varasm.c
Comment 10 Richard Biener 2018-06-20 13:27:15 UTC
Fixed.