> FTR, my concern & suggestion was:
>
> I suppose the difficulty is that we might make:
>
> MASK_LOAD (mask, ptr, some-arbitrary-else-value)
>
> seem as cheap as:
>
> MASK_LOAD (mask, ptr, { 0, 0,. ... 0})
>
> which definitely isn't the case for SVE (and I'm guessing also
> for AVX). It would be better to keep the:
>
> COND_EXPR (mask, ..., some-arbitrary-else-value)
>
> separate and try to optimise it with surrounding code.
Ah, I rather understood that as an "either or" rather than an "and".
> That is, we'd add the else value to the maskload optab and MASK_LOAD
> internal function, but use predicates to test whether a target supports
> a particular else value.
So e.g. for SVE we'd have
res = MASK_LOAD (mask, ptr, {0, 0, ..., 0})
COND_EXPR (mask, res, {0, 0, ...})
which would always be folded/optimized away, while for RVV
we'd have
res = MASK_LOAD (mask, ptr, whatever_else_value)
COND_EXPR (mask, res, {0, 0, ...})
that could/should result in a separate instruction depending on
the rest of the code?
Regards
Robin