__m128i is vector SSE type used in tsan.
It's handy to be able to print it for debugging.
Details
- Reviewers
vitalybuka - Commits
- rG6ca7247866f5: sanitizer_common: support printing __m128i type
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
compiler-rt/lib/sanitizer_common/sanitizer_printf.cpp | ||
---|---|---|
175–177 | Humm... I run arc lint... the lines below are changed by it, I did not change them. And arc lint does not produce any more warnings/changes.... |
compiler-rt/lib/sanitizer_common/tests/sanitizer_printf_test.cpp | ||
---|---|---|
165 | this unusual format |
compiler-rt/lib/sanitizer_common/tests/sanitizer_printf_test.cpp | ||
---|---|---|
165 | It's not this simple because __m128i is not an integer, it's some implementation-defined type, may be a struct, may have some implementation-specific attributes. We could do something along the lines of the following helpers: u64 m128part(__m128i v, bool lo) { u64 x[2]; internal_memcpy(&x, &v, sizeof(x)); return lo ? x[0] : x[1]; } #define M128FMT "%016llx%016llx" And use them as: Printf("value: " M128FMT "\n", m128part(v, true), m128part(v, false)); ... but on second though this won't work as well because printing u64 will revert bytes (high byte goes first), this is generally confusing for a vector. It may contain 2 u64s, or 4 u32s, or 8 u16s, so there is even no common way to revert it back while reading the log. Or we could add a helper function that prints a single value only: void PrintVec(const char* prefix, __m128i v); And then add DPrintVec/DPrintVec2 defines on top. Currently I do: DPrintf2(" MOP: shadow=%V access=%V\n", shadow, access); Your call. |
Humm... I run arc lint... the lines below are changed by it, I did not change them. And arc lint does not produce any more warnings/changes....