]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
PPC64, add support for the xvnegsp instruction. Add test case for the instruction.
authorCarl Love <carll@us.ibm.com>
Thu, 21 Jun 2018 22:27:40 +0000 (17:27 -0500)
committerCarl Love <carll@us.ibm.com>
Thu, 21 Jun 2018 22:27:40 +0000 (17:27 -0500)
https://bugs.kde.org/show_bug.cgi?id=395709

Signed-off-by: Carl Love <carll@us.ibm.com>
NEWS
VEX/priv/guest_ppc_toIR.c
none/tests/ppc32/test_isa_2_06_part3.c
none/tests/ppc64/test_isa_2_06_part3.stdout.exp

diff --git a/NEWS b/NEWS
index a04907af35e7d2049d484b85437f0dc52cc9832a..0f150563f21c26f194c0aa6b3d6505b1c226c27c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -113,6 +113,7 @@ where XXXXXX is the bug number as listed below.
 393023  callgrind_control risks using the wrong vgdb
 393062  build-id ELF phdrs read causes "debuginfo reader: ensure_valid failed"
 393099  posix_memalign() invalid write if alignment == 0
+395709  PPC64 is missing support for the xvnegsp instruction
 
 n-i-bz  Fix missing workq_ops operations (macOS)
 n-i-bz  fix bug in strspn replacement
index 7fd7780bbf29463b6c43ed6b6d60c05c4a3ca584..cb1cae176af36584a103b102d38906e6f12eadb8 100644 (file)
@@ -17870,6 +17870,35 @@ dis_vxv_misc ( UInt theInstr, UInt opc2 )
          }
          break;
       }
+      case 0x372: // xvnegsp (VSX Vector Negate Single-Precision)
+      {
+         IRTemp B0 = newTemp(Ity_I32);
+         IRTemp B1 = newTemp(Ity_I32);
+         IRTemp B2 = newTemp(Ity_I32);
+         IRTemp B3 = newTemp(Ity_I32);
+
+         DIP("xvnegsp v%d,v%d\n",  XT, XB);
+
+        /* Don't support NegF32, so just XOR the sign bit in the int value */
+         assign(B0, unop( Iop_64HIto32,
+                         unop( Iop_V128HIto64, getVSReg( XB ) ) ) );
+         assign(B1, unop( Iop_64to32,
+                         unop( Iop_V128HIto64, getVSReg( XB ) ) ) );
+         assign(B2, unop( Iop_64HIto32,
+                         unop( Iop_V128to64, getVSReg( XB ) ) ) );
+         assign(B3, unop( Iop_64to32,
+                         unop( Iop_V128to64, getVSReg( XB ) ) ) );
+
+         putVSReg( XT,
+                  binop( Iop_64HLtoV128,
+                         binop( Iop_32HLto64,
+                                binop( Iop_Xor32, mkexpr( B0 ), mkU32( 0x80000000 ) ),
+                                binop( Iop_Xor32, mkexpr( B1 ), mkU32( 0x80000000 ) ) ),
+                         binop( Iop_32HLto64,
+                                binop( Iop_Xor32, mkexpr( B2 ), mkU32( 0x80000000 ) ),
+                                binop( Iop_Xor32, mkexpr( B3 ), mkU32( 0x80000000 ) ) ) ) );
+         break;
+      }
       case 0x3F2: // xvnegdp (VSX Vector Negate Double-Precision)
       {
          IRTemp frB = newTemp(Ity_F64);
@@ -28418,6 +28447,7 @@ DisResult disInstr_PPC_WRK (
          case 0x134:  // xvresp
          case 0x1B4:  // xvredp
          case 0x194: case 0x114: // xvrsqrtedp, xvrsqrtesp
+         case 0x372:             // xvnegsp
          case 0x380: case 0x3A0: // xvmaxdp, xvmindp
          case 0x300: case 0x320: // xvmaxsp, xvminsp
          case 0x3C0: case 0x340: // xvcpsgndp, xvcpsgnsp
index 5ebc1a5e7f7d212d9fdeedb5409ee5d417cccd76..9f80da284129005cdff00e34fc7c4b3a0ead21e2 100644 (file)
@@ -765,6 +765,11 @@ static void test_xvnegdp(void)
    __asm__ __volatile__ ("xvnegdp   %x0, %x1" : "=wa" (vec_out): "wa" (vec_inB));
 }
 
+static void test_xvnegsp(void)
+{
+   __asm__ __volatile__ ("xvnegsp   %x0, %x1" : "=wa" (vec_out): "wa" (vec_inB));
+}
+
 static void test_xvabssp(void)
 {
    __asm__ __volatile__ ("xvabssp   %x0, %x1" : "=wa" (vec_out): "wa" (vec_inB));
@@ -850,6 +855,7 @@ vsx_one_fp_arg_tests[] = {
                                 { &test_xsrdpi, "xsrdpi", NULL, 20, DOUBLE_TEST, VX_CONV_TO_DOUBLE, "round"},
                                 { &test_xvabsdp, "xvabsdp", NULL, 20, DOUBLE_TEST, VX_DEFAULT, "abs"},
                                 { &test_xvnabsdp, "xvnabsdp", NULL, 20, DOUBLE_TEST, VX_DEFAULT, "nabs"},
+                                { &test_xvnegsp, "xvnegsp", NULL, 20, SINGLE_TEST, VX_DEFAULT, "neg"},
                                 { &test_xvnegdp, "xvnegdp", NULL, 20, DOUBLE_TEST, VX_DEFAULT, "neg"},
                                 { &test_xvabssp, "xvabssp", NULL, 20, SINGLE_TEST, VX_DEFAULT, "abs"},
                                 { &test_xvnabssp, "xvnabssp", NULL, 20, SINGLE_TEST, VX_DEFAULT, "nabs"},
index 1658a6eb4e567f24cf91cd2f094e71afda154c0c..e976074339d1498545e149b52c33071a1f9fe3a6 100644 (file)
@@ -310,6 +310,12 @@ Test VSX vector and scalar single argument instructions
 #8: xvnabsdp nabs(41382511a2000000) = c1382511a2000000; nabs(40312ef5a9300000) = c0312ef5a9300000
 #9: xvnabsdp nabs(40514bf5d2300000) = c0514bf5d2300000; nabs(40976bf982440000) = c0976bf982440000
 
+#0: xvnegsp neg(3ec00000) = bec00000; neg(42780000) = c2780000; neg(00000000) = 80000000; neg(7f800000) = ff800000
+#1: xvnegsp neg(00000000) = 80000000; neg(00000000) = 80000000; neg(80000000) = 00000000; neg(7f800000) = ff800000
+#2: xvnegsp neg(ff800000) = 7f800000; neg(7fbfffff) = ffbfffff; neg(ffbfffff) = 7fbfffff; neg(7fc00000) = ffc00000
+#3: xvnegsp neg(ffc00000) = 7fc00000; neg(80000000) = 00000000; neg(c683287b) = 4683287b; neg(49192c2d) = c9192c2d
+#4: xvnegsp neg(49c1288d) = c9c1288d; neg(418977ad) = c18977ad; neg(428a5faf) = c28a5faf; neg(44bb5fcc) = c4bb5fcc
+
 #0: xvnegdp neg(3fd8000000000000) = bfd8000000000000; neg(404f000000000000) = c04f000000000000
 #1: xvnegdp neg(0018000000b77501) = 8018000000b77501; neg(7fe800000000051b) = ffe800000000051b
 #2: xvnegdp neg(0123214569900000) = 8123214569900000; neg(0000000000000000) = 8000000000000000