[Bug target/85525] Alignment Issue in AVX compiler intrinsics

2018-04-26 Thread tom at ritter dot vg
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85525

--- Comment #9 from Tom Ritter  ---
This may be related to:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53485
https://sourceforge.net/p/mingw-w64/bugs/304/

[Bug target/85525] Alignment Issue in AVX compiler intrinsics

2018-04-25 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85525

Jonathan Wakely  changed:

   What|Removed |Added

 Status|WAITING |UNCONFIRMED
 Ever confirmed|1   |0

--- Comment #8 from Jonathan Wakely  ---
Thanks for the details.

[Bug target/85525] Alignment Issue in AVX compiler intrinsics

2018-04-25 Thread tom at ritter dot vg
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85525

--- Comment #7 from Tom Ritter  ---
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=15ce306b rbx=00656930 rcx=1f1ba500
> rdx= rsi= rdi=00656440
> rip=072656fa rsp=00656bc0 rbp=00657060
> r8=1fc0f0a0  r9=0018 r10=1fc0f0a0
> r11=1f75bcff r12=00657c90 r13=000f
> r14= r15=
> 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:
> `072656fa c5fd7f45f0  vmovdqa ymmword ptr [rbp-10h],ymm0 
> ss:`00657050=17


Disassembly:

vmovdqa expects 0x20 alignment
but offset by 0x10:
`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

`07235595 48c1e805shr rax,5
`07235599 48c1e005shl rax,5
`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.

[Bug target/85525] Alignment Issue in AVX compiler intrinsics

2018-04-25 Thread tom at ritter dot vg
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85525

--- Comment #6 from Tom Ritter  ---
Created attachment 44020
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44020=edit
Disassembly of affected function

[Bug target/85525] Alignment Issue in AVX compiler intrinsics

2018-04-25 Thread tom at ritter dot vg
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85525

--- Comment #5 from Tom Ritter  ---
./x86_64-w64-mingw32-g++ -v
Using built-in specs.
COLLECT_GCC=./x86_64-w64-mingw32-g++
COLLECT_LTO_WRAPPER=/builds/worker/workspace/build/src/mingw32/bin/../libexec/gcc/x86_64-w64-mingw32/6.4.0/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../gcc-6.4.0/configure
--prefix=/tmp/tmp.G8UuS5o8Pw/tools/mingw32 --target=x86_64-w64-mingw32 --with-
gnu-ld --with-gnu-as --disable-multilib --enable-threads=posix
Thread model: posix
gcc version 6.4.0 (GCC) 



