diff options
author | Djordje Todorovic <djolertrk@gmail.com> | 2023-07-19 11:25:51 +0200 |
---|---|---|
committer | Djordje Todorovic <djordje.todorovic@syrmia.com> | 2023-07-19 16:22:04 +0200 |
commit | 80e20c8a8d074cd4053d9dbfd675025a28240c85 (patch) | |
tree | 5f4350df710e0b00388120d3354c55558dcb0a1b /libc | |
parent | be6e9df11f880ab128aef6550c6911d9f091e7d7 (diff) | |
download | llvm-80e20c8a8d074cd4053d9dbfd675025a28240c85.zip llvm-80e20c8a8d074cd4053d9dbfd675025a28240c85.tar.gz llvm-80e20c8a8d074cd4053d9dbfd675025a28240c85.tar.bz2 |
[RISCV] Add DAG combine for CTTZ/CTLZ in the case of input 0
Within the AggressiveInstCombine Pass we have
an analysis/optimization that matches that
pattern of the Table Based CTZ. Some Targets do
not support/define ctz(0), but since the
AggressiveInstCombine is just an extension of
InstCombine, it should be a target-independent
canonicalization Pass, and therefore, we decided
to introduce several instructions, such as select
and compare that produce canonical IR, even if
the input is 0. The task for the Targets that do
support that input is to handle such a case and
to produce an optimal assembly.
This patch optimizes the CTTZ/CTLZ instructions
if the input is 0 by performing the`DAG combine`,
by generating the cttz(x) & 0x1f pattern (the
same goes for ctlz as well).
Differential Revision: https://reviews.llvm.org/D151449
Diffstat (limited to 'libc')
0 files changed, 0 insertions, 0 deletions