Bug 476978 - [SSE4.1] missing support for PMAXUD (x86)
Summary: [SSE4.1] missing support for PMAXUD (x86)
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: vex (show other bugs)
Version: 3.20.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-14 08:41 UTC by Dirk Mueller
Modified: 2023-11-14 10:12 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Mueller 2023-11-14 08:41:25 UTC
SUMMARY

[   94s] vex x86->IR: unhandled instruction bytes: 0x66 0xF 0x38 0x3F
[   94s] ==12135== valgrind: Unrecognised instruction at address 0x1f548b.
[   94s] ==12135==    at 0x1F548B: Perl_safesysmalloc (in /usr/bin/perl)
[   94s] ==12135==    by 0x229AD2: Perl_more_bodies (in /usr/bin/perl)
[   94s] ==12135==    by 0x22D9A6: ??? (in /usr/bin/perl)
[   94s] ==12135==    by 0x14F57A: perl_construct (in /usr/bin/perl)
[   94s] ==12135==    by 0x12C520: main (in /usr/bin/perl)
[   94s] ==12135== Your program just tried to execute an instruction that Valgrind
[   94s] ==12135== did not recognise.  There are two possible reasons for this.
[   94s] ==12135== 1. Your program has a bug and erroneously jumped to a non-code
[   94s] ==12135==    location.  If you are running Memcheck and you just saw a
[   94s] ==12135==    warning about a bad jump, it's probably your program's fault.
[   94s] ==12135== 2. The instruction is legitimate but Valgrind doesn't handle it,
[   94s] ==12135==    i.e. it's Valgrind's fault.  If you think this is the case or
[   94s] ==12135==    you are not sure, please let us know and we'll try to fix it.
[   94s] ==12135== Either way, Valgrind will now raise a SIGILL signal which will
[   94s] ==12135== probably kill your program.
[   94s] ==12135== 
[   94s] ==12135== Process terminating with default action of signal 4 (SIGILL): dumping core
[   94s] ==12135==  Illegal opcode at address 0x1F548B
[   94s] ==12135==    at 0x1F548B: Perl_safesysmalloc (in /usr/bin/perl)
[   94s] ==12135==    by 0x229AD2: Perl_more_bodies (in /usr/bin/perl)
[   94s] ==12135==    by 0x22D9A6: ??? (in /usr/bin/perl)
[   94s] ==12135==    by 0x14F57A: perl_construct (in /usr/bin/perl)
[   94s] ==12135==    by 0x12C520: main (in /usr/bin/perl)




SOFTWARE/OS VERSIONS
gcc 13.2 or later seems to be generating those instructions now for x86 with sse4 enabled


ADDITIONAL INFORMATION
Comment 1 Mark Wielaard 2023-11-14 10:12:14 UTC
Note that this is implemented for amd64, just not for x86 (32bit).

See VEX/priv/guest_amd64_toIR.c (dis_ESC_0F38__SSE4):

   case 0x3B:
   case 0x3F:
      /* 66 0F 38 3B /r = PMINUD xmm1, xmm2/m128
         Minimum of Packed Unsigned Doubleword Integers (XMM)
         66 0F 38 3F /r = PMAXUD xmm1, xmm2/m128
         Maximum of Packed Unsigned Doubleword Integers (XMM)
      */
      if (have66noF2noF3(pfx) && sz == 2) {
         /* FIXME: this needs an alignment check */
         Bool isMAX = opc == 0x3F;
         delta = dis_SSEint_E_to_G(
                    vbi, pfx, delta,
                    isMAX ? "pmaxud" : "pminud",
                    isMAX ? Iop_Max32Ux4 : Iop_Min32Ux4,
                    False
                 );
         goto decode_success;
      }
      break;

With tests in none/tests/amd64/sse4-64.c.