diff options
author | Christophe Lyon <christophe.lyon@linaro.org> | 2014-07-10 13:47:40 +0200 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@linaro.org> | 2014-07-10 13:50:51 +0200 |
commit | 1a3b239c63a3461c3fb61abb12b4db682be2b962 (patch) | |
tree | 253bbfba165a66b00a13fcc22e052e41aeded4e9 | |
parent | 1775be0bcaa673c19bb1f60f0c1bce1b91cdb414 (diff) | |
download | platform_external_arm-neon-tests-1a3b239c63a3461c3fb61abb12b4db682be2b962.tar.gz platform_external_arm-neon-tests-1a3b239c63a3461c3fb61abb12b4db682be2b962.tar.bz2 platform_external_arm-neon-tests-1a3b239c63a3461c3fb61abb12b4db682be2b962.zip |
Support Neon Cumulative Saturation flag for aarch64 too.
-rw-r--r-- | stm-arm-neon-ref.h | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/stm-arm-neon-ref.h b/stm-arm-neon-ref.h index 43d2ce7..b9b3fec 100644 --- a/stm-arm-neon-ref.h +++ b/stm-arm-neon-ref.h @@ -562,25 +562,41 @@ typedef union { #ifdef __ARMCC_VERSION register _ARM_FPSCR _afpscr_for_qc __asm("fpscr"); -#define Neon_Cumulative_Sat _afpscr_for_qc.b.QC -#define Set_Neon_Cumulative_Sat(x) {Neon_Cumulative_Sat = (x);} +# define Neon_Cumulative_Sat _afpscr_for_qc.b.QC +# define Set_Neon_Cumulative_Sat(x) {Neon_Cumulative_Sat = (x);} #else /* GCC/ARM does not know this register */ -#define Neon_Cumulative_Sat __read_neon_cumulative_sat() -static int __read_neon_cumulative_sat() { - _ARM_FPSCR _afpscr_for_qc; - asm("vmrs %0,fpscr" : "=r" (_afpscr_for_qc)); - return _afpscr_for_qc.b.QC; +# define Neon_Cumulative_Sat __read_neon_cumulative_sat() +# define Set_Neon_Cumulative_Sat(x) __set_neon_cumulative_sat((x)) + +# if defined(__aarch64__) +static volatile int __read_neon_cumulative_sat (void) { + _ARM_FPSCR _afpscr_for_qc; + asm volatile ("mrs %0,fpsr" : "=r" (_afpscr_for_qc)); + return _afpscr_for_qc.b.QC; } -#define Set_Neon_Cumulative_Sat(x) __set_neon_cumulative_sat((x)) -static void __set_neon_cumulative_sat(int x) { - _ARM_FPSCR _afpscr_for_qc; - asm("vmrs %0,fpscr" : "=r" (_afpscr_for_qc)); - _afpscr_for_qc.b.QC = x; - asm("vmsr fpscr,%0" : : "r" (_afpscr_for_qc)); - return; +static void __set_neon_cumulative_sat (int x) { + _ARM_FPSCR _afpscr_for_qc; + asm volatile ("mrs %0,fpsr" : "=r" (_afpscr_for_qc)); + _afpscr_for_qc.b.QC = x; + asm volatile ("msr fpsr,%0" : : "r" (_afpscr_for_qc)); + return; +} +# else +static volatile int __read_neon_cumulative_sat (void) { + _ARM_FPSCR _afpscr_for_qc; + asm volatile ("vmrs %0,fpscr" : "=r" (_afpscr_for_qc)); + return _afpscr_for_qc.b.QC; } +static void __set_neon_cumulative_sat (int x) { + _ARM_FPSCR _afpscr_for_qc; + asm volatile ("vmrs %0,fpscr" : "=r" (_afpscr_for_qc)); + _afpscr_for_qc.b.QC = x; + asm volatile ("vmsr fpscr,%0" : : "r" (_afpscr_for_qc)); + return; +} +# endif #endif #endif /* STM_ARM_NEON_MODELS */ |