diff options
author | Xi Ruoyao <xry111@xry111.site> | 2023-07-06 23:08:57 +0800 |
---|---|---|
committer | Xi Ruoyao <xry111@xry111.site> | 2023-07-10 18:34:38 +0800 |
commit | 63ae6bc60c0f67fb2791991bf4b6e7e0a907d420 (patch) | |
tree | ed267a90eeae0875f4eb7cbd9a2ec61faca7cb91 /libgcc | |
parent | 12b78b0b42d53019eb2c500d386094194e90ad16 (diff) | |
download | gcc-63ae6bc60c0f67fb2791991bf4b6e7e0a907d420.zip gcc-63ae6bc60c0f67fb2791991bf4b6e7e0a907d420.tar.gz gcc-63ae6bc60c0f67fb2791991bf4b6e7e0a907d420.tar.bz2 |
vect: Fix vectorized BIT_FIELD_REF for signed bit-fields [PR110557]
If a bit-field is signed and it's wider than the output type, we must
ensure the extracted result sign-extended. But this was not handled
correctly.
For example:
int x : 8;
long y : 55;
bool z : 1;
The vectorized extraction of y was:
vect__ifc__49.29_110 =
MEM <vector(2) long unsigned int> [(struct Item *)vectp_a.27_108];
vect_patt_38.30_112 =
vect__ifc__49.29_110 & { 9223372036854775552, 9223372036854775552 };
vect_patt_39.31_113 = vect_patt_38.30_112 >> 8;
vect_patt_40.32_114 =
VIEW_CONVERT_EXPR<vector(2) long int>(vect_patt_39.31_113);
This is obviously incorrect. This pach has implemented it as:
vect__ifc__25.16_62 =
MEM <vector(2) long unsigned int> [(struct Item *)vectp_a.14_60];
vect_patt_31.17_63 =
VIEW_CONVERT_EXPR<vector(2) long int>(vect__ifc__25.16_62);
vect_patt_32.18_64 = vect_patt_31.17_63 << 1;
vect_patt_33.19_65 = vect_patt_32.18_64 >> 9;
gcc/ChangeLog:
PR tree-optimization/110557
* tree-vect-patterns.cc (vect_recog_bitfield_ref_pattern):
Ensure the output sign-extended if necessary.
gcc/testsuite/ChangeLog:
PR tree-optimization/110557
* g++.dg/vect/pr110557.cc: New test.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions