Commit 23657388 by Roger Sayle Committed by Roger Sayle

mips.md: New reciprocal square root patterns that match sqrt(1.0/x) in addition to the...


	* config/mips/mips.md: New reciprocal square root patterns that
	match sqrt(1.0/x) in addition to the existing 1.0/sqrt(x) insns.

	* gcc.dg/mips-rsqrt-1.c: New test case.
	* gcc.dg/mips-rsqrt-2.c: New test case.
	* gcc.dg/mips-rsqrt-3.c: New test case.

From-SVN: r85759
parent c9ca9b88
2004-08-10 Roger Sayle <roger@eyesopen.com>
* config/mips/mips.md: New reciprocal square root patterns that
match sqrt(1.0/x) in addition to the existing 1.0/sqrt(x) insns.
2004-08-10 Paul Brook <paul@codesourcery.com>
* config/arm/arm-protos.h (arm_set_return_address,
......
......@@ -2203,6 +2203,46 @@
(if_then_else (ne (symbol_ref "TARGET_FIX_SB1") (const_int 0))
(const_int 8)
(const_int 4)))])
;; This pattern works around the early SB-1 rev2 core "F1" erratum (see
;; "divdf3" comment for details).
(define_insn ""
[(set (match_operand:DF 0 "register_operand" "=f")
(sqrt:DF (div:DF (match_operand:DF 1 "const_float_1_operand" "")
(match_operand:DF 2 "register_operand" "f"))))]
"ISA_HAS_FP4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && flag_unsafe_math_optimizations"
{
if (TARGET_FIX_SB1)
return "rsqrt.d\t%0,%2\;mov.d\t%0,%0";
else
return "rsqrt.d\t%0,%2";
}
[(set_attr "type" "frsqrt")
(set_attr "mode" "DF")
(set (attr "length")
(if_then_else (ne (symbol_ref "TARGET_FIX_SB1") (const_int 0))
(const_int 8)
(const_int 4)))])
;; This pattern works around the early SB-1 rev2 core "F1" erratum (see
;; "divdf3" comment for details).
(define_insn ""
[(set (match_operand:SF 0 "register_operand" "=f")
(sqrt:SF (div:SF (match_operand:SF 1 "const_float_1_operand" "")
(match_operand:SF 2 "register_operand" "f"))))]
"ISA_HAS_FP4 && TARGET_HARD_FLOAT && flag_unsafe_math_optimizations"
{
if (TARGET_FIX_SB1)
return "rsqrt.s\t%0,%2\;mov.s\t%0,%0";
else
return "rsqrt.s\t%0,%2";
}
[(set_attr "type" "frsqrt")
(set_attr "mode" "SF")
(set (attr "length")
(if_then_else (ne (symbol_ref "TARGET_FIX_SB1") (const_int 0))
(const_int 8)
(const_int 4)))])
;;
;; ....................
......
2004-08-10 Roger Sayle <roger@eyesopen.com>
* gcc.dg/mips-rsqrt-1.c: New test case.
* gcc.dg/mips-rsqrt-2.c: New test case.
* gcc.dg/mips-rsqrt-3.c: New test case.
2004-08-10 Paul Brook <paul@codesourcery.com>
* gfortran.dg/der_io_1.f90: New test.
......
/* { dg-do compile { target "mips*-*-*" } } */
/* { dg-options "-O2 -ffast-math -mips4" } */
/* { dg-final { scan-assembler "rsqrt.d" } } */
/* { dg-final { scan-assembler "rsqrt.s" } } */
extern double sqrt(double);
extern float sqrtf(float);
double foo(double x)
{
return 1.0/sqrt(x);
}
float bar(float x)
{
return 1.0f/sqrtf(x);
}
/* { dg-do compile { target "mips*-*-*" } } */
/* { dg-options "-O2 -ffast-math -mips4" } */
/* { dg-final { scan-assembler "rsqrt.d" } } */
/* { dg-final { scan-assembler "rsqrt.s" } } */
extern double sqrt(double);
extern float sqrtf(float);
double foo(double x)
{
return sqrt(1.0/x);
}
float bar(float x)
{
return sqrtf(1.0f/x);
}
/* { dg-do compile { target "mips*-*-*" } } */
/* { dg-options "-O2 -mips4" } */
/* { dg-final { scan-assembler-not "rsqrt.d" } } */
/* { dg-final { scan-assembler-not "rsqrt.s" } } */
extern double sqrt(double);
extern float sqrtf(float);
double foo(double x)
{
return 1.0/sqrt(x);
}
double bar(double x)
{
return sqrt(1.0/x);
}
float foof(float x)
{
return 1.0f/sqrtf(x);
}
float barf(float x)
{
return sqrtf(1.0f/x);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment