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
This commit is contained in:
Carl Love 2013-09-06 22:29:55 +00:00
parent 141c99dd09
commit 44901807b3
2 changed files with 33 additions and 1 deletions

View File

@ -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__

View File

@ -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