aboutsummaryrefslogtreecommitdiff
path: root/libcc1/marshall.cc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2024-07-19 19:09:37 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2024-07-19 19:09:37 +0100
commit348d890c287a7ec4c88d3082ae6105537bd39398 (patch)
tree48b755e45b01160ef360b3d74d83ed46d722e185 /libcc1/marshall.cc
parentebdad26ed9902c04704409b729d896a646188634 (diff)
Treat boolean vector elements as 0/-1 [PR115406]HEADtrunkmaster
Previously we built vector boolean constants using 1 for true elements and 0 for false elements. This matches the predicates produced by SVE's PTRUE instruction, but leads to a miscompilation on AVX, where all bits of a boolean element should be set. One option for RTL would be to make this target-configurable. But that isn't really possible at the tree level, where vectors should work in a more target-independent way. (There is currently no way to create a "generic" packed boolean vector, but never say never :)) And, if we were going to pick a generic behaviour, it would make sense to use 0/-1 rather than 0/1, for consistency with integer vectors. Both behaviours should work with SVE on read, since SVE ignores the upper bits in each predicate element. And the choice shouldn't make much difference for RTL, since all SVE predicate modes are expressed as vectors of BI, rather than of multi-bit booleans. I suspect there might be some fallout from this change on SVE. But I think we should at least give it a go, and see whether any fallout provides a strong counterargument against the approach. gcc/ PR middle-end/115406 * fold-const.cc (native_encode_vector_part): For vector booleans, check whether an element is nonzero and, if so, set all of the correspending bits in the target image. * simplify-rtx.cc (native_encode_rtx): Likewise. gcc/testsuite/ PR middle-end/115406 * gcc.dg/torture/pr115406.c: New test.
Diffstat (limited to 'libcc1/marshall.cc')
0 files changed, 0 insertions, 0 deletions