[llvm] [NVPTX] Generalize and extend upsizing when lowering 8/16-bit-element vector loads/stores (PR #119622)

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 11 14:40:39 PST 2024


================
@@ -6292,6 +6296,33 @@ static void ReplaceLoadVector(SDNode *N, SelectionDAG &DAG,
   EVT EltVT = ResVT.getVectorElementType();
   unsigned NumElts = ResVT.getVectorNumElements();
 
+  if (UpsizeElementTypes) {
+    switch (ResVT.getSimpleVT().SimpleTy) {
+    default:
+      llvm_unreachable("Unexpected Vector Type");
+    case MVT::v8i8: // <2 x i8x4>
+      NumElts = 2;
+      EltVT = MVT::v4i8;
+      break;
+    case MVT::v8f16: // <4 x f16x2>
+      NumElts = 4;
+      EltVT = MVT::v2f16;
+      break;
+    case MVT::v8bf16: // <4 x bf16x2>
+      NumElts = 4;
+      EltVT = MVT::v2bf16;
+      break;
+    case MVT::v8i16: // <4 x i16x2>
+      NumElts = 4;
+      EltVT = MVT::v2i16;
+      break;
+    case MVT::v16i8: // <4 x i8x4>
+      NumElts = 4;
+      EltVT = MVT::v4i8;
+      break;
+    }
+  }
+
----------------
AlexMaclean wrote:

This looks like a full copy paste of a similar switch above, can these be extracted into a small helper function?

https://github.com/llvm/llvm-project/pull/119622


More information about the llvm-commits mailing list