]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix a bug for TileGX platform found by instruction tests.
authorZhi-Gang Liu <zliu@tilera.com>
Tue, 7 Jul 2015 14:28:38 +0000 (14:28 +0000)
committerZhi-Gang Liu <zliu@tilera.com>
Tue, 7 Jul 2015 14:28:38 +0000 (14:28 +0000)
The issue is of the dirty helper of the SIMD instructions
with immediate operand.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3161

VEX/priv/guest_tilegx_helpers.c
VEX/priv/guest_tilegx_toIR.c

index cda5499539d3bcf30f3ea2f1632033bdb2bfa0f6..3fd02b769625d5a862cb5b82246f98e451519cb7 100644 (file)
@@ -778,7 +778,7 @@ ULong tilegx_dirtyhelper_gen ( ULong opc,
     break;
   case 271:
     {
-      return __insn_v1shli(rd1, rd2);
+      return __insn_v1shl(rd1, rd2);
     }
     break;
   case 272:
@@ -788,7 +788,7 @@ ULong tilegx_dirtyhelper_gen ( ULong opc,
     break;
   case 273:
     {
-      return __insn_v1shrsi(rd1, rd2);
+      return __insn_v1shrs(rd1, rd2);
     }
     break;
   case 274:
@@ -988,7 +988,7 @@ ULong tilegx_dirtyhelper_gen ( ULong opc,
     break;
   case 313:
     {
-      return __insn_v2shli(rd1, rd2);
+      return __insn_v2shl(rd1, rd2);
     }
     break;
   case 314:
@@ -1003,7 +1003,7 @@ ULong tilegx_dirtyhelper_gen ( ULong opc,
     break;
   case 316:
     {
-      return __insn_v2shrsi(rd1, rd2);
+      return __insn_v2shrs(rd1, rd2);
     }
     break;
   case 317:
@@ -1013,7 +1013,7 @@ ULong tilegx_dirtyhelper_gen ( ULong opc,
     break;
   case 318:
     {
-      return __insn_v2shrui(rd1, rd2);
+      return __insn_v2shru(rd1, rd2);
     }
     break;
   case 319:
index 4ce6f7bc5c25bd3b094eddaf0b360c6816fd99e7..c7f9728d975f46d4cc0ebae17e05b657b7c8adaf 100644 (file)
@@ -257,6 +257,22 @@ static IRStmt* dis_branch ( IRExpr* guard, ULong imm )
     rd_wb_index++;                              \
   } while(0)
 
+
+/* Expand/repeat byte _X 8 times to a 64-bit value */
+#define  V1EXP(_X)                                     \
+  ({                                                   \
+    _X = ((((UChar)(_X)) << 8) | ((UChar)(_X)));       \
+    _X = (((_X) << 16) | (_X));                        \
+    (((_X) << 32) | (_X));                             \
+  })
+
+/* Expand/repeat byte _X 4 times to a 64-bit value */
+#define  V2EXP(_X)                                 \
+  ({                                               \
+    _X = ((((UChar)(_X)) << 16) | ((UChar)(_X)));  \
+    (((_X) << 32) | (_X));                         \
+  })
+
 /*------------------------------------------------------------*/
 /*--- Disassemble a single instruction                     ---*/
 /*------------------------------------------------------------*/
@@ -2082,9 +2098,12 @@ static DisResult disInstr_TILEGX_WRK ( Bool(*resteerOkFn) (void *, Addr),
     case 232:
       /* Fall-through */
     case 233:
-      /* Fall-through */
+      use_dirty_helper = 1;
+      break;
     case 234:
-      /* Fall-through */
+      opd[3] = V1EXP(opd[3]);
+      use_dirty_helper = 1;
+      break;
     case 235:
       /* Fall-through */
     case 236:
@@ -2110,12 +2129,18 @@ static DisResult disInstr_TILEGX_WRK ( Bool(*resteerOkFn) (void *, Addr),
     case 241:
       /* Fall-through */
     case 242:
-      /* Fall-through */
+      use_dirty_helper = 1;
+      break;
     case 243:
+      opd[3] = V1EXP(opd[3]);
+      use_dirty_helper = 1;
+      break;
       /* Fall-through */
     case 244:
-      /* Fall-through */
+      use_dirty_helper = 1;
+      break;
     case 245:
+      opd[3] = V1EXP(opd[3]);
       use_dirty_helper = 1;
       break;
     case 246:  /* "v1cmpne" */
@@ -2151,13 +2176,19 @@ static DisResult disInstr_TILEGX_WRK ( Bool(*resteerOkFn) (void *, Addr),
     case 258:
       /* Fall-through */
     case 259:
-      /* Fall-through */
+      use_dirty_helper = 1;
+      break;
     case 260:
-      /* Fall-through */
+      opd[3] = V1EXP(opd[3]);
+      use_dirty_helper = 1;
+      break;
     case 261:
-      /* Fall-through */
+      use_dirty_helper = 1;
+      break;
     case 262:
-      /* Fall-through */
+      opd[3] = V1EXP(opd[3]);
+      use_dirty_helper = 1;
+      break;
     case 263:
       /* Fall-through */
     case 264:
@@ -2173,13 +2204,19 @@ static DisResult disInstr_TILEGX_WRK ( Bool(*resteerOkFn) (void *, Addr),
     case 269:
       /* Fall-through */
     case 270:
-      /* Fall-through */
+      use_dirty_helper = 1;
+      break;
     case 271:
-      /* Fall-through */
+      opd[3] = V1EXP(opd[3]);
+      use_dirty_helper = 1;
+      break;
     case 272:
-      /* Fall-through */
+      use_dirty_helper = 1;
+      break;
     case 273:
-      /* Fall-through */
+      opd[3] = V1EXP(opd[3]);
+      use_dirty_helper = 1;
+      break;
     case 274:
       use_dirty_helper = 1;
       break;
@@ -2195,9 +2232,12 @@ static DisResult disInstr_TILEGX_WRK ( Bool(*resteerOkFn) (void *, Addr),
     case 277:
       /* Fall-through */
     case 278:
-      /* Fall-through */
+      use_dirty_helper = 1;
+      break;
     case 279:
-      /* Fall-through */
+      opd[3] = V2EXP(opd[3]);
+      use_dirty_helper = 1;
+      break;
     case 280:
       /* Fall-through */
     case 281:
@@ -2205,21 +2245,30 @@ static DisResult disInstr_TILEGX_WRK ( Bool(*resteerOkFn) (void *, Addr),
     case 282:
       /* Fall-through */
     case 283:
-      /* Fall-through */
+      use_dirty_helper = 1;
+      break;
     case 284:
-      /* Fall-through */
+      opd[3] = V2EXP(opd[3]);
+      use_dirty_helper = 1;
+      break;
     case 285:
       /* Fall-through */
     case 286:
       /* Fall-through */
     case 287:
-      /* Fall-through */
+      use_dirty_helper = 1;
+      break;
     case 288:
-      /* Fall-through */
+      opd[3] = V2EXP(opd[3]);
+      use_dirty_helper = 1;
+      break;
     case 289:
-      /* Fall-through */
+      use_dirty_helper = 1;
+      break;
     case 290:
-      /* Fall-through */
+      opd[3] = V2EXP(opd[3]);
+      use_dirty_helper = 1;
+      break;
     case 291:
       /* Fall-through */
     case 292:
@@ -2231,13 +2280,19 @@ static DisResult disInstr_TILEGX_WRK ( Bool(*resteerOkFn) (void *, Addr),
     case 295:
       /* Fall-through */
     case 296:
-      /* Fall-through */
+      use_dirty_helper = 1;
+      break;
     case 297:
-      /* Fall-through */
+      opd[3] = V2EXP(opd[3]);
+      use_dirty_helper = 1;
+      break;
     case 298:
-      /* Fall-through */
+      use_dirty_helper = 1;
+      break;
     case 299:
-      /* Fall-through */
+      opd[3] = V2EXP(opd[3]);
+      use_dirty_helper = 1;
+      break;
     case 300:
       /* Fall-through */
     case 301:
@@ -2263,19 +2318,28 @@ static DisResult disInstr_TILEGX_WRK ( Bool(*resteerOkFn) (void *, Addr),
     case 311:
       /* Fall-through */
     case 312:
-      /* Fall-through */
+      use_dirty_helper = 1;
+      break;
     case 313:
-      /* Fall-through */
+      opd[3] = V2EXP(opd[3]);
+      use_dirty_helper = 1;
+      break;
     case 314:
       /* Fall-through */
     case 315:
-      /* Fall-through */
+      use_dirty_helper = 1;
+      break;
     case 316:
-      /* Fall-through */
+      opd[3] = V2EXP(opd[3]);
+      use_dirty_helper = 1;
+      break;
     case 317:
-      /* Fall-through */
+      use_dirty_helper = 1;
+      break;
     case 318:
-      /* Fall-through */
+      opd[3] = V2EXP(opd[3]);
+      use_dirty_helper = 1;
+      break;
     case 319:
       /* Fall-through */
     case 320: