diff options
author | Tamar Christina <tamar.christina@arm.com> | 2023-03-12 18:42:04 +0000 |
---|---|---|
committer | Tamar Christina <tamar.christina@arm.com> | 2023-03-12 18:42:04 +0000 |
commit | 81fd62d1378b7ddc1fa0967cbddcdcdcdd2d8d8c (patch) | |
tree | 3a6881be284bf7e9dbcb377959334cc7f2caeed4 /libgcc | |
parent | 0b3c630fcc44063a61f6131af48a4171b1de2b37 (diff) | |
download | gcc-81fd62d1378b7ddc1fa0967cbddcdcdcdd2d8d8c.zip gcc-81fd62d1378b7ddc1fa0967cbddcdcdcdd2d8d8c.tar.gz gcc-81fd62d1378b7ddc1fa0967cbddcdcdcdd2d8d8c.tar.bz2 |
middle-end: Implement preferred_div_as_shifts_over_mult [PR108583]
This now implements a hook
preferred_div_as_shifts_over_mult that indicates whether a target prefers that
the vectorizer decomposes division as shifts rather than multiplication when
possible.
In order to be able to use this we need to check whether the current precision
has enough bits to do the operation without any of the additions overflowing.
We use range information to determine this and only do the operation if we're
sure am overflow won't occur. This now uses ranger to do this range check.
This seems to work better than vect_get_range_info which uses range_query, but I
have not switched the interface of vect_get_range_info over in this PR fix.
As Andy said before initializing a ranger instance is cheap but not free, and if
the intention is to call it often during a pass it should be instantiated at
pass startup and passed along to the places that need it. This is a big
refactoring and doesn't seem right to do in this PR. But we should in GCC 14.
Currently we only instantiate it after a long series of much cheaper checks.
gcc/ChangeLog:
PR target/108583
* target.def (preferred_div_as_shifts_over_mult): New.
* doc/tm.texi.in: Document it.
* doc/tm.texi: Regenerate.
* targhooks.cc (default_preferred_div_as_shifts_over_mult): New.
* targhooks.h (default_preferred_div_as_shifts_over_mult): New.
* tree-vect-patterns.cc (vect_recog_divmod_pattern): Use it.
gcc/testsuite/ChangeLog:
PR target/108583
* gcc.dg/vect/vect-div-bitmask-4.c: New test.
* gcc.dg/vect/vect-div-bitmask-5.c: New test.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions