public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: Kirill Yukhin <kirill.yukhin@gmail.com>
Cc: Jakub Jelinek <jakub@redhat.com>, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH i386 13/8] [AVX-512] Fix argument order for perm and recp intrinsics.
Date: Tue, 18 Feb 2014 10:34:00 -0000	[thread overview]
Message-ID: <CAFULd4bWXwzO6e6Gnq7wGK8fzQzqfLkf2U+SDON75VHt6jjy6Q@mail.gmail.com> (raw)
In-Reply-To: <20140218100651.GA4382@msticlxl57.ims.intel.com>

On Tue, Feb 18, 2014 at 11:06 AM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:

>> >> >> Please don't change srcp pattern, it should be defined similar to
>> >> >> vrcpss (aka sse_vmrcpv4sf). You need to switch operand order
>> >> >> elsewhere.
>> >> >
>> >> > No, you are correct. Operands should be swapped as in your patch.
>> >>
>> >> Eh, sorry that after some more thinking, I have to again revert this decision.
>> >>
>> >> The srcp pattern should remain as is, and you should swap operands in
>> >> avx512fintrin.h instead:
>> >
>> > In the bottom there's updated patch.
>> >
>> > Added "sse" type. mem operand made second.
>> > Built-ins & tests fixed.
>> >
>> > Testing in progress.
>> >
>> > Is it ok for mainline if pass?
>>
>> No, you got operand order wrong.
>>
>> To correctly calculate "memory" attribute, all "sse" type insns expect
>> the operands in the way sse_vmrcpv4sf2 is defined. You should keep
>> nonimmedate operand as operand_1 and switch operands in builtins and
>> insn mnemonics to fulfill required operand order *in the pattern*.
> Patch updated. It is in the bottom.
> gcc/
>         * config/i386/avx512erintrin.h (_mm_rcp28_round_sd): Swap operands.
>         (_mm_rcp28_round_ss): Ditto.
>         (_mm_rsqrt28_round_sd): Ditto.
>         (_mm_rsqrt28_round_ss): Ditto.
>         * config/i386/avx512erintrin.h (_mm_rcp14_round_sd): Ditto.
>         (_mm_rcp14_round_ss): Ditto.
>         (_mm_rsqrt14_round_sd): Ditto.
>         (_mm_rsqrt14_round_ss): Ditto.
>         * config/i386/sse.md (rsqrt14<mode>): Make memory first operand.

"Put nonimmediate operand as the first input operand." (and in similar
way below).

>         (avx512er_exp2<mode><mask_name><round_saeonly_name>): Set type
>         attribute to sse.
>         (<mask_codefor>avx512er_rcp28<mode><mask_name><round_saeonly_name>):
>         Ditto.
>         (avx512er_vmrcp28<mode><round_saeonly_name>): Make memory first
>         operand, set type attribute.
>         (<mask_codefor>avx512er_rsqrt28<mode><mask_name><round_saeonly_name>):
>         Set type attribute.
>         (avx512er_vmrsqrt28<mode><round_saeonly_name>): Make memory first
>         operand, Set type attribute.
>
> gcc/testsuite/
>         * gcc.target/i386/avx512er-vrcp28sd-2.c: Distinguish src1 and src2.
>         * gcc.target/i386/avx512er-vrcp28ss-2.c: Call correct intrinsic.
>         * gcc.target/i386/avx512er-vrsqrt28sd-2.c: Distinguish src1 and src2.
>         * gcc.target/i386/avx512er-vrsqrt28ss-2.c: Ditto.
>         * gcc.target/i386/avx512f-vrcp14sd-2.c: Fix reference calculation.
>         * gcc.target/i386/avx512f-vrcp14ss-2.c: Ditto.

OK with a slight adjustement to vrcp14 patter below.

> --- a/gcc/config/i386/sse.md
> +++ b/gcc/config/i386/sse.md
> @@ -1551,13 +1551,13 @@
>    [(set (match_operand:VF_128 0 "register_operand" "=v")
>         (vec_merge:VF_128
>           (unspec:VF_128
> -           [(match_operand:VF_128 1 "register_operand" "v")
> -            (match_operand:VF_128 2 "nonimmediate_operand" "vm")]
> +           [(match_operand:VF_128 2 "register_operand" "v")
> +            (match_operand:VF_128 1 "nonimmediate_operand" "vm")]
>             UNSPEC_RSQRT14)
>           (match_dup 1)
>           (const_int 1)))]
>    "TARGET_AVX512F"
> -  "vrsqrt14<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
> +  "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %1}"

This pattern should probably read the same as other vmrsqrt patterns
(e.g. sse_vmrsqrtv4sf2 and avx512er_vmrsqrt28...):

       (vec_merge:VF_128
         (unspec:VF_128
           [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
           UNSPEC_RSQRT14)
         (match_operand:VF_128 2 "register_operand" "v")
         (const_int 1)))]
  "TARGET_AVX512F"
  "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %1}"

OK with the change above.

Thanks,
Uros.

      reply	other threads:[~2014-02-18 10:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13 10:45 Kirill Yukhin
2014-02-13 12:37 ` Uros Bizjak
2014-02-13 12:55   ` Uros Bizjak
2014-02-13 17:25     ` Uros Bizjak
2014-02-17 12:27       ` Kirill Yukhin
2014-02-17 12:42         ` Uros Bizjak
2014-02-18 10:07           ` Kirill Yukhin
2014-02-18 10:34             ` Uros Bizjak [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFULd4bWXwzO6e6Gnq7wGK8fzQzqfLkf2U+SDON75VHt6jjy6Q@mail.gmail.com \
    --to=ubizjak@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=kirill.yukhin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).