From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 110710 invoked by alias); 5 Apr 2017 08:00:34 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 107190 invoked by uid 89); 5 Apr 2017 08:00:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Apr 2017 08:00:26 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8B6B57E9E8; Wed, 5 Apr 2017 08:00:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8B6B57E9E8 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jakub@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8B6B57E9E8 Received: from tucnak.zalov.cz (ovpn-116-72.ams2.redhat.com [10.36.116.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 26D4B87650; Wed, 5 Apr 2017 08:00:11 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id v35809AH029303; Wed, 5 Apr 2017 10:00:09 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id v35807wx029302; Wed, 5 Apr 2017 10:00:07 +0200 Date: Wed, 05 Apr 2017 08:00:00 -0000 From: Jakub Jelinek To: Uros Bizjak Cc: "gcc-patches@gcc.gnu.org" Subject: Re: [PATCH] Don't error about x86 return value in SSE reg (or x86 reg) or argument in SSE reg too early (PR target/80298) Message-ID: <20170405080007.GN17461@tucnak> Reply-To: Jakub Jelinek References: <20170404192447.GL17461@tucnak> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg00198.txt.bz2 On Wed, Apr 05, 2017 at 09:42:31AM +0200, Uros Bizjak wrote: > On Tue, Apr 4, 2017 at 9:24 PM, Jakub Jelinek wrote: > > Hi! > > > > aggregate_value_p is called often very early during compilation, e.g. > > from allocate_function or during gimplification of a call with lhs. > > The problem with that is e.g. that on x86_64 -m64 -mno-sse we can't > > include , because the always_inline inline functions > > in mmx and 3dnow intrinsic headers return __m64 or take __m64 as arguments > > and that in the 64-bit ABI is in SSE register. > > > > The following patch makes sure we diagnose this only later (e.g. when > > expanding a function to RTL or when expanding calls to other functions), > > which means we don't diagnose e.g. inline functions that got successfully > > inlined (because then there is really no function return in SSE or x87 > > reg) or e.g. for builtin calls if they are emitted inline rather than > > as a library call (again, I think that is desirable). > > I had to tweak a few tests because the reported line changed slightly, > > and in the last test add -fno-builtin-fminl, because otherwise fminl > > is expanded inline and again there is no call left with the problem. > > > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > No, I think the issue should be fixed in intrinsics. But then you can't use the mmx intrinsics in pure mmx non-sse code, even when my patch allows that. Say: #include __attribute__((target ("nosse,mmx"))) void mmx_only (__m64 *a, __m64 *b, __m64 *c) { *a = _mm_packs_pu16 (*b, *c); } or without the attribute, but in -mno-sse -mmmx compilation. This compiles just fine for -m32 and there is no reason why it couldn't work similarly for -m64, when the intrinsic will be inlined there is no return nor argument needed in SSE registers. So in effect it makes MMX unusable for 64-bit code without SSE. Or do we just declare that unsupported? Of course, people shouldn't be using MMX, especially not in 64-bit code. Note, my patch apparently doesn't handle the above, there is still the aggregate_value_p call in NRV. So maybe we should also not error if: (cfun && current_ir_type () == IR_GIMPLE && !currently_expanding_to_rtl) or so. Jakub