Add 64 bit floating point opcodes
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 26 Aug 2010 15:28:10 +0000 (17:28 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 26 Aug 2010 17:10:25 +0000 (19:10 +0200)
orc/opcodes.h
orc/orcemulateopcodes.c
orc/orcemulateopcodes.h
orc/orcfunctions.c
orc/orcopcodes.c
orc/orcprogram-c.c

index d9c28c7..63a806a 100644 (file)
@@ -136,3 +136,17 @@ BINARY_FL(cmplef, "(ORC_DENORMAL(%s) <= ORC_DENORMAL(%s)) ? (~0) : 0")
 UNARY_FL(convfl, "(int)%s")
 UNARY_LF(convlf, "%s")
 
+BINARY_D(addd, "ORC_DENORMAL_D(ORC_DENORMAL_D(%s) + ORC_DENORMAL_D(%s))")
+BINARY_D(subd, "ORC_DENORMAL_D(ORC_DENORMAL_D(%s) - ORC_DENORMAL_D(%s))")
+BINARY_D(muld, "ORC_DENORMAL_D(ORC_DENORMAL_D(%s) * ORC_DENORMAL_D(%s))")
+BINARY_D(divd, "ORC_DENORMAL_D(ORC_DENORMAL_D(%s) / ORC_DENORMAL_D(%s))")
+UNARY_D(sqrtd, "sqrt(ORC_DENORMAL_D(%s))")
+BINARY_D(maxd, "ORC_MAXD(ORC_DENORMAL_D(%s),ORC_DENORMAL_D(%s))")
+BINARY_D(mind, "ORC_MIND(ORC_DENORMAL_D(%s),ORC_DENORMAL_D(%s))")
+BINARY_DQ(cmpeqd, "(ORC_DENORMAL_D(%s) == ORC_DENORMAL_D(%s)) ? (~0ULL) : 0")
+BINARY_DQ(cmpltd, "(ORC_DENORMAL_D(%s) < ORC_DENORMAL_D(%s)) ? (~0ULL) : 0")
+BINARY_DQ(cmpled, "(ORC_DENORMAL_D(%s) <= ORC_DENORMAL_D(%s)) ? (~0ULL) : 0")
+UNARY_DL(convdl, "(int)%s")
+UNARY_LD(convld, "%s")
+UNARY_DF(convdf, "ORC_DENORMAL ((float) %s)")
+UNARY_FD(convfd, "ORC_DENORMAL (%s)")
index a0d95eb..cbf2dfd 100644 (file)
 #define ORC_SWAP_L(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | (((x)&0xff0000)>>8) | (((x)&0xff000000)>>24))
 #define ORC_SWAP_Q(x) ((((x)&0xffU)<<56) | (((x)&0xff00U)<<40) | (((x)&0xff0000U)<<24) | (((x)&0xff000000U)<<8) | (((x)&0xff00000000U)>>8) | (((x)&0xff0000000000U)>>24) | (((x)&0xff000000000000U)>>40) | (((x)&0xff00000000000000U)>>56))
 #define ORC_PTR_OFFSET(ptr,offset) ((void *)(((unsigned char *)(ptr)) + (offset)))
-#define ORC_MIN_NORMAL (1.1754944909521339405e-38)
 #define ORC_RECAST_INT(x) (((orc_union32)(x)).i)
 #define ORC_RECAST_FLOAT(x) (((orc_union32)(orc_int32)(x)).f)
 #define ORC_DENORMAL(x) ORC_RECAST_FLOAT(ORC_RECAST_INT(x) & (((ORC_RECAST_INT(x)&0x7f800000) == 0) ? 0xff800000 : 0xffffffff))
 #define ORC_ISNAN(x) (((ORC_RECAST_INT(x)&0x7f800000) == 0x7f800000) && ((ORC_RECAST_INT(x)&0x007fffff) != 0))
 #define ORC_MINF(a,b) (ORC_ISNAN(a) ? a : ORC_ISNAN(b) ? b : ((a)<(b)) ? (a) : (b))
 #define ORC_MAXF(a,b) (ORC_ISNAN(a) ? a : ORC_ISNAN(b) ? b : ((a)>(b)) ? (a) : (b))
+#define ORC_RECAST_INT64(x) (((orc_union64)(x)).i)
+#define ORC_RECAST_DOUBLE(x) (((orc_union64)(orc_int64)(x)).f)
+#define ORC_DENORMAL_D(x) ORC_RECAST_DOUBLE(ORC_RECAST_INT64(x) & (((ORC_RECAST_INT64(x)&0x7ff0000000000000) == 0) ? 0xfff0000000000000 : 0xffffffffffffffff))
+#define ORC_ISNAN_D(x) (((ORC_RECAST_INT64(x)&0x7ff0000000000000) == 0x7ff0000000000000) && ((ORC_RECAST_INT64(x)&0x000fffffffffffff) != 0))
+#define ORC_MIND(a,b) (ORC_ISNAN_D(a) ? a : ORC_ISNAN_D(b) ? b : ((a)<(b)) ? (a) : (b))
+#define ORC_MAXD(a,b) (ORC_ISNAN_D(a) ? a : ORC_ISNAN_D(b) ? b : ((a)>(b)) ? (a) : (b))
 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 #define ORC_RESTRICT restrict
 #elif defined(__GNUC__) && __GNUC__ >= 4
@@ -4075,3 +4080,370 @@ emulate_convlf (OrcOpcodeExecutor *ex, int offset, int n)
 
 }
 
