diff options
author | Pan Li <pan2.li@intel.com> | 2024-09-25 09:26:07 +0800 |
---|---|---|
committer | Pan Li <pan2.li@intel.com> | 2024-09-30 08:42:05 +0800 |
commit | 3f8b1b21f377427adbdfa4cbfc21b979eb49c9d3 (patch) | |
tree | 121b41b5616d686d85934adc80fa6d66f1df0306 /libjava/ChangeLog-2000 | |
parent | f0d0c56b88d909b64c43b1566230bda29c69ec65 (diff) | |
download | gcc-master.zip gcc-master.tar.gz gcc-master.tar.bz2 |
This patch would like to support the form 1 of the scalar signed
integer SAT_SUB. Aka below example:
Form 1:
#define DEF_SAT_S_SUB_FMT_1(T, UT, MIN, MAX) \
T __attribute__((noinline)) \
sat_s_sub_##T##_fmt_1 (T x, T y) \
{ \
T minus = (UT)x - (UT)y; \
return (x ^ y) >= 0 \
? minus \
: (minus ^ x) >= 0 \
? minus \
: x < 0 ? MIN : MAX; \
}
DEF_SAT_S_SUB_FMT_1(int8_t, uint8_t, INT8_MIN, INT8_MAX)
Before this patch:
4 │ __attribute__((noinline))
5 │ int8_t sat_s_sub_int8_t_fmt_1 (int8_t x, int8_t y)
6 │ {
7 │ int8_t minus;
8 │ unsigned char x.0_1;
9 │ unsigned char y.1_2;
10 │ unsigned char _3;
11 │ signed char _4;
12 │ signed char _5;
13 │ int8_t _6;
14 │ _Bool _11;
15 │ signed char _12;
16 │ signed char _13;
17 │ signed char _14;
18 │ signed char _15;
19 │
20 │ ;; basic block 2, loop depth 0
21 │ ;; pred: ENTRY
22 │ x.0_1 = (unsigned char) x_7(D);
23 │ y.1_2 = (unsigned char) y_8(D);
24 │ _3 = x.0_1 - y.1_2;
25 │ minus_9 = (int8_t) _3;
26 │ _4 = x_7(D) ^ y_8(D);
27 │ _5 = x_7(D) ^ minus_9;
28 │ _15 = _4 & _5;
29 │ if (_15 < 0)
30 │ goto <bb 3>; [41.00%]
31 │ else
32 │ goto <bb 4>; [59.00%]
33 │ ;; succ: 3
34 │ ;; 4
35 │
36 │ ;; basic block 3, loop depth 0
37 │ ;; pred: 2
38 │ _11 = x_7(D) < 0;
39 │ _12 = (signed char) _11;
40 │ _13 = -_12;
41 │ _14 = _13 ^ 127;
42 │ ;; succ: 4
43 │
44 │ ;; basic block 4, loop depth 0
45 │ ;; pred: 2
46 │ ;; 3
47 │ # _6 = PHI <minus_9(2), _14(3)>
48 │ return _6;
49 │ ;; succ: EXIT
50 │
51 │ }
After this patch:
4 │ __attribute__((noinline))
5 │ int8_t sat_s_sub_int8_t_fmt_1 (int8_t x, int8_t y)
6 │ {
7 │ int8_t _6;
8 │
9 │ ;; basic block 2, loop depth 0
10 │ ;; pred: ENTRY
11 │ _6 = .SAT_SUB (x_7(D), y_8(D)); [tail call]
12 │ return _6;
13 │ ;; succ: EXIT
14 │
15 │ }
The below test suites are passed for this patch.
* The rv64gcv fully regression test.
* The x86 bootstrap test.
* The x86 fully regression test.
gcc/ChangeLog:
* match.pd: Add case 1 matching pattern for signed SAT_SUB.
* tree-ssa-math-opts.cc (gimple_signed_integer_sat_sub): Add new
decl for generated SAT_SUB matching func.
(match_unsigned_saturation_sub): Rename from...
(match_saturation_sub): ...Rename to and add signed SAT_SUB matching.
(math_opts_dom_walker::after_dom_children): Leverage the named
match func for both the unsigned and signed SAT_SUB.
Signed-off-by: Pan Li <pan2.li@intel.com>
Diffstat (limited to 'libjava/ChangeLog-2000')
0 files changed, 0 insertions, 0 deletions