Can this code be placed in tree.c?
Closed this issue · 0 comments
thvnx commented
Lines 114 to 189 in 47761af
static int | |
some_nonzerop (tree t) | |
{ | |
int zerop = false; | |
/* Operations with real or imaginary part of a complex number zero | |
cannot be treated the same as operations with a real or imaginary | |
operand if we care about the signs of zeros in the result. */ | |
if (TREE_CODE (t) == REAL_CST && !flag_signed_zeros) | |
zerop = real_identical (&TREE_REAL_CST (t), &dconst0); | |
else if (TREE_CODE (t) == FIXED_CST) | |
zerop = fixed_zerop (t); | |
else if (TREE_CODE (t) == INTEGER_CST) | |
zerop = integer_zerop (t); | |
return !zerop; | |
} | |
/* Return non-zero if T is the constant + or - 1. */ | |
static int | |
some_onep (tree t) | |
{ | |
int onep = false; | |
if (TREE_CODE (t) == REAL_CST) { | |
REAL_VALUE_TYPE abs_t; | |
abs_t = real_value_abs (&TREE_REAL_CST (t)); | |
onep = real_identical (&abs_t, &dconst1); | |
} | |
else if (TREE_CODE (t) == FIXED_CST) | |
onep = fixed_identical (&TREE_FIXED_CST (t), | |
&FCONST1 ((&TREE_FIXED_CST (t))->mode)); | |
else if (TREE_CODE (t) == INTEGER_CST) | |
onep = integer_onep (t) || integer_minus_onep (t); | |
else | |
gcc_unreachable(); | |
return onep; | |
} | |
/* Return non-zero if T is positive. */ | |
static int | |
some_posp (tree t) | |
{ | |
int posp = false; | |
if (TREE_CODE (t) == REAL_CST) | |
posp = !real_isneg (&TREE_REAL_CST (t)); | |
else if (TREE_CODE (t) == FIXED_CST) | |
posp = !fixed_isneg (&TREE_FIXED_CST (t)); | |
else if (TREE_CODE (t) == INTEGER_CST) | |
posp = !wi::neg_p (wi::to_wide (t)); | |
else | |
gcc_unreachable(); | |
return posp; | |
} | |
/* Return non-zero if a tree has been negated since its previous | |
definition (used in expand_accurate_complex_multiplication for | |
conjugation detection). */ | |
static int | |
new_def_is_negated (tree curr, tree old) | |
{ | |
if (TREE_CODE (curr) == SSA_NAME) | |
{ | |
gimple *stmt = SSA_NAME_DEF_STMT (curr); | |
return gimple_assign_rhs1 (stmt) == old && | |
gimple_assign_rhs_code (stmt) == NEGATE_EXPR; | |
} | |
else | |
gcc_unreachable(); | |
} |