[llvm] [RISCV][ISel] Remove redundant min/max in saturating truncation (PR #75145)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 12 00:34:16 PST 2023
sun-jacobi wrote:
> How can you use just vnsrl? vnsrl discards the upper bits without any max or min.
Yes, you are right.
But if the range created by a pair of max/min operation is precisely the range of the truncation destination,
then the pair could be removed.
In the below case, `[-128, 127]` is the value range of u8.
Since we truncate the u16 vector into a u8 vector, removing the max/min won't change the final result, AFAIU.
https://github.com/llvm/llvm-project/pull/75145
More information about the llvm-commits
mailing list