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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-11-30
             Status|UNCONFIRMED                 |ASSIGNED
           Priority|P3                          |P1
     Ever confirmed|0                           |1
             Target|                            |x86_64-*-*
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
   Target Milestone|---                         |12.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

(gdb) p debug_gimple_stmt (stmt)
_12 = (vector(8) signed int) foo_v256u8_0.0_1;
$1 = void
(gdb) p debug_tree (gimple_assign_lhs (stmt))
 <ssa_name 0x7ffff66ab3a8
    type <vector_type 0x7ffff66a5348
        type <integer_type 0x7ffff66a52a0 SI
            size <integer_cst 0x7ffff6543f90 constant 32>
            unit-size <integer_cst 0x7ffff6543fa8 constant 4>
            align:32 warn_if_not_align:0 symtab:0 alias-set 2 canonical-type
0x7ffff66a52a0 precision:32 min <integer_cst 0x7ffff6562438 -2147483648> max
<integer_cst 0x7ffff66b0570 2147483647>>
        BLK
        size <integer_cst 0x7ffff65620c0 constant 256>
        unit-size <integer_cst 0x7ffff65621b0 constant 32>
        align:256 warn_if_not_align:0 symtab:0 alias-set 2 canonical-type
0x7ffff66a5348 nunits:8>
    visited
    def_stmt _12 = (vector(8) signed int) foo_v256u8_0.0_1;
    version:12>
$2 = void
(gdb) p debug_tree (gimple_assign_rhs1 (stmt))
 <ssa_name 0x7ffff654ed80
    type <vector_type 0x7ffff667abd0
        type <integer_type 0x7ffff655e690 unsigned int public unsigned SI
            size <integer_cst 0x7ffff6543f90 constant 32>
            unit-size <integer_cst 0x7ffff6543fa8 constant 4>
            align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff655e690 precision:32 min <integer_cst 0x7ffff6543fc0 0> max <integer_cst
0x7ffff6543f78 4294967295>
            pointer_to_this <pointer_type 0x7ffff656e1f8>>
        unsigned BLK
        size <integer_cst 0x7ffff65620c0 constant 256>
        unit-size <integer_cst 0x7ffff65621b0 constant 32>
        align:256 warn_if_not_align:0 symtab:0 alias-set 1 canonical-type
0x7ffff667abd0 nunits:8
        pointer_to_this <pointer_type 0x7ffff66a51f8>>
    visited
    def_stmt foo_v256u8_0.0_1 = foo_v256u8_0;
    version:1>
$3 = void

the issue is that we introduce a non-V_C_E vector conversion in
forwprop3 that is not supported by the target and vector lowering is
not supporting lowering of such conversions.

/* Fold -((int)x >> (prec - 1)) into (unsigned)x >> (prec - 1).  */
(simplify
 (negate (convert? (rshift @0 INTEGER_CST@1)))
 (if (tree_nop_conversion_p (type, TREE_TYPE (@0))
      && wi::to_wide (@1) == element_precision (type) - 1)
  (with { tree stype = TREE_TYPE (@0);
          tree ntype = TYPE_UNSIGNED (stype) ? signed_type_for (stype)
                                             : unsigned_type_for (stype); }
   (convert (rshift:ntype (convert:ntype @0) @1)))))

is the pattern responsible.  For vector types this needs to check availability
of (convert ...) support or alternatively use VIEW_CONVERT.

Reply via email to