]> git.ipfire.org Git - thirdparty/gcc.git/commit
Match: Add unsigned SAT_MUL for form 7
authorPan Li <pan2.li@intel.com>
Tue, 25 Nov 2025 07:18:38 +0000 (15:18 +0800)
committerPan Li <pan2.li@intel.com>
Wed, 26 Nov 2025 02:40:02 +0000 (10:40 +0800)
commit09ca98e854dca41ae0987b878a1eaab59b31383d
tree001a74cb07e035843093a868f7675a47c4f4b4f2
parentd4e439f395e807f0f7606f92288db8be9852b2f4
Match: Add unsigned SAT_MUL for form 7

This patch would like to try to match the the unsigned
SAT_MUL form 7, aka below:

  #define DEF_SAT_U_MUL_FMT_7(NT, WT)             \
  NT __attribute__((noinline))                    \
  sat_u_mul_##NT##_from_##WT##_fmt_7 (NT a, NT b) \
  {                                               \
    WT x = (WT)a * (WT)b;                         \
    NT max = -1;                                  \
    bool overflow_p = x > (WT)(max);              \
    return -(NT)(overflow_p) | (NT)x;             \
  }

while WT is uint128_t, uint64_t, uint32_t and uint16_t, and
NT is uint64_t, uint32_t, uint16_t or uint8_t.

gcc/ChangeLog:

* match.pd: Add pattern for SAT_MUL form 7 include
mul and widen_mul.

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/match.pd