Skip to content

Commit d7acb92

Browse files
author
H. Peter Anvin
committed
x86-64, asm: If the assembler supports fxsave64, use it
Kbuild allows for us to probe for the existence of specific constructs in the assembler, use them to find out if we can use fxsave64 and permit the compiler to generate better code. Signed-off-by: H. Peter Anvin <[email protected]>
1 parent 7fe977d commit d7acb92

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

arch/x86/Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,12 @@ cfi := $(call as-instr,.cfi_startproc\n.cfi_rel_offset $(sp-y)$(comma)0\n.cfi_en
9696
# is .cfi_signal_frame supported too?
9797
cfi-sigframe := $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1)
9898
cfi-sections := $(call as-instr,.cfi_sections .debug_frame,-DCONFIG_AS_CFI_SECTIONS=1)
99-
KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections)
100-
KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections)
99+
100+
# does binutils support specific instructions?
101+
asinstr := $(call as-instr,fxsaveq (%rax),-DCONFIG_AS_FXSAVEQ=1)
102+
103+
KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr)
104+
KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr)
101105

102106
LDFLAGS := -m elf_$(UTS_MACHINE)
103107

arch/x86/include/asm/i387.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ static inline void fpu_fxsave(struct fpu *fpu)
175175
uses any extended registers for addressing, a second REX prefix
176176
will be generated (to the assembler, rex64 followed by semicolon
177177
is a separate instruction), and hence the 64-bitness is lost. */
178-
#if 0
178+
#ifdef CONFIG_AS_FXSAVEQ
179179
/* Using "fxsaveq %0" would be the ideal choice, but is only supported
180180
starting with gas 2.16. */
181181
__asm__ __volatile__("fxsaveq %0"

0 commit comments

Comments
 (0)