aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/call.cc14
-rw-r--r--gcc/cp/cp-gimplify.cc4
2 files changed, 16 insertions, 2 deletions
diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc
index 4516677..709fd74 100644
--- a/gcc/cp/call.cc
+++ b/gcc/cp/call.cc
@@ -9290,7 +9290,9 @@ convert_for_arg_passing (tree type, tree val, tsubst_flags_t complain)
This is true for some builtins which don't act like normal functions.
Return 2 if just decay_conversion and removal of excess precision should
be done, 1 if just decay_conversion. Return 3 for special treatment of
- the 3rd argument for __builtin_*_overflow_p. */
+ the 3rd argument for __builtin_*_overflow_p. Return 4 for special
+ treatment of the 1st argument for
+ __builtin_{clz,ctz,clrsb,ffs,parity,popcount}g. */
int
magic_varargs_p (tree fn)
@@ -9317,6 +9319,14 @@ magic_varargs_p (tree fn)
case BUILT_IN_FPCLASSIFY:
return 2;
+ case BUILT_IN_CLZG:
+ case BUILT_IN_CTZG:
+ case BUILT_IN_CLRSBG:
+ case BUILT_IN_FFSG:
+ case BUILT_IN_PARITYG:
+ case BUILT_IN_POPCOUNTG:
+ return 4;
+
default:
return lookup_attribute ("type generic",
TYPE_ATTRIBUTES (TREE_TYPE (fn))) != 0;
@@ -10122,7 +10132,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
for (; arg_index < vec_safe_length (args); ++arg_index)
{
tree a = (*args)[arg_index];
- if (magic == 3 && arg_index == 2)
+ if ((magic == 3 && arg_index == 2) || (magic == 4 && arg_index == 0))
{
/* Do no conversions for certain magic varargs. */
a = mark_type_use (a);
diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc
index 9375a11..795c811 100644
--- a/gcc/cp/cp-gimplify.cc
+++ b/gcc/cp/cp-gimplify.cc
@@ -771,6 +771,10 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
default:
break;
}
+ else if (decl
+ && fndecl_built_in_p (decl, BUILT_IN_CLZG, BUILT_IN_CTZG))
+ ret = (enum gimplify_status) c_gimplify_expr (expr_p, pre_p,
+ post_p);
}
break;