aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
diff options
context:
space:
mode:
authorVettel <924105575@qq.com>2023-09-17 17:11:28 +0800
committerGitHub <noreply@github.com>2023-09-17 17:11:28 +0800
commitddae50d1e6fd71b98a4abefeeebb7ad6ac3329c5 (patch)
treeeef84ac1c894b85b91e41c5cfce86b4ebdcb88dc /mlir/lib/Bytecode/Reader/BytecodeReader.cpp
parent2861ec84fce21c2ec9f33849e38661b9f4fe62e2 (diff)
downloadllvm-ddae50d1e6fd71b98a4abefeeebb7ad6ac3329c5.zip
llvm-ddae50d1e6fd71b98a4abefeeebb7ad6ac3329c5.tar.gz
llvm-ddae50d1e6fd71b98a4abefeeebb7ad6ac3329c5.tar.bz2
[RISCV] Combine trunc (sra sext (x), zext (y)) to sra (x, smin (y, scalarsizeinbits(y) - 1)) (#65728)
For RVV, If we want to perform an i8 or i16 element-wise vector arithmetic right shift in the upper C/C++ program, the value to be shifted would be first sign extended to i32, and the shift amount would also be zero_extended to i32 to perform the vsra.vv instruction, and followed by a truncate to get the final calculation result, such pattern will later expanded to a series of "vsetvli" and "vnsrl" instructions later, this is because the RVV spec only support 2 * SEW -> SEW truncate. But for vector, the shift amount can also be determined by smin (Y, ScalarSizeInBits(Y) - 1)). Also, for the vsra instruction, we only care about the low lg2(SEW) bits as the shift amount. - Alive2: https://alive2.llvm.org/ce/z/u3-Zdr - C++ Test cases : https://gcc.godbolt.org/z/q1qE7fbha
Diffstat (limited to 'mlir/lib/Bytecode/Reader/BytecodeReader.cpp')
0 files changed, 0 insertions, 0 deletions