shithub: riscv

Download patch

ref: 566c3ca2de98761f9039e49ca5f68ee1a9ad73c4
parent: 491fe2515890fc4e624af72f15775fd48510486a
author: Ori Bernstein <[email protected]>
date: Mon Feb 8 10:45:11 EST 2021

ape: sync flaot.h macros with u.h

The float.h macros got out of sync with u.h,
some of them missing and some of them being
incorrect. This change brings them back in
line.

--- a/386/include/ape/float.h
+++ b/386/include/ape/float.h
@@ -52,9 +52,10 @@
 #ifdef _PLAN9_SOURCE
 /* FCR */
 #define	FPINEX	(1<<5)
-#define	FPOVFL	(1<<3)
 #define	FPUNFL	((1<<4)|(1<<1))
+#define	FPOVFL	(1<<3)
 #define	FPZDIV	(1<<2)
+#define	FPINVAL	(1<<0)
 #define	FPRNR	(0<<10)
 #define	FPRZ	(3<<10)
 #define	FPRPINF	(2<<10)
@@ -69,5 +70,6 @@
 #define	FPAOVFL	FPOVFL
 #define	FPAUNFL	FPUNFL
 #define	FPAZDIV	FPZDIV
+#define	FPAINVAL	FPINVAL
 #endif
 #endif /* __FLOAT */
--- a/68020/include/ape/float.h
+++ b/68020/include/ape/float.h
@@ -58,6 +58,7 @@
 #define	FPZDIV	(1<<10)
 #define	FPRNR	(0<<4)
 #define	FPRZ	(1<<4)
+#define	FPINVAL	(3<<13)
 #define	FPRPINF	(3<<4)
 #define	FPRNINF	(2<<4)
 #define	FPRMASK	(3<<4)
@@ -70,5 +71,6 @@
 #define	FPAOVFL	FPOVFL
 #define	FPAUNFL	FPUNFL
 #define	FPAZDIV	FPZDIV
+#define	FPAINVAL	FPINVAL
 #endif
 #endif /* __FLOAT */
--- a/arm/include/ape/float.h
+++ b/arm/include/ape/float.h
@@ -50,24 +50,30 @@
 #define Sudden_Underflow 1
 #endif
 #ifdef _PLAN9_SOURCE
-/* FCR */
-#define	FPINEX	(1<<5)
-#define	FPOVFL	(1<<3)
-#define	FPUNFL	((1<<4)|(1<<1))
-#define	FPZDIV	(1<<2)
-#define	FPRNR	(0<<10)
-#define	FPRZ	(3<<10)
-#define	FPRPINF	(2<<10)
-#define	FPRNINF	(1<<10)
-#define	FPRMASK	(3<<10)
-#define	FPPEXT	(3<<8)
-#define	FPPSGL	(0<<8)
-#define	FPPDBL	(2<<8)
-#define	FPPMASK	(3<<8)
-/* FSR */
-#define	FPAINEX	FPINEX
-#define	FPAOVFL	FPOVFL
-#define	FPAUNFL	FPUNFL
-#define	FPAZDIV	FPZDIV
+/* VFP FPSCR (exceptions) */
+#define	FPINEX		(1<<12)
+#define	FPUNFL		(1<<11)
+#define	FPOVFL		(1<<10)
+#define	FPZDIV		(1<<9)
+#define	FPINVAL		(1<<8)
+
+/* VFP FPSCR (rounding) */
+#define	FPRNR		(0<<22)
+#define	FPRPINF		(1<<22)
+#define	FPRNINF		(2<<22)
+#define	FPRZ		(3<<22)
+
+#define	FPRMASK		(3<<22)
+
+/* VFP FPSCR (status) */
+#define	FPPEXT	0
+#define	FPPSGL	0
+#define	FPPDBL	0
+#define	FPPMASK	0
+#define	FPAINEX		(1<<4)
+#define	FPAUNFL		(1<<3)
+#define	FPAOVFL		(1<<2)
+#define	FPAZDIV		(1<<1)
+#define	FPAINVAL	(1<<0)
 #endif
 #endif /* __FLOAT */
