x86/asm: Use -mskip-rax-setup if supported · Rust-for-Linux/linux@d9ee948 (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Commit d9ee948

hjl-toolsIngo Molnar

authored and

committed

x86/asm: Use -mskip-rax-setup if supported

GCC 5 added a compiler option, -mskip-rax-setup, for x86-64. It skips setting up the RAX register when SSE is disabled and there are no variable arguments passed in vector registers. (According to the x86_64 ABI, %al is used as a hidden register containing the number of vector registers used). Since the kernel doesn't pass vector registers to functions with variable arguments, this option can be used to optimize the x86-64 kernel. This GCC feature was suggested by Rasmus Villemoes linux@rasmusvillemoes.dk. This is the corresponding kernel change using it. For kernel v3.17: text data bss dec filename 11455921 2204048 5853184 19513153 vmlinux #with -mskip-rax-setup 11480079 2204048 5853184 19537311 vmlinux For Kernel v4.0+ - custom config: text data bss dec filename 10231778 3479800 16617472 30329050 vmlinux-gcc5+-mskip-rax-setup 10268797 3547448 16621568 3043781 vmlinux Signed-off-by: H.J. Lu hjl.tools@gmail.com Signed-off-by: Borislav Petkov bp@suse.de Cc: Andy Lutomirski luto@amacapital.net Cc: Borislav Petkov bp@alien8.de Cc: Brian Gerst brgerst@gmail.com Cc: Denys Vlasenko dvlasenk@redhat.com Cc: H. Peter Anvin hpa@zytor.com Cc: Linus Torvalds torvalds@linux-foundation.org Cc: Rasmus Villemoes linux@rasmusvillemoes.dk Cc: Thomas Gleixner tglx@linutronix.de Signed-off-by: Ingo Molnar mingo@kernel.org

File tree

1 file changed

lines changed

1 file changed

lines changed

Original file line number Diff line number Diff line change
@@ -84,6 +84,9 @@ else
84 84 # Use -mpreferred-stack-boundary=3 if supported.
85 85 KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=3)
86 86
87 +# Use -mskip-rax-setup if supported.
88 + KBUILD_CFLAGS += $(call cc-option,-mskip-rax-setup)
89 +
87 90 # FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu)
88 91 cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)
89 92 cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)