[PATCH] D105952: [AArch64][GlobalISel] Clamp <n x p0> vecs when legalizing G_EXTRACT_VECTOR_ELT

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 13 17:47:51 PDT 2021


paquette created this revision.
paquette added reviewers: aemerson, jroelofs.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls, rovka.
paquette requested review of this revision.
Herald added a project: LLVM.

This case was missing from G_EXTRACT_VECTOR_ELT. It's the same as for s64.

https://godbolt.org/z/Tnq4acY8z


https://reviews.llvm.org/D105952

Files:
  llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/legalize-extract-vector-elt.mir


Index: llvm/test/CodeGen/AArch64/GlobalISel/legalize-extract-vector-elt.mir
===================================================================
--- llvm/test/CodeGen/AArch64/GlobalISel/legalize-extract-vector-elt.mir
+++ llvm/test/CodeGen/AArch64/GlobalISel/legalize-extract-vector-elt.mir
@@ -245,3 +245,20 @@
     $w0 = COPY %ext(s32)
     RET_ReallyLR
 ...
+---
+name:            test_eve_v4p0
+body: |
+  bb.0:
+    liveins: $x0
+    ; CHECK-LABEL: name: test_eve_v4p0
+    ; CHECK: [[DEF:%[0-9]+]]:_(p0) = G_IMPLICIT_DEF
+    ; CHECK: %idx:_(s64) = G_CONSTANT i64 1
+    ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p0>) = G_BUILD_VECTOR [[DEF]](p0), [[DEF]](p0)
+    ; CHECK: %eve:_(p0) = G_EXTRACT_VECTOR_ELT [[BUILD_VECTOR]](<2 x p0>), %idx(s64)
+    ; CHECK: $x0 = COPY %eve(p0)
+    ; CHECK: RET_ReallyLR
+    %vec:_(<4 x p0>) = G_IMPLICIT_DEF
+    %idx:_(s64) = G_CONSTANT i64 1
+    %eve:_(p0) = G_EXTRACT_VECTOR_ELT %vec:_(<4 x p0>), %idx:_(s64)
+    $x0 = COPY %eve(p0)
+    RET_ReallyLR
Index: llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
===================================================================
--- llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
+++ llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
@@ -644,7 +644,8 @@
       .minScalarOrElt(0, s8) // Worst case, we need at least s8.
       .clampMaxNumElements(1, s64, 2)
       .clampMaxNumElements(1, s32, 4)
-      .clampMaxNumElements(1, s16, 8);
+      .clampMaxNumElements(1, s16, 8)
+      .clampMaxNumElements(1, p0, 2);
 
   getActionDefinitionsBuilder(G_INSERT_VECTOR_ELT)
       .legalIf(typeInSet(0, {v8s16, v2s32, v4s32, v2s64}));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105952.358467.patch
Type: text/x-patch
Size: 1643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210714/9ad4ff20/attachment.bin>


More information about the llvm-commits mailing list