Bug 65990 - ICE: in extract_insn, at recog.c:2341 (unrecognizable insn) with -mmemcpy-strategy=rep_8byte:-1:noalign -m32 -mtune=btver2
Summary: ICE: in extract_insn, at recog.c:2341 (unrecognizable insn) with -mmemcpy-str...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 4.9.3
Assignee: Uroš Bizjak
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2015-05-03 07:44 UTC by Zdenek Sojka
Modified: 2015-05-06 16:23 UTC (History)
2 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: i686-pc-linux-gnu
Build:
Known to work:
Known to fail: 4.9.3, 5.1.1, 6.0
Last reconfirmed: 2015-05-04 00:00:00


Attachments
reduced testcase (98 bytes, text/plain)
2015-05-03 07:44 UTC, Zdenek Sojka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2015-05-03 07:44:34 UTC
Created attachment 35447 [details]
reduced testcase

Compiler output:
$ gcc -mmemcpy-strategy=rep_8byte:-1:noalign -m32 -mtune=btver2 testcase.c
testcase.c: In function 'foo':
testcase.c:24:1: error: unrecognizable insn:
 }
 ^
(insn 8 7 9 2 (parallel [
            (set (reg:SI 89)
                (const_int 0 [0]))
            (set (reg/f:SI 87)
                (plus:SI (ashift:SI (reg:SI 89)
                        (const_int 3 [0x3]))
                    (reg/f:SI 87)))
            (set (reg/f:SI 88)
                (plus:SI (ashift:SI (reg:SI 89)
                        (const_int 3 [0x3]))
                    (reg/f:SI 88)))
            (set (mem/c:BLK (reg/f:SI 87) [0 u9+0 S32 A32])
                (mem/u/c:BLK (reg/f:SI 88) [0  S32 A32]))
            (use (reg:SI 89))
        ]) testcase.c:11 -1
     (nil))
testcase.c:24:1: internal compiler error: in extract_insn, at recog.c:2341
0xae3e58 _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
        /mnt/svn/gcc-trunk/gcc/rtl-error.c:110
0xae3ee8 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        /mnt/svn/gcc-trunk/gcc/rtl-error.c:118
0xa99fe8 extract_insn(rtx_insn*)
        /mnt/svn/gcc-trunk/gcc/recog.c:2341
0x866dde instantiate_virtual_regs_in_insn
        /mnt/svn/gcc-trunk/gcc/function.c:1646
0x866dde instantiate_virtual_regs
        /mnt/svn/gcc-trunk/gcc/function.c:1966
0x866dde execute
        /mnt/svn/gcc-trunk/gcc/function.c:2015
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Tested revisions:
r222716 - ICE
5 r222437 - ICE
4_9 r222436 - ICE
Comment 1 Jakub Jelinek 2015-05-04 09:31:10 UTC
Not a regression, seems to have started with r201645 when the option has been introduced.
Comment 2 Uroš Bizjak 2015-05-05 07:03:02 UTC
We are passing (unsupported on 32bit target) DImode to expand_set_or_movmem_via_rep:

(gdb) bt
#0  expand_set_or_movmem_via_rep (destmem=0x2aaaae8b8d68, srcmem=0x2aaaae8b8d80, destptr=0x2aaaae8b8d98, srcptr=0x2aaaae8b8dc8, value=0x0, 
    orig_value=0x0, count=0x2aaaae7b06c0, mode=DImode, issetmem=false) at /home/uros/gcc-svn/trunk/gcc/config/i386/i386.c:23523
#1  0x00000000010eb99b in ix86_expand_set_or_movmem (dst=0x2aaaae8b8d68, src=0x2aaaae8b8d80, count_exp=0x2aaaae7b06c0, val_exp=0x0, 
    align_exp=0x2aaaae7b04c0, expected_align_exp=0x2aaaae7b04c0, expected_size_exp=0x2aaaae7b0470, min_size_exp=0x2aaaae7b06c0, 
    max_size_exp=0x2aaaae7b06c0, probable_max_size_exp=0x2aaaae7b06c0, issetmem=false) at /home/uros/gcc-svn/trunk/gcc/config/i386/i386.c:25114
