public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Uros Bizjak <ubizjak@gmail.com>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix ICEs with ss{e,e2,se3} builtins with -mno-mmx (PR target/82483)
Date: Tue, 10 Oct 2017 05:52:00 -0000	[thread overview]
Message-ID: <CAMe9rOpSQ8XQcv=pY1PyModepJsQsnuK9Rdgm7miPBz42K6bbA@mail.gmail.com> (raw)
In-Reply-To: <20171009194749.GK8614@tucnak>

On 10/9/17, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Oct 09, 2017 at 09:28:58PM +0200, Uros Bizjak wrote:
>> On Mon, Oct 9, 2017 at 9:16 PM, Jakub Jelinek <jakub@redhat.com> wrote:
>> > Hi!
>> >
>> > The following builtins have {SSE,SSE2,SSSE3} CPUID, yet they have
>> > MMX register operands (either input or output or both).
>> > As -mno-mmx doesn't imply -mno-sse, we get ICEs on these though,
>> > because
>> > with MMX disabled it is not possible to emit them.
>> >
>> > The following patch cheats and declares these builtins to require
>> > both the MMX and {SSE,SSE2,SSSE3} ISA, making them unavailable in
>> > -mno-mmx
>> > code, but I think it is the right thing to do, when somebody uses
>> > -mno-mmx,
>> > the intent is usually not to have any instructions touching the MMX
>> > register
>> > file and thus needing EMMS etc.
>> >
>> > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>>
>> Hm, I remember there was similar patch for PR79565 [1], which seems
>> related. Does your patch also fix all builtins that HJ's patch touch?
>
> Ah, I wasn't aware of that patch.  Will look in detail tomorrow.
>
>> [1] https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00751.html
>
> Just quick analysis, while -mno-mmx doesn't imply -mno-sse (that is
> right), it implies -mno-3dnow and -mno-3dnow implies -mno-3dnowa.
> So all the spots that were changed from OPTION_MASK_ISA_3DNOW
> to OPTION_MASK_ISA_3DNOW | OPTION_MASK_ISA_MMX or from
> OPTION_MASK_ISA_3DNOW_A to OPTION_MASK_ISA_3DNOW_A | OPTION_MASK_ISA_MMX
> were useless, we can do what we did before.
> It is just OPTION_MASK_ISA_SSE or higher with OPTION_MASK_ISA_MMX that
> is needed.
> I have no idea why __builtin_ia32_sfence or __builtin_ia32_movntq were
> changed.
> Nor I understand why any sse.md changes are needed, then the builtins
> aren't available, those insns shouldn't be synthetized out of thin air.
> And the i386.c def_builtin change IMNSHO isn't needed either, it is
> a compile time speed/memory optimization not to declare everything
> unconditionally, and the way it works right now is that any of the enabled
> ISAs enables the builtin, meaning that MMX enabled will mean those
> 35 will be declared, even when perhaps SSE isn't enabled, or for
> SSE when MMX isn't enabled, but that isn't that big deal.
>
>

Please free feel to change it as long as there is no regression.

Thanks.


-- 
H.J.

  reply	other threads:[~2017-10-10  1:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09 19:17 Jakub Jelinek
2017-10-09 19:32 ` Uros Bizjak
2017-10-09 19:59   ` Jakub Jelinek
2017-10-10  5:52     ` H.J. Lu [this message]
2017-10-10 11:28     ` [PATCH] Fix ICEs with ss{e,e2,se3} builtins with -mno-mmx (PR target/82483, take 2) Jakub Jelinek
2017-10-10 13:03       ` Uros Bizjak

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='CAMe9rOpSQ8XQcv=pY1PyModepJsQsnuK9Rdgm7miPBz42K6bbA@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=ubizjak@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).