Skip to content

Commit b98b567

Browse files
authored
[ARM] Correctly handle .inst in IT and VPT blocks (#68902)
Advance the IT and VPT block state when parsing the .inst directive, so that it is possible to use them to emit conditional instructions. If we don't do this, then a later instruction inside or just after the block will have a mis-matched condition, so be incorrectly reported as an error.
1 parent ef9f617 commit b98b567

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11981,6 +11981,8 @@ bool ARMAsmParser::parseDirectiveInst(SMLoc Loc, char Suffix) {
1198111981
}
1198211982

1198311983
getTargetStreamer().emitInst(Value->getValue(), CurSuffix);
11984+
forwardITPosition();
11985+
forwardVPTPosition();
1198411986
return false;
1198511987
};
1198611988

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// RUN: llvm-mc %s -triple armv8m.main -mattr=+mve -filetype asm -o - | FileCheck %s
2+
3+
.thumb
4+
5+
// CHECK: it eq
6+
// CHECK: .inst.n 0x3001
7+
// CHECK: add.w r0, r0, #1
8+
it eq
9+
.inst.n 0x3001 // addeq r0, #1
10+
add r0, #1
11+
12+
// CHECK: vpst
13+
// CHECK: .inst.w 0xef220844
14+
// CHECK: vadd.i32 q0, q1, q2
15+
vpst
16+
.inst.w 0xef220844 // vaddt.i32 q0, q1, q2
17+
vadd.i32 q0, q1, q2
18+
19+
// CHECK: ite eq
20+
// CHECK: .inst.n 0x3001
21+
// CHECK: addne r0, #1
22+
// CHECK: add.w r0, r0, #1
23+
ite eq
24+
.inst.n 0x3001 // addeq r0, #1
25+
addne r0, #1
26+
add r0, #1

0 commit comments

Comments
 (0)