[llvm] r342891 - [Arm][AsmParser] Restrict register list size for VSTM/VLDM
Luke Cheeseman via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 24 08:13:48 PDT 2018
Author: lukecheeseman
Date: Mon Sep 24 08:13:48 2018
New Revision: 342891
URL: http://llvm.org/viewvc/llvm-project?rev=342891&view=rev
Log:
[Arm][AsmParser] Restrict register list size for VSTM/VLDM
- The assembler accepts VSTM/VLDM with register lists (specifically double registers lists) with more than 16 registers specified
- The Arm architecture reference manual says this instruction must not contain more than 16 registers when the registers are doubleword registers
- This addresses one of the concerns in https://bugs.llvm.org/show_bug.cgi?id=38389
Differential Revision: https://reviews.llvm.org/D52082
Modified:
llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/trunk/test/MC/ARM/single-precision-fp.s
Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=342891&r1=342890&r2=342891&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Mon Sep 24 08:13:48 2018
@@ -6841,6 +6841,15 @@ bool ARMAsmParser::validateInstruction(M
"destination operands must be sequential");
break;
}
+ case ARM::VLDMDIA:
+ case ARM::VSTMDIA: {
+ ARMOperand &Op = static_cast<ARMOperand&>(*Operands[3]);
+ auto &RegList = Op.getRegList();
+ if (RegList.size() < 1 || RegList.size() > 16)
+ return Error(Operands[3]->getStartLoc(),
+ "list of registers must be at least 1 and at most 16");
+ break;
+ }
}
return false;
Modified: llvm/trunk/test/MC/ARM/single-precision-fp.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/single-precision-fp.s?rev=342891&r1=342890&r2=342891&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/single-precision-fp.s (original)
+++ llvm/trunk/test/MC/ARM/single-precision-fp.s Mon Sep 24 08:13:48 2018
@@ -171,6 +171,21 @@
@ CHECK-ERRORS: error: instruction requires: double precision VFP
@ CHECK-ERRORS-NEXT: vrintm.f64 d3, d2
+ vstm r4, {}
+ vstm r4, {d15-d30}
+ vstm r4, {d15-d31}
+ vstm r4, {s15-s31}
+ vldm r4, {d15-d30}
+ vldm r4, {d15-d31}
+ vldm r4, {s15-s31}
+@ CHECK-ERRORS: error: register expected
+@ CHECK: vstmia r4, {d15, d16, d17, d18, d19, d20, d21, d22, d23, d24, d25, d26, d27, d28, d29, d30}
+@ CHECK-ERRORS: error: list of registers must be at least 1 and at most 16
+@ CHECK: vstmia r4, {s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28, s29, s30, s31}
+@ CHECK: vldmia r4, {d15, d16, d17, d18, d19, d20, d21, d22, d23, d24, d25, d26, d27, d28, d29, d30}
+@ CHECK-ERRORS: error: list of registers must be at least 1 and at most 16
+@ CHECK: vldmia r4, {s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28, s29, s30, s31}
+
@ Double precisionish operations that actually *are* allowed.
vldr d0, [sp]
vstr d3, [sp]
More information about the llvm-commits
mailing list