+void
+emulate_addd (OrcOpcodeExecutor *ex, int offset, int n)
+{
+  int i;
+  orc_union64 * ORC_RESTRICT ptr0;
+  const orc_union64 * ORC_RESTRICT ptr4;
+  const orc_union64 * ORC_RESTRICT ptr5;
+  orc_union64 var32;
+  orc_union64 var33;
+  orc_union64 var34;
+
+  ptr0 = (orc_union64 *)ex->dest_ptrs[0];
+  ptr4 = (orc_union64 *)ex->src_ptrs[0];
+  ptr5 = (orc_union64 *)ex->src_ptrs[1];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var32 = ptr4[i];
+    /* 1: loadq */
+    var33 = ptr5[i];
+    /* 2: addd */
+    var34.f = ORC_DENORMAL_D(ORC_DENORMAL_D(var32.f) + ORC_DENORMAL_D(var33.f));
+    /* 3: storeq */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+emulate_subd (OrcOpcodeExecutor *ex, int offset, int n)
+{
+  int i;
+  orc_union64 * ORC_RESTRICT ptr0;
+  const orc_union64 * ORC_RESTRICT ptr4;
+  const orc_union64 * ORC_RESTRICT ptr5;
+  orc_union64 var32;
+  orc_union64 var33;
+  orc_union64 var34;
+
+  ptr0 = (orc_union64 *)ex->dest_ptrs[0];
+  ptr4 = (orc_union64 *)ex->src_ptrs[0];
+  ptr5 = (orc_union64 *)ex->src_ptrs[1];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var32 = ptr4[i];
+    /* 1: loadq */
+    var33 = ptr5[i];
+    /* 2: subd */
+    var34.f = ORC_DENORMAL_D(ORC_DENORMAL_D(var32.f) - ORC_DENORMAL_D(var33.f));
+    /* 3: storeq */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+emulate_muld (OrcOpcodeExecutor *ex, int offset, int n)
+{
+  int i;
+  orc_union64 * ORC_RESTRICT ptr0;
+  const orc_union64 * ORC_RESTRICT ptr4;
+  const orc_union64 * ORC_RESTRICT ptr5;
+  orc_union64 var32;
+  orc_union64 var33;
+  orc_union64 var34;
+
+  ptr0 = (orc_union64 *)ex->dest_ptrs[0];
+  ptr4 = (orc_union64 *)ex->src_ptrs[0];
+  ptr5 = (orc_union64 *)ex->src_ptrs[1];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var32 = ptr4[i];
+    /* 1: loadq */
+    var33 = ptr5[i];
+    /* 2: muld */
+    var34.f = ORC_DENORMAL_D(ORC_DENORMAL_D(var32.f) * ORC_DENORMAL_D(var33.f));
+    /* 3: storeq */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+emulate_divd (OrcOpcodeExecutor *ex, int offset, int n)
+{
+  int i;
+  orc_union64 * ORC_RESTRICT ptr0;
+  const orc_union64 * ORC_RESTRICT ptr4;
+  const orc_union64 * ORC_RESTRICT ptr5;
+  orc_union64 var32;
+  orc_union64 var33;
+  orc_union64 var34;
+
+  ptr0 = (orc_union64 *)ex->dest_ptrs[0];
+  ptr4 = (orc_union64 *)ex->src_ptrs[0];
+  ptr5 = (orc_union64 *)ex->src_ptrs[1];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var32 = ptr4[i];
+    /* 1: loadq */
+    var33 = ptr5[i];
+    /* 2: divd */
+    var34.f = ORC_DENORMAL_D(ORC_DENORMAL_D(var32.f) / ORC_DENORMAL_D(var33.f));
+    /* 3: storeq */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+emulate_sqrtd (OrcOpcodeExecutor *ex, int offset, int n)
+{
+  int i;
+  orc_union64 * ORC_RESTRICT ptr0;
+  const orc_union64 * ORC_RESTRICT ptr4;
+  orc_union64 var32;
+  orc_union64 var33;
+
+  ptr0 = (orc_union64 *)ex->dest_ptrs[0];
+  ptr4 = (orc_union64 *)ex->src_ptrs[0];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var32 = ptr4[i];
+    /* 1: sqrtd */
+    var33.f = sqrt(ORC_DENORMAL_D(var32.f));
+    /* 2: storeq */
+    ptr0[i] = var33;
+  }
+
+}
+
+void
+emulate_maxd (OrcOpcodeExecutor *ex, int offset, int n)
+{
+  int i;
+  orc_union64 * ORC_RESTRICT ptr0;
+  const orc_union64 * ORC_RESTRICT ptr4;
+  const orc_union64 * ORC_RESTRICT ptr5;
+  orc_union64 var32;
+  orc_union64 var33;
+  orc_union64 var34;
+
+  ptr0 = (orc_union64 *)ex->dest_ptrs[0];
+  ptr4 = (orc_union64 *)ex->src_ptrs[0];
+  ptr5 = (orc_union64 *)ex->src_ptrs[1];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var32 = ptr4[i];
+    /* 1: loadq */
+    var33 = ptr5[i];
+    /* 2: maxd */
+    var34.f = ORC_MAXD(ORC_DENORMAL_D(var32.f),ORC_DENORMAL_D(var33.f));
+    /* 3: storeq */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+emulate_mind (OrcOpcodeExecutor *ex, int offset, int n)
+{
+  int i;
+  orc_union64 * ORC_RESTRICT ptr0;
+  const orc_union64 * ORC_RESTRICT ptr4;
+  const orc_union64 * ORC_RESTRICT ptr5;
+  orc_union64 var32;
+  orc_union64 var33;
+  orc_union64 var34;
+
+  ptr0 = (orc_union64 *)ex->dest_ptrs[0];
+  ptr4 = (orc_union64 *)ex->src_ptrs[0];
+  ptr5 = (orc_union64 *)ex->src_ptrs[1];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var32 = ptr4[i];
+    /* 1: loadq */
+    var33 = ptr5[i];
+    /* 2: mind */
+    var34.f = ORC_MIND(ORC_DENORMAL_D(var32.f),ORC_DENORMAL_D(var33.f));
+    /* 3: storeq */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+emulate_cmpeqd (OrcOpcodeExecutor *ex, int offset, int n)
+{
+  int i;
+  orc_union64 * ORC_RESTRICT ptr0;
+  const orc_union64 * ORC_RESTRICT ptr4;
+  const orc_union64 * ORC_RESTRICT ptr5;
+  orc_union64 var32;
+  orc_union64 var33;
+  orc_union64 var34;
+
+  ptr0 = (orc_union64 *)ex->dest_ptrs[0];
+  ptr4 = (orc_union64 *)ex->src_ptrs[0];
+  ptr5 = (orc_union64 *)ex->src_ptrs[1];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var32 = ptr4[i];
+    /* 1: loadq */
+    var33 = ptr5[i];
+    /* 2: cmpeqd */
+    var34.i = (ORC_DENORMAL_D(var32.f) == ORC_DENORMAL_D(var33.f)) ? (~0ULL) : 0;
+    /* 3: storeq */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+emulate_cmpltd (OrcOpcodeExecutor *ex, int offset, int n)
+{
+  int i;
+  orc_union64 * ORC_RESTRICT ptr0;
+  const orc_union64 * ORC_RESTRICT ptr4;
+  const orc_union64 * ORC_RESTRICT ptr5;
+  orc_union64 var32;
+  orc_union64 var33;
+  orc_union64 var34;
+
+  ptr0 = (orc_union64 *)ex->dest_ptrs[0];
+  ptr4 = (orc_union64 *)ex->src_ptrs[0];
+  ptr5 = (orc_union64 *)ex->src_ptrs[1];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var32 = ptr4[i];
+    /* 1: loadq */
+    var33 = ptr5[i];
+    /* 2: cmpltd */
+    var34.i = (ORC_DENORMAL_D(var32.f) < ORC_DENORMAL_D(var33.f)) ? (~0ULL) : 0;
+    /* 3: storeq */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+emulate_cmpled (OrcOpcodeExecutor *ex, int offset, int n)
+{
+  int i;
+  orc_union64 * ORC_RESTRICT ptr0;
+  const orc_union64 * ORC_RESTRICT ptr4;
+  const orc_union64 * ORC_RESTRICT ptr5;
+  orc_union64 var32;
+  orc_union64 var33;
+  orc_union64 var34;
+
+  ptr0 = (orc_union64 *)ex->dest_ptrs[0];
+  ptr4 = (orc_union64 *)ex->src_ptrs[0];
+  ptr5 = (orc_union64 *)ex->src_ptrs[1];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var32 = ptr4[i];
+    /* 1: loadq */
+    var33 = ptr5[i];
+    /* 2: cmpled */
+    var34.i = (ORC_DENORMAL_D(var32.f) <= ORC_DENORMAL_D(var33.f)) ? (~0ULL) : 0;
+    /* 3: storeq */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+emulate_convdl (OrcOpcodeExecutor *ex, int offset, int n)
+{
+  int i;
+  orc_union32 * ORC_RESTRICT ptr0;
+  const orc_union64 * ORC_RESTRICT ptr4;
+  orc_union64 var32;
+  orc_union32 var33;
+
+  ptr0 = (orc_union32 *)ex->dest_ptrs[0];
+  ptr4 = (orc_union64 *)ex->src_ptrs[0];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var32 = ptr4[i];
+    /* 1: convdl */
+    var33.i = (int)var32.f;
+    /* 2: storel */
+    ptr0[i] = var33;
+  }
+
+}
+
+void
+emulate_convld (OrcOpcodeExecutor *ex, int offset, int n)
+{
+  int i;
+  orc_union64 * ORC_RESTRICT ptr0;
+  const orc_union32 * ORC_RESTRICT ptr4;
+  orc_union32 var32;
+  orc_union64 var33;
+
+  ptr0 = (orc_union64 *)ex->dest_ptrs[0];
+  ptr4 = (orc_union32 *)ex->src_ptrs[0];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var32 = ptr4[i];
+    /* 1: convld */
+    var33.f = var32.i;
+    /* 2: storeq */
+    ptr0[i] = var33;
+  }
+
+}
+
+void
+emulate_convfd (OrcOpcodeExecutor *ex, int offset, int n)
+{
+  int i;
+  orc_union64 * ORC_RESTRICT ptr0;
+  const orc_union32 * ORC_RESTRICT ptr4;
+  orc_union32 var32;
+  orc_union64 var33;
+
+  ptr0 = (orc_union64 *)ex->dest_ptrs[0];
+  ptr4 = (orc_union32 *)ex->src_ptrs[0];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var32 = ptr4[i];
+    /* 1: convfd */
+    var33.f = ORC_DENORMAL (var32.f);
+    /* 2: storeq */
+    ptr0[i] = var33;
+  }
+
+}
+
+void
+emulate_convdf (OrcOpcodeExecutor *ex, int offset, int n)
+{
+  int i;
+  orc_union32 * ORC_RESTRICT ptr0;
+  const orc_union64 * ORC_RESTRICT ptr4;
+  orc_union64 var32;
+  orc_union32 var33;
+
+  ptr0 = (orc_union32 *)ex->dest_ptrs[0];
+  ptr4 = (orc_union64 *)ex->src_ptrs[0];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var32 = ptr4[i];
+    /* 1: convdf */
+    var33.f = ORC_DENORMAL ((float) var32.f);
+    /* 2: storel */
+    ptr0[i] = var33;
+  }
+
+}
+
index 9ab736e..49279d2 100644 (file)
@@ -164,6 +164,20 @@ void emulate_cmpltf (OrcOpcodeExecutor *ex, int i, int n);
 void emulate_cmplef (OrcOpcodeExecutor *ex, int i, int n);
 void emulate_convfl (OrcOpcodeExecutor *ex, int i, int n);
 void emulate_convlf (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_addd (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_subd (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_muld (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_divd (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_sqrtd (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_maxd (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_mind (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_cmpeqd (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_cmpltd (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_cmpled (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_convdl (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_convld (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_convfd (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_convdf (OrcOpcodeExecutor *ex, int i, int n);
 
 #endif
 
index 80dc08f..13fde14 100644 (file)
@@ -81,13 +81,18 @@ void orc_memset (void * d1, int p1, int n);
 #define ORC_SWAP_L(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | (((x)&0xff0000)>>8) | (((x)&0xff000000)>>24))
 #define ORC_SWAP_Q(x) ((((x)&0xffU)<<56) | (((x)&0xff00U)<<40) | (((x)&0xff0000U)<<24) | (((x)&0xff000000U)<<8) | (((x)&0xff00000000U)>>8) | (((x)&0xff0000000000U)>>24) | (((x)&0xff000000000000U)>>40) | (((x)&0xff00000000000000U)>>56))
 #define ORC_PTR_OFFSET(ptr,offset) ((void *)(((unsigned char *)(ptr)) + (offset)))
-#define ORC_MIN_NORMAL (1.1754944909521339405e-38)
 #define ORC_RECAST_INT(x) (((orc_union32)(x)).i)
 #define ORC_RECAST_FLOAT(x) (((orc_union32)(orc_int32)(x)).f)
 #define ORC_DENORMAL(x) ORC_RECAST_FLOAT(ORC_RECAST_INT(x) & (((ORC_RECAST_INT(x)&0x7f800000) == 0) ? 0xff800000 : 0xffffffff))
 #define ORC_ISNAN(x) (((ORC_RECAST_INT(x)&0x7f800000) == 0x7f800000) && ((ORC_RECAST_INT(x)&0x007fffff) != 0))
 #define ORC_MINF(a,b) (ORC_ISNAN(a) ? a : ORC_ISNAN(b) ? b : ((a)<(b)) ? (a) : (b))
 #define ORC_MAXF(a,b) (ORC_ISNAN(a) ? a : ORC_ISNAN(b) ? b : ((a)>(b)) ? (a) : (b))
+#define ORC_RECAST_INT64(x) (((orc_union64)(x)).i)
+#define ORC_RECAST_DOUBLE(x) (((orc_union64)(orc_int64)(x)).f)
+#define ORC_DENORMAL_D(x) ORC_RECAST_DOUBLE(ORC_RECAST_INT64(x) & (((ORC_RECAST_INT64(x)&0x7ff0000000000000) == 0) ? 0xfff0000000000000 : 0xffffffffffffffff))
+#define ORC_ISNAN_D(x) (((ORC_RECAST_INT64(x)&0x7ff0000000000000) == 0x7ff0000000000000) && ((ORC_RECAST_INT64(x)&0x000fffffffffffff) != 0))
+#define ORC_MIND(a,b) (ORC_ISNAN_D(a) ? a : ORC_ISNAN_D(b) ? b : ((a)<(b)) ? (a) : (b))
+#define ORC_MAXD(a,b) (ORC_ISNAN_D(a) ? a : ORC_ISNAN_D(b) ? b : ((a)>(b)) ? (a) : (b))
 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 #define ORC_RESTRICT restrict
 #elif defined(__GNUC__) && __GNUC__ >= 4
index 6c2a0a6..3b150bd 100644 (file)
@@ -466,6 +466,22 @@ static OrcStaticOpcode opcodes[] = {
   { "convfl", ORC_STATIC_OPCODE_FLOAT_SRC, { 4 }, { 4 }, emulate_convfl },
   { "convlf", ORC_STATIC_OPCODE_FLOAT_DEST, { 4 }, { 4 }, emulate_convlf },
 
+  /* double ops */
+  { "addd", ORC_STATIC_OPCODE_FLOAT, { 8 }, { 8, 8 }, emulate_addd },
+  { "subd", ORC_STATIC_OPCODE_FLOAT, { 8 }, { 8, 8 }, emulate_subd },
+  { "muld", ORC_STATIC_OPCODE_FLOAT, { 8 }, { 8, 8 }, emulate_muld },
+  { "divd", ORC_STATIC_OPCODE_FLOAT, { 8 }, { 8, 8 }, emulate_divd },
+  { "sqrtd", ORC_STATIC_OPCODE_FLOAT, { 8 }, { 8 }, emulate_sqrtd },
+  { "maxd", ORC_STATIC_OPCODE_FLOAT, { 8 }, { 8, 8 }, emulate_maxd },
+  { "mind", ORC_STATIC_OPCODE_FLOAT, { 8 }, { 8, 8 }, emulate_mind },
+  { "cmpeqd", ORC_STATIC_OPCODE_FLOAT_SRC, { 8 }, { 8, 8 }, emulate_cmpeqd },
+  { "cmpltd", ORC_STATIC_OPCODE_FLOAT_SRC, { 8 }, { 8, 8 }, emulate_cmpltd },
+  { "cmpled", ORC_STATIC_OPCODE_FLOAT_SRC, { 8 }, { 8, 8 }, emulate_cmpled },
+  { "convdl", ORC_STATIC_OPCODE_FLOAT_SRC, { 4 }, { 8 }, emulate_convdl },
+  { "convld", ORC_STATIC_OPCODE_FLOAT_DEST, { 8 }, { 4 }, emulate_convld },
+  { "convfd", ORC_STATIC_OPCODE_FLOAT, { 8 }, { 4 }, emulate_convfd },
+  { "convdf", ORC_STATIC_OPCODE_FLOAT, { 4 }, { 8 }, emulate_convdf },
+
   { "" }
 };
 
index 5513b40..64c2035 100644 (file)
@@ -103,13 +103,18 @@ orc_target_c_get_asm_preamble (void)
     "#define ORC_SWAP_L(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | (((x)&0xff0000)>>8) | (((x)&0xff000000)>>24))\n"
     "#define ORC_SWAP_Q(x) ((((x)&0xffU)<<56) | (((x)&0xff00U)<<40) | (((x)&0xff0000U)<<24) | (((x)&0xff000000U)<<8) | (((x)&0xff00000000U)>>8) | (((x)&0xff0000000000U)>>24) | (((x)&0xff000000000000U)>>40) | (((x)&0xff00000000000000U)>>56))\n"
     "#define ORC_PTR_OFFSET(ptr,offset) ((void *)(((unsigned char *)(ptr)) + (offset)))\n"
-    "#define ORC_MIN_NORMAL (1.1754944909521339405e-38)\n"
     "#define ORC_RECAST_INT(x) (((orc_union32)(x)).i)\n"
     "#define ORC_RECAST_FLOAT(x) (((orc_union32)(orc_int32)(x)).f)\n"
     "#define ORC_DENORMAL(x) ORC_RECAST_FLOAT(ORC_RECAST_INT(x) & (((ORC_RECAST_INT(x)&0x7f800000) == 0) ? 0xff800000 : 0xffffffff))\n"
     "#define ORC_ISNAN(x) (((ORC_RECAST_INT(x)&0x7f800000) == 0x7f800000) && ((ORC_RECAST_INT(x)&0x007fffff) != 0))\n"
     "#define ORC_MINF(a,b) (ORC_ISNAN(a) ? a : ORC_ISNAN(b) ? b : ((a)<(b)) ? (a) : (b))\n"
     "#define ORC_MAXF(a,b) (ORC_ISNAN(a) ? a : ORC_ISNAN(b) ? b : ((a)>(b)) ? (a) : (b))\n"
+    "#define ORC_RECAST_INT64(x) (((orc_union64)(x)).i)\n"
+    "#define ORC_RECAST_DOUBLE(x) (((orc_union64)(orc_int64)(x)).f)\n"
+    "#define ORC_DENORMAL_D(x) ORC_RECAST_DOUBLE(ORC_RECAST_INT64(x) & (((ORC_RECAST_INT64(x)&0x7ff0000000000000) == 0) ? 0xfff0000000000000 : 0xffffffffffffffff))\n"
+    "#define ORC_ISNAN_D(x) (((ORC_RECAST_INT64(x)&0x7ff0000000000000) == 0x7ff0000000000000) && ((ORC_RECAST_INT64(x)&0x000fffffffffffff) != 0))\n"
+    "#define ORC_MIND(a,b) (ORC_ISNAN_D(a) ? a : ORC_ISNAN_D(b) ? b : ((a)<(b)) ? (a) : (b))\n"
+    "#define ORC_MAXD(a,b) (ORC_ISNAN_D(a) ? a : ORC_ISNAN_D(b) ? b : ((a)>(b)) ? (a) : (b))\n"
     "#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\n"
     "#define ORC_RESTRICT restrict\n"
     "#elif defined(__GNUC__) && __GNUC__ >= 4\n"
@@ -596,6 +601,14 @@ c_rule_ ## name (OrcCompiler *p, void *user, OrcInstruction *insn) \
 #define UNARY_FL(a,b) UNARYFL(a,b)
 #define UNARY_LF(a,b) UNARYLF(a,b)
 
+#define BINARY_D(a,b) BINARYF(a,b)
+#define BINARY_DQ(a,b) BINARYFL(a,b)
+#define UNARY_D(a,b) UNARYF(a,b)
+#define UNARY_DL(a,b) UNARYFL(a,b)
+#define UNARY_LD(a,b) UNARYLF(a,b)
+#define UNARY_DF(a,b) UNARYF(a,b)
+#define UNARY_FD(a,b) UNARYF(a,b)
+
 #include "opcodes.h"
 
 #undef BINARY_SB
@@ -607,6 +620,7 @@ c_rule_ ## name (OrcCompiler *p, void *user, OrcInstruction *insn) \
 #undef BINARY_SQ
 #undef BINARY_UQ
 #undef BINARY_F
+#undef BINARY_D
 #undef UNARY_SB
 #undef UNARY_UB
 #undef UNARY_SW
@@ -616,6 +630,7 @@ c_rule_ ## name (OrcCompiler *p, void *user, OrcInstruction *insn) \
 #undef UNARY_SQ
 #undef UNARY_UQ
 #undef UNARY_F
+#undef UNARY_D
 #undef BINARY_BW
 #undef BINARY_WL
 #undef BINARY_LW
@@ -627,8 +642,13 @@ c_rule_ ## name (OrcCompiler *p, void *user, OrcInstruction *insn) \
 #undef UNARY_LW
 #undef UNARY_WB
 #undef UNARY_FL
+#undef UNARY_DL
 #undef UNARY_LF
+#undef UNARY_LD
 #undef BINARY_FL
+#undef BINARY_DQ
+#undef UNARY_FD
+#undef UNARY_DF
 
 static void
 c_rule_loadpX (OrcCompiler *p, void *user, OrcInstruction *insn)
@@ -973,6 +993,7 @@ orc_c_init (void)
 #define BINARY_SQ(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
 #define BINARY_UQ(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
 #define BINARY_F(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
+#define BINARY_D(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
 #define UNARY_SB(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
 #define UNARY_UB(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
 #define UNARY_SW(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
@@ -982,6 +1003,7 @@ orc_c_init (void)
 #define UNARY_SQ(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
 #define UNARY_UQ(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
 #define UNARY_F(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
+#define UNARY_D(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
 #define BINARY_BW(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
 #define BINARY_WL(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
 #define BINARY_LW(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
@@ -994,8 +1016,13 @@ orc_c_init (void)
 #define UNARY_WB(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
 
 #define UNARY_FL(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
+#define UNARY_DL(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
 #define BINARY_FL(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
+#define BINARY_DQ(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
 #define UNARY_LF(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
+#define UNARY_LD(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
+#define UNARY_DF(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
+#define UNARY_FD(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);
 
 #include "opcodes.h"