Bug 508932 - mips: Fix IROps implementation
Summary: mips: 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:07 UTC by Florian Krohm
Modified: 2025-08-30 12:07 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:07:40 UTC
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 MullU8
    opnd 0:          01
    opnd 1:          80
    result fold:     0080
    result nofold:   ff80
    result expected: 0080

Affected IROps are
for mips32: 16Sto64, 8Sto64, 8Uto64, CmpLE32U, Max32U, MullU16, MullU8, Not64
for mips64: CmpLE32U, Max32U, MullU16, MullU8

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