[PATCH] D102493: [RISCV] Expand unaligned fixed-length vector memory accesses

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 17 07:36:04 PDT 2021


frasercrmck marked 2 inline comments as done.
frasercrmck added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h:107
 
+    if (Alignment < DL.getTypeStoreSize(DataType->getScalarType()))
+      return false;
----------------
craig.topper wrote:
> Does the project intend to eventually remove the implicit cast to unsigned from TypeSize? If so should this call getFixedSize() before doing the compare?
Good spot! My understanding is that the implicit cast is not long for this world. I've added the call to `getFixedSize()`.


================
Comment at: llvm/test/Analysis/CostModel/RISCV/fixed-vector-gather.ll:8
 ; CHECK-LABEL: 'masked_gather'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V8F64 = call <8 x double> @llvm.masked.gather.v8f64.v8p0f64(<8 x double*> undef, i32 1, <8 x i1> undef, <8 x double> undef)
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V4F64 = call <4 x double> @llvm.masked.gather.v4f64.v4p0f64(<4 x double*> undef, i32 1, <4 x i1> undef, <4 x double> undef)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %V8F64 = call <8 x double> @llvm.masked.gather.v8f64.v8p0f64(<8 x double*> undef, i32 1, <8 x i1> undef, <8 x double> undef)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %V4F64 = call <4 x double> @llvm.masked.gather.v4f64.v4p0f64(<4 x double*> undef, i32 1, <4 x i1> undef, <4 x double> undef)
----------------
craig.topper wrote:
> frasercrmck wrote:
> > I just updated these tests naively, @craig.topper, but since I suspect the intention was only to test well-aligned values, perhaps we should add additional cases?
> Yeah I think we should have additional tests. I'm not sure why I got the alignment right on some tests but not others.
I've added those now. I pre-committed the updated alignment for these existing cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102493



More information about the llvm-commits mailing list