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

--- Comment #6 from rguenther at suse dot de <rguenther at suse dot de> ---
On Fri, 28 Aug 2020, marxin at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96466
> 
> --- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
> Looking at the ICE, we actually ICE at the place where a fake comparison is
> constructed:
> 
>   if (TREE_CODE_CLASS (tcode) != tcc_comparison)
>     {
>       gcc_assert (VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (op0)));
>       if (get_vcond_mask_icode (mode, TYPE_MODE (TREE_TYPE (op0)))
>           != CODE_FOR_nothing)
>         return gimple_build_call_internal (IFN_VCOND_MASK, 3, op0, op1, op2);
>       /* Fake op0 < 0.  */
>       else
>         {
>           gcc_assert (GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (op0)))
>                       == MODE_VECTOR_INT);
>           op0a = op0;
>           op0b = build_zero_cst (TREE_TYPE (op0));
>           tcode = LT_EXPR;
>         }
>     }
> 
> So we have:
> 
> (gdb) p debug_tree(op0a)
>  <ssa_name 0x7ffff74815e8
>     type <vector_type 0x7ffff743b1f8
>         type <boolean_type 0x7ffff743bf18 public DI
>             size <integer_cst 0x7ffff75d4d98 constant 64>
>             unit-size <integer_cst 0x7ffff75d4db0 constant 8>
>             align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
> 0x7ffff743bf18 precision:64 min <integer_cst 0x7ffff73da090
> -9223372036854775808> max <integer_cst 0x7ffff7448d20 9223372036854775807>>
>         BLK size <integer_cst 0x7ffff75d4d98 64> unit-size <integer_cst
> 0x7ffff75d4db0 8>
>         align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
> 0x7ffff743b1f8 nunits:1>
>     visited
>     def_stmt _4 = { 0 };
>     version:4>
> $4 = void
> (gdb) p debug_tree(op0b)
>  <vector_cst 0x7ffff74892a0
>     type <vector_type 0x7ffff743b1f8
>         type <boolean_type 0x7ffff743bf18 public DI
>             size <integer_cst 0x7ffff75d4d98 constant 64>
>             unit-size <integer_cst 0x7ffff75d4db0 constant 8>
>             align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
> 0x7ffff743bf18 precision:64 min <integer_cst 0x7ffff73da090
> -9223372036854775808> max <integer_cst 0x7ffff7448d20 9223372036854775807>>
>         BLK size <integer_cst 0x7ffff75d4d98 64> unit-size <integer_cst
> 0x7ffff75d4db0 8>
>         align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
> 0x7ffff743b1f8 nunits:1>
>     constant npatterns:1 nelts-per-pattern:1
>     elt:0:  <integer_cst 0x7ffff7489258 type <boolean_type 0x7ffff743bf18>
> constant 0>>
> $5 = void
> (gdb) p tcode
> $7 = LT_EXPR
> 
> but the modes do not match:
> 
> (gdb) p mode
> $1 = E_DImode
> (gdb) p cmp_op_mode
> $2 = E_BLKmode
> 
> and so we ICE here:
> 
>   gcc_assert (known_eq (GET_MODE_SIZE (mode), GET_MODE_SIZE (cmp_op_mode))
>               && known_eq (GET_MODE_NUNITS (mode),
>                            GET_MODE_NUNITS (cmp_op_mode)));
> 
> So what to do about it?

As said you have to fake "regular" non-bool comparison operands,
best based on the COND_EXPRs operand types (using integer types
of the same size)

Reply via email to