bca718
commit 196f456b842ee96e1bf1e5ae6ed21ba427dee3f3
bca718
Author: Marcus Shawcroft <marcus.shawcroft@linaro.org>
bca718
Date:   Tue Jan 7 16:16:35 2014 +0000
bca718
bca718
    [AArch64] Fix FP_ROUNDMODE.
bca718
    
bca718
    [BZ #16387] Fix FP_ROUNDMODE to extract the correct bits from FPCR.
bca718
bca718
diff --git a/ports/sysdeps/aarch64/fpu/fpu_control.h b/ports/sysdeps/aarch64/fpu/fpu_control.h
bca718
index 79ab5fb..6a265e8 100644
bca718
--- a/ports/sysdeps/aarch64/fpu/fpu_control.h
bca718
+++ b/ports/sysdeps/aarch64/fpu/fpu_control.h
bca718
@@ -59,6 +59,9 @@
bca718
                    E E D D
bca718
                        E E
bca718
  */
bca718
+
bca718
+#define _FPU_FPCR_RM_MASK  0xc00000
bca718
+
bca718
 #define _FPU_FPCR_MASK_IXE 0x1000
bca718
 #define _FPU_FPCR_MASK_UFE 0x0800
bca718
 #define _FPU_FPCR_MASK_OFE 0x0400
bca718
diff --git a/ports/sysdeps/aarch64/soft-fp/sfp-machine.h b/ports/sysdeps/aarch64/soft-fp/sfp-machine.h
bca718
index d21d00a..9bb94e5 100644
bca718
--- a/ports/sysdeps/aarch64/soft-fp/sfp-machine.h
bca718
+++ b/ports/sysdeps/aarch64/soft-fp/sfp-machine.h
bca718
@@ -47,7 +47,7 @@
bca718
 
bca718
 #define _FP_DECL_EX		fpu_control_t _fcw
bca718
 
bca718
-#define FP_ROUNDMODE		(_fcw & 0x3)
bca718
+#define FP_ROUNDMODE		(_fcw & _FPU_FPCR_RM_MASK)
bca718
 
bca718
 #define FP_RND_NEAREST		FE_TONEAREST
bca718
 #define FP_RND_ZERO		FE_TOWARDZERO