From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26247 invoked by alias); 30 Nov 2010 13:40:49 -0000 Received: (qmail 26209 invoked by uid 22791); 30 Nov 2010 13:40:46 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 30 Nov 2010 13:40:42 +0000 From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/46716] [4.3/4.4/4.5/4.6 Regression] bad code generated with -mno-sse2 -m64 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: hjl.tools at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.3.6 X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Tue, 30 Nov 2010 13:49:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-11/txt/msg03672.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46716 H.J. Lu changed: What |Removed |Added ---------------------------------------------------------------------------- CC|hjl at gcc dot gnu.org |hjl.tools at gmail dot com, | |ubizjak at gmail dot com --- Comment #4 from H.J. Lu 2010-11-30 13:40:23 UTC --- From http://gcc.gnu.org/ml/gcc/2010-11/msg00650.html I think this is a compiler bug in the i386 backend. The classify_argument function uses X86_64_SSEUP_CLASS for V2DFmode, and examine_argument counts that as requiring a single SSE register. However, since the SSE2 instructions are not available, the argument is split into two SSE registers. The result is that the first argument is passed in %xmm0/%xmm1, and the second argument is passed in %xmm1/%xmm2. That is, the arguments overlap, leading to the incorrect result. Basically, the 64-bit calling convention support assumes that the SSE2 instructions are always available, and silently fails when -mno-sse2 is used. I don't really have an opinion as to whether the compiler needs to support this case correctly, but I think that clearly it must not silently fail.