vfpmacros.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * arch/arm/include/asm/vfpmacros.h
  4. *
  5. * Assembler-only file containing VFP macros and register definitions.
  6. */
  7. #include <asm/hwcap.h>
  8. #include <asm/vfp.h>
  9. .macro VFPFMRX, rd, sysreg, cond
  10. vmrs\cond \rd, \sysreg
  11. .endm
  12. .macro VFPFMXR, sysreg, rd, cond
  13. vmsr\cond \sysreg, \rd
  14. .endm
  15. @ read all the working registers back into the VFP
  16. .macro VFPFLDMIA, base, tmp
  17. .fpu vfpv2
  18. #if __LINUX_ARM_ARCH__ < 6
  19. fldmiax \base!, {d0-d15}
  20. #else
  21. vldmia \base!, {d0-d15}
  22. #endif
  23. #ifdef CONFIG_VFPv3
  24. .fpu vfpv3
  25. #if __LINUX_ARM_ARCH__ <= 6
  26. ldr \tmp, =elf_hwcap @ may not have MVFR regs
  27. ldr \tmp, [\tmp, #0]
  28. tst \tmp, #HWCAP_VFPD32
  29. vldmiane \base!, {d16-d31}
  30. addeq \base, \base, #32*4 @ step over unused register space
  31. #else
  32. VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
  33. and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
  34. cmp \tmp, #2 @ 32 x 64bit registers?
  35. vldmiaeq \base!, {d16-d31}
  36. addne \base, \base, #32*4 @ step over unused register space
  37. #endif
  38. #endif
  39. .endm
  40. @ write all the working registers out of the VFP
  41. .macro VFPFSTMIA, base, tmp
  42. #if __LINUX_ARM_ARCH__ < 6
  43. fstmiax \base!, {d0-d15}
  44. #else
  45. vstmia \base!, {d0-d15}
  46. #endif
  47. #ifdef CONFIG_VFPv3
  48. .fpu vfpv3
  49. #if __LINUX_ARM_ARCH__ <= 6
  50. ldr \tmp, =elf_hwcap @ may not have MVFR regs
  51. ldr \tmp, [\tmp, #0]
  52. tst \tmp, #HWCAP_VFPD32
  53. vstmiane \base!, {d16-d31}
  54. addeq \base, \base, #32*4 @ step over unused register space
  55. #else
  56. VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
  57. and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
  58. cmp \tmp, #2 @ 32 x 64bit registers?
  59. vstmiaeq \base!, {d16-d31}
  60. addne \base, \base, #32*4 @ step over unused register space
  61. #endif
  62. #endif
  63. .endm