diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-01-26 22:02:11 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-01-26 22:02:11 +0000 |
commit | 557c19428ab5a8c3108bc305e1c6f0c6807d61e8 (patch) | |
tree | 638f5ac175067ff03b306bcc14f058b3bdc7451b | |
parent | 80adbd968d26b269eea7fdb31344187cc637ac10 (diff) | |
download | gcc-557c19428ab5a8c3108bc305e1c6f0c6807d61e8.tar.gz |
handle isl_ast_op_select
2016-01-26 Abderrazek Zaafrani <a.zaafrani@samsung.com>
Sebastian Pop <s.pop@samsung.com>
* graphite-isl-ast-to-gimple.c (ternary_op_to_tree): Handle
isl_ast_op_cond and isl_ast_op_select.
(gcc_expression_from_isl_expr_op): Same.
* gcc.dg/graphite/isl-ast-op-select.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232851 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/graphite-isl-ast-to-gimple.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/graphite/isl-ast-op-select.c | 29 |
4 files changed, 49 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 043dd88bf61..0358f1c04aa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-01-26 Abderrazek Zaafrani <a.zaafrani@samsung.com> + Sebastian Pop <s.pop@samsung.com> + + * graphite-isl-ast-to-gimple.c (ternary_op_to_tree): Handle + isl_ast_op_cond and isl_ast_op_select. + (gcc_expression_from_isl_expr_op): Same. + 2016-01-26 Jason Merrill <jason@redhat.com> PR c++/68782 diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index 0f585032b1c..81ed3046e1d 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -689,22 +689,20 @@ tree translate_isl_ast_to_gimple:: ternary_op_to_tree (tree type, __isl_take isl_ast_expr *expr, ivs_params &ip) { - gcc_assert (isl_ast_expr_get_op_type (expr) == isl_ast_op_minus); + enum isl_ast_op_type t = isl_ast_expr_get_op_type (expr); + gcc_assert (t == isl_ast_op_cond || t == isl_ast_op_select); isl_ast_expr *arg_expr = isl_ast_expr_get_op_arg (expr, 0); - tree tree_first_expr - = gcc_expression_from_isl_expression (type, arg_expr, ip); + tree a = gcc_expression_from_isl_expression (type, arg_expr, ip); arg_expr = isl_ast_expr_get_op_arg (expr, 1); - tree tree_second_expr - = gcc_expression_from_isl_expression (type, arg_expr, ip); + tree b = gcc_expression_from_isl_expression (type, arg_expr, ip); arg_expr = isl_ast_expr_get_op_arg (expr, 2); - tree tree_third_expr - = gcc_expression_from_isl_expression (type, arg_expr, ip); + tree c = gcc_expression_from_isl_expression (type, arg_expr, ip); isl_ast_expr_free (expr); if (codegen_error) return NULL_TREE; - return fold_build3 (COND_EXPR, type, tree_first_expr, - tree_second_expr, tree_third_expr); + + return fold_build3 (COND_EXPR, type, a, b, c); } /* Converts a unary isl_ast_expr_op expression E to a GCC expression tree of @@ -791,7 +789,6 @@ gcc_expression_from_isl_expr_op (tree type, __isl_take isl_ast_expr *expr, case isl_ast_op_call: case isl_ast_op_and_then: case isl_ast_op_or_else: - case isl_ast_op_select: gcc_unreachable (); case isl_ast_op_max: @@ -822,6 +819,7 @@ gcc_expression_from_isl_expr_op (tree type, __isl_take isl_ast_expr *expr, return unary_op_to_tree (type, expr, ip); case isl_ast_op_cond: + case isl_ast_op_select: return ternary_op_to_tree (type, expr, ip); default: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a35d29568a8..ee59ff14610 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-01-26 Abderrazek Zaafrani <a.zaafrani@samsung.com> + Sebastian Pop <s.pop@samsung.com> + + * gcc.dg/graphite/isl-ast-op-select.c: New. + 2015-01-26 Paul Thomas <pault@gcc.gnu.org> PR fortran/69385 diff --git a/gcc/testsuite/gcc.dg/graphite/isl-ast-op-select.c b/gcc/testsuite/gcc.dg/graphite/isl-ast-op-select.c new file mode 100644 index 00000000000..688176e0ed5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/isl-ast-op-select.c @@ -0,0 +1,29 @@ +/* { dg-options "-O2 -floop-nest-optimize" } */ + +static void kernel_gemm(int ni, int nj, int nk, double alpha, double beta, double C[1024][1024], double A[1024][1024], double B[1024][1024]) +{ + int i, j, k; + for (i = 0; i < ni; i++) + for (j = 0; j < nj; j++) + { + C[i][j] *= beta; + for (k = 0; k < nk; ++k) + C[i][j] += alpha * A[i][k] * B[k][j]; + } +} + +void *polybench_alloc_data (int, int); + +int main(int argc, char** argv) { + int ni = 1024; + int nj = 1024; + int nk = 1024; + double alpha; + double beta; + double (*C)[1024][1024]; + C = (double(*)[1024][1024])polybench_alloc_data ((1024) * (1024), sizeof(double)); + double (*A)[1024][1024]; + A = (double(*)[1024][1024])polybench_alloc_data ((1024) * (1024), sizeof(double)); + double (*B)[1024][1024]; + kernel_gemm (ni, nj, nk, alpha, beta, *C, *A, *B); +} |