public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: Ilya Tocar <tocarip.intel@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH, i386, testsuite] FMA intrinsics
Date: Mon, 22 Aug 2011 20:41:00 -0000	[thread overview]
Message-ID: <CAFULd4ZZ6ozxao7OqXh=GetQr6okBSJXiYUB+io4egrc-KuChA@mail.gmail.com> (raw)
In-Reply-To: <CAFFGCRB-auRYMdLGPzSdb9ftGd++vtgeWzOG2xARQwe4vij9iQ@mail.gmail.com>

On Mon, Aug 22, 2011 at 6:25 PM, Ilya Tocar <tocarip.intel@gmail.com> wrote:

>> You don't need to add "negated" versions, one FMA builtin per mode is
>> enough, please see existing FMA4 descriptions. Just put unary minus
>> sign in the intrinsics header for "negated" operand and let GCC do its
>> job. Please see existing FMA4 intrinsics header.
>>
> Actually i tried that.But in such case  when i compile(FMA4 example)
> #include <x86intrin.h>
> extern  __m128 a,b,c;
> void foo(){
>   a = _mm_nmsub_ps(a,b,c);
> }
> with -S -O0 -mfma4
> The asm have
>
>        vxorps  %xmm1, %xmm0, %xmm0
>        vmovaps -16(%rbp), %xmm1
>        vmovaps .LC0(%rip), %xmm2
>        vxorps  %xmm2, %xmm1, %xmm1
>        vfmaddps        %xmm0, -32(%rbp), %xmm1, %xmm0
> So vfmaddps of negated values is generated instead of vfnmsubps.
> I think it is bad that intrinsic for  instruction can generate code
> without this instruction.
> So to make sure that exact instruction is always generated i
> introduced additional expands and builtins.
> Is it wrong?

This is artificial limitation. User requested the functionality of the
intrinsic, and should not bother with how the compiler realizes it.
With -O2, negation would propagate into the insn during combine pass,
and optimal instruction would be generated.

So, to answer your question - it is wrong to expect exact instruction
from builtins. Maybe from using -O0, but this should not be used
anyway in the testsuite.

Uros.

  reply	other threads:[~2011-08-22 19:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-20 11:23 Uros Bizjak
2011-08-22 17:32 ` Ilya Tocar
2011-08-22 20:41   ` Uros Bizjak [this message]
2011-08-23 14:55     ` Ilya Tocar
2011-08-23 15:33       ` Uros Bizjak
2011-08-24 10:06         ` Ilya Tocar
2011-08-24 10:12           ` Jakub Jelinek
2011-08-24 11:12             ` Ilya Tocar
2011-08-24 13:31               ` Uros Bizjak
2011-08-24 13:52                 ` Ilya Tocar
2011-08-24 22:00                   ` Uros Bizjak
2011-08-25 10:15                     ` Ilya Tocar
2011-08-25 10:46                       ` Uros Bizjak
2011-08-25 11:46                         ` Ilya Tocar
2011-08-25 11:46                           ` Jakub Jelinek
2011-08-25 11:49                             ` Ilya Tocar
2011-08-26 11:03                               ` Ilya Tocar
2011-08-26 14:07                                 ` H.J. Lu
2011-08-26 15:47                                   ` Ilya Tocar
2011-08-26 17:02                                     ` H.J. Lu
2011-08-26 17:06                                       ` H.J. Lu
2011-08-30 12:05                                         ` Ilya Tocar
2011-08-30 14:02                                           ` H.J. Lu
2011-08-30 14:10                                             ` Ilya Tocar
2011-08-30 14:32                                               ` Ilya Tocar
2011-08-30 15:25                                                 ` H.J. Lu
  -- strict thread matches above, loose matches on Subject: below --
2011-08-17 14:08 [PATCH, i386, testsuite]FMA intrinsics Ilya Tocar

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='CAFULd4ZZ6ozxao7OqXh=GetQr6okBSJXiYUB+io4egrc-KuChA@mail.gmail.com' \
    --to=ubizjak@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tocarip.intel@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).