--- a/arm64/include/ape/float.h
+++ b/arm64/include/ape/float.h
@@ -50,24 +50,29 @@
 #define Sudden_Underflow 1
 #endif
 #ifdef _PLAN9_SOURCE
-/* FCR */
-#define	FPINEX	(1<<5)
-#define	FPOVFL	(1<<3)
-#define	FPUNFL	((1<<4)|(1<<1))
-#define	FPZDIV	(1<<2)
-#define	FPRNR	(0<<10)
-#define	FPRZ	(3<<10)
-#define	FPRPINF	(2<<10)
-#define	FPRNINF	(1<<10)
-#define	FPRMASK	(3<<10)
-#define	FPPEXT	(3<<8)
-#define	FPPSGL	(0<<8)
-#define	FPPDBL	(2<<8)
-#define	FPPMASK	(3<<8)
-/* FSR */
-#define	FPAINEX	FPINEX
-#define	FPAOVFL	FPOVFL
-#define	FPAUNFL	FPUNFL
-#define	FPAZDIV	FPZDIV
+/* FPCR (control) */
+#define	FPINEX		(1<<12)
+#define	FPUNFL		(1<<11)
+#define	FPOVFL		(1<<10)
+#define	FPZDIV		(1<<9)
+#define	FPINVAL		(1<<8)
+
+#define	FPRNR		(0<<22)
+#define	FPRPINF		(1<<22)
+#define	FPRNINF		(2<<22)
+#define	FPRZ		(3<<22)
+
+#define	FPRMASK		(3<<22)
+
+/* FPSR (status) */
+#define	FPPEXT	0
+#define	FPPSGL	0
+#define	FPPDBL	0
+#define	FPPMASK	0
+#define	FPAINEX		(1<<4)
+#define	FPAUNFL		(1<<3)
+#define	FPAOVFL		(1<<2)
+#define	FPAZDIV		(1<<1)
+#define	FPAINVAL	(1<<0)
 #endif
 #endif /* __FLOAT */
--- a/mips/include/ape/float.h
+++ b/mips/include/ape/float.h
@@ -52,9 +52,10 @@
 #ifdef _PLAN9_SOURCE
 /* FCR */
 #define	FPINEX	(1<<7)
-#define	FPOVFL	(1<<9)
 #define	FPUNFL	(1<<8)
+#define	FPOVFL	(1<<9)
 #define	FPZDIV	(1<<10)
+#define	FPINVAL	(1<<11)
 #define	FPRNR	(0<<0)
 #define	FPRZ	(1<<0)
 #define	FPRPINF	(2<<0)
@@ -69,5 +70,6 @@
 #define	FPAOVFL	(1<<4)
 #define	FPAUNFL	(1<<3)
 #define	FPAZDIV	(1<<5)
+#define	FPAINVAL	(1<<6)
 #endif
 #endif /* __FLOAT */
--- a/power/include/ape/float.h
+++ b/power/include/ape/float.h
@@ -50,24 +50,45 @@
 #define Sudden_Underflow 1
 #endif
 #ifdef _PLAN9_SOURCE
