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.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r232851
This commit is contained in:
Abderrazek Zaafrani 2016-01-26 22:02:11 +00:00 committed by Sebastian Pop
parent a0909527ea
commit 56f80f54fe
4 changed files with 49 additions and 10 deletions

View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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);
}