From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 106498 invoked by alias); 18 Mar 2016 12:25: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 106483 invoked by uid 89); 18 Mar 2016 12:25:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=BAYES_00,KAM_ASCII_DIVIDERS,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no version=3.3.2 spammy=xb, UD:value, 498212, 4982,12 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 18 Mar 2016 12:25:32 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 409C4804EC for ; Fri, 18 Mar 2016 12:25:31 +0000 (UTC) Received: from localhost.localdomain (vpn1-6-65.ams2.redhat.com [10.36.6.65]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2ICPTau006482; Fri, 18 Mar 2016 08:25:30 -0400 References: <56EBF12B.40701@t-online.de> To: GCC Patches , Vladimir Makarov From: Bernd Schmidt Subject: Fix 70278 (LRA split_regs followup patch) X-Forwarded-Message-Id: <56EBF12B.40701@t-online.de> Message-ID: <56EBF3B9.5050005@redhat.com> Date: Fri, 18 Mar 2016 12:38:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <56EBF12B.40701@t-online.de> Content-Type: multipart/mixed; boundary="------------000102060403050104070005" X-IsSubscribed: yes X-SW-Source: 2016-03/txt/msg01089.txt.bz2 This is a multi-part message in MIME format. --------------000102060403050104070005 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 507 This fixes an oversight in my previous patch here. I used biggest_mode in the assumption that if the reg was used in the function, it would be set to something other than VOIDmode, but that fails if we have a multiword access - only the first hard reg gets its biggest_mode assigned in that case. Bootstrapped and tested on x86_64-linux, ran (just) the new arm testcase manually with arm-eabi. Ok? (The testcase seems to be from glibc. Do we keep the copyright notices on the reduced form)? Bernd --------------000102060403050104070005 Content-Type: text/x-patch; name="70278.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="70278.diff" Content-length: 3936 PR rtl-optimization/70278 * lra-constraints.c (split_reg): Handle the case where biggest_mode is VOIDmode. testsuite/ * gcc.dg/torture/pr70278.c: New test. * gcc.target/arm/pr70278.c: New test. Index: gcc/lra-constraints.c =================================================================== --- gcc/lra-constraints.c (revision 234184) +++ gcc/lra-constraints.c (working copy) @@ -4982,7 +4982,12 @@ split_reg (bool before_p, int original_r nregs = 1; mode = lra_reg_info[hard_regno].biggest_mode; machine_mode reg_rtx_mode = GET_MODE (regno_reg_rtx[hard_regno]); - if (GET_MODE_SIZE (mode) > GET_MODE_SIZE (reg_rtx_mode)) + /* A reg can have a biggest_mode of VOIDmode if it was only ever seen + as part of a multi-word register. In that case, or if the biggest + mode was larger than a register, just use the reg_rtx. Otherwise, + limit the size to that of the biggest access in the function. */ + if (mode == VOIDmode + || GET_MODE_SIZE (mode) > GET_MODE_SIZE (reg_rtx_mode)) { original_reg = regno_reg_rtx[hard_regno]; mode = reg_rtx_mode; Index: gcc/testsuite/gcc.dg/torture/pr70278.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr70278.c (revision 0) +++ gcc/testsuite/gcc.dg/torture/pr70278.c (working copy) @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ +typedef union +{ + double value; + struct + { + unsigned int msw; + } parts; +} ieee_double_shape_type; +double __ieee754_hypot(double x, double y) +{ + double a=x,b=y,t1,t2,y1,y2,w; + int j,k,ha,hb; + do { ieee_double_shape_type gh_u; gh_u.value = (x); (ha) = gh_u.parts.msw; } while (0);; + if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;} + if(ha > 0x5f300000) { + do { ieee_double_shape_type sh_u; sh_u.value = (a); sh_u.parts.msw = (ha); (a) = sh_u.value; } while (0);; + } + w = a-b; + if (w <= b) + { + t2 = a - t1; + w = t1*y1-(w*(-w)-(t1*y2+t2*b)); + } + if(k!=0) { + } else return w; +} Index: gcc/testsuite/gcc.target/arm/pr70278.c =================================================================== --- gcc/testsuite/gcc.target/arm/pr70278.c (revision 0) +++ gcc/testsuite/gcc.target/arm/pr70278.c (working copy) @@ -0,0 +1,41 @@ +/* { dg-do compile } */ +/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-march=*" } { "-march=armv4t" } } */ +/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" } { "" } } */ +/* { dg-options "-mthumb" } */ +/* { dg-add-options arm_arch_v4t } */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ +typedef union +{ + double value; + struct + { + unsigned int msw; + } parts; +} ieee_double_shape_type; +double __ieee754_hypot(double x, double y) +{ + double a=x,b=y,t1,t2,y1,y2,w; + int j,k,ha,hb; + do { ieee_double_shape_type gh_u; gh_u.value = (x); (ha) = gh_u.parts.msw; } while (0);; + if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;} + if(ha > 0x5f300000) { + do { ieee_double_shape_type sh_u; sh_u.value = (a); sh_u.parts.msw = (ha); (a) = sh_u.value; } while (0);; + } + w = a-b; + if (w <= b) + { + t2 = a - t1; + w = t1*y1-(w*(-w)-(t1*y2+t2*b)); + } + if(k!=0) { + } else return w; +} --------------000102060403050104070005--