Skip to content

Commit 96ed1bd

Browse files
committed
[MC][test] Add some label difference tests
1 parent b70b96c commit 96ed1bd

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

llvm/test/MC/AsmParser/assembler-expressions.s

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1-
# RUN: not llvm-mc -triple x86_64-unknown-unknown %s 2>&1 | FileCheck %s --check-prefix=ASM-ERR
1+
# RUN: not llvm-mc -triple x86_64-unknown-unknown %s 2>&1 | FileCheck %s --check-prefix=ASM-ERR --implicit-check-not=error:
22
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s | llvm-objdump -j .data -s - | FileCheck %s --check-prefix=OBJDATA
33
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s | llvm-objdump -j .text -s - | FileCheck %s --check-prefix=OBJTEXT
44
.data
55

66
# OBJDATA: Contents of section .data
7-
# OBJDATA-NEXT: 0000 aa0506ff
7+
# OBJDATA-NEXT: 0000 aa01aa05 06ff
8+
9+
foo1:
10+
# ASM-ERR: :[[#@LINE+1]]:5: error: expected absolute expression
11+
.if . - foo1 == 0
12+
.byte 0xaa
13+
.else
14+
.byte 0x00
15+
.endif
816

917
foo2:
10-
# ASM-ERR: [[@LINE+1]]:5: error: expected absolute expression
11-
.if . - foo2 == 0
18+
.byte 1
19+
# ASM-ERR: :[[#@LINE+1]]:5: error: expected absolute expression
20+
.if foo2 - . == -1
1221
.byte 0xaa
1322
.else
1423
.byte 0x00

llvm/test/MC/ELF/RISCV/subsection.s

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# RUN: not llvm-mc -filetype=obj -triple=riscv64 -mattr=-relax %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR --implicit-check-not=error:
2+
# RUN: not llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR --implicit-check-not=error:
3+
4+
a:
5+
nop
6+
b:
7+
call foo@plt
8+
c:
9+
nop
10+
d:
11+
12+
.data
13+
## Positive subsection numbers
14+
.subsection c-b
15+
.subsection d-b
16+
.subsection c-a
17+
18+
.subsection b-a
19+
.subsection d-c
20+
21+
## Negative subsection numbers
22+
# ERR: :[[#@LINE+1]]:14: error: subsection number -8 is not within [0,2147483647]
23+
.subsection b-c
24+
# ERR: :[[#@LINE+1]]:14: error: subsection number -12 is not within [0,2147483647]
25+
.subsection b-d
26+
# ERR: :[[#@LINE+1]]:14: error: subsection number -12 is not within [0,2147483647]
27+
.subsection a-c
28+
# ERR: :[[#@LINE+1]]:14: error: subsection number -4 is not within [0,2147483647]
29+
.subsection a-b
30+
# ERR: :[[#@LINE+1]]:14: error: subsection number -4 is not within [0,2147483647]
31+
.subsection c-d

0 commit comments

Comments
 (0)