-
- Downloads
Vect: Support IFN SAT_TRUNC for unsigned vector int
This patch would like to support the .SAT_TRUNC for the unsigned
vector int. Given we have below example code:
Form 1
#define VEC_DEF_SAT_U_TRUC_FMT_1(NT, WT) \
void __attribute__((noinline)) \
vec_sat_u_truc_##WT##_to_##NT##_fmt_1 (NT *x, WT *y, unsigned limit) \
{ \
for (unsigned i = 0; i < limit; i++) \
{ \
bool overflow = y[i] > (WT)(NT)(-1); \
x[i] = ((NT)y[i]) | (NT)-overflow; \
} \
}
VEC_DEF_SAT_U_TRUC_FMT_1 (uint32_t, uint64_t)
Before this patch:
void vec_sat_u_truc_uint64_t_to_uint32_t_fmt_1 (uint32_t * x, uint64_t * y, unsigned int limit)
{
...
_51 = .SELECT_VL (ivtmp_49, POLY_INT_CST [2, 2]);
ivtmp_35 = _51 * 8;
vect__4.7_32 = .MASK_LEN_LOAD (vectp_y.5_34, 64B, { -1, ... }, _51, 0);
mask_overflow_16.8_30 = vect__4.7_32 > { 4294967295, ... };
vect__5.9_29 = (vector([2,2]) unsigned int) vect__4.7_32;
vect__10.13_20 = .VCOND_MASK (mask_overflow_16.8_30, { 4294967295, ... }, vect__5.9_29);
ivtmp_12 = _51 * 4;
.MASK_LEN_STORE (vectp_x.14_11, 32B, { -1, ... }, _51, 0, vect__10.13_20);
vectp_y.5_33 = vectp_y.5_34 + ivtmp_35;
vectp_x.14_46 = vectp_x.14_11 + ivtmp_12;
ivtmp_50 = ivtmp_49 - _51;
if (ivtmp_50 != 0)
...
}
After this patch:
void vec_sat_u_truc_uint64_t_to_uint32_t_fmt_1 (uint32_t * x, uint64_t * y, unsigned int limit)
{
...
_12 = .SELECT_VL (ivtmp_21, POLY_INT_CST [2, 2]);
ivtmp_34 = _12 * 8;
vect__4.7_31 = .MASK_LEN_LOAD (vectp_y.5_33, 64B, { -1, ... }, _12, 0);
vect_patt_40.8_30 = .SAT_TRUNC (vect__4.7_31); // << .SAT_TRUNC
ivtmp_29 = _12 * 4;
.MASK_LEN_STORE (vectp_x.9_28, 32B, { -1, ... }, _12, 0, vect_patt_40.8_30);
vectp_y.5_32 = vectp_y.5_33 + ivtmp_34;
vectp_x.9_27 = vectp_x.9_28 + ivtmp_29;
ivtmp_20 = ivtmp_21 - _12;
if (ivtmp_20 != 0)
...
}
The below test suites are passed for this patch
* The x86 bootstrap test.
* The x86 fully regression test.
* The rv64gcv fully regression tests.
gcc/ChangeLog:
* tree-vect-patterns.cc (gimple_unsigned_integer_sat_trunc): Add
new decl generated by match.
(vect_recog_sat_trunc_pattern): Add new func impl to recog the
.SAT_TRUNC pattern.
Signed-off-by:
Pan Li <pan2.li@intel.com>
Loading
Please register or sign in to comment