Implemented several of the floating point intrinsics (using cgtest19 and the occam 2.1 manual)

This commit is contained in:
Neil Brown 2009-01-25 21:31:58 +00:00
parent 65171e4492
commit ff61ebfa2b

View File

@ -1,6 +1,14 @@
static inline INT ADD_PREFIX(IEEECOMPARE) (REAL, REAL, const char*) occam_unused;
static inline INT ADD_PREFIX(IEEECOMPARE) (REAL X, REAL Y, const char* pos) {
return 0;
if (isunordered(X,Y)) {
return 2;
} else if (isgreater(X,Y)) {
return 1;
} else if (isless(X,Y)) {
return -1;
} else {
return 0;
}
}
static inline BOOL SPLICE_SIZE(occam_IEEE,OP) (REAL, INT, INT, REAL, REAL*, const char*) occam_unused;
static inline BOOL SPLICE_SIZE(occam_IEEE,OP) (REAL X, INT Rm, INT Op, REAL Y, REAL* result1, const char* pos) {
@ -16,7 +24,7 @@ static inline BOOL SPLICE_SIZE(occam_REAL,EQ) (REAL X, REAL Y, const char* pos)
}
static inline BOOL SPLICE_SIZE(occam_REAL,GT) (REAL, REAL, const char*) occam_unused;
static inline BOOL SPLICE_SIZE(occam_REAL,GT) (REAL X, REAL Y, const char* pos) {
return 0;
return isgreater(X,Y);
}
static inline REAL SPLICE_SIZE(occam_REAL,OP) (REAL, INT, REAL, const char*) occam_unused;
static inline REAL SPLICE_SIZE(occam_REAL,OP) (REAL X, INT Op, REAL Y, const char* pos) {
@ -43,7 +51,7 @@ static inline REAL ADD_PREFIX(ABS) (REAL X, const char* pos) {
}
static inline REAL ADD_PREFIX(COPYSIGN) (REAL, REAL, const char*) occam_unused;
static inline REAL ADD_PREFIX(COPYSIGN) (REAL X, REAL Y, const char* pos) {
return 0;
return F(copysign)(X,Y);
}
static inline REAL ADD_PREFIX(DIVBY2) (REAL, const char*) occam_unused;
static inline REAL ADD_PREFIX(DIVBY2) (REAL X, const char* pos) {
@ -83,7 +91,7 @@ static inline BOOL ADD_PREFIX(NOTFINITE) (REAL X, const char* pos) {
}
static inline BOOL ADD_PREFIX(ORDERED) (REAL, REAL, const char*) occam_unused;
static inline BOOL ADD_PREFIX(ORDERED) (REAL X, REAL Y, const char* pos) {
return 0;
return !(isunordered(X,Y));
}
static inline REAL ADD_PREFIX(SCALEB) (REAL, INT, const char*) occam_unused;
static inline REAL ADD_PREFIX(SCALEB) (REAL X, INT n, const char* pos) {