#2  0x0000000001259fc4 in gen_movmemsi (operand0=0x2aaaae8b8d68, operand1=0x2aaaae8b8d80, operand2=0x2aaaae7b06c0, operand3=0x2aaaae7b04c0, 
    operand4=0x2aaaae7b04c0, operand5=0x2aaaae7b0470, operand6=0x2aaaae7b06c0, operand7=0x2aaaae7b06c0, operand8=0x2aaaae7b06c0)
    at /home/uros/gcc-svn/trunk/gcc/config/i386/i386.md:15968
Comment 3 Uroš Bizjak 2015-05-05 07:42:38 UTC
Proposed patch:

--cut here--
Index: i386.c
===================================================================
--- i386.c      (revision 222796)
+++ i386.c      (working copy)
@@ -2988,6 +2988,17 @@ ix86_parse_stringop_strategy_string (char *strateg
           return;
         }
 
+      if ((stringop_alg) i == rep_prefix_8_byte
+         && !TARGET_64BIT)
+       {
+         /* rep; movq isn't available in 32-bit code.  */
+         error ("stringop strategy name %s specified for option %s "
+                "not supported for 32-bit code",
+                 alg_name,
+                 is_memset ? "-mmemset_strategy=" : "-mmemcpy_strategy=");
+         return;
+       }
+
       input_ranges[n].max = maxs;
       input_ranges[n].alg = (stringop_alg) i;
       if (!strcmp (align, "align"))
--cut here--
Comment 4 uros 2015-05-05 16:53:59 UTC
Author: uros
Date: Tue May  5 16:53:27 2015
New Revision: 222817

URL: https://gcc.gnu.org/viewcvs?rev=222817&root=gcc&view=rev
Log:
	PR target/65990
	* config/i386/i386.c (ix86_parse_stringop_strategy_string): Error out
	if rep_8byte stringop strategy was specified for 32-bit target.

testsuite/ChangeLog:

	PR target/65990
	* gcc.target/i386/pr65990.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/i386/pr65990.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/testsuite/ChangeLog
Comment 5 uros 2015-05-06 16:18:32 UTC
Author: uros
Date: Wed May  6 16:17:59 2015
New Revision: 222858

URL: https://gcc.gnu.org/viewcvs?rev=222858&root=gcc&view=rev
Log:
	PR target/65990
	* config/i386/i386.c (ix86_parse_stringop_strategy_string): Error out
	if rep_8byte stringop strategy was specified for 32-bit target.

testsuite/ChangeLog:

	PR target/65990
	* gcc.target/i386/pr65990.c: New test.


Added:
    branches/gcc-5-branch/gcc/testsuite/gcc.target/i386/pr65990.c
Modified:
    branches/gcc-5-branch/gcc/ChangeLog
    branches/gcc-5-branch/gcc/config/i386/i386.c
    branches/gcc-5-branch/gcc/testsuite/ChangeLog
Comment 6 uros 2015-05-06 16:21:38 UTC
Author: uros
Date: Wed May  6 16:21:07 2015
New Revision: 222859

URL: https://gcc.gnu.org/viewcvs?rev=222859&root=gcc&view=rev
Log:
	PR target/65990
	* config/i386/i386.c (ix86_parse_stringop_strategy_string): Error out
	if rep_8byte stringop strategy was specified for 32-bit target.

testsuite/ChangeLog:

	PR target/65990
	* gcc.target/i386/pr65990.c: New test.


Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.target/i386/pr65990.c
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/config/i386/i386.c
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
Comment 7 Uroš Bizjak 2015-05-06 16:22:58 UTC
Fixed everywhere.
Comment 8 Uroš Bizjak 2015-05-06 16:23:12 UTC
.