| Summary: | memcheck doesn't mark %xmm as initialized after "pcmpeqw %xmm %xmm" | ||
|---|---|---|---|
| Product: | [Developer tools] valgrind | Reporter: | Alexey Samsonov <samsonov> |
| Component: | memcheck | Assignee: | Julian Seward <jseward> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | glider, nh2, samsonov |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Compiled Sources | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: | Valgrind VEX - a couple of IR optimizations | ||
Created attachment 67783 [details]
Valgrind VEX - a couple of IR optimizations
Attached patch seems to fix memcheck false positives for pcmpeqw and pcmpeqd instructions. Committed, vex r2423. Thanks. |
Version: unspecified OS: Linux When an uninitialized value is stored in SSE register %xmm, instruction "pcmpeqw %xmm, %xmm" should mark it as initialized, but it doesn't. Same problem for "pcmpeqd", but "pcmpeqb" or "pxor" works. Reproducible: Always Steps to Reproduce: $ cat test.cc #include <stdio.h> #include "include/valgrind/memcheck.h" int main() { unsigned char data[32], vbits[32]; asm("movdqu (%0), %%xmm0\n" "pcmpeqw %%xmm0, %%xmm0\n" "movdqu %%xmm0, 16(%0)\n" ::"r"(data):"memory"); VALGRIND_GET_VBITS(data, vbits, 32); for(int i=0; i<2; i++) { for(int j=0; j<16; j++) printf("%02x ", vbits[i*16+j]); printf("\n"); } return 0; } $ (g++ test.cc && ./bin/valgrind ./a.out) Actual Results: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff Expected Results: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00