blob: 3d5fc41ae8d38a7743b3bee9c55490135c19dcea [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Russell King4baa9922008-08-02 10:55:55 +01002 * arch/arm/include/asm/vfpmacros.h
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
4 * Assembler-only file containing VFP macros and register definitions.
5 */
Tony Lindgren5aaf2542010-07-01 13:41:05 +01006#include <asm/hwcap.h>
7
Linus Torvalds1da177e2005-04-16 15:20:36 -07008#include "vfp.h"
9
10@ Macros to allow building with old toolkits (with no VFP support)
11 .macro VFPFMRX, rd, sysreg, cond
12 MRC\cond p10, 7, \rd, \sysreg, cr0, 0 @ FMRX \rd, \sysreg
13 .endm
14
15 .macro VFPFMXR, sysreg, rd, cond
16 MCR\cond p10, 7, \rd, \sysreg, cr0, 0 @ FMXR \sysreg, \rd
17 .endm
18
19 @ read all the working registers back into the VFP
Catalin Marinas25ebee02007-09-25 15:22:24 +010020 .macro VFPFLDMIA, base, tmp
Catalin Marinasbb54a332006-04-10 21:32:42 +010021#if __LINUX_ARM_ARCH__ < 6
Linus Torvalds1da177e2005-04-16 15:20:36 -070022 LDC p11, cr0, [\base],#33*4 @ FLDMIAX \base!, {d0-d15}
Catalin Marinasbb54a332006-04-10 21:32:42 +010023#else
24 LDC p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d0-d15}
25#endif
Catalin Marinas25ebee02007-09-25 15:22:24 +010026#ifdef CONFIG_VFPv3
Tony Lindgren5aaf2542010-07-01 13:41:05 +010027#if __LINUX_ARM_ARCH__ <= 6
28 ldr \tmp, =elf_hwcap @ may not have MVFR regs
29 ldr \tmp, [\tmp, #0]
30 tst \tmp, #HWCAP_VFPv3D16
31 ldceq p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
32 addne \base, \base, #32*4 @ step over unused register space
33#else
Catalin Marinas25ebee02007-09-25 15:22:24 +010034 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
35 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
36 cmp \tmp, #2 @ 32 x 64bit registers?
37 ldceql p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
38 addne \base, \base, #32*4 @ step over unused register space
39#endif
Tony Lindgren5aaf2542010-07-01 13:41:05 +010040#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 .endm
42
43 @ write all the working registers out of the VFP
Catalin Marinas25ebee02007-09-25 15:22:24 +010044 .macro VFPFSTMIA, base, tmp
Catalin Marinasbb54a332006-04-10 21:32:42 +010045#if __LINUX_ARM_ARCH__ < 6
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 STC p11, cr0, [\base],#33*4 @ FSTMIAX \base!, {d0-d15}
Catalin Marinasbb54a332006-04-10 21:32:42 +010047#else
48 STC p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d0-d15}
49#endif
Catalin Marinas25ebee02007-09-25 15:22:24 +010050#ifdef CONFIG_VFPv3
Tony Lindgren5aaf2542010-07-01 13:41:05 +010051#if __LINUX_ARM_ARCH__ <= 6
52 ldr \tmp, =elf_hwcap @ may not have MVFR regs
53 ldr \tmp, [\tmp, #0]
54 tst \tmp, #HWCAP_VFPv3D16
55 stceq p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
56 addne \base, \base, #32*4 @ step over unused register space
57#else
Catalin Marinas25ebee02007-09-25 15:22:24 +010058 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
59 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
60 cmp \tmp, #2 @ 32 x 64bit registers?
61 stceql p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
62 addne \base, \base, #32*4 @ step over unused register space
63#endif
Tony Lindgren5aaf2542010-07-01 13:41:05 +010064#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 .endm