[PATCH] Allow all 1s of integer as standard SSE constants

H.J. Lu hjl.tools@gmail.com
Fri Apr 22 17:00:00 GMT 2016


On Fri, Apr 22, 2016 at 7:50 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Fri, Apr 22, 2016 at 7:19 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Fri, Apr 22, 2016 at 5:11 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>>> On Thu, Apr 21, 2016 at 10:58 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>
>>>> Here is the updated patch with my standard_sse_constant_p change and
>>>> your SSE/AVX pattern change.  I didn't include your
>>>> standard_sse_constant_opcode since it didn't compile nor is needed
>>>> for this purpose.
>>>
>>> H.J.,
>>>
>>> please test the attached patch that finally rewrites and improves SSE
>>> constants handling.
>>>
>>> This is what I want to commit, a follow-up patch will further clean
>>> standard_sse_constant_opcode wrt TARGET_AVX512VL.
>>>
>>
>> It doesn't address my problem which is "Allow all 1s of integer as
>> standard SSE constants".  The key here is "integer".  I'd like to use
>> SSE/AVX store TI/OI/XI integers with -1.
>>
>> --
>> H.J.
>
> I am testing this on top of yours:
>
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index 27c3bbd..677aa71 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -11136,7 +11136,20 @@ standard_sse_constant_p (rtx x, machine_mode pred_mode)
>    /* VOIDmode integer constant, infer mode from the predicate.  */
>    if (mode == VOIDmode)
>      mode = pred_mode;
> -
> +  if (CONST_INT_P (x))
> +    {
> +      /* If mode != VOIDmode, standard_sse_constant_p must be called:
> + 1. On TImode with SSE2.
> + 2. On OImode with AVX2.
> + 3. On XImode with AVX512F.
> +       */
> +      if ((HOST_WIDE_INT) INTVAL (x) == HOST_WIDE_INT_M1
> +  && (mode == VOIDmode
> +      || (mode == TImode && TARGET_SSE2)
> +      || (mode == OImode && TARGET_AVX2)
> +      || (mode == XImode && TARGET_AVX512F)))
> + return 2;
> +    }
>    else if (all_ones_operand (x, VOIDmode))
>      switch (GET_MODE_SIZE (mode))
>        {
>
>

This one works for me.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Allow-all-1s-of-integer-as-standard-SSE-constants.patch
Type: text/x-patch
Size: 17556 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160422/06d05e28/attachment.bin>


More information about the Gcc-patches mailing list