From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E90433858D34; Sat, 13 Jun 2020 01:24:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E90433858D34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592011488; bh=VgsFhx3aW7v3sgZqU2C0tSx/KATvtXN0TEcrXGOe1JE=; h=From:To:Subject:Date:From; b=A3woThgrgn4JDKjwysPriRPEWrRIGwLPg0YBw/jkvH+p2OT0GsxaOja5yb/epEYf1 w2CQWnIEelnWObGG0UEL51oGOKu3tY5+rOfSdEEvc0PEjPRQZDIfuRupXGSpKkTlvz i2x89p4c9PnztFdk6MDWuyeVoPBwg2C8GkSg8wXM= From: "memmerto at ca dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/95661] New: Code built with -m32 uses SSE2 instructions Date: Sat, 13 Jun 2020 01:24:48 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 8.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: memmerto at ca dot ibm.com 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jun 2020 01:24:49 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95661 Bug ID: 95661 Summary: Code built with -m32 uses SSE2 instructions Product: gcc Version: 8.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: memmerto at ca dot ibm.com Target Milestone: --- When building 32-bit code with -m32, SSE2 instructions are generated. This= is in contrast to the docs. https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html "The -m32 option sets int, long, and pointer types to 32 bits, and generates code that runs on any i386 system." In particular, the code to do floating-point/integer conversions appear to = use SSE2 instructions. Compiler: $ /opt/rh/devtoolset-8/root/usr/bin/gcc -v Using built-in specs. COLLECT_GCC=3D/opt/rh/devtoolset-8/root/usr/bin/gcc COLLECT_LTO_WRAPPER=3D/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redh= at-linux/8/lto-wrapper Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=3Dc,c++,fortran,lto --prefix=3D/opt/rh/devtoolset-8/root= /usr --mandir=3D/opt/rh/devtoolset-8/root/usr/share/man --infodir=3D/opt/rh/devtoolset-8/root/usr/share/info --with-bugurl=3Dhttp://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=3Dposix --enable-checking=3Drelease --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=3Dgnu --with-default-libstdcxx-abi=3Dgcc4-compatible --enable-plugin --enable-initfini-array --with-isl=3D/builddir/build/BUILD/gcc-8.3.1-20190311/obj-x86_64-redhat-lin= ux/isl-install --disable-libmpx --enable-gnu-indirect-function --with-tune=3Dgeneric --with-arch_32=3Dx86-64 --build=3Dx86_64-redhat-linux Thread model: posix gcc version 8.3.1 20190311 (Red Hat 8.3.1-3) (GCC) Compile Command: gcc -c -m32 t.c -save-temps -fverbose-asm -o t.o Testcase: #include #include int main(void) { double d =3D 100.0; int i =3D (int)d; printf("%d\n",i); } Assembly Fragment: # t.c:7: int i =3D (int)d; movsd -16(%ebp), %xmm0 # d, tmp90 cvttsd2si %xmm0, %eax # tmp90, tmp91 movl %eax, -20(%ebp) # tmp91, i I would expect 387 instructions to be generated (since -mfpmath is the defa= ult for 32-bit targets).=