PR fortran/42131 Sign test using ternary operator
From-SVN: r154876
This commit is contained in:
parent
d557591da1
commit
d0d565e1b0
|
@ -1,3 +1,8 @@
|
|||
2009-12-01 Janne Blomqvist <jb@gcc.gnu.org>
|
||||
|
||||
* PR fortran/42131
|
||||
* trans-stmt.c (gfc_trans_do): Sign test using ternary operator.
|
||||
|
||||
2009-11-30 Janus Weil <janus@gcc.gnu.org>
|
||||
|
||||
PR fortran/42053
|
||||
|
|
|
@ -1028,17 +1028,13 @@ gfc_trans_do (gfc_code * code)
|
|||
{
|
||||
tree pos, neg, step_sign, to2, from2, step2;
|
||||
|
||||
/* Calculate SIGN (1,step) */
|
||||
/* Calculate SIGN (1,step), as (step < 0 ? -1 : 1) */
|
||||
|
||||
tmp = fold_build2 (RSHIFT_EXPR, type, step,
|
||||
build_int_cst (type,
|
||||
TYPE_PRECISION (type) - 1));
|
||||
|
||||
tmp = fold_build2 (MULT_EXPR, type, tmp,
|
||||
build_int_cst (type, 2));
|
||||
|
||||
step_sign = fold_build2 (PLUS_EXPR, type, tmp,
|
||||
fold_convert (type, integer_one_node));
|
||||
tmp = fold_build2 (LT_EXPR, boolean_type_node, step,
|
||||
build_int_cst (TREE_TYPE (step), 0));
|
||||
step_sign = fold_build3 (COND_EXPR, type, tmp,
|
||||
build_int_cst (type, -1),
|
||||
build_int_cst (type, 1));
|
||||
|
||||
tmp = fold_build2 (LT_EXPR, boolean_type_node, to, from);
|
||||
pos = fold_build3 (COND_EXPR, void_type_node, tmp,
|
||||
|
|
Loading…
Reference in New Issue