]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
PPC64, Add support for vlogefp, vexptefp instructions
authorCarl Love <carll@us.ibm.com>
Tue, 28 May 2019 19:07:04 +0000 (14:07 -0500)
committerCarl Love <carll@us.ibm.com>
Tue, 28 May 2019 19:07:04 +0000 (14:07 -0500)
Add Iop_Exp2_32Fx4 to VEX/pub/libvex_ir.h to support the 2^x instruction.

Enable the existing test support for the two instructions in
none/tests/ppc64/subnormal_test.c and none/tests/ppc64/jm-insns.c.

https://bugs.kde.org/show_bug.cgi?id=407340

NEWS
VEX/priv/guest_ppc_toIR.c
VEX/priv/host_ppc_defs.c
VEX/priv/host_ppc_defs.h
VEX/priv/host_ppc_isel.c
VEX/priv/ir_defs.c
VEX/pub/libvex_ir.h
memcheck/mc_translate.c
memcheck/tests/vbit-test/irops.c

diff --git a/NEWS b/NEWS
index 788e92fc75979ff5265420afa440631612e68417..753171f7aaf089dffcb55573a8ad3632e7fba171 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -212,6 +212,7 @@ where XXXXXX is the bug number as listed below.
 406360  memcheck/tests/libstdc++.supp needs more supression variants
 406422  none/tests/amd64-linux/map_32bits.vgtest fails too easily
 406465  arm64 insn selector fails on "t0 = <expr>" where <expr> has type Ity_F16
+407340  PPC64, does not support the vlogefp, vexptefp instructions.
 n-i-bz  add syswrap for PTRACE_GET|SET_THREAD_AREA on amd64.
 n-i-bz  Fix callgrind_annotate non deterministic order for equal total
 n-i-bz  callgrind_annotate --threshold=100 does not print all functions.
index ad79b5e560052084fce833bd71883315cdc97a65..12480b3d1783e2365f21f66a4a79048119b762b3 100644 (file)
@@ -27702,17 +27702,21 @@ static Bool dis_av_fp_arith ( UInt theInstr )
 
    case 0x18A: // vexptefp (2 Raised to the Exp Est FP, AV p173)
       DIP("vexptefp v%d,v%d\n", vD_addr, vB_addr);
-      DIP(" => not implemented\n");
       /* NOTE, need to address dnormalized value handling when this is
          implemented.  */
-      return False;
+      putVReg( vD_addr,
+               dnorm_adj_Vector( unop( Iop_Exp2_32Fx4,
+                                       dnorm_adj_Vector( mkexpr( vB ) ) ) ) );
+      return True;
 
    case 0x1CA: // vlogefp (Log2 Estimate FP, AV p175)
       DIP("vlogefp v%d,v%d\n", vD_addr, vB_addr);
-      DIP(" => not implemented\n");
       /* NOTE, need to address dnormalized value handling when this is
          implemented.  */
-      return False;
+      putVReg( vD_addr,
+               dnorm_adj_Vector( unop( Iop_Log2_32Fx4,
+                                       dnorm_adj_Vector( mkexpr( vB ) ) ) ) );
+      return True;
 
    default:
       vex_printf("dis_av_fp_arith(ppc)(opc2=0x%x)\n",opc2);
