From: Bernd Schmidt <bschmidt@redhat.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>,
Vladimir Makarov <vmakarov@redhat.com>
Subject: Fix 70278 (LRA split_regs followup patch)
Date: Fri, 18 Mar 2016 12:38:00 -0000 [thread overview]
Message-ID: <56EBF3B9.5050005@redhat.com> (raw)
In-Reply-To: <56EBF12B.40701@t-online.de>
[-- Attachment #1: Type: text/plain, Size: 507 bytes --]
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
[-- Attachment #2: 70278.diff --]
[-- Type: text/x-patch, Size: 3936 bytes --]
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;
+}
next parent reply other threads:[~2016-03-18 12:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <56EBF12B.40701@t-online.de>
2016-03-18 12:38 ` Bernd Schmidt [this message]
2016-03-18 16:54 ` Jeff Law
2016-03-22 9:37 ` Christophe Lyon
2016-03-22 12:39 ` Bernd Schmidt
2016-03-22 14:16 ` Christophe Lyon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56EBF3B9.5050005@redhat.com \
--to=bschmidt@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=vmakarov@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).