From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128922 invoked by alias); 15 Jan 2019 11:18:44 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 128909 invoked by uid 89); 15 Jan 2019 11:18:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=kumar, H*i:sk:CABKRkg, H*f:sk:CABKRkg, H*c:alternative X-HELO: mail-it1-f171.google.com Received: from mail-it1-f171.google.com (HELO mail-it1-f171.google.com) (209.85.166.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Jan 2019 11:18:41 +0000 Received: by mail-it1-f171.google.com with SMTP id i145so4395608ita.4 for ; Tue, 15 Jan 2019 03:18:41 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: kamlesh kumar Date: Tue, 15 Jan 2019 11:18:00 -0000 Message-ID: Subject: Re: RS6000 emitting sign extention for unsigned type To: gcc@gcc.gnu.org, Umesh Kalappa , jakub@redhat.com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-01/txt/msg00113.txt.bz2 Hi all, Analysed it further and find out that function ' rs6000_promote_function_mode ' (rs6000.c) needs modifcation. """ static machine_mode rs6000_promote_function_mode (const_tree type ATTRIBUTE_UNUSED, machine_mode mode, int *punsignedp ATTRIBUTE_UNUSED, const_tree, int) { PROMOTE_MODE (mode, *punsignedp, type); return mode; } """ Here, This function is promoting the mode but it is not even touching 'punsignedp' and it is always initialized to zero by default. So in all cases 'punsignedp' remain zero even if it is for unsigned type. which cause the sign extension to happen even for unsigned type. is there any way to set 'punsignedp' appropriately here. Thanks On Tue, Jan 15, 2019 at 12:11 AM kamlesh kumar wrote: > Hi devs, > consider below testcase: > $cat test.c > void foo(){ > unsigned int x=-1; > double d=x; > } > $./cc1 test.c -msoft-float -m64 > $cat test.s > > .foo: > .LFB0: > mflr 0 > std 0,16(1) > stdu 1,-128(1) > .LCFI0: > li 9,-1 > stw 9,112(1) > lwa 9,112(1) > mr 3,9 > bl .__floatunsidf > nop > mr 9,3 > std 9,120(1) > nop > addi 1,1,128 > .LCFI1: > ld 0,16(1) > mtlr 0 > blr > .long 0 > .byte 0,0,0,1,128,0,0,1 > > Here, you can see sign extension before calling the __floatunsidf routine. > As per my understanding it should emit zero extension here because > __floatunsidf has it argument as unsigned type. > > Like to know , Reason behind doing sign extension here , rather than > zero extension. > or if this is a bug? > is there Any work around or hook? > Even you can point me to the right direction in the source? where we need > to do modification? > > Thanks > ~Kamlesh > > > Thanks ! > Kamlesh >