diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-02-07 10:59:06 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2024-02-07 10:59:06 +0100 |
commit | 29998cc8a21b3a52f706275923166cd1f95d0555 (patch) | |
tree | 2a8c151e4049b2416eba2d90aa197ec85b0e0d87 /gcc/tree-vect-loop.cc | |
parent | 6e308d5f71a91225946c199e69708adc92404975 (diff) | |
download | gcc-29998cc8a21b3a52f706275923166cd1f95d0555.zip gcc-29998cc8a21b3a52f706275923166cd1f95d0555.tar.gz gcc-29998cc8a21b3a52f706275923166cd1f95d0555.tar.bz2 |
range-op: Fix up ABSU_EXPR handling [PR113756]
ABSU_EXPR unary expr is special because it has a signed integer
argument and unsigned integer result (of the same precision).
The following testcase is miscompiled since ABSU_EXPR handling has
been added to range-op because it uses widest_int::from with the
result sign (i.e. UNSIGNED) rather than the operand sign (i.e. SIGNED),
so e.g. for the 32-bit int argument mask ends up 0xffffffc1 or something
similar and even when it has most significant bit in the precision set,
in widest_int (tree-ssa-ccp.cc really should stop using widest_int, but
that is I think stage1 task) it doesn't appear to be negative and so
bit_value_unop ABSU_EXPR doesn't set the resulting mask/value from
oring of the argument and its negation.
Fixed thusly, not doing that for GIMPLE_BINARY_RHS because I don't know
about a binary op that would need something similar.
2024-02-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/113756
* range-op.cc (update_known_bitmask): For GIMPLE_UNARY_RHS,
use TYPE_SIGN (lh.type ()) instead of sign for widest_int::from
of lh_bits value and mask.
* gcc.dg/pr113756.c: New test.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
0 files changed, 0 insertions, 0 deletions