diff options
author | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-06-18 08:30:47 +0000 |
---|---|---|
committer | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-06-18 08:30:47 +0000 |
commit | 2cd360b676114938f74bfae8da993a67a25c9929 (patch) | |
tree | a70a489abddc4e7f99e532e8ae5b8057df6f9b21 /gcc/tree-ssa-math-opts.c | |
parent | e9ffa5ca84e36ab04fd62d888f514159ea00834c (diff) | |
download | gcc-2cd360b676114938f74bfae8da993a67a25c9929.tar.gz |
PR tree-optimization/32383
* targhooks.c (default_builtin_reciprocal): Add new bool argument.
* targhooks.h (default_builtin_reciprocal): Update prototype.
* target.h (struct gcc_target): Update builtin_reciprocal.
* doc/tm.texi (TARGET_BUILTIN_RECIPROCAL): Update description.
* tree-ssa-math-opts (execute_cse_reciprocals): Skip statements
where arg1 is not SSA_NAME. Pass true to targetm.builtin_reciprocal
when fndecl is in BUILT_IN_MD class.
(execute_convert_to_rsqrt): Ditto.
* config/i386/i386.c (ix86_builtin_reciprocal): Update for new bool
argument. Convert IX86_BUILTIN_SQRTPS code only when md_fn is true.
Convert BUILT_IN_SQRTF code only when md_fn is false.
testsuite/ChangeLog:
PR tree-optimization/32383
* testsuite/g++.dg/opt/pr32383.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125790 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-math-opts.c')
-rw-r--r-- | gcc/tree-ssa-math-opts.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 0534dcf2f90..0320ac1f4d4 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -507,7 +507,12 @@ execute_cse_reciprocals (void) && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == RDIV_EXPR) { tree arg1 = TREE_OPERAND (GIMPLE_STMT_OPERAND (stmt, 1), 1); - tree stmt1 = SSA_NAME_DEF_STMT (arg1); + tree stmt1; + + if (TREE_CODE (arg1) != SSA_NAME) + continue; + + stmt1 = SSA_NAME_DEF_STMT (arg1); if (TREE_CODE (stmt1) == GIMPLE_MODIFY_STMT && TREE_CODE (GIMPLE_STMT_OPERAND (stmt1, 1)) == CALL_EXPR @@ -517,11 +522,14 @@ execute_cse_reciprocals (void) || DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)) { enum built_in_function code; + bool md_code; tree arg10; tree tmp; code = DECL_FUNCTION_CODE (fndecl); - fndecl = targetm.builtin_reciprocal (code, false); + md_code = DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD; + + fndecl = targetm.builtin_reciprocal (code, md_code, false); if (!fndecl) continue; @@ -791,15 +799,22 @@ execute_convert_to_rsqrt (void) || DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)) { enum built_in_function code; + bool md_code; tree arg1; tree stmt1; code = DECL_FUNCTION_CODE (fndecl); - fndecl = targetm.builtin_reciprocal (code, true); + md_code = DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD; + + fndecl = targetm.builtin_reciprocal (code, md_code, true); if (!fndecl) continue; arg1 = CALL_EXPR_ARG (GIMPLE_STMT_OPERAND (stmt, 1), 0); + + if (TREE_CODE (arg1) != SSA_NAME) + continue; + stmt1 = SSA_NAME_DEF_STMT (arg1); if (TREE_CODE (stmt1) == GIMPLE_MODIFY_STMT |