From: Carl Love Date: Fri, 6 Sep 2013 22:29:55 +0000 (+0000) Subject: The existing overflow detection in VEX/priv/guest_ppc_toIR.c/set_XER_OV_64() X-Git-Tag: svn/VALGRIND_3_9_0~154 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44901807b3bfa45a051a03ce66d42d96303a0035;p=thirdparty%2Fvalgrind.git The existing overflow detection in VEX/priv/guest_ppc_toIR.c/set_XER_OV_64() under the case PPCG_FLAG_OP_MULLW: does not apply to the mulldo as we need to detect overflow when performing a Multiply Low Doubleword (not Multiply Low Word). Hence, we added a new enumeration value PPCG_FLAG_OP_MULLD in VEX/priv/guest_ppc_defs.h and a corresponding new case under which the computation for detecting overflow for mulldo/mulldo. is added in set_XER_OV_64(). The tests have been added to: none/tests/ppc32/jm-insns.c Vex commit 2754 for the source code fix This commit adds the test cases. Bugzilla 324594, submitted by Anmol P. Paralkar Patch reviewed and tested by Carl Love git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13537 --- diff --git a/none/tests/ppc32/jm-insns.c b/none/tests/ppc32/jm-insns.c index fefd2ae4bc..86f6cd84d0 100644 --- a/none/tests/ppc32/jm-insns.c +++ b/none/tests/ppc32/jm-insns.c @@ -530,6 +530,11 @@ static void test_mulld (void) __asm__ __volatile__ ("mulld 17, 14, 15"); } +static void test_mulldo (void) +{ + __asm__ __volatile__ ("mulldo 17, 14, 15"); +} + static void test_mulhd (void) { __asm__ __volatile__ ("mulhd 17, 14, 15"); @@ -572,6 +577,7 @@ static test_t tests_ia_ops_two[] = { { &test_mulhd , " mulhd", }, { &test_mulhdu , " mulhdu", }, { &test_mulld , " mulld", }, + { &test_mulldo , " mulldo", }, { &test_divd , " divd", }, { &test_divdu , " divdu", }, #endif // #ifdef __powerpc64__ @@ -674,6 +680,11 @@ static void test_mulld_ (void) __asm__ __volatile__ ("mulld. 17, 14, 15"); } +static void test_mulldo_ (void) +{ + __asm__ __volatile__ ("mulldo. 17, 14, 15"); +} + static void test_divd_ (void) { __asm__ __volatile__ ("divd. 17, 14, 15"); @@ -706,6 +717,7 @@ static test_t tests_iar_ops_two[] = { { &test_mulhd_ , " mulhd.", }, { &test_mulhdu_ , " mulhdu.", }, { &test_mulld_ , " mulld.", }, + { &test_mulldo_ , " mulldo.", }, { &test_divd_ , " divd.", }, { &test_divdu_ , " divdu.", }, #endif // #ifdef __powerpc64__ diff --git a/none/tests/ppc64/jm-int.stdout.exp b/none/tests/ppc64/jm-int.stdout.exp index 4dba79bb5a..fc3ed10e63 100644 --- a/none/tests/ppc64/jm-int.stdout.exp +++ b/none/tests/ppc64/jm-int.stdout.exp @@ -177,6 +177,16 @@ PPC integer arith insns with two args: mulld ffffffffffffffff, 0000001cbe991def => ffffffe34166e211 (00000000 00000000) mulld ffffffffffffffff, ffffffffffffffff => 0000000000000001 (00000000 00000000) + mulldo 0000000000000000, 0000000000000000 => 0000000000000000 (00000000 00000000) + mulldo 0000000000000000, 0000001cbe991def => 0000000000000000 (00000000 00000000) + mulldo 0000000000000000, ffffffffffffffff => 0000000000000000 (00000000 00000000) + mulldo 0000001cbe991def, 0000000000000000 => 0000000000000000 (00000000 00000000) + mulldo 0000001cbe991def, 0000001cbe991def => 3f66304b8f2e0521 (00000000 c0000000) + mulldo 0000001cbe991def, ffffffffffffffff => ffffffe34166e211 (00000000 00000000) + mulldo ffffffffffffffff, 0000000000000000 => 0000000000000000 (00000000 00000000) + mulldo ffffffffffffffff, 0000001cbe991def => ffffffe34166e211 (00000000 00000000) + mulldo ffffffffffffffff, ffffffffffffffff => 0000000000000001 (00000000 00000000) + divd 0000000000000000, 0000000000000000 => 0000000000000000 (00000000 00000000) divd 0000000000000000, 0000001cbe991def => 0000000000000000 (00000000 00000000) divd 0000000000000000, ffffffffffffffff => 0000000000000000 (00000000 00000000) @@ -376,6 +386,16 @@ PPC integer arith insns with two args with flags update: mulld. ffffffffffffffff, 0000001cbe991def => ffffffe34166e211 (80000000 00000000) mulld. ffffffffffffffff, ffffffffffffffff => 0000000000000001 (40000000 00000000) + mulldo. 0000000000000000, 0000000000000000 => 0000000000000000 (20000000 00000000) + mulldo. 0000000000000000, 0000001cbe991def => 0000000000000000 (20000000 00000000) + mulldo. 0000000000000000, ffffffffffffffff => 0000000000000000 (20000000 00000000) + mulldo. 0000001cbe991def, 0000000000000000 => 0000000000000000 (20000000 00000000) + mulldo. 0000001cbe991def, 0000001cbe991def => 3f66304b8f2e0521 (50000000 c0000000) + mulldo. 0000001cbe991def, ffffffffffffffff => ffffffe34166e211 (80000000 00000000) + mulldo. ffffffffffffffff, 0000000000000000 => 0000000000000000 (20000000 00000000) + mulldo. ffffffffffffffff, 0000001cbe991def => ffffffe34166e211 (80000000 00000000) + mulldo. ffffffffffffffff, ffffffffffffffff => 0000000000000001 (40000000 00000000) + divd. 0000000000000000, 0000000000000000 => 0000000000000000 (20000000 00000000) divd. 0000000000000000, 0000001cbe991def => 0000000000000000 (20000000 00000000) divd. 0000000000000000, ffffffffffffffff => 0000000000000000 (20000000 00000000) @@ -4710,4 +4730,4 @@ PPC integer population count with one register args, no flags: popcntb 0000001cbe991def => 0000000306040407 (00000000 00000000) popcntb ffffffffffffffff => 0808080808080808 (00000000 00000000) -All done. Tested 204 different instructions +All done. Tested 206 different instructions