* [Patch ARM] Fix PR target/63408
@ 2015-06-24 8:51 Ramana Radhakrishnan
0 siblings, 0 replies; only message in thread
From: Ramana Radhakrishnan @ 2015-06-24 8:51 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 723 bytes --]
Hi,
The attached patch fixes PR target/63408 and adds a regression test
for the same. The problem is essentially that
vfp3_const_double_for_fract_bits() needs to be aware that negative
values cannot be used in this context.
Tested with a bootstrap and regression test run on armhf. Applied to trunk.
Will apply to 5 after regression testing there and 4.9 after it unfreezes.
Ramana
2015-06-24 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
PR target/63408
* config/arm/arm.c (vfp3_const_double_for_fract_bits): Disable
for negative numbers.
2015-06-24 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
PR target/63408
* gcc.target/arm/pr63408.c: New test.
[-- Attachment #2: fix-pr63408.txt --]
[-- Type: text/plain, Size: 1336 bytes --]
commit 9e6fb32c5ba143912c1114a59af0114500c5bc31
Author: Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
Date: Tue Jun 23 17:04:40 2015 +0100
Fix PR target/63408
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 4fea1a6..4a284ec 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -29812,7 +29812,8 @@ vfp3_const_double_for_fract_bits (rtx operand)
return 0;
REAL_VALUE_FROM_CONST_DOUBLE (r0, operand);
- if (exact_real_inverse (DFmode, &r0))
+ if (exact_real_inverse (DFmode, &r0)
+ && !REAL_VALUE_NEGATIVE (r0))
{
if (exact_real_truncate (DFmode, &r0))
{
diff --git a/gcc/testsuite/gcc.target/arm/pr63408.c b/gcc/testsuite/gcc.target/arm/pr63408.c
new file mode 100644
index 0000000..a23b2a4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr63408.c
@@ -0,0 +1,25 @@
+
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+void abort (void) __attribute__ ((noreturn));
+float __attribute__((noinline))
+f(float a, int b)
+{
+ return a - (((float)b / 0x7fffffff) * 100);
+}
+
+
+int
+main (void)
+{
+ float a[] = { 100.0, 0.0, 0.0};
+ int b[] = { 0x7fffffff, 0x7fffffff/100.0f, -0x7fffffff / 100.0f};
+ float c[] = { 0.0, -1.0, 1.0 };
+ int i;
+
+ for (i = 0; i < (sizeof(a) / sizeof (float)); i++)
+ if (f (a[i], b[i]) != c[i])
+ abort ();
+
+ return 0;
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-06-24 8:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24 8:51 [Patch ARM] Fix PR target/63408 Ramana Radhakrishnan
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).