[Bug target/77452] [7 Regression] ICE: in plus_constant, at explow.c:87 with -fno-split-wide-types -mavx512f --param=max-combine-insns=2

2016-09-06 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77452

Uroš Bizjak  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Uroš Bizjak  ---
Fixed for gcc-6+.

[Bug target/77452] [7 Regression] ICE: in plus_constant, at explow.c:87 with -fno-split-wide-types -mavx512f --param=max-combine-insns=2

2016-09-06 Thread uros at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77452

--- Comment #4 from uros at gcc dot gnu.org ---
Author: uros
Date: Tue Sep  6 15:33:32 2016
New Revision: 240012

URL: https://gcc.gnu.org/viewcvs?rev=240012=gcc=rev
Log:
Backport from mainline
2016-09-05  Uros Bizjak  

PR rtl-optimization/77452
* explow.c (plus_constant) : Extract scalar constant from
inner-mode reference to a CONST_VECTOR constant in the constant pool.

testsuite/ChangeLog:

Backport from mainline
2016-09-05  Uros Bizjak  

PR rtl-optimization/77452
* gcc.target/i386/pr77452.c: New test.


Added:
branches/gcc-6-branch/gcc/testsuite/gcc.target/i386/pr77452.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/explow.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug target/77452] [7 Regression] ICE: in plus_constant, at explow.c:87 with -fno-split-wide-types -mavx512f --param=max-combine-insns=2

2016-09-05 Thread uros at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77452

--- Comment #3 from uros at gcc dot gnu.org ---
Author: uros
Date: Mon Sep  5 14:44:19 2016
New Revision: 239989

URL: https://gcc.gnu.org/viewcvs?rev=239989=gcc=rev
Log:
PR rtl-optimization/77452
* explow.c (plus_constant) : Extract scalar constant from
inner-mode reference to a CONST_VECTOR constant in the constant pool.

testsuite/ChangeLog:

PR rtl-optimization/77452
* gcc.target/i386/pr77452.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/i386/pr77452.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/explow.c
trunk/gcc/testsuite/ChangeLog

[Bug target/77452] [7 Regression] ICE: in plus_constant, at explow.c:87 with -fno-split-wide-types -mavx512f --param=max-combine-insns=2

2016-09-04 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77452

Uroš Bizjak  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2016-09-04
   Assignee|unassigned at gcc dot gnu.org  |ubizjak at gmail dot com
 Ever confirmed|0   |1

--- Comment #2 from Uroš Bizjak  ---
Combine is able to combine the whole sequence of:

(insn 24 12 25 2 (set (reg:V2SI 110)
(vec_concat:V2SI (subreg:SI (reg/v:V4TI 100 [ v ]) 0)
(const_int 0 [0]))) pr77452.c:7 3640 {*vec_concatv2si_sse4_1}
 (nil))
(insn 25 24 26 2 (set (reg:V2SI 112)
(mem/u/c:V2SI (symbol_ref/u:DI ("*.LC0") [flags 0x2]) [2  S8 A64]))
pr77452.c:7 1115 {*movv2si_internal}
 (expr_list:REG_EQUAL (const_vector:V2SI [
(const_int 1 [0x1])
(const_int 1 [0x1])
])
(nil)))
(insn 26 25 30 2 (set (reg:V4SI 113)
(vec_concat:V4SI (reg:V2SI 112)
(reg:V2SI 110))) pr77452.c:7 3642 {*vec_concatv4si}
 (expr_list:REG_DEAD (reg:V2SI 112)
(expr_list:REG_DEAD (reg:V2SI 110)
(nil
(insn 30 26 32 2 (set (reg:V8SI 117)
(vec_concat:V8SI (reg:V4SI 113)
(const_vector:V4SI [
(const_int 0 [0])
(const_int 0 [0])
(const_int 0 [0])
(const_int 0 [0])
]))) pr77452.c:7 4493 {avx_vec_concatv8si}
 (expr_list:REG_DEAD (reg:V4SI 113)
(nil)))
(insn 32 30 34 2 (set (reg:V16SI 101 [ D.2653 ])
(vec_concat:V16SI (reg:V8SI 117)
(const_vector:V8SI [
(const_int 0 [0])
(const_int 0 [0])
(const_int 0 [0])
(const_int 0 [0])
(const_int 0 [0])
(const_int 0 [0])
(const_int 0 [0])
(const_int 0 [0])
]))) pr77452.c:7 4499 {avx_vec_concatv16si}
 (expr_list:REG_DEAD (reg:V8SI 117)
(nil)))
(insn 34 32 35 2 (set (reg:SI 90 [ _4 ])
(subreg:SI (reg:V16SI 101 [ D.2653 ]) 0)) pr77452.c:7 82
{*movsi_internal}
 (expr_list:REG_DEAD (reg:V16SI 101 [ D.2653 ])
(nil)))

to a simple:

(insn 34 32 35 2 (set (reg:SI 90 [ _4 ])
(mem/u/c:SI (symbol_ref/u:DI ("*.LC0") [flags 0x2]) [2  S4 A64]))
pr77452.c:7 82 {*movsi_internal}
 (nil))


However, plus_constant is not able to handle lowpart SImode access to:

(const_vector:V2SI [
(const_int 1 [0x1])
(const_int 1 [0x1])
])

Following patch allows this.

--cut here--
Index: explow.c
===
--- explow.c(revision 239975)
+++ explow.c(working copy)
@@ -106,7 +106,15 @@ plus_constant (machine_mode mode, rtx x, HOST_WIDE
   if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF
  && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)))
{
- tem = plus_constant (mode, get_pool_constant (XEXP (x, 0)), c);
+ rtx cst = get_pool_constant (XEXP (x, 0));
+
+ if (GET_CODE (cst) == CONST_VECTOR
+ && GET_MODE_INNER (GET_MODE (cst)) == mode)
+   {
+ cst = gen_lowpart (mode, cst);
+ gcc_assert (cst);
+   }
+ tem = plus_constant (mode, cst, c);
  tem = force_const_mem (GET_MODE (x), tem);
  /* Targets may disallow some constants in the constant pool, thus
 force_const_mem may return NULL_RTX.  */
--cut here--

[Bug target/77452] [7 Regression] ICE: in plus_constant, at explow.c:87 with -fno-split-wide-types -mavx512f --param=max-combine-insns=2

2016-09-02 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77452

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |7.0

[Bug target/77452] [7 Regression] ICE: in plus_constant, at explow.c:87 with -fno-split-wide-types -mavx512f --param=max-combine-insns=2

2016-09-02 Thread zsojka at seznam dot cz
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77452

--- Comment #1 from Zdenek Sojka  ---
(gdb) p mode
$4 = SImode
(gdb) p *x  
$6 = {code = CONST_VECTOR, mode = V2SImode, ...