aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/mips
diff options
context:
space:
mode:
authorRichard Sandiford <richard@codesourcery.com>2006-09-20 21:09:42 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2006-09-20 21:09:42 +0000
commit1bded8e1a0abebabf1f2d6323ec859b10641b45b (patch)
tree605b63641b86dde655cfed36b185424554ce5ca7 /gcc/config/mips
parentd2b40c0921356a20361e8a740d5502824065d003 (diff)
downloadgcc-1bded8e1a0abebabf1f2d6323ec859b10641b45b.zip
gcc-1bded8e1a0abebabf1f2d6323ec859b10641b45b.tar.gz
gcc-1bded8e1a0abebabf1f2d6323ec859b10641b45b.tar.bz2
mips.c (CODE_FOR_mips_abs_ps): Delete.
gcc/ * config/mips/mips.c (CODE_FOR_mips_abs_ps): Delete. * config/mips/mips.md (UNSPEC_ABS_PS): New constant. (UNSPEC_RSQRT1, UNSPEC_RSQRT2, UNSPEC_RECIP1, UNSPEC_RECIP2) (UNSPEC_SINGLE_CC, UNSPEC_SCC): Bump values by 1. (*nmadd<mode>, *nmadd<mode>_fastmath): Require !HONOR_NANS. (*nmsub<mode>, *nmsub<mode>_fastmath): Likewise. (abs<mode>2, neg<mode>2): Likewise. * config/mips/mips-ps-3d.md (mips_abs_ps): New define_expand. (*mips_abs_ps): New define_insn. gcc/testsuite/ * gcc.target/mips/mips-ps-type.c: Add -ffinite-math-only. * gcc.target/mips/nmadd-2.c: Likewise. * gcc.target/mips/mips-ps-6.c: New test. * gcc.target/mips/neg-abs-1.c: Likewise. * gcc.target/mips/neg-abs-2.c: Likewise. * gcc.target/mips/nmadd-3.c: New test. From-SVN: r117093
Diffstat (limited to 'gcc/config/mips')
-rw-r--r--gcc/config/mips/mips-ps-3d.md25
-rw-r--r--gcc/config/mips/mips.c3
-rw-r--r--gcc/config/mips/mips.md37
3 files changed, 50 insertions, 15 deletions
diff --git a/gcc/config/mips/mips-ps-3d.md b/gcc/config/mips/mips-ps-3d.md
index 78c8b5c..c817f4d 100644
--- a/gcc/config/mips/mips-ps-3d.md
+++ b/gcc/config/mips/mips-ps-3d.md
@@ -276,6 +276,31 @@
[(set_attr "type" "fmul")
(set_attr "mode" "SF")])
+; abs.ps
+(define_expand "mips_abs_ps"
+ [(set (match_operand:V2SF 0 "register_operand")
+ (unspec:V2SF [(match_operand:V2SF 1 "register_operand")]
+ UNSPEC_ABS_PS))]
+ "TARGET_PAIRED_SINGLE_FLOAT"
+{
+ /* If we can ignore NaNs, this operation is equivalent to the
+ rtl ABS code. */
+ if (!HONOR_NANS (V2SFmode))
+ {
+ emit_insn (gen_absv2sf2 (operands[0], operands[1]));
+ DONE;
+ }
+})
+
+(define_insn "*mips_abs_ps"
+ [(set (match_operand:V2SF 0 "register_operand" "=f")
+ (unspec:V2SF [(match_operand:V2SF 1 "register_operand" "f")]
+ UNSPEC_ABS_PS))]
+ "TARGET_PAIRED_SINGLE_FLOAT"
+ "abs.ps\t%0,%1"
+ [(set_attr "type" "fabs")
+ (set_attr "mode" "SF")])
+
;----------------------------------------------------------------------------
; Floating Point Comparisons for Scalars
;----------------------------------------------------------------------------
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 91e90e0..7110a2d 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -10084,9 +10084,6 @@ struct builtin_description
CMP_4S_BUILTINS (c, COND), \
CMP_4S_BUILTINS (cabs, COND)
-/* __builtin_mips_abs_ps() maps to the standard absM2 pattern. */
-#define CODE_FOR_mips_abs_ps CODE_FOR_absv2sf2
-
static const struct builtin_description mips_bdesc[] =
{
DIRECT_BUILTIN (pll_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, MASK_PAIRED_SINGLE_FLOAT),
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index a9b9add..969d22f 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -67,13 +67,14 @@
(UNSPEC_CVT_PW_PS 205)
(UNSPEC_CVT_PS_PW 206)
(UNSPEC_MULR_PS 207)
+ (UNSPEC_ABS_PS 208)
- (UNSPEC_RSQRT1 208)
- (UNSPEC_RSQRT2 209)
- (UNSPEC_RECIP1 210)
- (UNSPEC_RECIP2 211)
- (UNSPEC_SINGLE_CC 212)
- (UNSPEC_SCC 213)
+ (UNSPEC_RSQRT1 209)
+ (UNSPEC_RSQRT2 210)
+ (UNSPEC_RECIP1 211)
+ (UNSPEC_RECIP2 212)
+ (UNSPEC_SINGLE_CC 213)
+ (UNSPEC_SCC 214)
;; MIPS DSP ASE Revision 0.98 3/24/2005
(UNSPEC_ADDQ 300)
@@ -1765,7 +1766,8 @@
(match_operand:ANYF 2 "register_operand" "f"))
(match_operand:ANYF 3 "register_operand" "f"))))]
"ISA_HAS_NMADD_NMSUB && TARGET_FUSED_MADD
- && HONOR_SIGNED_ZEROS (<MODE>mode)"
+ && HONOR_SIGNED_ZEROS (<MODE>mode)
+ && !HONOR_NANS (<MODE>mode)"
"nmadd.<fmt>\t%0,%3,%1,%2"
[(set_attr "type" "fmadd")
(set_attr "mode" "<UNITMODE>")])
@@ -1777,7 +1779,8 @@
(match_operand:ANYF 2 "register_operand" "f"))
(match_operand:ANYF 3 "register_operand" "f")))]
"ISA_HAS_NMADD_NMSUB && TARGET_FUSED_MADD
- && !HONOR_SIGNED_ZEROS (<MODE>mode)"
+ && !HONOR_SIGNED_ZEROS (<MODE>mode)
+ && !HONOR_NANS (<MODE>mode)"
"nmadd.<fmt>\t%0,%3,%1,%2"
[(set_attr "type" "fmadd")
(set_attr "mode" "<UNITMODE>")])
@@ -1789,7 +1792,8 @@
(match_operand:ANYF 3 "register_operand" "f"))
(match_operand:ANYF 1 "register_operand" "f"))))]
"ISA_HAS_NMADD_NMSUB && TARGET_FUSED_MADD
- && HONOR_SIGNED_ZEROS (<MODE>mode)"
+ && HONOR_SIGNED_ZEROS (<MODE>mode)
+ && !HONOR_NANS (<MODE>mode)"
"nmsub.<fmt>\t%0,%1,%2,%3"
[(set_attr "type" "fmadd")
(set_attr "mode" "<UNITMODE>")])
@@ -1801,7 +1805,8 @@
(mult:ANYF (match_operand:ANYF 2 "register_operand" "f")
(match_operand:ANYF 3 "register_operand" "f"))))]
"ISA_HAS_NMADD_NMSUB && TARGET_FUSED_MADD
- && !HONOR_SIGNED_ZEROS (<MODE>mode)"
+ && !HONOR_SIGNED_ZEROS (<MODE>mode)
+ && !HONOR_NANS (<MODE>mode)"
"nmsub.<fmt>\t%0,%1,%2,%3"
[(set_attr "type" "fmadd")
(set_attr "mode" "<UNITMODE>")])
@@ -1972,10 +1977,14 @@
;; Do not use the integer abs macro instruction, since that signals an
;; exception on -2147483648 (sigh).
+;; abs.fmt is an arithmetic instruction and treats all NaN inputs as
+;; invalid; it does not clear their sign bits. We therefore can't use
+;; abs.fmt if the signs of NaNs matter.
+
(define_insn "abs<mode>2"
[(set (match_operand:ANYF 0 "register_operand" "=f")
(abs:ANYF (match_operand:ANYF 1 "register_operand" "f")))]
- ""
+ "!HONOR_NANS (<MODE>mode)"
"abs.<fmt>\t%0,%1"
[(set_attr "type" "fabs")
(set_attr "mode" "<UNITMODE>")])
@@ -2024,10 +2033,14 @@
[(set_attr "type" "arith")
(set_attr "mode" "DI")])
+;; neg.fmt is an arithmetic instruction and treats all NaN inputs as
+;; invalid; it does not flip their sign bit. We therefore can't use
+;; neg.fmt if the signs of NaNs matter.
+
(define_insn "neg<mode>2"
[(set (match_operand:ANYF 0 "register_operand" "=f")
(neg:ANYF (match_operand:ANYF 1 "register_operand" "f")))]
- ""
+ "!HONOR_NANS (<MODE>mode)"
"neg.<fmt>\t%0,%1"
[(set_attr "type" "fneg")
(set_attr "mode" "<UNITMODE>")])