vr-values: Avoid ICEs on large _BitInt cast to floating point [PR112901]
commitb5cfbb8f4cceb621d6812eec3e0fb876b648241c
authorJakub Jelinek <jakub@redhat.com>
Fri, 8 Dec 2023 08:02:15 +0000 (8 09:02 +0100)
committerJakub Jelinek <jakub@redhat.com>
Fri, 8 Dec 2023 08:02:15 +0000 (8 09:02 +0100)
tree49a108e298046a33cbfa9acac6a8c215cbcf16e1
parent8f60f5499e10d19218cada082e0909516ebf0e74
vr-values: Avoid ICEs on large _BitInt cast to floating point [PR112901]

For casts from integers to floating point,
simplify_float_conversion_using_ranges uses SCALAR_INT_TYPE_MODE
and queries optabs on the optimization it wants to make.

That doesn't really work for large/huge BITINT_TYPE, those have BLKmode
which is not scalar int mode.  Querying an optab is not useful for that
either.

I think it is best to just skip this optimization for those bitints,
after all, bitint lowering uses ranges already to determine minimum
precision for bitint operands of the integer to float casts.

2023-12-08  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/112901
* vr-values.cc
(simplify_using_ranges::simplify_float_conversion_using_ranges):
Return false if rhs1 has BITINT_TYPE type with BLKmode TYPE_MODE.

* gcc.dg/bitint-51.c: New test.
gcc/testsuite/gcc.dg/bitint-51.c [new file with mode: 0644]
gcc/vr-values.cc