-/* FCR */
-#define	FPINEX	(1<<7)
-#define	FPOVFL	(1<<9)
-#define	FPUNFL	(1<<8)
-#define	FPZDIV	(1<<10)
+/* FPSCR */
+#define	FPSFX	(1<<31)	/* exception summary (sticky) */
+#define	FPSEX	(1<<30)	/* enabled exception summary */
+#define	FPSVX	(1<<29)	/* invalid operation exception summary */
+#define	FPSOX	(1<<28)	/* overflow exception OX (sticky) */
+#define	FPSUX	(1<<27)	/* underflow exception UX (sticky) */
+#define	FPSZX	(1<<26)	/* zero divide exception ZX (sticky) */
+#define	FPSXX	(1<<25)	/* inexact exception XX (sticky) */
+#define	FPSVXSNAN (1<<24)	/* invalid operation exception for SNaN (sticky) */
+#define	FPSVXISI (1<<23)	/* invalid operation exception for ∞-∞ (sticky) */
+#define	FPSVXIDI (1<<22)	/* invalid operation exception for ∞/∞ (sticky) */
+#define	FPSVXZDZ (1<<21)	/* invalid operation exception for 0/0 (sticky) */
+#define	FPSVXIMZ (1<<20)	/* invalid operation exception for ∞*0 (sticky) */
+#define	FPSVXVC	(1<<19)	/* invalid operation exception for invalid compare (sticky) */
+#define	FPSFR	(1<<18)	/* fraction rounded */
+#define	FPSFI	(1<<17)	/* fraction inexact */
+#define	FPSFPRF	(1<<16)	/* floating point result class */
+#define	FPSFPCC	(0xF<<12)	/* <, >, =, unordered */
+#define	FPVXCVI	(1<<8)	/* enable exception for invalid integer convert (sticky) */
+#define	FPVE	(1<<7)	/* invalid operation exception enable */
+#define	FPOVFL	(1<<6)	/* enable overflow exceptions */
+#define	FPUNFL	(1<<5)	/* enable underflow */
+#define	FPZDIV	(1<<4)	/* enable zero divide */
+#define	FPINEX	(1<<3)	/* enable inexact exceptions */
+#define	FPRMASK	(3<<0)	/* rounding mode */
 #define	FPRNR	(0<<0)
 #define	FPRZ	(1<<0)
 #define	FPRPINF	(2<<0)
 #define	FPRNINF	(3<<0)
-#define	FPRMASK	(3<<0)
 #define	FPPEXT	0
 #define	FPPSGL	0
 #define	FPPDBL	0
 #define	FPPMASK	0
-/* FSR */
-#define	FPAINEX	(1<<2)
-#define	FPAOVFL	(1<<4)
-#define	FPAUNFL	(1<<3)
-#define	FPAZDIV	(1<<5)
+#define	FPINVAL	FPVE
+
+#define	FPAOVFL	FPSOX
+#define	FPAINEX	FPSXX
+#define	FPAUNFL	FPSUX
+#define	FPAZDIV	FPSZX
+#define	FPAINVAL	FPSVX
 #endif
 #endif /* __FLOAT */
--- a/sparc/include/ape/float.h
+++ b/sparc/include/ape/float.h
@@ -57,6 +57,7 @@
 #define	FPZDIV	(1<<24)
 #define	FPRNR	(0<<30)
 #define	FPRZ	(1<<30)
+#define	FPINVAL	(1<<27)
 #define	FPRPINF	(2<<30)
 #define	FPRNINF	(3<<30)
 #define	FPRMASK	(3<<30)
@@ -66,8 +67,9 @@
 #define	FPPMASK	0
 /* FSR */
 #define	FPAINEX	(1<<5)
-#define	FPAOVFL	(1<<8)
-#define	FPAUNFL	(1<<7)
 #define	FPAZDIV	(1<<6)
+#define	FPAUNFL	(1<<7)
+#define	FPAOVFL	(1<<8)
+#define	FPAINVAL	(1<<9)
 #endif
 #endif /* __FLOAT */
--- a/sparc64/include/ape/float.h
+++ b/sparc64/include/ape/float.h
@@ -57,6 +57,7 @@
 #define	FPZDIV	(1<<24)
 #define	FPRNR	(0<<30)
 #define	FPRZ	(1<<30)
+#define	FPINVAL	(1<<27)
 #define	FPRPINF	(2<<30)
 #define	FPRNINF	(3<<30)
 #define	FPRMASK	(3<<30)
@@ -66,8 +67,9 @@
 #define	FPPMASK	0
 /* FSR */
 #define	FPAINEX	(1<<5)
-#define	FPAOVFL	(1<<8)
-#define	FPAUNFL	(1<<7)
 #define	FPAZDIV	(1<<6)
+#define	FPAUNFL	(1<<7)
+#define	FPAOVFL	(1<<8)
+#define	FPAINVAL	(1<<9)
 #endif
 #endif /* __FLOAT */