[PATCH] D104573: [AArch64] Optimize SVE bitcasts of unpacked types.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 21 10:29:55 PDT 2021


efriedma added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:3510-3512
+      SDValue CastResult =
+          getSVESafeBitCast(MVT::nxv4f32, Op.getOperand(0), DAG);
+      return getSVESafeBitCast(MVT::nxv2f32, CastResult, DAG);
----------------
paulwalker-arm wrote:
> You may as well just remove the "Cannot cast between unpacked scalable vector types" assert from `getSVESafeBitCast`.  The original intent of the assert was to catch cases where  `getSVESafeBitCast` wasn't needed because a single `REINTERPRET_CAST` could do the job.  The assert is clearly too generic but at the same time I deliberately didn't add isel patterns for the unpacked-unpacked-fp cases[1], so I don't see a real benefit to tightening up the assert.
> 
> [1] I know this is not consistent with i1 handling.
Sure, will do.


================
Comment at: llvm/test/CodeGen/AArch64/sve-bitcast.ll:460
+; CHECK-NEXT:    ret
+  %load = load <vscale x 2 x double>, <vscale x 2 x double>* %p
+  %trunc = fptrunc <vscale x 2 x double> %load to <vscale x 2 x float>
----------------
paulwalker-arm wrote:
> Out of interest are the loads fundamental to these three tests?
When I was constructing the tests, I had to be careful to make sure we actually hit the codepath in question.  In the simplest cases, the bitcast gets combined away.

Maybe it's not necessary for the final form these tests ended up with, though; I'll check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104573



More information about the llvm-commits mailing list