[PATCH] D65930: [IntrinsicEmitter] Support scalable vectors in intrinsics

Cullen Rhodes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 07:59:41 PDT 2019


c-rhodes marked an inline comment as done.
c-rhodes added inline comments.


================
Comment at: test/Verifier/intrinsic-bad-arg-type.ll:7
+define <vscale x 16 x i8> @abs_i8(<vscale x 16 x i8> %a, <16 x i1> %pg, <vscale x 16 x i8> %b) {
+  %out = call <vscale x 16 x i8> @llvm.aarch64.sve.abs.nxv16i8(<vscale x 16 x i8> %a, <16 x i1> %pg, <vscale x 16 x i8> %b)
+  ret <vscale x 16 x i8> %out
----------------
c-rhodes wrote:
> sdesmalen wrote:
> > Can you also test this with `llvm.masked.load` ? If so, then you can leave abs/neg for D65931 and simplify this one.
> I've tried the following IR based on your suggestion but hit an assert with a debug build:
> ```
> define <vscale x 4 x i32> @masked_load(<vscale x 4 x i32>* %addr, <4 x i1> %mask, <vscale x 4 x i32> %dst) {
>   %res = call <vscale x 4 x i32> @llvm.masked.load.nxv4i32(<vscale x 4 x i32>* %addr, i32 4, <4 x i1> %mask, <vscale x 4 x i32> %dst)
>   ret <vscale x 4 x i32> %res
> }
> declare <vscale x 4 x i32> @llvm.masked.load.nxv4i32(<vscale x 4 x i32>*, i32, <4 x i1>, <vscale x 4 x i32>)```
> 
> Opt output:
> 
> ```
> opt -S -verify masked-load-scalable-mask.ll
> 
> opt: ./llvm/lib/IR/Instructions.cpp:405: void llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, const llvm::Twine&): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed.```
> 
> For the `abs` intrinsic test the same `Verifier` error is hit regardless of build type, the intrinsic definitions are similar with respect to the mask (`LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>`) so I'm not exactly sure what's going on here.
I fixed the issue I hit by specifying the intrinsic as `@llvm.masked.load.nxv4i32.p0nxv4i32`, wasn't aware the last bit was necessary but it brings the error handling inline with what I was seeing for the `abs` test. I've updated the patch.


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

https://reviews.llvm.org/D65930





More information about the llvm-commits mailing list