Add 64 bit addq/subq opcodes
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 6 Sep 2010 08:53:26 +0000 (10:53 +0200)
committerDavid Schleef <ds@schleef.org>
Wed, 8 Sep 2010 20:35:00 +0000 (13:35 -0700)
orc/opcodes.h
orc/orcemulateopcodes.c
orc/orcemulateopcodes.h
orc/orcopcodes.c

index 92a066e4bfada7d830e9f630f8eb8b56eeeefecd..20cc1bc51bed983ed68d9eeb744bfe28f700edd8 100644 (file)
@@ -89,6 +89,8 @@ BINARY_SQ(andq, "%s & %s")
 BINARY_SQ(andnq, "(~%s) & %s")
 BINARY_SQ(orq, "%s | %s")
 BINARY_SQ(xorq, "%s ^ %s")
+BINARY_SQ(addq, "%s + %s")
+BINARY_SQ(subq, "%s - %s")
 
 UNARY_BW(convsbw, "%s")
 UNARY_BW(convubw, "(orc_uint8)%s")
index 6e6d533cc0746bb03a018296417ea87d3653e975..785aa6dd62995745cc86b6f72d7a6882f887b07c 100644 (file)
@@ -3027,6 +3027,64 @@ emulate_xorq (OrcOpcodeExecutor *ex, int offset, int n)
 
 }
 
+void
+emulate_addq (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: addq */
+    var34.i = var32.i + var33.i;
+    /* 3: storeq */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+emulate_subq (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: subq */
+    var34.i = var32.i - var33.i;
+    /* 3: storeq */
+    ptr0[i] = var34;
+  }
+
+}
+
 void
 emulate_convsbw (OrcOpcodeExecutor *ex, int offset, int n)
 {
index 38d1ff65a702807b5a7c65c093f16813e696292c..4f4df65fce828fcbf8df893ef5dbc677dab9ed44 100644 (file)
@@ -116,6 +116,8 @@ void emulate_andq (OrcOpcodeExecutor *ex, int i, int n);
 void emulate_andnq (OrcOpcodeExecutor *ex, int i, int n);
 void emulate_orq (OrcOpcodeExecutor *ex, int i, int n);
 void emulate_xorq (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_addq (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_subq (OrcOpcodeExecutor *ex, int i, int n);
 void emulate_convsbw (OrcOpcodeExecutor *ex, int i, int n);
 void emulate_convubw (OrcOpcodeExecutor *ex, int i, int n);
 void emulate_splatbw (OrcOpcodeExecutor *ex, int i, int n);
index 41142a94979dd1a0c408b1425afa3d5899838969..243ff0b6ff0e317735cbefb99b4ecd6103eefd80 100644 (file)
@@ -403,6 +403,8 @@ static OrcStaticOpcode opcodes[] = {
   { "andnq", 0, { 8 }, { 8, 8 }, emulate_andnq },
   { "orq", 0, { 8 }, { 8, 8 }, emulate_orq },
   { "xorq", 0, { 8 }, { 8, 8 }, emulate_xorq },
+  { "addq", 0, { 8 }, { 8, 8 }, emulate_addq },
+  { "subq", 0, { 8 }, { 8, 8 }, emulate_subq },
 
   { "convsbw", 0, { 2 }, { 1 }, emulate_convsbw },
   { "convubw", 0, { 2 }, { 1 }, emulate_convubw },