[gcc/]
authorRoman Gareev <gareevroman@gmail.com>
Thu, 24 Jul 2014 13:35:27 +0000 (13:35 +0000)
committerRoman Gareev <romangareev@gcc.gnu.org>
Thu, 24 Jul 2014 13:35:27 +0000 (13:35 +0000)
* graphite-isl-ast-to-gimple.c:
(binary_op_to_tree): Add calling of translate_isl_ast_node_block.
(gcc_expression_from_isl_expr_op): Move isl_ast_op_pdiv_q,
isl_ast_op_pdiv_r to the different case.

[gcc/testsuite]

* gcc.dg/graphite/isl-ast-gen-blocks-3.c: New testcase.

From-SVN: r212990

gcc/ChangeLog
gcc/graphite-isl-ast-to-gimple.c
gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-3.c [new file with mode: 0644]

index 96a8161787ddec3a2b0b863b580087a62c4f2ef2..9ba6bfb8890fdc7d2b356494befbbdb6e208099d 100644 (file)
@@ -1,3 +1,12 @@
+2014-07-24  Roman Gareev  <gareevroman@gmail.com>
+
+       * graphite-isl-ast-to-gimple.c:
+       (binary_op_to_tree): Add calling of translate_isl_ast_node_block.
+       (gcc_expression_from_isl_expr_op): Move isl_ast_op_pdiv_q,
+       isl_ast_op_pdiv_r to the different case.
+
+       * gcc.dg/graphite/isl-ast-gen-blocks-3.c: New testcase.
+
 2014-07-24  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        PR middle-end/61876
index 6f58c7c600fc9cd2a0c45312a55e7a955429f658..b42d3317a6f3269c9c5e38031d83c6df2922cd57 100644 (file)
@@ -186,6 +186,12 @@ binary_op_to_tree (tree type, __isl_take isl_ast_expr *expr, ivs_params &ip)
     case isl_ast_op_div:
       return fold_build2 (EXACT_DIV_EXPR, type, tree_lhs_expr, tree_rhs_expr);
 
+    case isl_ast_op_pdiv_q:
+      return fold_build2 (TRUNC_DIV_EXPR, type, tree_lhs_expr, tree_rhs_expr);
+
+    case isl_ast_op_pdiv_r:
+      return fold_build2 (TRUNC_MOD_EXPR, type, tree_lhs_expr, tree_rhs_expr);
+
     case isl_ast_op_fdiv_q:
       return fold_build2 (FLOOR_DIV_EXPR, type, tree_lhs_expr, tree_rhs_expr);
 
@@ -299,8 +305,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_pdiv_q:
-    case isl_ast_op_pdiv_r:
     case isl_ast_op_select:
       gcc_unreachable ();
 
@@ -312,6 +316,8 @@ gcc_expression_from_isl_expr_op (tree type, __isl_take isl_ast_expr *expr,
     case isl_ast_op_sub:
     case isl_ast_op_mul:
     case isl_ast_op_div:
+    case isl_ast_op_pdiv_q:
+    case isl_ast_op_pdiv_r:
     case isl_ast_op_fdiv_q:
     case isl_ast_op_and:
     case isl_ast_op_or:
diff --git a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-3.c b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-3.c
new file mode 100644 (file)
index 0000000..d4a902d
--- /dev/null
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fgraphite-identity -fgraphite-code-generator=isl" } */
+
+/* We use a global variable 'k' to avoid ipa-cp. */
+int k = 50;
+static int __attribute__((noinline))
+foo ()
+{
+  int i, res = 0;
+  for (i = k/2; i < k; i++)
+    res += i;
+
+  return res;
+}
+
+extern void abort ();
+
+int
+main (void)
+{ 
+  int res = foo ();
+
+  if (res != 925)
+    abort ();
+
+  return 0;
+}