index 682500a1e3ff2867353260b88f972a5cdcc5d880..6c298fa18b7f67334be03db1656c42d130bba85e 100644 (file)
@@ -750,6 +750,8 @@ const HChar* showPPCAvFpOp ( PPCAvFpOp op ) {
    /* Floating Point Unary */
    case Pavfp_RCPF:      return "vrefp";
    case Pavfp_RSQRTF:    return "vrsqrtefp";
+   case Pavfp_Log2:      return "vlogefp";
+   case Pavfp_Exp2:      return "vexptefp";
    case Pavfp_CVTU2F:    return "vcfux";
    case Pavfp_CVTS2F:    return "vcfsx";
    case Pavfp_QCVTF2U:   return "vctuxs";
@@ -5733,6 +5735,8 @@ Int emit_PPCInstr ( /*MB_MOD*/Bool* is_profInc,
       switch (i->Pin.AvUn32Fx4.op) {
       case Pavfp_RCPF:    opc2 =  266; break; // vrefp
       case Pavfp_RSQRTF:  opc2 =  330; break; // vrsqrtefp
+      case Pavfp_Log2:    opc2 =  458; break; // vlogefp
+      case Pavfp_Exp2:    opc2 =  394; break; // vexptefp
       case Pavfp_CVTU2F:  opc2 =  778; break; // vcfux
       case Pavfp_CVTS2F:  opc2 =  842; break; // vcfsx
       case Pavfp_QCVTF2U: opc2 =  906; break; // vctuxs
index 0d05954f501ac90550a2af1119f3f816a62b8639..70c3b6cb96f57cf0cd77b9f3b1d79aea74af908c 100644 (file)
@@ -489,7 +489,7 @@ typedef
       Pavfp_CMPEQF, Pavfp_CMPGTF, Pavfp_CMPGEF,
 
       /* Floating point unary */
-      Pavfp_RCPF, Pavfp_RSQRTF,
+      Pavfp_RCPF, Pavfp_RSQRTF, Pavfp_Log2, Pavfp_Exp2,
       Pavfp_CVTU2F, Pavfp_CVTS2F, Pavfp_QCVTF2U, Pavfp_QCVTF2S,
       Pavfp_ROUNDM, Pavfp_ROUNDP, Pavfp_ROUNDN, Pavfp_ROUNDZ,
    }
index e05145c043b45fc7372da423d94f850f82b7c987..5e2a3b80c892e9e182dd159bb0d33848745b1516 100644 (file)
@@ -5779,6 +5779,8 @@ static HReg iselVecExpr_wrk ( ISelEnv* env, const IRExpr* e,
 
       case Iop_RecipEst32Fx4: fpop = Pavfp_RCPF;    goto do_32Fx4_unary;
       case Iop_RSqrtEst32Fx4: fpop = Pavfp_RSQRTF;  goto do_32Fx4_unary;
+      case Iop_Log2_32Fx4:    fpop = Pavfp_Log2;    goto do_32Fx4_unary;
+      case Iop_Exp2_32Fx4:    fpop = Pavfp_Exp2;    goto do_32Fx4_unary;
       case Iop_I32UtoF32x4_DEP: fpop = Pavfp_CVTU2F;  goto do_32Fx4_unary;
       case Iop_I32StoF32x4_DEP: fpop = Pavfp_CVTS2F;  goto do_32Fx4_unary;
       case Iop_QF32toI32Ux4_RZ: fpop = Pavfp_QCVTF2U; goto do_32Fx4_unary;
index f30cf0d4eaf265819c2dab91f5dadbd7987c8edb..30e936a2de011ff76ae7df191f28891aed8a5caf 100644 (file)
@@ -707,7 +707,8 @@ void ppIROp ( IROp op )
       case Iop_Scale2_64Fx2: vex_printf("Scale2_64Fx2"); return;
       case Iop_Log2_32Fx4: vex_printf("Log2_32Fx4"); return;
       case Iop_Log2_64Fx2: vex_printf("Log2_64Fx2"); return;
+      case Iop_Exp2_32Fx4: vex_printf("Iop_Exp2_32Fx4"); return;
+
       case Iop_Sub32Fx4:  vex_printf("Sub32Fx4"); return;
       case Iop_Sub32Fx2:  vex_printf("Sub32Fx2"); return;
       case Iop_Sub32F0x4: vex_printf("Sub32F0x4"); return;
@@ -3012,6 +3013,7 @@ void typeOfPrimop ( IROp op,
          TERNARY(ity_RMode,Ity_V128,Ity_V128, Ity_V128);
       case Iop_Log2_32Fx4:
       case Iop_Log2_64Fx2:
+      case Iop_Exp2_32Fx4:
          UNARY(Ity_V128, Ity_V128);
 
       case Iop_V128to64: case Iop_V128HIto64:
index d797bd4b34adfdb378da082e8943092b387e8621..d5e7f5036e352a74100d18fe96f9cbd2804a79c0 100644 (file)
@@ -1385,6 +1385,8 @@ typedef
       /* Vector floating-point base 2 logarithm */
       Iop_Log2_32Fx4,
 
+      /* Vector floating-point exponential 2^x */
+      Iop_Exp2_32Fx4,
 
       /* Vector Reciprocal Square Root Step computes (3.0 - arg1 * arg2) / 2.0.
          Note, that of one of the arguments is zero and another one is infiinty
index 424de15aca2db4fec4fc13dda1014d0c53cb33f7..02b93ba5132ae3f19258cb5f73e988004601cf1a 100644 (file)
@@ -4921,6 +4921,7 @@ IRExpr* expr2vbits_Unop ( MCEnv* mce, IROp op, IRAtom* atom )
       case Iop_Neg32Fx4:
       case Iop_RSqrtEst32Fx4:
       case Iop_Log2_32Fx4:
+      case Iop_Exp2_32Fx4:
          return unary32Fx4(mce, vatom);
 
       case Iop_I32UtoF32x2_DEP:
index 58d03e91d74143f0c80cad2d478e0842150efa1c..29451b43547ffcba7265630ea935a49f692cd13c 100644 (file)
@@ -631,6 +631,7 @@ static irop_t irops[] = {
   { DEFOP(Iop_Sqrt32Fx4, UNDEF_UNKNOWN), },
   { DEFOP(Iop_Scale2_32Fx4, UNDEF_UNKNOWN), },
   { DEFOP(Iop_Log2_32Fx4, UNDEF_UNKNOWN), },
+  { DEFOP(Iop_Exp2_32Fx4, UNDEF_UNKNOWN), },
   { DEFOP(Iop_Neg32Fx4, UNDEF_UNKNOWN), },
   { DEFOP(Iop_RecipEst32Fx4, UNDEF_UNKNOWN), },
   { DEFOP(Iop_RecipStep32Fx4, UNDEF_UNKNOWN), },