This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Scalar masks 2/x] Use bool masks in if-conversion
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: Ilya Enkovich <enkovich dot gnu at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 21 Aug 2015 10:15:29 +0200
- Subject: Re: [Scalar masks 2/x] Use bool masks in if-conversion
- Authentication-results: sourceware.org; auth=none
- References: <20150817162544 dot GB12565 at msticlxl57 dot ims dot intel dot com> <55D62076 dot 8020105 at redhat dot com>
On Thu, Aug 20, 2015 at 8:46 PM, Jeff Law <law@redhat.com> wrote:
> On 08/17/2015 10:25 AM, Ilya Enkovich wrote:
>>
>> Hi,
>>
>> This patch intoriduces a new vectorizer hook use_scalar_mask_p which
>> affects code generated by if-conversion pass (and affects patterns in later
>> patches).
>>
>> Thanks,
>> Ilya
>> --
>> 2015-08-17 Ilya Enkovich <enkovich.gnu@gmail.com>
>>
>> * doc/tm.texi (TARGET_VECTORIZE_USE_SCALAR_MASK_P): New.
>> * doc/tm.texi.in: Regenerated.
>> * target.def (use_scalar_mask_p): New.
>> * tree-if-conv.c: Include target.h.
>> (predicate_mem_writes): Don't convert boolean predicates into
>> integer when scalar masks are used.
>
> Presumably this is how you prevent the generation of scalar masks rather
> than boolean masks on targets which don't have the former?
>
> I hate to ask, but how painful would it be to go from a boolean to integer
> masks later such as during expansion? Or vice-versa.
>
> WIthout a deep knowledge of the entire patchkit, it feels like we're
> introducing target stuff in a place where we don't want it and that we'd be
> better served with a canonical representation through gimple, then dropping
> into something more target specific during gimple->rtl expansion.
Indeed. I don't remember my exact comments during the talk at the Cauldron
but the scheme used there was sth like
mask = GEN_MASK <vec1 < vec2>;
b = a + 1;
x = VEC_COND <mask, a, b>
to model conditional execution already at the if-conversion stage (for
all scalar
stmts made executed unconditionally rather than just the PHI results). I was
asking for the condition to be removed from GEN_MASK (patch 1 has this
fixed now AFAICS). And I also asked why it was necessary to do this "lowering"
here and not simply do
mask = vec1 < vec2; // regular vector mask!
b = a + 1;
x = VEC_COND <mask, a, b>
and have the lowering to an integer mask done later. You'd still
change if-conversion
to predicate _all_ statements, not just those with side-effects. So I
think there
still needs to be a new target hook to trigger this, similar to how
the target capabilities
trigger the masked load/store path in if-conversion.
But I don't like changing our IL so much as to allow 'integer' masks everywhere.
Richard.
>
> Jeff