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/34155] New: [4.3 Regression] ICE in simplify_binary_operation_1, at simplify-rtx.c:2666 on sh64


With -O, gcc.c-torture/compile/simd-2.c ICEs with

internal compiler error: in simplify_binary_operation_1, at simplify-rtx.c:2666

on sh64.  It didn't fail on revision 127620, so this is a 4.3 regression.

The backtrace with gdb looks like

#1  0x08388b7d in simplify_binary_operation (code=VEC_SELECT, mode=SFmode, 
    op0=0xa6a, op1=0x87d1c52) at ../../ORIG/trunk/gcc/simplify-rtx.c:2875
#2  0x086c6b05 in combine_simplify_rtx (x=0x40239888, op0_mode=SFmode, 
    in_dest=0) at ../../ORIG/trunk/gcc/combine.c:4706
#3  0x086c933a in subst (x=0x40239888, from=0x40234110, to=0x401a30c0, 
    in_dest=0, unique_copy=0) at ../../ORIG/trunk/gcc/combine.c:4541

and the first parameter of combine_simplify_rtx at #2 is:

(vec_select:SF (plus:SF (vec_select:SF (reg:V2SF 163)
            (parallel [
                    (const_int 0 [0x0])
                ]))
        (vec_select:SF (reg:V2SF 175)
            (parallel [
                    (const_int 0 [0x0])
                ])))
    (parallel [
            (const_int 0 [0x0])
        ]))

simplify_binary_operation_1 checks if the first argument of vec_select
is VECTOR_MODE_P when the mode of vec_select is a scalar type:

    case VEC_SELECT:
      if (!VECTOR_MODE_P (mode))
        {
          gcc_assert (VECTOR_MODE_P (GET_MODE (trueop0)));

but the above rtl isn't.  Thus the above gcc_assert fails.
It seems that combine optimization makes a rtl like

(vec_select:SF
  (vec_select:V2SF
    (vec_concat:V2SF
        (vec_select:SF (reg:V2SF 187)
            (parallel [
                    (const_int 1 [0x1])
                ]))
        (plus:SF (vec_select:SF (reg:V2SF 163)
                   (parallel [
                        (const_int 0 [0x0])
                    ]))
               (vec_select:SF (reg:V2SF 175)
                 (parallel [
                        (const_int 0 [0x0])
                    ]))))
    (parallel [
            (const_int 1 [0x1])
            (const_int 0 [0x0])
        ]))
  (parallel [
          (const_int 0 [0x0])
   ]))

and simplify_binary_operation_1 simplifies it to

(vec_select:SF
  (plus:SF (vec_select:SF (reg:V2SF 163)
             (parallel [
                  (const_int 0 [0x0])
               ]))
           (vec_select:SF (reg:V2SF 175)
             (parallel [
                  (const_int 0 [0x0])
               ])))
  (parallel [
        (const_int 0 [0x0])
    ]))

with the code flow

    case VEC_SELECT:
      if (!VECTOR_MODE_P (mode))
        {
          gcc_assert (VECTOR_MODE_P (GET_MODE (trueop0)));
          ...

          /* Extract a scalar element from a nested VEC_SELECT expression
             (with optional nested VEC_CONCAT expression).  Some targets
             (i386) extract scalar element from a vector using chain of
             nested VEC_SELECT expressions.  When input operand is a memory
             operand, this operation can be simplified to a simple scalar
             load from an offseted memory address.  */
          if (GET_CODE (trueop0) == VEC_SELECT)
            {
              ...

              /* Handle the case when nested VEC_SELECT wraps VEC_CONCAT.  */
              if (GET_CODE (op0) == VEC_CONCAT)
                  ...

              tmp = gen_rtx_fmt_ee (code, mode,
                                    tmp_op, gen_rtx_PARALLEL (VOIDmode, vec));
              return tmp;
            }

in the failed case.
Then at the another simplify_binary_operation_1 invocation, the last
rtl is considered a problematic one.


-- 
           Summary: [4.3 Regression] ICE in simplify_binary_operation_1, at
                    simplify-rtx.c:2666 on sh64
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kkojima at gcc dot gnu dot org
GCC target triplet: sh64-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34155


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