Bug 508932

Summary: mips: Fix IROps implementation
Product: [Developer tools] valgrind Reporter: Florian Krohm <flo2030>
Component: vexAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

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