https://bugs.kde.org/show_bug.cgi?id=521413

--- Comment #9 from Martin Cermak <[email protected]> ---
(In reply to Mark Wielaard from comment #8)
> (In reply to mcermak from comment #7)
> > Created attachment 194647 [details]
> > proposed patch
> 
> - .gitignore new test, ack.
> - NEWS add bug, ack.
> - guest_x86_defs.h define x86g_dirtyhelper_PCMPxSTRx, ack.
> - VEX/priv/guest_x86_toIR.c. Add OFFB_XMM8. dis_PCMPxSTRx32
>   adapted from amd dis_PCMPxSTRx, takes isAvx but that is never used.
>   could be dropped to simplify code. Comment still calls the pseudo-register
>   XMM16 in one place, but should be XMM8 for x86. The special case for
>   dis_PCMPISTRI_3A is commented out and not implemented. I am not sure
>   I am following that case in the amd64 code either. Could you explain?

Based on git blame, it refers to commit d3d96f5530f35 and bug 309921.
Seems like I can reproduce that "special case" with -m32:

$ cat test.c 
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
    const char *s = strdup("hello, world");
    int result;

    asm("movdqa (%1),%%xmm0\n"
        "pcmpistri $0x3a,%%xmm0,%%xmm0\n"
        : "=c" (result) : "p" (s) : "xmm0");

    free((void *)s);

    return result;
}
$ gcc -O3 -msse4.2 -m32 -g -o test test.c
$ ./vg-in-place --partial-loads-ok=yes --track-origins=yes   ./test
==1528877== Memcheck, a memory error detector
==1528877== Copyright (C) 2002-2026, and GNU GPL'd, by Julian Seward et al.
==1528877== Using Valgrind-3.28.0.GIT and LibVEX; rerun with -h for copyright
info
==1528877== Command: ./test
==1528877== 
==1528877== Syscall param exit_group(status) contains uninitialised byte(s)
==1528877==    at 0x413268D: _Exit (_exit.c:30)
==1528877==    by 0x4093D0A: __run_exit_handlers (exit.c:141)
==1528877==    by 0x4093EB2: exit (exit.c:148)
==1528877==    by 0x407A137: (below main) (libc_start_call_main.h:83)
==1528877== 
==1528877== 
==1528877== HEAP SUMMARY:
==1528877==     in use at exit: 0 bytes in 0 blocks
==1528877==   total heap usage: 1 allocs, 1 frees, 13 bytes allocated
==1528877== 
==1528877== All heap blocks were freed -- no leaks are possible
==1528877== 
==1528877== For lists of detected and suppressed errors, rerun with: -s
==1528877== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
$

>   The rest of the function looks correct. As does the actual instruction
>   detection.
> - VEX/pub/libvex_guest_x86.h. ack. Extend state with fake XMM8 reg.
> - VEX/priv/guest_x86_helpers.c. zmask_from_V128 and zmask_from_V128_wide
>   might be put in a shared header (as static inline), but that is not really
> necessary.
>   x86g_dirtyhelper_PCMPxSTRx comment says "fake XMM16 register" but that
> should
>   be "fake XMM8 register".  Code looks correct, it uses compute_PCMPxSTRx and
>   compute_PCMPxSTRx_wide which are already shared in guest_generic_x87.
> - none/tests/x86/Makefile.am, ack. Add new testcase. 
> - none/tests/x86/pcmpxstrx32.vgtest, prereq should test against x86-sse42
>   not amd64-sse42 to work on "pure" x86 32bit systems. Also it might be build
>   on systems where configure detects it cannot 
>   So prereq should be test -e  pcmpxstrx32 &&
> ../../../tests/x86_amd64_features x86-sse42
> - none/tests/x86/pcmpxstrx32.stdout.exp, ack, regenerates from native OK.
> - none/tests/x86/pcmpxstrx32.c looks like the correct adaption of
>   none/tests/amd64/pcmpxstrx64.c (offsets and regnames changed). OK.

I've rebased my patch and pushed it to users/mcermak/try-bug521413-pcmpxstrx .

Focusing on the aforementioned special case.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to