Commit a831ffb8 by Mikael Morin

trans-intrinsic.c (gfc_conv_intrinsic_arith): Update conditions.

	* trans-intrinsic.c (gfc_conv_intrinsic_arith): Update conditions.

From-SVN: r180913
parent 93ee6382
2011-11-04 Mikael Morin <mikael@gcc.gnu.org> 2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
* trans-intrinsic.c (gfc_conv_intrinsic_arith): Update conditions.
2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
* frontend-passes.c (cfe_register_funcs): Return early in the case * frontend-passes.c (cfe_register_funcs): Return early in the case
of an inline intrinsic function. of an inline intrinsic function.
(optimize_binop_array_assignment): Skip optimization in the case of (optimize_binop_array_assignment): Skip optimization in the case of
......
...@@ -2624,7 +2624,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op, ...@@ -2624,7 +2624,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op,
maskexpr = actual->expr; maskexpr = actual->expr;
} }
if (maskexpr && maskexpr->rank != 0) if (maskexpr && maskexpr->rank > 0)
{ {
maskss = gfc_walk_expr (maskexpr); maskss = gfc_walk_expr (maskexpr);
gcc_assert (maskss != gfc_ss_terminator); gcc_assert (maskss != gfc_ss_terminator);
...@@ -2635,7 +2635,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op, ...@@ -2635,7 +2635,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op,
/* Initialize the scalarizer. */ /* Initialize the scalarizer. */
gfc_init_loopinfo (&loop); gfc_init_loopinfo (&loop);
gfc_add_ss_to_loop (&loop, arrayss); gfc_add_ss_to_loop (&loop, arrayss);
if (maskss) if (maskexpr && maskexpr->rank > 0)
gfc_add_ss_to_loop (&loop, maskss); gfc_add_ss_to_loop (&loop, maskss);
/* Initialize the loop. */ /* Initialize the loop. */
...@@ -2643,13 +2643,13 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op, ...@@ -2643,13 +2643,13 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op,
gfc_conv_loop_setup (&loop, &expr->where); gfc_conv_loop_setup (&loop, &expr->where);
gfc_mark_ss_chain_used (arrayss, 1); gfc_mark_ss_chain_used (arrayss, 1);
if (maskss) if (maskexpr && maskexpr->rank > 0)
gfc_mark_ss_chain_used (maskss, 1); gfc_mark_ss_chain_used (maskss, 1);
/* Generate the loop body. */ /* Generate the loop body. */
gfc_start_scalarized_body (&loop, &body); gfc_start_scalarized_body (&loop, &body);
/* If we have a mask, only add this element if the mask is set. */ /* If we have a mask, only add this element if the mask is set. */
if (maskss) if (maskexpr && maskexpr->rank > 0)
{ {
gfc_init_se (&maskse, NULL); gfc_init_se (&maskse, NULL);
gfc_copy_loopinfo_to_se (&maskse, &loop); gfc_copy_loopinfo_to_se (&maskse, &loop);
...@@ -2740,7 +2740,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op, ...@@ -2740,7 +2740,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op,
gfc_add_block_to_block (&block, &arrayse.post); gfc_add_block_to_block (&block, &arrayse.post);
if (maskss) if (maskexpr && maskexpr->rank > 0)
{ {
/* We enclose the above in if (mask) {...} . */ /* We enclose the above in if (mask) {...} . */
...@@ -2755,7 +2755,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op, ...@@ -2755,7 +2755,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op,
gfc_trans_scalarizing_loops (&loop, &body); gfc_trans_scalarizing_loops (&loop, &body);
/* For a scalar mask, enclose the loop in an if statement. */ /* For a scalar mask, enclose the loop in an if statement. */
if (maskexpr && maskss == NULL) if (maskexpr && maskexpr->rank == 0)
{ {
gfc_init_se (&maskse, NULL); gfc_init_se (&maskse, NULL);
gfc_conv_expr_val (&maskse, maskexpr); gfc_conv_expr_val (&maskse, maskexpr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment