[all-commits] [llvm/llvm-project] 5280d3: [RISCV] Teach lowerCTLZ_CTTZ_ZERO_UNDEF to handle ...
Yeting Kuo via All-commits
all-commits at lists.llvm.org
Wed Jan 11 22:43:03 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 5280d3e7384835bb6ee797def32c98f30afaee98
https://github.com/llvm/llvm-project/commit/5280d3e7384835bb6ee797def32c98f30afaee98
Author: Yeting Kuo <yeting.kuo at sifive.com>
Date: 2023-01-12 (Thu, 12 Jan 2023)
Changed paths:
M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
M llvm/lib/Target/RISCV/RISCVISelLowering.h
M llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
M llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
M llvm/test/CodeGen/RISCV/rvv/ctlz-sdnode.ll
M llvm/test/CodeGen/RISCV/rvv/cttz-sdnode.ll
M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-ctlz.ll
M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-cttz.ll
Log Message:
-----------
[RISCV] Teach lowerCTLZ_CTTZ_ZERO_UNDEF to handle conversion i32/i64 vectors to f32 vectors.
Previously lowerCTLZ_CTTZ_ZERO_UNDEF converted the source to float value by
ISD::UINT_TO_FP. ISD::UINT_TO_FP uses dynamic rounding mode, so the rounding
may make the exponent of the result not as expected when converting i32/i64 to f32.
This is the reason why we constrained lowerCTLZ_CTTZ_ZERO_UNDEF to only handle
an i32 source when the f64 type having the same element count as source is legal.
The patch teaches lowerCTLZ_CTTZ_ZERO_UNDEF converts i32/i64 vectors to f32
vectors by vfcvt.f.xu.v with RTZ rounding mode. Using RTZ is to make sure the
exponent of results is correct, although f32 could not totally represent each
value in i32/i64.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D140782
More information about the All-commits
mailing list