aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@nildram.co.uk>2008-01-04 10:26:41 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2008-01-04 10:26:41 +0000
commit6a3d1d4957e60027cf5ab581bf260f50441cdd52 (patch)
tree575dcbb02d909df984752fa2e9b85d4f03b2c446 /gcc
parent3c7215130f7f1c4677597a3882430fc65e2dba0c (diff)
downloadgcc-6a3d1d4957e60027cf5ab581bf260f50441cdd52.zip
gcc-6a3d1d4957e60027cf5ab581bf260f50441cdd52.tar.gz
gcc-6a3d1d4957e60027cf5ab581bf260f50441cdd52.tar.bz2
mips.md (sqrt_condition): Tweak comment.
gcc/ * config/mips/mips.md (sqrt_condition): Tweak comment. (recip_condition): Likewise. Require TARGET_FLOAT64 for DFmode. gcc/testsuite/ * gcc.target/mips/rsqrt-1.c: Require -mgp64. * gcc.target/mips/rsqrt-2.c: Likewise. * gcc.target/mips/rsqrt-4.c: New test. From-SVN: r131318
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/mips/mips.md13
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.target/mips/rsqrt-1.c2
-rw-r--r--gcc/testsuite/gcc.target/mips/rsqrt-2.c2
-rw-r--r--gcc/testsuite/gcc.target/mips/rsqrt-4.c27
6 files changed, 49 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8a7ae19..6dd3f15 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-04 Richard Sandiford <rsandifo@nildram.co.uk>
+
+ * config/mips/mips.md (sqrt_condition): Tweak comment.
+ (recip_condition): Likewise. Require TARGET_FLOAT64 for DFmode.
+
2008-01-03 Tom Tromey <tromey@redhat.com>
PR c/34457:
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index b32ed33..864013a 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -583,14 +583,19 @@
[DF (SF "!TARGET_FIX_SB1 || flag_unsafe_math_optimizations")
(V2SF "TARGET_SB1 && (!TARGET_FIX_SB1 || flag_unsafe_math_optimizations)")])
-; This attribute gives the condition for which sqrt instructions exist.
+;; This attribute gives the conditions under which SQRT.fmt instructions
+;; can be used.
(define_mode_attr sqrt_condition
[(SF "!ISA_MIPS1") (DF "!ISA_MIPS1") (V2SF "TARGET_SB1")])
-; This attribute gives the condition for which recip and rsqrt instructions
-; exist.
+;; This attribute gives the conditions under which RECIP.fmt and RSQRT.fmt
+;; instructions can be used. The MIPS32 and MIPS64 ISAs say that RECIP.D
+;; and RSQRT.D are unpredictable when doubles are stored in pairs of FPRs,
+;; so for safety's sake, we apply this restriction to all targets.
(define_mode_attr recip_condition
- [(SF "ISA_HAS_FP4") (DF "ISA_HAS_FP4") (V2SF "TARGET_SB1")])
+ [(SF "ISA_HAS_FP4")
+ (DF "ISA_HAS_FP4 && TARGET_FLOAT64")
+ (V2SF "TARGET_SB1")])
;; This code iterator allows all branch instructions to be generated from
;; a single define_expand template.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index dd64236..c027dba 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-04 Richard Sandiford <rsandifo@nildram.co.uk>
+
+ * gcc.target/mips/rsqrt-1.c: Require -mgp64.
+ * gcc.target/mips/rsqrt-2.c: Likewise.
+ * gcc.target/mips/rsqrt-4.c: New test.
+
2008-01-04 Tobias Burnus <burnus@net-b.de>
PR fortran/34557
diff --git a/gcc/testsuite/gcc.target/mips/rsqrt-1.c b/gcc/testsuite/gcc.target/mips/rsqrt-1.c
index 885deef..4cc6212 100644
--- a/gcc/testsuite/gcc.target/mips/rsqrt-1.c
+++ b/gcc/testsuite/gcc.target/mips/rsqrt-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-mips-options "-O2 -ffast-math -mips4 -mhard-float" } */
+/* { dg-mips-options "-O2 -ffast-math -mips4 -mhard-float -mgp64" } */
/* { dg-final { scan-assembler "rsqrt.d" } } */
/* { dg-final { scan-assembler "rsqrt.s" } } */
diff --git a/gcc/testsuite/gcc.target/mips/rsqrt-2.c b/gcc/testsuite/gcc.target/mips/rsqrt-2.c
index d3e7aa3..03a0013 100644
--- a/gcc/testsuite/gcc.target/mips/rsqrt-2.c
+++ b/gcc/testsuite/gcc.target/mips/rsqrt-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-mips-options "-O2 -ffast-math -mips4 -mhard-float" } */
+/* { dg-mips-options "-O2 -ffast-math -mips4 -mhard-float -mgp64" } */
/* { dg-final { scan-assembler "rsqrt.d" } } */
/* { dg-final { scan-assembler "rsqrt.s" } } */
diff --git a/gcc/testsuite/gcc.target/mips/rsqrt-4.c b/gcc/testsuite/gcc.target/mips/rsqrt-4.c
new file mode 100644
index 0000000..7f7da64
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/rsqrt-4.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-mips-options "-O2 -ffast-math -mips64 -mhard-float -mgp32" } */
+/* { dg-final { scan-assembler-not "\trsqrt.d\t" } } */
+/* { dg-final { scan-assembler-times "\trsqrt.s\t" 2 } } */
+
+extern double sqrt(double);
+extern float sqrtf(float);
+
+NOMIPS16 double f1 (double x)
+{
+ return 1.0 / sqrt (x);
+}
+
+NOMIPS16 double f2 (double x)
+{
+ return sqrt (1.0 / x);
+}
+
+NOMIPS16 float f3 (float x)
+{
+ return 1.0f / sqrtf (x);
+}
+
+NOMIPS16 float f4 (float x)
+{
+ return sqrtf (1.0f / x);
+}