From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DBB943858430; Wed, 15 May 2024 21:38:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DBB943858430 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715809117; bh=TjuNJowucdgbpY57FrFnG9VluwaJ+WcnNFlmTEce9MM=; h=From:To:Subject:Date:From; b=UoTkgvUh/MHFfI0v0InNuksxdTSpAsUk5gLkK/qyu0OnLy4PPN9A44GkMWol0OUkv we1c+PqjajON9x+4Uv0XH7rdJ/z/igu32bX/ylzDy2t4LHx1F7xpGeJvfVwamyCmmz lSd7SHeenLON+/abvLdWbXF4a/uhzwnc+aWyR0ME= From: "slyfox at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/115115] New: [12/13/14/15 Regression] highway-1.0.7 wrong _mm_cvttps_epi32() constant fold Date: Wed, 15 May 2024 21:38:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: slyfox at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115115 Bug ID: 115115 Summary: [12/13/14/15 Regression] highway-1.0.7 wrong _mm_cvttps_epi32() constant fold Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at gcc dot gnu.org Target Milestone: --- Initially I observed the testsuite failure on highway-1.0.7 library as on r15-523-g1a05332bbac98a. I reduced it down to the following: ```c // $ cat bug.c #include #include #include #include __attribute__((noipa)) static void dump_m128i(const char * prefix, const __m128i * v) { uint32_t p[4]; memcpy(p, v, 16); fprintf(stderr, "%s:", prefix); for (size_t i =3D 0; i < 4; ++i) { fprintf(stderr, " %#08x", p[i]); } fprintf(stderr, "\n"); } __attribute__((noipa)) static void assert_m128i(const __m128i * v) { uint32_t p[4]; memcpy(p, v, 16); uint32_t q[4] =3D { 0x80000000, 0x80000000, 0x80000000, 0x80000000, }; if (memcmp(p, q, 16) !=3D 0) __builtin_abort(); } __attribute__((noipa)) static void TestAllF2IPromoteTo() { const __m128i iv =3D _mm_set_epi32(0x4f000000, 0x4f000000, 0x4f000000, 0x4f000000); const __m128 fv =3D _mm_castsi128_ps(iv); const __m128i riv =3D _mm_cvttps_epi32(fv); dump_m128i("riv", &riv); assert_m128i(&riv); } int main() { TestAllF2IPromoteTo(); } ``` Triggering: $ gcc-15 bug.c -o a -O0 && ./a riv: 0x80000000 0x80000000 0x80000000 0x80000000 # ok? $ gcc-15 bug.c -o a -O1 && ./a riv: 0x7fffffff 0x7fffffff 0x7fffffff 0x7fffffff Aborted (core dumped) # bad? I think highway expect the former. At least gcc-8/9/10/11 pass the test. gcc-12/13/14/15 all fail it. $ gcc -v Using built-in specs. COLLECT_GCC=3D/<>/gcc-15.0.0/bin/gcc COLLECT_LTO_WRAPPER=3D/<>/gcc-15.0.0/libexec/gcc/x86_64-unknown-linux-= gnu/15.0.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../source/configure --prefix=3D/<>/gcc-15.0.0 --with-gmp-include=3D/<>/gmp-6.3.0-dev/include --with-gmp-lib=3D/<>/gmp-6.3.0/lib --with-mpfr-include=3D/<>/mpfr-4.2.1-dev/include --with-mpfr-lib=3D/<>/mpfr-4.2.1/lib --with-mpc=3D/<>/libmpc-1.3.1 --with-native-system-header-dir=3D/<>/glibc-2.39-52-dev/include --with-build-sysroot=3D/ --with-gxx-include-dir=3D/<>/gcc-15.0.0/include/c++/15.0.0/ --program-prefix=3D --enable-lto --disable-libstdcxx-pch --without-included-gettext --with-system-zlib --enable-checking=3Drelease --enable-static --enable-languages=3Dc,c++ --disable-multilib --enable-plug= in --disable-libcc1 --with-isl=3D/<>/isl-0.20 --disable-bootstrap --build=3Dx86_64-unknown-linux-gnu --host=3Dx86_64-unknown-linux-gnu --target=3Dx86_64-unknown-linux-gnu Thread model: posix Supported LTO compression algorithms: zlib gcc version 15.0.0 99999999 (experimental) (GCC)=