Skip to content

Commit ee44033

Browse files
agnersRussell King
authored andcommitted
ARM: 8990/1: use VFP assembler mnemonics in register load/store macros
The integrated assembler of Clang 10 and earlier do not allow to access the VFP registers through the coprocessor load/store instructions: <instantiation>:4:6: error: invalid operand for instruction LDC p11, cr0, [r10],#32*4 @ FLDMIAD r10!, {d0-d15} ^ This has been addressed with Clang 11 [0]. However, to support earlier versions of Clang and for better readability use of VFP assembler mnemonics still is preferred. Replace the coprocessor load/store instructions with explicit assembler mnemonics to accessing the floating point coprocessor registers. Use assembler directives to select the appropriate FPU version. This allows to build these macros with GNU assembler as well as with Clang's built-in assembler. [0] https://reviews.llvm.org/D59733 Link: ClangBuiltLinux#905 Signed-off-by: Stefan Agner <stefan@agner.ch> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
1 parent a6c3087 commit ee44033

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

arch/arm/include/asm/vfpmacros.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,25 @@
1919

2020
@ read all the working registers back into the VFP
2121
.macro VFPFLDMIA, base, tmp
22+
.fpu vfpv2
2223
#if __LINUX_ARM_ARCH__ < 6
23-
LDC p11, cr0, [\base],#33*4 @ FLDMIAX \base!, {d0-d15}
24+
fldmiax \base!, {d0-d15}
2425
#else
25-
LDC p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d0-d15}
26+
vldmia \base!, {d0-d15}
2627
#endif
2728
#ifdef CONFIG_VFPv3
29+
.fpu vfpv3
2830
#if __LINUX_ARM_ARCH__ <= 6
2931
ldr \tmp, =elf_hwcap @ may not have MVFR regs
3032
ldr \tmp, [\tmp, #0]
3133
tst \tmp, #HWCAP_VFPD32
32-
ldclne p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
34+
vldmiane \base!, {d16-d31}
3335
addeq \base, \base, #32*4 @ step over unused register space
3436
#else
3537
VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
3638
and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
3739
cmp \tmp, #2 @ 32 x 64bit registers?
38-
ldcleq p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
40+
vldmiaeq \base!, {d16-d31}
3941
addne \base, \base, #32*4 @ step over unused register space
4042
#endif
4143
#endif
@@ -44,22 +46,23 @@
4446
@ write all the working registers out of the VFP
4547
.macro VFPFSTMIA, base, tmp
4648
#if __LINUX_ARM_ARCH__ < 6
47-
STC p11, cr0, [\base],#33*4 @ FSTMIAX \base!, {d0-d15}
49+
fstmiax \base!, {d0-d15}
4850
#else
49-
STC p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d0-d15}
51+
vstmia \base!, {d0-d15}
5052
#endif
5153
#ifdef CONFIG_VFPv3
54+
.fpu vfpv3
5255
#if __LINUX_ARM_ARCH__ <= 6
5356
ldr \tmp, =elf_hwcap @ may not have MVFR regs
5457
ldr \tmp, [\tmp, #0]
5558
tst \tmp, #HWCAP_VFPD32
56-
stclne p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
59+
vstmiane \base!, {d16-d31}
5760
addeq \base, \base, #32*4 @ step over unused register space
5861
#else
5962
VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
6063
and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
6164
cmp \tmp, #2 @ 32 x 64bit registers?
62-
stcleq p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
65+
vstmiaeq \base!, {d16-d31}
6366
addne \base, \base, #32*4 @ step over unused register space
6467
#endif
6568
#endif

0 commit comments

Comments
 (0)