From: Richard Sandiford Date: Tue, 17 Nov 2015 18:45:41 +0000 (+0000) Subject: Use combined_fn in tree-ssa-math-opts.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c97d1c9dc4bf70364920ca123c2ab3aed082e00c;p=gcc.git Use combined_fn in tree-ssa-math-opts.c Another patch to extend uses of built_in_function to combined_fn, this time in tree-ssa-math-opts.c. Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi. gcc/ * tree-ssa-math-opts.c: Include case-cfn-macros.h. (execute_cse_sincos_1): Use combined_fn instead of built-in codes. (pass_cse_sincos::execute): Likewise. From-SVN: r230481 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 323450d4c8d..051b29eaec1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-11-17 Richard Sandiford + + * tree-ssa-math-opts.c: Include case-cfn-macros.h. + (execute_cse_sincos_1): Use combined_fn instead of built-in codes. + (pass_cse_sincos::execute): Likewise. + 2015-11-17 Richard Sandiford * tree-ssa-reassoc.c: Include case-cfn-macros.h. diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 6368ddf8266..1e7cf7ed283 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -110,6 +110,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa.h" #include "builtins.h" #include "params.h" +#include "case-cfn-macros.h" /* This structure represents one basic block that either computes a division, or is a common dominator for basic block that compute a @@ -725,22 +726,20 @@ execute_cse_sincos_1 (tree name) FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, name) { if (gimple_code (use_stmt) != GIMPLE_CALL - || !gimple_call_lhs (use_stmt) - || !(fndecl = gimple_call_fndecl (use_stmt)) - || DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_NORMAL) + || !gimple_call_lhs (use_stmt)) continue; - switch (DECL_FUNCTION_CODE (fndecl)) + switch (gimple_call_combined_fn (use_stmt)) { - CASE_FLT_FN (BUILT_IN_COS): + CASE_CFN_COS: seen_cos |= maybe_record_sincos (&stmts, &top_bb, use_stmt) ? 1 : 0; break; - CASE_FLT_FN (BUILT_IN_SIN): + CASE_CFN_SIN: seen_sin |= maybe_record_sincos (&stmts, &top_bb, use_stmt) ? 1 : 0; break; - CASE_FLT_FN (BUILT_IN_CEXPI): + CASE_CFN_CEXPI: seen_cexpi |= maybe_record_sincos (&stmts, &top_bb, use_stmt) ? 1 : 0; break; @@ -779,19 +778,18 @@ execute_cse_sincos_1 (tree name) for (i = 0; stmts.iterate (i, &use_stmt); ++i) { tree rhs = NULL; - fndecl = gimple_call_fndecl (use_stmt); - switch (DECL_FUNCTION_CODE (fndecl)) + switch (gimple_call_combined_fn (use_stmt)) { - CASE_FLT_FN (BUILT_IN_COS): + CASE_CFN_COS: rhs = fold_build1 (REALPART_EXPR, type, res); break; - CASE_FLT_FN (BUILT_IN_SIN): + CASE_CFN_SIN: rhs = fold_build1 (IMAGPART_EXPR, type, res); break; - CASE_FLT_FN (BUILT_IN_CEXPI): + CASE_CFN_CEXPI: rhs = res; break; @@ -1727,26 +1725,24 @@ pass_cse_sincos::execute (function *fun) for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple *stmt = gsi_stmt (gsi); - tree fndecl; /* Only the last stmt in a bb could throw, no need to call gimple_purge_dead_eh_edges if we change something in the middle of a basic block. */ cleanup_eh = false; - if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL) + if (is_gimple_call (stmt) && gimple_call_lhs (stmt)) { tree arg, arg0, arg1, result; HOST_WIDE_INT n; location_t loc; - fndecl = gimple_call_fndecl (stmt); - switch (DECL_FUNCTION_CODE (fndecl)) + switch (gimple_call_combined_fn (stmt)) { - CASE_FLT_FN (BUILT_IN_COS): - CASE_FLT_FN (BUILT_IN_SIN): - CASE_FLT_FN (BUILT_IN_CEXPI): + CASE_CFN_COS: + CASE_CFN_SIN: + CASE_CFN_CEXPI: /* Make sure we have either sincos or cexp. */ if (!targetm.libc_has_function (function_c99_math_complex) && !targetm.libc_has_function (function_sincos)) @@ -1757,7 +1753,7 @@ pass_cse_sincos::execute (function *fun) cfg_changed |= execute_cse_sincos_1 (arg); break; - CASE_FLT_FN (BUILT_IN_POW): + CASE_CFN_POW: arg0 = gimple_call_arg (stmt, 0); arg1 = gimple_call_arg (stmt, 1); @@ -1777,7 +1773,7 @@ pass_cse_sincos::execute (function *fun) } break; - CASE_FLT_FN (BUILT_IN_POWI): + CASE_CFN_POWI: arg0 = gimple_call_arg (stmt, 0); arg1 = gimple_call_arg (stmt, 1); loc = gimple_location (stmt); @@ -1826,7 +1822,7 @@ pass_cse_sincos::execute (function *fun) } break; - CASE_FLT_FN (BUILT_IN_CABS): + CASE_CFN_CABS: arg0 = gimple_call_arg (stmt, 0); loc = gimple_location (stmt); result = gimple_expand_builtin_cabs (&gsi, loc, arg0);