From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 80414 invoked by alias); 9 Nov 2015 21:10:56 -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 80399 invoked by uid 89); 9 Nov 2015 21:10:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Nov 2015 21:10:54 +0000 Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Websense Email Security Gateway with ESMTPS id 90C08C48F46F5; Mon, 9 Nov 2015 21:10:47 +0000 (GMT) Received: from BAMAIL02.ba.imgtec.org (10.20.40.28) by hhmail02.hh.imgtec.org (10.100.10.20) with Microsoft SMTP Server (TLS) id 14.3.235.1; Mon, 9 Nov 2015 21:10:51 +0000 Received: from [10.20.3.214] (10.20.3.214) by bamail02.ba.imgtec.org (10.20.40.28) with Microsoft SMTP Server (TLS) id 14.3.174.1; Mon, 9 Nov 2015 13:10:49 -0800 Message-ID: <1447103449.3867.51.camel@ubuntu-sellcey> Subject: Re: [Patch] Change to argument promotion in fixed conversion library calls From: Steve Ellcey Reply-To: To: Bernd Schmidt CC: Date: Mon, 09 Nov 2015 21:10:00 -0000 In-Reply-To: <56410672.6050807@redhat.com> References: <15881f44-1bed-4fda-a47c-45234f9c091e@BAMAIL02.ba.imgtec.org> <563CFC33.8050004@redhat.com> <1446838073.3867.19.camel@ubuntu-sellcey> <563CFF8A.9050900@redhat.com> <1447088342.3867.27.camel@ubuntu-sellcey> <56410672.6050807@redhat.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-SW-Source: 2015-11/txt/msg01104.txt.bz2 On Mon, 2015-11-09 at 21:47 +0100, Bernd Schmidt wrote: > On 11/09/2015 05:59 PM, Steve Ellcey wrote: > > Here is a version with the code moved into a new function. How does > > this look? > > > > 2015-11-09 Steve Ellcey > > > > * optabs.c (prepare_libcall_arg): New function. > > (expand_fixed_convert): Add call to prepare_libcall_arg. > > Hold on a moment - I see that emit_library_call_value_1 calls > promote_function_mode for arguments. Can you investigate why that > doesn't do what you need? > > > Bernd emit_library_call_value_1 has no way of knowing if the promotion should be signed or unsigned because it has a mode (probably QImode or HImode) that it knows may need to be promoted to SImode but it has no way to know if that should be a signed or unsigned promotion because it has no tree type information about the library call argument types. Right now it guesses based on the return type but it may guess wrong when converting an unsigned int to a signed fixed type or visa versa. By doing the promotion in expand_fixed_convert GCC can use the uintp argument to ensure that the signedness of the promotion is done correctly. We could pass that argument into emit_library_call_value_1 so it can do the correct promotion but that would require changing the argument list for emit_library_call and emit_library_call_value_1 and changing all the other call locations for those functions and that seemed like overkill. Steve Ellcey