From c3d0c1844371b2fe1c1089b20eddd70861d712d7 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Mon, 28 Jun 2010 23:22:35 -0700 Subject: [PATCH] opcodes: Add code for handling denormals --- orc/orcopcodes.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/orc/orcopcodes.c b/orc/orcopcodes.c index 1a57f4b..e8c98a8 100644 --- a/orc/orcopcodes.c +++ b/orc/orcopcodes.c @@ -656,13 +656,21 @@ name (OrcOpcodeExecutor *ex, void *user) \ ex->dest_values[0] = code ; \ } -BINARY_F(addf, a + b) -BINARY_F(subf, a - b) -BINARY_F(mulf, a * b) -BINARY_F(divf, a / b) -UNARY_F(orc_sqrtf, sqrt(a) ) -BINARY_F(maxf, (a>b) ? a : b) -BINARY_F(minf, (a -MIN_NONDENORMAL && (x) < MIN_NONDENORMAL) ? 0 : (x)) +#else +#define ORC_DENORMAL(x) (x) +#endif + +BINARY_F(addf, ORC_DENORMAL(ORC_DENORMAL(a) + ORC_DENORMAL(b))) +BINARY_F(subf, ORC_DENORMAL(ORC_DENORMAL(a) - ORC_DENORMAL(b))) +BINARY_F(mulf, ORC_DENORMAL(ORC_DENORMAL(a) * ORC_DENORMAL(b))) +BINARY_F(divf, ORC_DENORMAL(ORC_DENORMAL(a) / ORC_DENORMAL(b))) +UNARY_F(orc_sqrtf, sqrt(ORC_DENORMAL(a)) ) +BINARY_F(maxf, isnan(a) ? a : isnan(b) ? b : (a>b) ? ORC_DENORMAL(a) : ORC_DENORMAL(b)) +BINARY_F(minf, isnan(a) ? a : isnan(b) ? b : (a a)) ? (~0) : 0) -- 2.7.4