aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPan Li <pan2.li@intel.com>2024-07-05 20:36:35 +0800
committerPan Li <pan2.li@intel.com>2024-07-10 17:30:40 +0800
commit80e446e829d818dc19daa6e671b9626e93ee4949 (patch)
tree61552d9b715aab00ce0e78391fd7dcdd30c5ad85 /gcc/cp
parent1ae5fc24e86ecc9e7b60346d9ca2e56f83517bda (diff)
downloadgcc-80e446e829d818dc19daa6e671b9626e93ee4949.zip
gcc-80e446e829d818dc19daa6e671b9626e93ee4949.tar.gz
gcc-80e446e829d818dc19daa6e671b9626e93ee4949.tar.bz2
Match: Support form 2 for the .SAT_TRUNC
This patch would like to add form 2 support for the .SAT_TRUNC. Aka: Form 2: #define DEF_SAT_U_TRUC_FMT_2(NT, WT) \ NT __attribute__((noinline)) \ sat_u_truc_##WT##_to_##NT##_fmt_2 (WT x) \ { \ bool overflow = x > (WT)(NT)(-1); \ return overflow ? (NT)-1 : (NT)x; \ } DEF_SAT_U_TRUC_FMT_2(uint32, uint64) Before this patch: 3 │ 4 │ __attribute__((noinline)) 5 │ uint32_t sat_u_truc_uint64_t_to_uint32_t_fmt_2 (uint64_t x) 6 │ { 7 │ uint32_t _1; 8 │ long unsigned int _3; 9 │ 10 │ ;; basic block 2, loop depth 0 11 │ ;; pred: ENTRY 12 │ _3 = MIN_EXPR <x_2(D), 4294967295>; 13 │ _1 = (uint32_t) _3; 14 │ return _1; 15 │ ;; succ: EXIT 16 │ 17 │ } After this patch: 3 │ 4 │ __attribute__((noinline)) 5 │ uint32_t sat_u_truc_uint64_t_to_uint32_t_fmt_2 (uint64_t x) 6 │ { 7 │ uint32_t _1; 8 │ 9 │ ;; basic block 2, loop depth 0 10 │ ;; pred: ENTRY 11 │ _1 = .SAT_TRUNC (x_2(D)); [tail call] 12 │ return _1; 13 │ ;; succ: EXIT 14 │ 15 │ } The below test suites are passed for this patch: 1. The x86 bootstrap test. 2. The x86 fully regression test. 3. The rv64gcv fully regresssion test. gcc/ChangeLog: * match.pd: Add form 2 for .SAT_TRUNC. * tree-ssa-math-opts.cc (math_opts_dom_walker::after_dom_children): Add new case NOP_EXPR, and try to match SAT_TRUNC. Signed-off-by: Pan Li <pan2.li@intel.com>
Diffstat (limited to 'gcc/cp')
0 files changed, 0 insertions, 0 deletions