diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2015-11-05 15:46:59 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2015-11-05 15:46:59 +0000 |
commit | 451e8dae5dac91d6e3c4d835630d9a8fb4a52cc9 (patch) | |
tree | 7cccd64204c12aace7a7403d94e327f7ade47e95 /gcc | |
parent | e01d41e553aae24572da3a067347a5f2c02cd620 (diff) | |
download | gcc-451e8dae5dac91d6e3c4d835630d9a8fb4a52cc9.zip gcc-451e8dae5dac91d6e3c4d835630d9a8fb4a52cc9.tar.gz gcc-451e8dae5dac91d6e3c4d835630d9a8fb4a52cc9.tar.bz2 |
gimple-fold.c: Include omp-low.h.
* gimple-fold.c: Include omp-low.h.
(fold_internal_goacc_dim): New.
(gimple_fold_call): Call it.
From-SVN: r229816
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/gimple-fold.c | 27 |
2 files changed, 33 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 81b94ea..5c567f6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-11-05 Nathan Sidwell <nathan@codesourcery.com> + + * gimple-fold.c: Include omp-low.h. + (fold_internal_goacc_dim): New. + (gimple_fold_call): Call it. + 2015-11-05 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index c9b9593..45840af 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -52,6 +52,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-match.h" #include "gomp-constants.h" #include "optabs-query.h" +#include "omp-low.h" /* Return true when DECL can be referenced from current unit. @@ -2906,6 +2907,28 @@ gimple_fold_builtin (gimple_stmt_iterator *gsi) return false; } +/* Transform IFN_GOACC_DIM_SIZE and IFN_GOACC_DIM_POS internal + function calls to constants, where possible. */ + +static tree +fold_internal_goacc_dim (const gimple *call) +{ + int axis = get_oacc_ifn_dim_arg (call); + int size = get_oacc_fn_dim_size (current_function_decl, axis); + bool is_pos = gimple_call_internal_fn (call) == IFN_GOACC_DIM_POS; + tree result = NULL_TREE; + + /* If the size is 1, or we only want the size and it is not dynamic, + we know the answer. */ + if (size == 1 || (!is_pos && size)) + { + tree type = TREE_TYPE (gimple_call_lhs (call)); + result = build_int_cst (type, size - is_pos); + } + + return result; +} + /* Return true if ARG0 CODE ARG1 in infinite signed precision operation doesn't fit into TYPE. The test for overflow should be regardless of -fwrapv, and even for unsigned types. */ @@ -3106,6 +3129,10 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace) return true; } break; + case IFN_GOACC_DIM_SIZE: + case IFN_GOACC_DIM_POS: + result = fold_internal_goacc_dim (stmt); + break; case IFN_UBSAN_CHECK_ADD: subcode = PLUS_EXPR; break; |