[Bug c++/106322] i386: Wrong code at O2 level (O0 / O1 are working)

2022-07-16 Thread malat at debian dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106322

--- Comment #7 from Mathieu Malaterre  ---
I can make it fails with sanitize=address:

/usr/bin/g++-12 -DHWY_STATIC_DEFINE
-I"/home/malat/highway-0.17.1~git20220711.f0a396a" -O2 -fsanitize=address -fPIE
-fvisibility=hidden -fvisibility-inlines-hidden -Wno-builtin-macro-redefined
-D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\"
-fmerge-all-constants -Wall -Wextra -Wconversion -Wsign-conversion -Wvla
-Wnon-virtual-dtor -fmath-errno -fno-exceptions -DHWY_IS_TEST=1
-DGTEST_HAS_PTHREAD=1 -MD -MT CMakeFiles/mul_test.dir/hwy/tests/mul_test.cc.o
-MF CMakeFiles/mul_test.dir/hwy/tests/mul_test.cc.o.d -o
CMakeFiles/mul_test.dir/hwy/tests/mul_test.cc.o -c
"/home/malat/highway-0.17.1~git20220711.f0a396a/hwy/tests/mul_test.cc"
[...]
Running main() from ./googletest/src/gtest_main.cc
Note: Google Test filter = HwyMulTestGroup/HwyMulTest.TestAllMulHigh/Emu128
[==] Running 1 test from 1 test suite.
[--] Global test environment set-up.
[--] 1 test from HwyMulTestGroup/HwyMulTest
[ RUN  ] HwyMulTestGroup/HwyMulTest.TestAllMulHigh/Emu128


i16x2 expect [0+ ->]:
  0x3FFF,0x0FFF,
i16x2 actual [0+ ->]:
  0xBFFF,0x0FFF,
Abort at
/home/malat/highway-0.17.1~git20220711.f0a396a/hwy/tests/mul_test.cc:131:
Emu128, i16x2 lane 0 mismatch: expected '0x3FFF', got '0xBFFF'.

[Bug c++/106322] i386: Wrong code at O2 level (O0 / O1 are working)

2022-07-16 Thread malat at debian dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106322

--- Comment #6 from Mathieu Malaterre  ---
Using `-fno-strict-aliasing` causes the same symptoms:

/usr/bin/g++-12 -DHWY_STATIC_DEFINE
-I"/home/malat/highway-0.17.1~git20220711.f0a396a" -O2 -fno-strict-aliasing
-fPIE -fvisibility=hidden -fvisibility-inlines-hidden
-Wno-builtin-macro-redefined -D__DATE__=\"redacted\"
-D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -fmerge-all-constants
-Wall -Wextra -Wconversion -Wsign-conversion -Wvla -Wnon-virtual-dtor
-fmath-errno -fno-exceptions -DHWY_IS_TEST=1 -DGTEST_HAS_PTHREAD=1 -MD -MT
CMakeFiles/mul_test.dir/hwy/tests/mul_test.cc.o -MF
CMakeFiles/mul_test.dir/hwy/tests/mul_test.cc.o.d -o
CMakeFiles/mul_test.dir/hwy/tests/mul_test.cc.o -c
"/home/malat/highway-0.17.1~git20220711.f0a396a/hwy/tests/mul_test.cc"
[...]
Running main() from ./googletest/src/gtest_main.cc
Note: Google Test filter = HwyMulTestGroup/HwyMulTest.TestAllMulHigh/Emu128
[==] Running 1 test from 1 test suite.
[--] Global test environment set-up.
[--] 1 test from HwyMulTestGroup/HwyMulTest
[ RUN  ] HwyMulTestGroup/HwyMulTest.TestAllMulHigh/Emu128


i16x8 expect [0+ ->]:
  0x3FFF,0x0FFF,0x03FF,0x00FF,0x003F,0x000F,0x0003,
i16x8 actual [0+ ->]:
  0xBFFF,0x0FFF,0xE400,0x00FF,0xF840,0x000F,0xFE04,
Abort at
/home/malat/highway-0.17.1~git20220711.f0a396a/hwy/tests/mul_test.cc:131:
Emu128, i16x8 lane 0 mismatch: expected '0x3FFF', got '0xBFFF'.

[Bug c++/106322] i386: Wrong code at O2 level (O0 / O1 are working)

2022-07-16 Thread malat at debian dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106322

--- Comment #5 from Mathieu Malaterre  ---
Compilation line for -save-temps is:

% /usr/bin/g++-12 -DHWY_STATIC_DEFINE
-I"/home/malat/highway-0.17.1~git20220711.f0a396a" -O2 -fPIE
-fvisibility=hidden -fvisibility-inlines-hidden -Wno-builtin-macro-redefined
-D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\"
-fmerge-all-constants -Wall -Wextra -Wconversion -Wsign-conversion -Wvla
-Wnon-virtual-dtor -fmath-errno -fno-exceptions -DHWY_IS_TEST=1
-DGTEST_HAS_PTHREAD=1 -MD -MT CMakeFiles/mul_test.dir/hwy/tests/mul_test.cc.o
-MF CMakeFiles/mul_test.dir/hwy/tests/mul_test.cc.o.d -o
CMakeFiles/mul_test.dir/hwy/tests/mul_test.cc.o -c
"/home/malat/highway-0.17.1~git20220711.f0a396a/hwy/tests/mul_test.cc"
-save-temps

[Bug c++/106322] i386: Wrong code at O2 level (O0 / O1 are working)

2022-07-16 Thread malat at debian dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106322

--- Comment #4 from Mathieu Malaterre  ---
gcc-11 version on my side is:

 % gcc-11 --version
gcc-11 (Debian 11.3.0-4) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


gcc-12 version is:

% gcc-12 --version
gcc-12 (Debian 12.1.0-5) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Everything was executed from public porterbox barriere.debian.org (Debian sid
chroot).

[Bug c++/106322] i386: Wrong code at O2 level (O0 / O1 are working)

2022-07-16 Thread malat at debian dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106322

--- Comment #3 from Mathieu Malaterre  ---
Created attachment 53306
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53306&action=edit
gcc-12 -O2 -save-temps

[Bug c++/106322] i386: Wrong code at O2 level (O0 / O1 are working)

2022-07-16 Thread malat at debian dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106322

Mathieu Malaterre  changed:

   What|Removed |Added

 CC||malat at debian dot org

--- Comment #2 from Mathieu Malaterre  ---
Created attachment 53305
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53305&action=edit
gcc-11 -O2 -save-temps

[Bug c++/106322] i386: Wrong code at O2 level (O0 / O1 are working)

2022-07-16 Thread malat at debian dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106322

--- Comment #1 from Mathieu Malaterre  ---
I can reduce the gtest code to simply:

```
HWY_NOINLINE void TestAllMulHigh() {
  ForPartialVectors test;
  test(int16_t());
//  test(uint16_t());
}
```