Match: Support IMM=max-1 for unsigned scalar .SAT_SUB IMM form 1
This patch would like to support .SAT_SUB when one of the op
is IMM = max - 1 of form1.
Form 1:
#define DEF_SAT_U_SUB_IMM_FMT_1(T, IMM) \
T __attribute__((noinline)) \
sat_u_sub_imm##IMM##_##T##_fmt_1 (T y) \
{ \
return IMM >= y ? IMM - y : 0; \
}
Take below form 1 as example:
DEF_SAT_U_SUB_IMM_FMT_1(uint8_t, 254)
Before this patch:
__attribute__((noinline))
uint8_t sat_u_sub_imm254_uint8_t_fmt_1 (uint8_t y)
{
uint8_t _1;
uint8_t _3;
<bb 2> [local count: 1073741824]:
if (y_2(D) != 255)
goto <bb 3>; [66.00%]
else
goto <bb 4>; [34.00%]
<bb 3> [local count: 708669600]:
_3 = 254 - y_2(D);
<bb 4> [local count: 1073741824]:
# _1 = PHI <0(2), _3(3)>
return _1;
}
After this patch:
__attribute__((noinline))
uint8_t sat_u_sub_imm254_uint8_t_fmt_1 (uint8_t y)
{
uint8_t _1;
<bb 2> [local count: 1073741824]:
_1 = .SAT_SUB (254, y_2(D)); [tail call]
return _1;
}
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: Support IMM=max-1.
Loading
Please register or sign in to comment