vfpmacros.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. #ifdef CONFIG_AS_VFP_VMRS_FPINST
  10. .macro VFPFMRX, rd, sysreg, cond
  11. vmrs\cond \rd, \sysreg
  12. .endm
  13. .macro VFPFMXR, sysreg, rd, cond
  14. vmsr\cond \sysreg, \rd
  15. .endm
  16. #else
  17. @ Macros to allow building with old toolkits (with no VFP support)
  18. .macro VFPFMRX, rd, sysreg, cond
  19. MRC\cond p10, 7, \rd, \sysreg, cr0, 0 @ FMRX \rd, \sysreg
  20. .endm
  21. .macro VFPFMXR, sysreg, rd, cond
  22. MCR\cond p10, 7, \rd, \sysreg, cr0, 0 @ FMXR \sysreg, \rd
  23. .endm
  24. #endif
  25. @ read all the working registers back into the VFP
  26. .macro VFPFLDMIA, base, tmp
  27. .fpu vfpv2
  28. #if __LINUX_ARM_ARCH__ < 6
  29. fldmiax \base!, {d0-d15}
  30. #else
  31. vldmia \base!, {d0-d15}
  32. #endif
  33. #ifdef CONFIG_VFPv3
  34. .fpu vfpv3
  35. #if __LINUX_ARM_ARCH__ <= 6
  36. ldr \tmp, =elf_hwcap @ may not have MVFR regs
  37. ldr \tmp, [\tmp, #0]
  38. tst \tmp, #HWCAP_VFPD32
  39. vldmiane \base!, {d16-d31}
  40. addeq \base, \base, #32*4 @ step over unused register space
  41. #else
  42. VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
  43. and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
  44. cmp \tmp, #2 @ 32 x 64bit registers?
  45. vldmiaeq \base!, {d16-d31}
  46. addne \base, \base, #32*4 @ step over unused register space
  47. #endif
  48. #endif
  49. .endm
  50. @ write all the working registers out of the VFP
  51. .macro VFPFSTMIA, base, tmp
  52. #if __LINUX_ARM_ARCH__ < 6
  53. fstmiax \base!, {d0-d15}
  54. #else
  55. vstmia \base!, {d0-d15}
  56. #endif
  57. #ifdef CONFIG_VFPv3
  58. .fpu vfpv3
  59. #if __LINUX_ARM_ARCH__ <= 6
  60. ldr \tmp, =elf_hwcap @ may not have MVFR regs
  61. ldr \tmp, [\tmp, #0]
  62. tst \tmp, #HWCAP_VFPD32
  63. vstmiane \base!, {d16-d31}
  64. addeq \base, \base, #32*4 @ step over unused register space
  65. #else
  66. VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
  67. and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
  68. cmp \tmp, #2 @ 32 x 64bit registers?
  69. vstmiaeq \base!, {d16-d31}
  70. addne \base, \base, #32*4 @ step over unused register space
  71. #endif
  72. #endif
  73. .endm