Skip to contentSkip to conversation

x86: also suppress use of MMX insns

PATCH In review Jan Beulich 3 participants 4 messages Jul 20, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: also suppress use of MMX insns

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.

xen/arch/x86/arch.mk +3 -3
@@ -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.
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jan Beulich

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.

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

#2 lore raw
Quoted 10 lines · Andrew Cooper
Quoted 7 lines · Jan Beulich

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.

Thanks.

Quoted 2 lines

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

#3 lore raw
Quoted 9 lines · Jan Beulich
Quoted 8 lines · Andrew Cooper
Quoted 7 lines · Jan Beulich

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.

Quoted 8 lines
Quoted 1 line

Thanks.

Quoted 2 lines

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