aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorxuli <xuli1@eswincomputing.com>2024-12-27 07:03:14 +0000
committerxuli <xuli1@eswincomputing.com>2025-05-27 02:35:40 +0000
commit7cf7149ec8303d0ed828fb7629417b28e6565d32 (patch)
tree782bd70fa1c6ff783278562b29a824eeebec51fd /libgcc
parent15e55f3fb559fad1acaaadb57561a15c42c20c7d (diff)
downloadgcc-7cf7149ec8303d0ed828fb7629417b28e6565d32.zip
gcc-7cf7149ec8303d0ed828fb7629417b28e6565d32.tar.gz
gcc-7cf7149ec8303d0ed828fb7629417b28e6565d32.tar.bz2
Match:Support IMM=-1 for signed scalar SAT_ADD IMM form1
This patch would like to support .SAT_ADD when IMM=-1. Form1: T __attribute__((noinline)) \ sat_s_add_imm_##T##_fmt_1##_##INDEX (T x) \ { \ T sum = (UT)x + (UT)IMM; \ return (x ^ IMM) < 0 \ ? sum \ : (sum ^ x) >= 0 \ ? sum \ : x < 0 ? MIN : MAX; \ } Take below form1 as example: DEF_SAT_S_ADD_IMM_FMT_1(0, int8_t, uint8_t, -1, INT8_MIN, INT8_MAX) Before this patch: __attribute__((noinline)) int8_t sat_s_add_imm_int8_t_fmt_1_0 (int8_t x) { unsigned char x.0_1; unsigned char _2; unsigned char _3; int8_t iftmp.1_4; signed char _8; unsigned char _9; signed char _10; <bb 2> [local count: 1073741824]: x.0_1 = (unsigned char) x_5(D); _3 = -x.0_1; _10 = (signed char) _3; _8 = x_5(D) & _10; if (_8 < 0) goto <bb 4>; [1.40%] else goto <bb 3>; [98.60%] <bb 3> [local count: 434070867]: _2 = x.0_1 + 255; <bb 4> [local count: 1073741824]: # _9 = PHI <_2(3), 128(2)> iftmp.1_4 = (int8_t) _9; return iftmp.1_4; } After this patch: __attribute__((noinline)) int8_t sat_s_add_imm_int8_t_fmt_1_0 (int8_t x) { int8_t _4; <bb 2> [local count: 1073741824]: gimple_call <.SAT_ADD, _4, x_5(D), 255> [tail call] gimple_return <_4> } The below test suites are passed for this patch: 1. The rv64gcv fully regression tests. 2. The x86 bootstrap tests. 3. The x86 fully regression tests. Signed-off-by: Li Xu <xuli1@eswincomputing.com> gcc/ChangeLog: * match.pd: Add signed scalar SAT_ADD IMM form1 with IMM=-1 matching. * tree-ssa-math-opts.cc (match_unsigned_saturation_add): Adapt function name. (match_saturation_add_with_assign): Match signed and unsigned SAT_ADD with assign. (math_opts_dom_walker::after_dom_children): Match imm=-1 signed SAT_ADD with NOP_EXPR case.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions