]> git.ipfire.org Git - thirdparty/gcc.git/commit
Widening-Mul: Support unsigned scalar SAT_MUL 2
authorPan Li <pan2.li@intel.com>
Fri, 1 Aug 2025 02:42:23 +0000 (10:42 +0800)
committerPan Li <pan2.li@intel.com>
Mon, 11 Aug 2025 13:10:09 +0000 (21:10 +0800)
commit7d2daedde2a4ec620735d84610b05203a9cc2606
tree3a91a2f6988d46fab30d804dc2d5a26c26ee3cbd
parentdeb0a4c80414697d07e808b1d2500229eb281600
Widening-Mul: Support unsigned scalar SAT_MUL 2

For mul_overflow api, we will have PHI node similar as below:

  _6 = .MUL_OVERFLOW (a_4(D), b_5(D));
  _2 = IMAGPART_EXPR <_6>;
  if (_2 != 0)
    goto <bb 4>; [35.00%]
  else
    goto <bb 3>; [65.00%]

  <bb 3> [local count: 697932184]:
  _1 = REALPART_EXPR <_6>;

  <bb 4> [local count: 1073741824]:
  # _3 = PHI <18446744073709551615(2), _1(3)>

Based on the help of match.pd pattern match, the widening-mul will
try to convert it to below:

  _3 = .SAT_MUL (a_4(D), b_5(D));

gcc/ChangeLog:

* tree-ssa-math-opts.cc (match_saturation_mul): Add new func
to emit IFN_SAT_MUL if matched.
(math_opts_dom_walker::after_dom_children): Try to match
the phi node for SAT_MUL.

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/tree-ssa-math-opts.cc