[PATCH] D95447: [RISCV] Add support for RVV int<->fp & fp<->fp conversions

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 27 13:24:59 PST 2021


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:850
+    MVT SrcEltVT = Src.getSimpleValueType().getVectorElementType();
+    uint64_t EltSize = EltVT.getSizeInBits();
+    uint64_t SrcEltSize = SrcEltVT.getSizeInBits();
----------------
frasercrmck wrote:
> craig.topper wrote:
> > frasercrmck wrote:
> > > craig.topper wrote:
> > > > getSizeInBits returns an unsigned.
> > > Correct me if I'm wrong, but since it returns `TypeSize`, it returns `uint64_t` as its underlying `ScalarTy` as per:
> > > 
> > > ```
> > > // This class is used to represent the size of types. If the type is of fixed
> > > class TypeSize;
> > > template <> struct LinearPolyBaseTypeTraits<TypeSize> {
> > >   using ScalarTy = uint64_t;
> > >   static constexpr unsigned Dimensions = 2;
> > > };
> > > ```
> > > 
> > > (Interestingly the comment trails off there. Might need to fix that up)
> > It used to return unsigned before TypeSize was introduced. I guess I'm used to seeing unsigned everywhere. Sorry for the noise.
> No worries. Having a wee look, I think there are a few places we explicitly use `unsigned` which we can clear up for posterity.
unsigned is of course more efficient when the compiler is built to run on a 32 bit CPU. And vectors and especially their elements are never going to need 64 bits to represent.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95447/new/

https://reviews.llvm.org/D95447



More information about the llvm-commits mailing list