This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Try vector<bool> as a new representation for vector masks
- From: Richard Henderson <rth at redhat dot com>
- To: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- Cc: Jeff Law <law at redhat dot com>, Richard Biener <richard dot guenther at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 18 Sep 2015 09:50:43 -0700
- Subject: Re: [RFC] Try vector<bool> as a new representation for vector masks
- Authentication-results: sourceware.org; auth=none
- References: <CAFiYyc0xd4bN7kRqNomeijYX6TCSRxz3kpmBAvGnfRmWydfg9Q at mail dot gmail dot com> <CAMbmDYa0uARbRzyZWbud1YrpLZEV+11=wWEt7vVZFcxhZD0kWw at mail dot gmail dot com> <CAFiYyc38xisFJJndJ7yKsUbGciyq+NDNyCJzq_X46dK+9VsWWQ at mail dot gmail dot com> <CAMbmDYaT2v1UbDGPFz5_OiV=45PsKOdGCJ=J6CBwqEQMe+JN-g at mail dot gmail dot com> <CAFiYyc218U_zN+hF-JyL_ok6FxzgsPjKD5BYzznGAH7z53t_eA at mail dot gmail dot com> <CAMbmDYbdehpCFjf-1D5ytfSPBwLEB9HD6-SUUNy9JSAyOe8qwA at mail dot gmail dot com> <CAFiYyc37e5HP-SvhPxjbT03rNRZU+HamD5taxY8K_Sv2nsREPw at mail dot gmail dot com> <20150901130800 dot GA55610 at msticlxl57 dot ims dot intel dot com> <55EA0230 dot 3000102 at redhat dot com> <CAMbmDYYkrUCGDEz+qaD97DwP31-iMO+72c5rF206QhcHOrqL6A at mail dot gmail dot com> <20150915135233 dot GA26618 at msticlxl57 dot ims dot intel dot com> <55FAF9DD dot 6080505 at redhat dot com> <CAMbmDYatbcWLv5B4Y8Y7gRYjE5n_mOPJcHYGBo3m6+bdwMmtbg at mail dot gmail dot com>
On 09/18/2015 06:21 AM, Ilya Enkovich wrote:
>>> +machine_mode
>>> +default_get_mask_mode (unsigned nunits, unsigned vector_size)
>>> +{
>>> + unsigned elem_size = vector_size / nunits;
>>> + machine_mode elem_mode
>>> + = smallest_mode_for_size (elem_size * BITS_PER_UNIT, MODE_INT);
>>
>> Why these arguments as opposed to passing elem_size? It seems that every hook
>> is going to have to do this division...
>
> Every target would have nunits = vector_size / elem_size because
> nunits is used to create a vector mode. Thus no difference.
I meant passing nunits and elem_size, but not vector_size. Thus no division
required. If the target does require the vector size, it could be obtained by
multiplication, which is cheaper. But in cases like this we'd not require
either mult or div.
>>> @@ -1885,7 +1885,9 @@ expand_MASK_LOAD (gcall *stmt)
>>> create_output_operand (&ops[0], target, TYPE_MODE (type));
>>> create_fixed_operand (&ops[1], mem);
>>> create_input_operand (&ops[2], mask, TYPE_MODE (TREE_TYPE (maskt)));
>>> - expand_insn (optab_handler (maskload_optab, TYPE_MODE (type)), 3, ops);
>>> + expand_insn (convert_optab_handler (maskload_optab, TYPE_MODE (type),
>>> + TYPE_MODE (TREE_TYPE (maskt))),
>>> + 3, ops);
>>
>> Why do we now need a conversion here?
>
> Mask mode was implicit for masked loads and stores. Now it becomes
> explicit because we may load the same value using different masks.
> E.g. for i386 we may load 256bit vector using both vector and scalar
> masks.
Ok, sure, the mask mode is needed, I get that. But that doesn't answer the
question regarding conversion. Why would convert_optab_handler be needed to
*change* the mode of the mask. I assume that's not actually possible, with the
target hook already having chosen the proper mode for the mask.
r~