[RISCV] Update the computeKnownBitsForTargetNode for RISCVISD::READ_VLENB to consider...
authorCraig Topper <craig.topper@sifive.com>
Mon, 31 Jan 2022 17:08:05 +0000 (09:08 -0800)
committerCraig Topper <craig.topper@sifive.com>
Mon, 31 Jan 2022 17:13:14 +0000 (09:13 -0800)
commit09606d6a635b15ae08d596bedaa5bd88d7f8ea1a
tree3c13f17903ef9356f6e2021d8f3c3aff5758b9ac
parent23f73ff5f6fd665b94459f922e1fdd48d1ffb68b
[RISCV] Update the computeKnownBitsForTargetNode for RISCVISD::READ_VLENB to consider Zve/Zvl.

We had previously hardcoded this to assume that vector registers
are 128 bits. This was true when only V existed, but after Zve
extensions were added this became incorrect.

This patch adjusts it to support 128, 64, or 32 bit vectors depending
on Zvl. The 128-bit limit is artificial, but we don't have any test
coverage showing that we larger values so I was being conservative.

None of our lit tests depend on this code today due to the custom
lowering of ISD::VSCALE that inserts the appropriate left or right
shift to convert from VLENB to VSCALE. That code was added after
this code in computeKnownBitsForTargetNode.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D118582
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVSubtarget.h