/builds/worker/workspace/build/src/mingw32/bin/x86_64-w64-mingw32-g++ -mwindows
-o SkOpts_hsw.o -c
-I/builds/worker/workspace/build/src/obj-firefox/dist/stl_wrappers -DDEBUG=1
-DSK_JUMPER_USE_ASSEMBLY=0 -DUNICODE -D_UNICODE -DSKIA_IMPLEMENTATION=1
-DSK_PDF_USE_SFNTLY=1 -DSK_CAN_USE_DLOPEN=0 -DSTATIC_EXPORTABLE_JS_API
-DMOZ_HAS_MOZGLUE -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL
-I/builds/worker/workspace/build/src/gfx/skia
-I/builds/worker/workspace/build/src/obj-firefox/gfx/skia
-I/builds/worker/workspace/build/src/gfx/skia/skia/include/c
-I/builds/worker/workspace/build/src/gfx/skia/skia/include/config
-I/builds/worker/workspace/build/src/gfx/skia/skia/include/core
-I/builds/worker/workspace/build/src/gfx/skia/skia/include/effects
-I/builds/worker/workspace/build/src/gfx/skia/skia/include/gpu
-I/builds/worker/workspace/build/src/gfx/skia/skia/include/pathops
-I/builds/worker/workspace/build/src/gfx/skia/skia/include/ports
-I/builds/worker/workspace/build/src/gfx/skia/skia/include/private
-I/builds/worker/workspace/build/src/gfx/skia/skia/include/utils
-I/builds/worker/workspace/build/src/gfx/skia/skia/include/utils/mac
-I/builds/worker/workspace/build/src/gfx/skia/skia/include/views
-I/builds/worker/workspace/build/src/gfx/skia/skia/src/core
-I/builds/worker/workspace/build/src/gfx/skia/skia/src/gpu
-I/builds/worker/workspace/build/src/gfx/skia/skia/src/gpu/effects
-I/builds/worker/workspace/build/src/gfx/skia/skia/src/gpu/gl
-I/builds/worker/workspace/build/src/gfx/skia/skia/src/gpu/glsl
-I/builds/worker/workspace/build/src/gfx/skia/skia/src/image
-I/builds/worker/workspace/build/src/gfx/skia/skia/src/lazy
-I/builds/worker/workspace/build/src/gfx/skia/skia/src/opts
-I/builds/worker/workspace/build/src/gfx/skia/skia/src/sfnt
-I/builds/worker/workspace/build/src/gfx/skia/skia/src/sksl
-I/builds/worker/workspace/build/src/gfx/skia/skia/src/utils
-I/builds/worker/workspace/build/src/gfx/skia/skia/src/utils/mac
-I/builds/worker/workspace/build/src/gfx/skia/skia/src/utils/win
-I/builds/worker/workspace/build/src/gfx/sfntly/cpp/src
-I/builds/worker/workspace/build/src/obj-firefox/dist/include
-I/builds/worker/workspace/build/src/obj-firefox/dist/include/nspr
-I/builds/worker/workspace/build/src/obj-firefox/dist/include/nss
-DMOZILLA_CLIENT -include
/builds/worker/workspace/build/src/obj-firefox/mozilla-config.h -Wall
-Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith
-Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings
-Wno-invalid-offsetof -Wduplicated-cond -Wno-error=maybe-uninitialized
-Wno-error=deprecated-declarations -Wno-error=array-bounds
-Wno-error=free-nonheap-object -Wno-unknown-pragmas -Wno-unused-function
-Wno-conversion-null -Wno-switch -Wno-enum-compare -fno-sized-deallocation
-fno-exceptions -fno-strict-aliasing -mms-bitfields -fno-keep-inline-dllexport
-fno-rtti -ffunction-sections -fdata-sections -Wa,-mbig-obj -fno-exceptions
-fno-math-errno -pthread -pipe -g -fno-omit-frame-pointer
-Wno-deprecated-declarations -Wno-overloaded-virtual -Wno-shadow
-Wno-sign-compare -Wno-unreachable-code -Wno-unused-function -Wno-logical-op
-Wno-maybe-uninitialized  -MD -MP -MF .deps/SkOpts_hsw.o.pp  -mavx2
/builds/worker/workspace/build/src/gfx/skia/skia/src/opts/SkOpts_hsw.cpp

(There is no compiler output.)

[Bug target/85525] Alignment Issue in AVX compiler intrinsics

2018-04-25 Thread tom at ritter dot vg
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85525

--- Comment #4 from Tom Ritter  ---
Created attachment 44018
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44018=edit
Preprocessed source file

[Bug target/85525] Alignment Issue in AVX compiler intrinsics

2018-04-25 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85525

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2018-04-25
 Ever confirmed|0   |1

--- Comment #3 from Jonathan Wakely  ---
Please read https://gcc.gnu.org/bugs/ and provide the information requested
there, and put the details in this report instead of a link to a pastebin.

[Bug target/85525] Alignment Issue in AVX compiler intrinsics

2018-04-25 Thread tom at ritter dot vg
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85525

--- Comment #2 from Tom Ritter  ---
(In reply to Andrew Pinski from comment #1)
> What exact target is this on?

Sorry, this is x64 if that's what you mean?

[Bug target/85525] Alignment Issue in AVX compiler intrinsics

2018-04-25 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85525

Andrew Pinski  changed:

   What|Removed |Added

  Component|c   |target

--- Comment #1 from Andrew Pinski  ---
What exact target is this on?