All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: also suppress use of MMX insns
@ 2022-07-20 13:30 Jan Beulich
  2022-07-20 13:33 ` Andrew Cooper
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2022-07-20 13:30 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Wei Liu, Roger Pau Monné, ChrisD

Passing -mno-sse alone is not enough: The compiler may still find
(questionable) reasons to use MMX insns. In particular with gcc12 use
of MOVD+PUNPCKLDQ+MOVQ was observed in an apparent attempt to auto-
vectorize the storing of two adjacent zeroes, 32 bits each.

Reported-by: ChrisD <chris@dalessio.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -36,9 +36,9 @@ $(call cc-option-add,CFLAGS,CC,-Wa$$(com
 
 CFLAGS += -mno-red-zone -fpic
 
-# Xen doesn't use SSE interally.  If the compiler supports it, also skip the
-# SSE setup for variadic function calls.
-CFLAGS += -mno-sse $(call cc-option,$(CC),-mskip-rax-setup)
+# Xen doesn't use MMX or SSE interally.  If the compiler supports it, also skip
+# the SSE setup for variadic function calls.
+CFLAGS += -mno-mmx -mno-sse $(call cc-option,$(CC),-mskip-rax-setup)
 
 ifeq ($(CONFIG_INDIRECT_THUNK),y)
 # Compile with gcc thunk-extern, indirect-branch-register if available.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: also suppress use of MMX insns
  2022-07-20 13:30 [PATCH] x86: also suppress use of MMX insns Jan Beulich
@ 2022-07-20 13:33 ` Andrew Cooper
  2022-07-20 13:36   ` Jan Beulich
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cooper @ 2022-07-20 13:33 UTC (permalink / raw)
  To: Jan Beulich, xen-devel
  Cc: Andrew Cooper, Wei Liu, Roger Pau Monné, ChrisD

On 20/07/2022 14:30, Jan Beulich wrote:
> Passing -mno-sse alone is not enough: The compiler may still find
> (questionable) reasons to use MMX insns. In particular with gcc12 use
> of MOVD+PUNPCKLDQ+MOVQ was observed in an apparent attempt to auto-
> vectorize the storing of two adjacent zeroes, 32 bits each.
>
> Reported-by: ChrisD <chris@dalessio.org>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

But while we're at it, what else might we have to clobber to stop
nonsense like this?  x87 and avx come to mind.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: also suppress use of MMX insns
  2022-07-20 13:33 ` Andrew Cooper
@ 2022-07-20 13:36   ` Jan Beulich
  2022-07-20 13:39     ` Andrew Cooper
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2022-07-20 13:36 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Andrew Cooper, Wei Liu, Roger Pau Monné, ChrisD, xen-devel

On 20.07.2022 15:33, Andrew Cooper wrote:
> On 20/07/2022 14:30, Jan Beulich wrote:
>> Passing -mno-sse alone is not enough: The compiler may still find
>> (questionable) reasons to use MMX insns. In particular with gcc12 use
>> of MOVD+PUNPCKLDQ+MOVQ was observed in an apparent attempt to auto-
>> vectorize the storing of two adjacent zeroes, 32 bits each.
>>
>> Reported-by: ChrisD <chris@dalessio.org>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

Thanks.

> But while we're at it, what else might we have to clobber to stop
> nonsense like this?  x87 and avx come to mind.

AVX is taking SSE as a prereq (with -mno-sse %xmm etc registers simply
are unavailable). And with -msoft-float I would very much hope we have
clearly indicated to the compiler that we want no x87 insns whatsoever.

Jan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: also suppress use of MMX insns
  2022-07-20 13:36   ` Jan Beulich
@ 2022-07-20 13:39     ` Andrew Cooper
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cooper @ 2022-07-20 13:39 UTC (permalink / raw)
  To: Jan Beulich, Andrew Cooper; +Cc: Wei Liu, Roger Pau Monne, ChrisD, xen-devel

On 20/07/2022 14:36, Jan Beulich wrote:
> On 20.07.2022 15:33, Andrew Cooper wrote:
>> On 20/07/2022 14:30, Jan Beulich wrote:
>>> Passing -mno-sse alone is not enough: The compiler may still find
>>> (questionable) reasons to use MMX insns. In particular with gcc12 use
>>> of MOVD+PUNPCKLDQ+MOVQ was observed in an apparent attempt to auto-
>>> vectorize the storing of two adjacent zeroes, 32 bits each.
>>>
>>> Reported-by: ChrisD <chris@dalessio.org>
>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Thanks.
>
>> But while we're at it, what else might we have to clobber to stop
>> nonsense like this?  x87 and avx come to mind.
> AVX is taking SSE as a prereq (with -mno-sse %xmm etc registers simply
> are unavailable). And with -msoft-float I would very much hope we have
> clearly indicated to the compiler that we want no x87 insns whatsoever.

Ok.  Sounds plausible.

~Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-20 13:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-20 13:30 [PATCH] x86: also suppress use of MMX insns Jan Beulich
2022-07-20 13:33 ` Andrew Cooper
2022-07-20 13:36   ` Jan Beulich
2022-07-20 13:39     ` Andrew Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.