]> git.ipfire.org Git - thirdparty/gcc.git/commit
SSA MATH: Support COND_LEN_FMA for floating-point math optimization
authorJu-Zhe Zhong <juzhe.zhong@rivai.ai>
Thu, 13 Jul 2023 08:54:34 +0000 (16:54 +0800)
committerPan Li <pan2.li@intel.com>
Thu, 13 Jul 2023 13:46:58 +0000 (21:46 +0800)
commit834f34947b20b18696487fc5d2bccab5ea720351
treebfcca51b61e8b18ab658771b8ad9a0dfd1266e3f
parent6f0b0cdb8a2b169169697c5ca533a676d0da4089
SSA MATH: Support COND_LEN_FMA for floating-point math optimization

Hi, Richard and Richi.

Previous patch we support COND_LEN_* binary operations. However, we didn't
support COND_LEN_* ternary.

Now, this patch support COND_LEN_* ternary. Consider this following case:

  __attribute__ ((noipa)) void ternop_##TYPE (TYPE *__restrict dst,            \
      TYPE *__restrict a,              \
      TYPE *__restrict b,\
                TYPE *__restrict c, int n)       \
  {                                                                            \
    for (int i = 0; i < n; i++)                                                \
      dst[i] += a[i] * b[i];                                                   \
  }

TEST_ALL ()

Before this patch:
...
COND_LEN_MUL
COND_LEN_ADD

Afther this patch:
...
COND_LEN_FMA

gcc/ChangeLog:

* genmatch.cc (commutative_op): Add COND_LEN_*
* internal-fn.cc (first_commutative_argument): Ditto.
(CASE): Ditto.
(get_unconditional_internal_fn): Ditto.
(can_interpret_as_conditional_op_p): Ditto.
(internal_fn_len_index): Ditto.
* internal-fn.h (can_interpret_as_conditional_op_p): Ditt.
* tree-ssa-math-opts.cc (convert_mult_to_fma_1): Ditto.
(convert_mult_to_fma): Ditto.
(math_opts_dom_walker::after_dom_children): Ditto.
gcc/genmatch.cc
gcc/internal-fn.cc
gcc/internal-fn.h
gcc/tree-ssa-math-opts.cc