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

--- Comment #8 from [email protected] ---
Comparing the above disassemblies of g_calc_mpsadbw() shows how the
slp-vectorizer optimization causes heavy use of xmm registers while when this
optimization is disabled, scalar operations are being done instead.

I've rebuilt Valgrind with full clang -O2 and caught the SEGV in GDB.  Started
with handle SIGILL SIGSEGV nostop noprint as README_DEVELOPERS suggests, and
set breakpoint to g_calc_mpsadbw()  (sad_8x4() is an inline inside it).  Then
after hitting the breakpoint:

(gdb) handle SIGSEGV stop nopass
Signal        Stop      Print   Pass to program Description
SIGSEGV       Yes       Yes     No              Segmentation fault
(gdb) continue 
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x58185c5f in abdU8 (xx=158 '\236', yy=<optimized out>) at
priv/guest_generic_helpers.h:40
40         return toUChar(xx>yy ? xx-yy : yy-xx);
(gdb) l
35      #define __VEX_GUEST_GENERIC_HELPERS_H
36      
37      #include "libvex_basictypes.h"
38      
39      static inline UChar abdU8 ( UChar xx, UChar yy ) {
40         return toUChar(xx>yy ? xx-yy : yy-xx);
41      }
42      
43      static inline UChar sel8x8_7 ( ULong w64 ) {
44         UInt hi32 = toUInt(w64 >> 32);
(gdb) x/i $eip
=> 0x58185c5f <g_calc_mpsadbw+383>:     movdqa %xmm1,0x60(%esp)
(gdb) p $esp
$6 = (void *) 0x82ca7e08
(gdb) p 0x82ca7e08 % 16
$7 = 8
(gdb) 

So the problem appears to be that movdqa expects aligned double quadword. That
is 128-bit (16-byte) value whose address is a multiple of 16 bytes.  Which in
this case isn't true ^^ and that seems to cause the segfault.

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

Reply via email to