+2023-02-23 Andrew Stubbs <ams@codesourcery.com>
+
+ Backport from mainline:
+ PR tree-optimization/108888
+ * tree-if-conv.cc (if_convertible_stmt_p): Set PLF_2 on
+ calls to predicate.
+ (predicate_statements): Only predicate calls with PLF_2.
+
2023-02-23 Andrew Stubbs <ams@codesourcery.com>
* internal-fn.cc (expand_MASK_CALL): New.
+2023-02-23 Andrew Stubbs <ams@codesourcery.com>
+
+ Backport from mainline:
+ * g++.dg/torture/pr108888.C: New testcase.
+
2023-02-23 Andrew Stubbs <ams@codesourcery.com>
* gcc.dg/vect/vect-simd-clone-16.c: New test.
--- /dev/null
+// { dg-do compile }
+
+int scaleValueSaturate_scalefactor, scaleValueSaturate___trans_tmp_2,
+ scaleValuesSaturate_i;
+int scaleValueSaturate(int value) {
+ int result = __builtin_clz(value);
+ if (value)
+ if (-result <= scaleValueSaturate_scalefactor)
+ return 0;
+ return scaleValueSaturate___trans_tmp_2;
+}
+short scaleValuesSaturate_dst;
+short *scaleValuesSaturate_src;
+void scaleValuesSaturate() {
+ for (; scaleValuesSaturate_i; scaleValuesSaturate_i++)
+ scaleValuesSaturate_dst =
+ scaleValueSaturate(scaleValuesSaturate_src[scaleValuesSaturate_i]);
+}
n = n->simdclone->next_clone)
if (n->simdclone->inbranch)
{
+ gimple_set_plf (stmt, GF_PLF_2, true);
need_to_predicate = true;
return true;
}
release_defs (stmt);
continue;
}
- else if (gimple_plf (stmt, GF_PLF_2))
+ else if (gimple_plf (stmt, GF_PLF_2)
+ && is_gimple_assign (stmt))
{
tree lhs = gimple_assign_lhs (stmt);
tree mask;
gimple_assign_set_rhs1 (stmt, ifc_temp_var (type, rhs, &gsi));
update_stmt (stmt);
}
-
- /* Convert functions that have a SIMD clone to IFN_MASK_CALL. This
- will cause the vectorizer to match the "in branch" clone variants,
- and serves to build the mask vector in a natural way. */
- gcall *call = dyn_cast <gcall *> (gsi_stmt (gsi));
- if (call && !gimple_call_internal_p (call))
+ else if (gimple_plf (stmt, GF_PLF_2)
+ && is_gimple_call (stmt))
{
+ /* Convert functions that have a SIMD clone to IFN_MASK_CALL.
+ This will cause the vectorizer to match the "in branch"
+ clone variants, and serves to build the mask vector
+ in a natural way. */
+ gcall *call = dyn_cast <gcall *> (gsi_stmt (gsi));
tree orig_fn = gimple_call_fn (call);
int orig_nargs = gimple_call_num_args (call);
auto_vec<tree> args;