diff options
author | Alexandre Oliva <oliva@adacore.com> | 2025-01-13 10:49:51 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2025-01-13 10:49:51 -0300 |
commit | 52e4ede030979d8aff2f88364e1d11c61fb212aa (patch) | |
tree | 9c9643ca8af1111b1cda7faee40ec1a9a5de3dab /libiberty/simple-object-xcoff.c | |
parent | 41a5a97dba6873d928675fd789a2d884c6d20a8d (diff) | |
download | gcc-52e4ede030979d8aff2f88364e1d11c61fb212aa.zip gcc-52e4ede030979d8aff2f88364e1d11c61fb212aa.tar.gz gcc-52e4ede030979d8aff2f88364e1d11c61fb212aa.tar.bz2 |
[ifcombine] propagate signbit mask to XOR right-hand operand
If a single-bit bitfield takes up the sign bit of a storage unit,
comparing the corresponding bitfield between two objects loads the
storage units, XORs them, converts the result to signed char, and
compares it with zero: ((signed char)(a.<byte> ^ c.<byte>) >= 0).
fold_truth_andor_for_ifcombine recognizes the compare with zero as a
sign bit test, then it decomposes the XOR into an equality test.
The problem is that, after this decomposition, that figures out the
width of the accessed fields, we apply the sign bit mask to the
left-hand operand of the compare, but we failed to also apply it to
the right-hand operand when both were taken from the same XOR.
This patch fixes that.
for gcc/ChangeLog
PR tree-optimization/118409
* gimple-fold.cc (fold_truth_andor_for_ifcombine): Apply the
signbit mask to the right-hand XOR operand too.
for gcc/testsuite/ChangeLog
PR tree-optimization/118409
* gcc.dg/field-merge-20.c: New.
Diffstat (limited to 'libiberty/simple-object-xcoff.c')
0 files changed, 0 insertions, 0 deletions