What also works is something like:

      scalar_mode extract_mode = innermode;
      if (GET_MODE_CLASS (outermode) == MODE_VECTOR_BOOL)
        extract_mode = smallest_int_mode_for_size
                          (GET_MODE_PRECISION (innermode));

however

> So yes, I guess we need to answer BImode vs. QImode.  I hope Richard
> has a better idea here?

aarch64's predicate vec_extract is:

(define_expand "vec_extract<vpred><Vel>"
  [(match_operand:<VEL> 0 "register_operand")
   (match_operand:<VPRED> 1 "register_operand")
   (match_operand:SI 2 "nonmemory_operand")
   ;; Dummy operand to which we can attach the iterator.
   (reg:SVE_FULL_I V0_REGNUM)]

So if I'm reading this correctly they are using the element
mode of the associated full vector mode for extraction rather
than QImode.

I could also do something similar for the riscv backend but
that still wouldn't yield a BImode vec_extract result of course
and expmed would need to be adjusted.  Do we even know the
original associated non-predicate mode here?  I suppose not?

Do we need a mov from/to BImode instead?

Maybe Richard has a good idea.

Even though I haven't seen it being hit, vec_set in expmed
would have the same problem?

Regards
 Robin

Reply via email to