Bug 508933 - ppc: Fix IROps implementation
Summary: ppc: Fix IROps implementation
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: vex (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-08-30 12:23 UTC by Florian Krohm
Modified: 2025-08-30 12:23 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Krohm 2025-08-30 12:23:05 UTC
ppc: Fix IROps implementation

Running iropt-test identifies a few IROps for which the implementation
is not quite right. In other words: the expected result as computed by
the insn sequence implementing the IROp differs from the result as
obtained via constant folding. For example:

*** Incorrect result for operator MullU32
    opnd 0:          00000001
    opnd 1:          80000000
    result fold:     0000000080000000
    result nofold:   ffffffff80000000
    result expected: 0000000080000000

Affected IROps are
for ppc32: DivU32E, DivS32E
for ppc64be: DivS32, DivS32E, DivU32E, MullU32
for ppc64le: DivS32, DivS32E, DivU32E, MullU32

Steps to reproduce:
1) Apply this patch:

diff --git a/none/tests/iropt-test/main.c b/none/tests/iropt-test/main.c
index 64ad44d87..98f144bae 100644
--- a/none/tests/iropt-test/main.c
+++ b/none/tests/iropt-test/main.c
@@ -47,7 +47,7 @@ main(int argc, char *argv[])
 {
 // FIXME: temporarily until ppc and mips have been fixed
 #if !defined(__s390x__) && !defined(__i386__) && !defined(__x86_64__)
-   return 0;
+//   return 0;
 #endif
    assert(sizeof(long long) == 8);
    srand48(42L);

2) Reduild
3) Run:
   perl tests/vg_regtest none/tests/iropt-test/iropt-test