From c919858d6a696636b2bf7aa276fb902ad2f6d60b Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Thu, 14 Jan 2010 22:52:02 +0000 Subject: [PATCH] Fix 42747, make -mvsx enable sqrt From-SVN: r155923 --- gcc/ChangeLog | 7 +++++++ gcc/config/rs6000/rs6000.md | 11 +++++++++-- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/powerpc/pr42747.c | 8 ++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr42747.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce96cca5aca5..17c9a4b51289 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2010-01-14 Michael Meissner + + PR target/42747 + * config/rs6000/rs6000.md (sqrtdf2): Split into expander and insn + to allow generation of the xssqrtdp instruction on power7. + (sqrtdf2_fpr): Ditto. + 2010-01-14 Jakub Jelinek PR middle-end/42674 diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index f30cb38d2464..08475b65e545 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -1,6 +1,6 @@ ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler ;; Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 ;; Free Software Foundation, Inc. ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) @@ -6310,7 +6310,14 @@ [(set_attr "type" "dmul") (set_attr "fp_type" "fp_maddsub_d")]) -(define_insn "sqrtdf2" +(define_expand "sqrtdf2" + [(set (match_operand:DF 0 "gpc_reg_operand" "") + (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))] + "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS + && TARGET_DOUBLE_FLOAT" + "") + +(define_insn "*sqrtdf2_fpr" [(set (match_operand:DF 0 "gpc_reg_operand" "=d") (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))] "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f4d13bedd86a..f527fce46b6e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-01-14 Michael Meissner + + * gcc.target/powerpc/pr42747.c: New file. + 2010-01-14 Jakub Jelinek PR middle-end/42674 diff --git a/gcc/testsuite/gcc.target/powerpc/pr42747.c b/gcc/testsuite/gcc.target/powerpc/pr42747.c new file mode 100644 index 000000000000..9e7310e1767a --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr42747.c @@ -0,0 +1,8 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-O2 -mcpu=power7 -ffast-math" } */ + +double foo (double x) { return __builtin_sqrt (x); } + +/* { dg-final { scan-assembler "xssqrtdp" } } */