This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/85525] Alignment Issue in AVX compiler intrinsics
- From: "tom at ritter dot vg" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 25 Apr 2018 21:52:02 +0000
- Subject: [Bug target/85525] Alignment Issue in AVX compiler intrinsics
- Auto-submitted: auto-generated
- References: <bug-85525-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85525
--- Comment #7 from Tom Ritter <tom at ritter dot vg> ---
I'm compiling some AVX code with MinGW+gcc. I'm afraid it's difficult to
create a test case, but I think there's an alignment issue here.
Registers at crash site:
rbp is 0x00 % 20
> 0:000> r
> rax=0000000015ce306b rbx=0000000000656930 rcx=000000001f1ba500
> rdx=0000000000000000 rsi=0000000000000000 rdi=0000000000656440
> rip=00000000072656fa rsp=0000000000656bc0 rbp=0000000000657060
> r8=000000001fc0f0a0 r9=0000000000000018 r10=000000001fc0f0a0
> r11=000000001f75bcff r12=0000000000657c90 r13=000000000000000f
> r14=0000000000000000 r15=0000000000000000
> iopl=0 nv up ei pl nz na po nc
> cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010204
> xul!XRE_GetBootstrap+0x256380a:
> 00000000`072656fa c5fd7f45f0 vmovdqa ymmword ptr [rbp-10h],ymm0 ss:00000000`00657050=17
Disassembly:
vmovdqa expects 0x20 alignment
but offset by 0x10:
00000000`072356fa c5fd7f45f0 vmovdqa ymmword ptr [rbp-10h],ymm0
I've attached the disassembly.
The c++ code is attached and also at:
https://searchfox.org/mozilla-central/rev/36dec78aecc40539ecc8d78e91612e38810f963c/gfx/skia/skia/src/opts/SkOpts_hsw.cpp
There is a function; convolve_16_pixels that corresponds to
xul!XRE_GetBootstrap+0x6676510 in the attached disassembly
It was pointed out that
00000000`07235595 48c1e805 shr rax,5
00000000`07235599 48c1e005 shl rax,5
00000000`0723559d 4889c3 mov rbx,rax
aligns rbx at the entry to the function, so it can safely do things like
vmovdqa ymmword ptr [rbx+3E0h],ymm0
However rbp does not get the same alignment treatment, and operations offset
from it may not be correctly aligned.