[llvm] [CodeGen][MIR] Support parsing of scalable vectors in MIR (PR #70893)
Michael Maitland via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 1 11:40:48 PDT 2023
https://github.com/michaelmaitland updated https://github.com/llvm/llvm-project/pull/70893
>From 2ab957c6d5e74912baf97848ec67fc4d76dd8d73 Mon Sep 17 00:00:00 2001
From: Michael Maitland <michaeltmaitland at gmail.com>
Date: Tue, 31 Oct 2023 20:39:46 -0700
Subject: [PATCH 1/3] [CodeGen][MIR] Support parsing of scalable vectors in MIR
This patch builds on the support for vectors by adding ability to parse
scalable vectors in MIR.
---
llvm/lib/CodeGen/MIRParser/MIParser.cpp | 37 +++++++++++++++----
.../MIR/Generic/scalable-vector-type.mir | 23 ++++++++++++
2 files changed, 52 insertions(+), 8 deletions(-)
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type.mir
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
index c01b34d6f490b0e..0da664e935f5442 100644
--- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
@@ -1946,12 +1946,28 @@ bool MIParser::parseLowLevelType(StringRef::iterator Loc, LLT &Ty) {
// Now we're looking for a vector.
if (Token.isNot(MIToken::less))
- return error(Loc,
- "expected sN, pA, <M x sN>, or <M x pA> for GlobalISel type");
+ return error(Loc, "expected sN, pA, <M x sN>, <M x pA>, <vscale x M x sN>, "
+ "or <vscale x M x pA> for GlobalISel type");
lex();
+ bool HasVScale = Token.stringValue() == "vscale";
+ if (HasVScale) {
+ lex();
+ if (Token.stringValue() != "x")
+ return error("expected <vscale x M x sN> or <vscale x M x pA>");
+ lex();
+ }
+
+ auto GetError = [&](bool HasVScale, StringRef::iterator Loc) {
+ if (HasVScale)
+ return error(
+ Loc, "expected <vscale x M x sN> or <vscale M x pA> for vector type");
+ else
+ return error(Loc, "expected <M x sN> or <M x pA> for vector type");
+ };
+
if (Token.isNot(MIToken::IntegerLiteral))
- return error(Loc, "expected <M x sN> or <M x pA> for vector type");
+ return GetError(HasVScale, Loc);
uint64_t NumElements = Token.integerValue().getZExtValue();
if (!verifyVectorElementCount(NumElements))
return error("invalid number of vector elements");
@@ -1959,11 +1975,12 @@ bool MIParser::parseLowLevelType(StringRef::iterator Loc, LLT &Ty) {
lex();
if (Token.isNot(MIToken::Identifier) || Token.stringValue() != "x")
- return error(Loc, "expected <M x sN> or <M x pA> for vector type");
+ return GetError(HasVScale, Loc);
lex();
if (Token.range().front() != 's' && Token.range().front() != 'p')
- return error(Loc, "expected <M x sN> or <M x pA> for vector type");
+ return GetError(HasVScale, Loc);
+
StringRef SizeStr = Token.range().drop_front();
if (SizeStr.size() == 0 || !llvm::all_of(SizeStr, isdigit))
return error("expected integers after 's'/'p' type character");
@@ -1981,14 +1998,18 @@ bool MIParser::parseLowLevelType(StringRef::iterator Loc, LLT &Ty) {
Ty = LLT::pointer(AS, DL.getPointerSizeInBits(AS));
} else
- return error(Loc, "expected <M x sN> or <M x pA> for vector type");
+ return GetError(HasVScale, Loc);
lex();
if (Token.isNot(MIToken::greater))
- return error(Loc, "expected <M x sN> or <M x pA> for vector type");
+ return GetError(HasVScale, Loc);
+
lex();
- Ty = LLT::fixed_vector(NumElements, Ty);
+ if (HasVScale)
+ Ty = LLT::scalable_vector(NumElements, Ty);
+ else
+ Ty = LLT::fixed_vector(NumElements, Ty);
return false;
}
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type.mir
new file mode 100644
index 000000000000000..61ac8411b64505b
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type.mir
@@ -0,0 +1,23 @@
+# RUN: llc -run-pass=none -o - %s | FileCheck %s
+
+---
+name: scalable_vector_type_s
+body: |
+ bb.0:
+ ; CHECK-LABEL: name: scalable_vector_type_s
+ ; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 1 x s8>) = IMPLICIT_DEF
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 1 x s8>) = COPY [[DEF]](<vscale x 1 x s8>)
+ %0:_(<vscale x 1 x s8>) = IMPLICIT_DEF
+ %1:_(<vscale x 1 x s8>) = COPY %0
+...
+
+---
+name: scalable_vector_type_p
+body: |
+ bb.0:
+ ; CHECK-LABEL: name: scalable_vector_type_p
+ ; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 1 x p0>) = IMPLICIT_DEF
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 1 x p0>) = COPY [[DEF]](<vscale x 1 x p0>)
+ %0:_(<vscale x 1 x p0>) = IMPLICIT_DEF
+ %1:_(<vscale x 1 x p0>) = COPY %0
+...
>From 4e0e292e9b26d9ed28d249082070a02a8e2f5969 Mon Sep 17 00:00:00 2001
From: Michael Maitland <michaeltmaitland at gmail.com>
Date: Wed, 1 Nov 2023 10:35:06 -0700
Subject: [PATCH 2/3] Add more tests and fix craigs comments about parser
---
llvm/lib/CodeGen/MIRParser/MIParser.cpp | 22 ++--
.../MIR/Generic/scalable-vector-type.mir | 118 +++++++++++++++++-
2 files changed, 124 insertions(+), 16 deletions(-)
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
index 0da664e935f5442..22d23c18e330d69 100644
--- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
@@ -1950,15 +1950,16 @@ bool MIParser::parseLowLevelType(StringRef::iterator Loc, LLT &Ty) {
"or <vscale x M x pA> for GlobalISel type");
lex();
- bool HasVScale = Token.stringValue() == "vscale";
+ bool HasVScale =
+ Token.is(MIToken::Identifier) && Token.stringValue() == "vscale";
if (HasVScale) {
lex();
- if (Token.stringValue() != "x")
+ if (Token.isNot(MIToken::Identifier) || Token.stringValue() != "x")
return error("expected <vscale x M x sN> or <vscale x M x pA>");
lex();
}
- auto GetError = [&](bool HasVScale, StringRef::iterator Loc) {
+ auto GetError = [this, &HasVScale, Loc]() {
if (HasVScale)
return error(
Loc, "expected <vscale x M x sN> or <vscale M x pA> for vector type");
@@ -1967,7 +1968,7 @@ bool MIParser::parseLowLevelType(StringRef::iterator Loc, LLT &Ty) {
};
if (Token.isNot(MIToken::IntegerLiteral))
- return GetError(HasVScale, Loc);
+ return GetError();
uint64_t NumElements = Token.integerValue().getZExtValue();
if (!verifyVectorElementCount(NumElements))
return error("invalid number of vector elements");
@@ -1975,11 +1976,11 @@ bool MIParser::parseLowLevelType(StringRef::iterator Loc, LLT &Ty) {
lex();
if (Token.isNot(MIToken::Identifier) || Token.stringValue() != "x")
- return GetError(HasVScale, Loc);
+ return GetError();
lex();
if (Token.range().front() != 's' && Token.range().front() != 'p')
- return GetError(HasVScale, Loc);
+ return GetError();
StringRef SizeStr = Token.range().drop_front();
if (SizeStr.size() == 0 || !llvm::all_of(SizeStr, isdigit))
@@ -1998,18 +1999,15 @@ bool MIParser::parseLowLevelType(StringRef::iterator Loc, LLT &Ty) {
Ty = LLT::pointer(AS, DL.getPointerSizeInBits(AS));
} else
- return GetError(HasVScale, Loc);
+ return GetError();
lex();
if (Token.isNot(MIToken::greater))
- return GetError(HasVScale, Loc);
+ return GetError();
lex();
- if (HasVScale)
- Ty = LLT::scalable_vector(NumElements, Ty);
- else
- Ty = LLT::fixed_vector(NumElements, Ty);
+ Ty = LLT::vector(ElementCount::get(NumElements, HasVScale), Ty);
return false;
}
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type.mir
index 61ac8411b64505b..d9352fef1c6df2f 100644
--- a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type.mir
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type.mir
@@ -1,10 +1,10 @@
# RUN: llc -run-pass=none -o - %s | FileCheck %s
---
-name: scalable_vector_type_s
+name: test_nxv1s8
body: |
bb.0:
- ; CHECK-LABEL: name: scalable_vector_type_s
+ ; CHECK-LABEL: name: test_nxv1s8
; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 1 x s8>) = IMPLICIT_DEF
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 1 x s8>) = COPY [[DEF]](<vscale x 1 x s8>)
%0:_(<vscale x 1 x s8>) = IMPLICIT_DEF
@@ -12,12 +12,122 @@ body: |
...
---
-name: scalable_vector_type_p
+name: test_nxv1s16
body: |
bb.0:
- ; CHECK-LABEL: name: scalable_vector_type_p
+ ; CHECK-LABEL: name: test_nxv1s16
+ ; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 1 x s16>) = IMPLICIT_DEF
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 1 x s16>) = COPY [[DEF]](<vscale x 1 x s16>)
+ %0:_(<vscale x 1 x s16>) = IMPLICIT_DEF
+ %1:_(<vscale x 1 x s16>) = COPY %0
+...
+
+---
+name: test_nxv1s32
+body: |
+ bb.0:
+ ; CHECK-LABEL: name: test_nxv1s32
+ ; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 1 x s32>) = IMPLICIT_DEF
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 1 x s32>) = COPY [[DEF]](<vscale x 1 x s32>)
+ %0:_(<vscale x 1 x s32>) = IMPLICIT_DEF
+ %1:_(<vscale x 1 x s32>) = COPY %0
+...
+
+---
+name: test_nxv1s64
+body: |
+ bb.0:
+ ; CHECK-LABEL: name: test_nxv1s64
+ ; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 1 x s64>) = IMPLICIT_DEF
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 1 x s64>) = COPY [[DEF]](<vscale x 1 x s64>)
+ %0:_(<vscale x 1 x s64>) = IMPLICIT_DEF
+ %1:_(<vscale x 1 x s64>) = COPY %0
+...
+
+---
+name: test_nxv4s8
+body: |
+ bb.0:
+ ; CHECK-LABEL: name: test_nxv4s8
+ ; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 4 x s8>) = IMPLICIT_DEF
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 4 x s8>) = COPY [[DEF]](<vscale x 4 x s8>)
+ %0:_(<vscale x 4 x s8>) = IMPLICIT_DEF
+ %1:_(<vscale x 4 x s8>) = COPY %0
+...
+
+---
+name: test_nxv4s16
+body: |
+ bb.0:
+ ; CHECK-LABEL: name: test_nxv4s16
+ ; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 4 x s16>) = IMPLICIT_DEF
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 4 x s16>) = COPY [[DEF]](<vscale x 4 x s16>)
+ %0:_(<vscale x 4 x s16>) = IMPLICIT_DEF
+ %1:_(<vscale x 4 x s16>) = COPY %0
+...
+
+---
+name: test_nxv4s32
+body: |
+ bb.0:
+ ; CHECK-LABEL: name: test_nxv4s32
+ ; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 4 x s32>) = IMPLICIT_DEF
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 4 x s32>) = COPY [[DEF]](<vscale x 4 x s32>)
+ %0:_(<vscale x 4 x s32>) = IMPLICIT_DEF
+ %1:_(<vscale x 4 x s32>) = COPY %0
+...
+
+---
+name: test_nxv4s64
+body: |
+ bb.0:
+ ; CHECK-LABEL: name: test_nxv4s64
+ ; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 4 x s64>) = IMPLICIT_DEF
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 4 x s64>) = COPY [[DEF]](<vscale x 4 x s64>)
+ %0:_(<vscale x 4 x s64>) = IMPLICIT_DEF
+ %1:_(<vscale x 4 x s64>) = COPY %0
+...
+
+---
+name: test_nxv1p0
+body: |
+ bb.0:
+ ; CHECK-LABEL: name: test_nxv1p0
; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 1 x p0>) = IMPLICIT_DEF
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 1 x p0>) = COPY [[DEF]](<vscale x 1 x p0>)
%0:_(<vscale x 1 x p0>) = IMPLICIT_DEF
%1:_(<vscale x 1 x p0>) = COPY %0
...
+
+---
+name: test_nxv1sp1
+body: |
+ bb.0:
+ ; CHECK-LABEL: name: test_nxv1sp1
+ ; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 1 x p0>) = IMPLICIT_DEF
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 1 x p0>) = COPY [[DEF]](<vscale x 1 x p0>)
+ %0:_(<vscale x 1 x p0>) = IMPLICIT_DEF
+ %1:_(<vscale x 1 x p0>) = COPY %0
+...
+
+---
+name: test_nxv4p0
+body: |
+ bb.0:
+ ; CHECK-LABEL: name: test_nxv4p0
+ ; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 4 x p0>) = IMPLICIT_DEF
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 4 x p0>) = COPY [[DEF]](<vscale x 4 x p0>)
+ %0:_(<vscale x 4 x p0>) = IMPLICIT_DEF
+ %1:_(<vscale x 4 x p0>) = COPY %0
+...
+
+---
+name: test_nxv4p1
+body: |
+ bb.0:
+ ; CHECK-LABEL: name: test_nxv4p1
+ ; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 4 x p1>) = IMPLICIT_DEF
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 4 x p1>) = COPY [[DEF]](<vscale x 4 x p1>)
+ %0:_(<vscale x 4 x p1>) = IMPLICIT_DEF
+ %1:_(<vscale x 4 x p1>) = COPY %0
+...
>From d5e11a623fffca4083decc6d4e7610526832b8af Mon Sep 17 00:00:00 2001
From: Michael Maitland <michaeltmaitland at gmail.com>
Date: Wed, 1 Nov 2023 11:40:18 -0700
Subject: [PATCH 3/3] add test cases for failures
---
.../CodeGen/MIR/Generic/scalable-vector-type-err0.mir | 10 ++++++++++
.../CodeGen/MIR/Generic/scalable-vector-type-err1.mir | 9 +++++++++
.../MIR/Generic/scalable-vector-type-err10.mir | 10 ++++++++++
.../MIR/Generic/scalable-vector-type-err11.mir | 10 ++++++++++
.../MIR/Generic/scalable-vector-type-err12.mir | 10 ++++++++++
.../MIR/Generic/scalable-vector-type-err13.mir | 10 ++++++++++
.../MIR/Generic/scalable-vector-type-err14.mir | 10 ++++++++++
.../MIR/Generic/scalable-vector-type-err15.mir | 10 ++++++++++
.../CodeGen/MIR/Generic/scalable-vector-type-err2.mir | 9 +++++++++
.../CodeGen/MIR/Generic/scalable-vector-type-err3.mir | 9 +++++++++
.../CodeGen/MIR/Generic/scalable-vector-type-err4.mir | 10 ++++++++++
.../CodeGen/MIR/Generic/scalable-vector-type-err5.mir | 9 +++++++++
.../CodeGen/MIR/Generic/scalable-vector-type-err6.mir | 11 +++++++++++
.../CodeGen/MIR/Generic/scalable-vector-type-err7.mir | 9 +++++++++
.../CodeGen/MIR/Generic/scalable-vector-type-err8.mir | 10 ++++++++++
.../CodeGen/MIR/Generic/scalable-vector-type-err9.mir | 11 +++++++++++
16 files changed, 157 insertions(+)
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err0.mir
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err1.mir
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err10.mir
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err11.mir
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err12.mir
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err13.mir
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err14.mir
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err15.mir
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err2.mir
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err3.mir
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err4.mir
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err5.mir
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err6.mir
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err7.mir
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err8.mir
create mode 100644 llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err9.mir
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err0.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err0.mir
new file mode 100644
index 000000000000000..5553d97acd00306
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err0.mir
@@ -0,0 +1,10 @@
+# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s
+---
+name: err_after_vscale0
+body: |
+ bb.0:
+ %0:_(<vscale) = IMPLICIT_DEF
+...
+
+# CHECK: expected <vscale x M x sN> or <vscale x M x pA>
+
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err1.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err1.mir
new file mode 100644
index 000000000000000..12bfb82ebcd1244
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err1.mir
@@ -0,0 +1,9 @@
+# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s
+---
+name: err_after_vscale1
+body: |
+ bb.0:
+ %0:_(<vscale notanx) = IMPLICIT_DEF
+...
+
+# CHECK: expected <vscale x M x sN> or <vscale x M x pA>
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err10.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err10.mir
new file mode 100644
index 000000000000000..7d7d7e49f23fe2d
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err10.mir
@@ -0,0 +1,10 @@
+# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s
+
+---
+name: err_after_vscalexMxp
+body: |
+ bb.0:
+ %0:_(<vscale x 4 x p) = IMPLICIT_DEF
+...
+
+# CHECK: expected integers after 's'/'p' type character
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err11.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err11.mir
new file mode 100644
index 000000000000000..f8927c22ab45f78
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err11.mir
@@ -0,0 +1,10 @@
+# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s
+
+---
+name: err_after_vscalexMxs32
+body: |
+ bb.0:
+ %0:_(<vscale x 4 x s32) = IMPLICIT_DEF
+...
+
+# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err12.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err12.mir
new file mode 100644
index 000000000000000..5ced1aea30c0855
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err12.mir
@@ -0,0 +1,10 @@
+# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s
+
+---
+name: err_after_vscalexMxp0
+body: |
+ bb.0:
+ %0:_(<vscale x 4 x p0) = IMPLICIT_DEF
+...
+
+# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err13.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err13.mir
new file mode 100644
index 000000000000000..94b8230233fa62a
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err13.mir
@@ -0,0 +1,10 @@
+# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s
+
+---
+name: err_after_vscalexMxs32X
+body: |
+ bb.0:
+ %0:_(<vscale x 4 x s32 X) = IMPLICIT_DEF
+...
+
+# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err14.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err14.mir
new file mode 100644
index 000000000000000..323e2d975692fcf
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err14.mir
@@ -0,0 +1,10 @@
+# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s
+
+---
+name: err_after_vscalexMxp0
+body: |
+ bb.0:
+ %0:_(<vscale x 4 x p0 X) = IMPLICIT_DEF
+...
+
+# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err15.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err15.mir
new file mode 100644
index 000000000000000..d1613869bf67142
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err15.mir
@@ -0,0 +1,10 @@
+# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s
+
+---
+name: err_after_vscale0
+body: |
+ bb.0:
+ %0:_(notatype) = IMPLICIT_DEF
+...
+
+# CHECK: expected sN, pA, <M x sN>, <M x pA>, <vscale x M x sN>, or <vscale x M x pA> for GlobalISel type
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err2.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err2.mir
new file mode 100644
index 000000000000000..c504a7d6be24927
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err2.mir
@@ -0,0 +1,9 @@
+# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s
+---
+name: err_after_vscalex0
+body: |
+ bb.0:
+ %0:_(<vscale x) = IMPLICIT_DEF
+...
+
+# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err3.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err3.mir
new file mode 100644
index 000000000000000..c504a7d6be24927
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err3.mir
@@ -0,0 +1,9 @@
+# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s
+---
+name: err_after_vscalex0
+body: |
+ bb.0:
+ %0:_(<vscale x) = IMPLICIT_DEF
+...
+
+# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err4.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err4.mir
new file mode 100644
index 000000000000000..654f534f4d30188
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err4.mir
@@ -0,0 +1,10 @@
+# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s
+---
+name: err_after_vscalex1
+body: |
+ bb.0:
+ %0:_(<vscale x notanint) = IMPLICIT_DEF
+...
+
+# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type
+
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err5.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err5.mir
new file mode 100644
index 000000000000000..26be2868c522e8b
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err5.mir
@@ -0,0 +1,9 @@
+# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s
+---
+name: err_after_vscalexM
+body: |
+ bb.0:
+ %0:_(<vscale x 4) = IMPLICIT_DEF
+...
+
+# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err6.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err6.mir
new file mode 100644
index 000000000000000..07a30f57139dc61
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err6.mir
@@ -0,0 +1,11 @@
+# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s
+
+---
+name: err_after_vscalexMx0
+body: |
+ bb.0:
+ %0:_(<vscale x 4 x) = IMPLICIT_DEF
+...
+
+# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type
+
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err7.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err7.mir
new file mode 100644
index 000000000000000..dba902efe6331d4
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err7.mir
@@ -0,0 +1,9 @@
+# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s
+---
+name: err_after_vscalexMx1
+body: |
+ bb.0:
+ %0:_(<vscale x 4 x notansorp) = IMPLICIT_DEF
+...
+
+# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err8.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err8.mir
new file mode 100644
index 000000000000000..8bedeabaa790685
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err8.mir
@@ -0,0 +1,10 @@
+# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s
+
+---
+name: err_after_vscalexMxs
+body: |
+ bb.0:
+ %0:_(<vscale x 4 x s) = IMPLICIT_DEF
+...
+
+# CHECK: expected integers after 's'/'p' type character
diff --git a/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err9.mir b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err9.mir
new file mode 100644
index 000000000000000..fd0b9a4a054abc2
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err9.mir
@@ -0,0 +1,11 @@
+# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s
+---
+name: err_after_vscalexMxpX
+body: |
+ bb.0:
+ %0:_(<vscale x 4 x pX) = IMPLICIT_DEF
+...
+
+# CHECK: expected integers after 's'/'p' type character
+
+
More information about the llvm-commits
mailing list