This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

Uroš Bizjak <ubizjak at gmail dot com> 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 <ubizjak at gmail dot com> ---
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--

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]