diff options
author | Christophe Lyon <christophe.lyon@st.com> | 2012-05-09 17:06:10 +0200 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@st.com> | 2012-05-11 15:02:56 +0200 |
commit | eb8034b39a424f157b7117141e23cdad329d5cc0 (patch) | |
tree | 80291f26ba85698cb7d86be3bcaa7f6c66101566 /stm-arm-neon-ref.h | |
parent | 93e9bc588cd8f38808540ed136260fd7af359efa (diff) | |
download | platform_external_arm-neon-tests-eb8034b39a424f157b7117141e23cdad329d5cc0.tar.gz platform_external_arm-neon-tests-eb8034b39a424f157b7117141e23cdad329d5cc0.tar.bz2 platform_external_arm-neon-tests-eb8034b39a424f157b7117141e23cdad329d5cc0.zip |
Add accessor functions for Neon_Overflow, such that its value can be
read/changed when compiling with GCC/ARM too.
Diffstat (limited to 'stm-arm-neon-ref.h')
-rw-r--r-- | stm-arm-neon-ref.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/stm-arm-neon-ref.h b/stm-arm-neon-ref.h index e4d17d3..7d09a38 100644 --- a/stm-arm-neon-ref.h +++ b/stm-arm-neon-ref.h @@ -238,7 +238,7 @@ static void dump_results_hex (const char *test_name) typedef union { struct { int _xxx:27; - int QC:1; + unsigned int QC:1; int V:1; int C:1; int Z:1; @@ -255,7 +255,7 @@ typedef union { int Z:1; int C:1; int V:1; - int QC:1; + unsigned int QC:1; int _dnm:27; } b; unsigned int word; @@ -266,10 +266,24 @@ typedef union { #ifdef __ARMCC_VERSION register _ARM_FPSCR _afpscr_for_qc __asm("fpscr"); #define Neon_Overflow _afpscr_for_qc.b.QC +#define Set_Neon_Overflow(x) {Neon_Overflow = (x);} #else -/* Fake declaration because GCC/ARM does not know this register */ - int myerrno; -#define Neon_Overflow myerrno +/* GCC/ARM does not know this register */ +#define Neon_Overflow __read_neon_overflow() +static int __read_neon_overflow() { + _ARM_FPSCR _afpscr_for_qc; + asm("vmrs %0,fpscr" : "=r" (_afpscr_for_qc)); + return _afpscr_for_qc.b.QC; +} +#define Set_Neon_Overflow(x) __set_neon_overflow((x)) +static void __set_neon_overflow(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; +} + #endif #endif /* STM_ARM_NEON_MODELS */ |