Add 64 bit shlq/shrsq/shruq opcodes
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 6 Sep 2010 09:02:56 +0000 (11:02 +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 20cc1bc..568f2d6 100644 (file)
@@ -91,6 +91,9 @@ BINARY_SQ(orq, "%s | %s")
 BINARY_SQ(xorq, "%s ^ %s")
 BINARY_SQ(addq, "%s + %s")
 BINARY_SQ(subq, "%s - %s")
+BINARY_SQ(shlq, "%s << %s")
+BINARY_SQ(shrsq, "%s >> %s")
+BINARY_UQ(shruq, "((orc_uint64)%s) >> %s")
 
 UNARY_BW(convsbw, "%s")
 UNARY_BW(convubw, "(orc_uint8)%s")
index 785aa6d..654b14e 100644 (file)
@@ -3086,6 +3086,78 @@ emulate_subq (OrcOpcodeExecutor *ex, int offset, int n)
 }
 
 void
+emulate_shlq (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: shlq */
+    var33.i = var32.i << ((orc_union32 *)(ex->src_ptrs[1]))->i;
+    /* 2: storeq */
+    ptr0[i] = var33;
+  }
+
+}
+
+void
+emulate_shrsq (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: shrsq */
+    var33.i = var32.i >> ((orc_union32 *)(ex->src_ptrs[1]))->i;
+    /* 2: storeq */
+    ptr0[i] = var33;
+  }
+
+}
+
+void
+emulate_shruq (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: shruq */
+    var33.i = ((orc_uint64)var32.i) >> ((orc_union32 *)(ex->src_ptrs[1]))->i;
+    /* 2: storeq */
+    ptr0[i] = var33;
+  }
+
+}
+
+void
 emulate_convsbw (OrcOpcodeExecutor *ex, int offset, int n)
 {
   int i;
index 4f4df65..26267e3 100644 (file)
@@ -118,6 +118,9 @@ 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_shlq (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_shrsq (OrcOpcodeExecutor *ex, int i, int n);
+void emulate_shruq (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 243ff0b..2850ca1 100644 (file)
@@ -405,6 +405,9 @@ static OrcStaticOpcode opcodes[] = {
   { "xorq", 0, { 8 }, { 8, 8 }, emulate_xorq },
   { "addq", 0, { 8 }, { 8, 8 }, emulate_addq },
   { "subq", 0, { 8 }, { 8, 8 }, emulate_subq },
+  { "shlq", ORC_STATIC_OPCODE_SCALAR, { 8 }, { 8, 8 }, emulate_shlq },
+  { "shrsq", ORC_STATIC_OPCODE_SCALAR, { 8 }, { 8, 8 }, emulate_shrsq },
+  { "shruq", ORC_STATIC_OPCODE_SCALAR, { 8 }, { 8, 8 }, emulate_shruq },
 
   { "convsbw", 0, { 2 }, { 1 }, emulate_convsbw },
   { "convubw", 0, { 2 }, { 1 }, emulate_convubw },