#include "tree-ssa-threadedge.h"
#include "omp-low.h"
#include "target.h"
+#include "case-cfn-macros.h"
/* Range of values that can be associated with an SSA_NAME after VRP
has executed. */
bool sop = false;
tree type = gimple_expr_type (stmt);
- if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
+ if (is_gimple_call (stmt))
{
- tree fndecl = gimple_call_fndecl (stmt), arg;
+ tree arg;
int mini, maxi, zerov = 0, prec;
+ enum tree_code subcode = ERROR_MARK;
+ combined_fn cfn = gimple_call_combined_fn (stmt);
- switch (DECL_FUNCTION_CODE (fndecl))
+ switch (cfn)
{
- case BUILT_IN_CONSTANT_P:
+ case CFN_BUILT_IN_CONSTANT_P:
/* If the call is __builtin_constant_p and the argument is a
function parameter resolve it to false. This avoids bogus
array bound warnings.
break;
/* Both __builtin_ffs* and __builtin_popcount return
[0, prec]. */
- CASE_INT_FN (BUILT_IN_FFS):
- CASE_INT_FN (BUILT_IN_POPCOUNT):
+ CASE_CFN_FFS:
+ CASE_CFN_POPCOUNT:
arg = gimple_call_arg (stmt, 0);
prec = TYPE_PRECISION (TREE_TYPE (arg));
mini = 0;
}
goto bitop_builtin;
/* __builtin_parity* returns [0, 1]. */
- CASE_INT_FN (BUILT_IN_PARITY):
+ CASE_CFN_PARITY:
mini = 0;
maxi = 1;
goto bitop_builtin;
On many targets where the CLZ RTL or optab value is defined
for 0 the value is prec, so include that in the range
by default. */
- CASE_INT_FN (BUILT_IN_CLZ):
+ CASE_CFN_CLZ:
arg = gimple_call_arg (stmt, 0);
prec = TYPE_PRECISION (TREE_TYPE (arg));
mini = 0;
If there is a ctz optab for this mode and
CTZ_DEFINED_VALUE_AT_ZERO, include that in the range,
otherwise just assume 0 won't be seen. */
- CASE_INT_FN (BUILT_IN_CTZ):
+ CASE_CFN_CTZ:
arg = gimple_call_arg (stmt, 0);
prec = TYPE_PRECISION (TREE_TYPE (arg));
mini = 0;
break;
goto bitop_builtin;
/* __builtin_clrsb* returns [0, prec-1]. */
- CASE_INT_FN (BUILT_IN_CLRSB):
+ CASE_CFN_CLRSB:
arg = gimple_call_arg (stmt, 0);
prec = TYPE_PRECISION (TREE_TYPE (arg));
mini = 0;
set_value_range (vr, VR_RANGE, build_int_cst (type, mini),
build_int_cst (type, maxi), NULL);
return;
- default:
- break;
- }
- }
- else if (is_gimple_call (stmt) && gimple_call_internal_p (stmt))
- {
- enum tree_code subcode = ERROR_MARK;
- unsigned ifn_code = gimple_call_internal_fn (stmt);
-
- switch (ifn_code)
- {
- case IFN_UBSAN_CHECK_ADD:
+ case CFN_UBSAN_CHECK_ADD:
subcode = PLUS_EXPR;
break;
- case IFN_UBSAN_CHECK_SUB:
+ case CFN_UBSAN_CHECK_SUB:
subcode = MINUS_EXPR;
break;
- case IFN_UBSAN_CHECK_MUL:
+ case CFN_UBSAN_CHECK_MUL:
subcode = MULT_EXPR;
break;
- case IFN_GOACC_DIM_SIZE:
- case IFN_GOACC_DIM_POS:
+ case CFN_GOACC_DIM_SIZE:
+ case CFN_GOACC_DIM_POS:
/* Optimizing these two internal functions helps the loop
optimizer eliminate outer comparisons. Size is [1,N]
and pos is [0,N-1]. */
{
- bool is_pos = ifn_code == IFN_GOACC_DIM_POS;
+ bool is_pos = cfn == CFN_GOACC_DIM_POS;
int axis = get_oacc_ifn_dim_arg (stmt);
int size = get_oacc_fn_dim_size (current_function_decl, axis);