From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13165 invoked by alias); 18 Oct 2004 16:30:28 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 13151 invoked from network); 18 Oct 2004 16:30:27 -0000 Received: from unknown (HELO atrey.karlin.mff.cuni.cz) (195.113.31.123) by sourceware.org with SMTP; 18 Oct 2004 16:30:27 -0000 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 4018) id BEE754B435A; Mon, 18 Oct 2004 18:30:26 +0200 (CEST) Date: Mon, 18 Oct 2004 16:49:00 -0000 From: Jan Hubicka To: Uros Bizjak Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] avoid xmm register in SSE float->int conversions Message-ID: <20041018163026.GA5128@atrey.karlin.mff.cuni.cz> References: <4173CE1D.8020408@kss-loka.si> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4173CE1D.8020408@kss-loka.si> User-Agent: Mutt/1.5.6i X-SW-Source: 2004-10/txt/msg01497.txt.bz2 > Hello! > > For the DF->SI testcases like this: > > int test1(double a) { > return sin(a); > } > > current mainline gcc produces following code for -march=pentium4: > ... > fsin > fstpl (%esp) > movsd (%esp), %xmm0 > cvttsd2si %xmm0, %eax > ... > ret > > At least for pentium4 (and perhaps other !TARGET_K8 targets), xmm > register could be avoided, as cvttsd2si can convert directly from memory > to integer register. Attached patch introduces a couple of peephole2 > optimizers to get rid of extra movsd. > Unfortunatelly, combine pass can't be used in this case, because all > necessary moves are generated in greg pass _after_ combine. To make the peepholes safe, you need to verify that xmm0 is dead after it is stored to memoery again. However it is definitly better to teach reload to not do this sillyness, but it might be quite dificult... Honza