https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105394
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
We are calling tree_vec_extract with bitsize 32 but a QImode boolean type.

ICK.

(gdb) p debug_gimple_stmt (stmt)
_8 = VEC_COND_EXPR <_6, _7, { 3.0e+0, 3.0e+0, 3.0e+0, 3.0e+0 }>;
$15 = void
(gdb) p debug_tree (a)
 <ssa_name 0x7ffff6492318
    type <vector_type 0x7ffff66309d8
        type <boolean_type 0x7ffff6630930 public QI
            size <integer_cst 0x7ffff6526348 constant 8>
            unit-size <integer_cst 0x7ffff6526360 constant 1>
            align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6630930 precision:4 min <integer_cst 0x7ffff662e300 -8> max <integer_cst
0x7ffff662e348 7>>
        V4BI
        size <integer_cst 0x7ffff6526408 constant 16>
        unit-size <integer_cst 0x7ffff6526420 constant 2>
        align:16 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff66309d8 nunits:4>
    visited
    def_stmt _6 = _27;
    version:6>

so we have a non 1-precision BImode bool.  That's something we assume
doesn't happen (here).

I see V4BImode is 2 bytes in size, are there really 4 bits used for each
element?

The patch below assumes that and generates

  _40 = VIEW_CONVERT_EXPR<unsigned short>(_6);
  _41 = _40 & 15;
  _42 = _41 != 0 ? _30 : 3.0e+0;
  _43 = _40 & 240;
  _44 = _43 != 0 ? _33 : 3.0e+0;
  _45 = _40 & 3840;
  _46 = _45 != 0 ? _36 : 3.0e+0;
  _47 = _40 & 61440;
  _48 = _47 != 0 ? _39 : 3.0e+0;
  _8 = {_42, _44, _46, _48};

for the unsupported VEC_COND_EXPR.  The approach won't work for variable-length
vectors since we cannot pun that to an integer type (precision is always
constant).  So eventually using an adjusted BIT_FIELD_REF for the
vector BImode case is better - as said the current code simply assumes
a classical mask.

I suppose for SVE we never run into unsupported conds?

Reply via email to