1 # RUN: llvm-mc -triple riscv32 -mattr=-relax -riscv-no-aliases < %s \
2 # RUN: | FileCheck -check-prefix=CHECK-INST %s
3 # RUN: llvm-mc -filetype=obj -triple riscv32 < %s \
4 # RUN: | llvm-readobj -r | FileCheck -check-prefix=CHECK-RELOC %s
5 # RUN: llvm-mc -triple riscv32 -filetype=obj < %s \
6 # RUN: | llvm-objdump -triple riscv32 -mattr=+c -d - \
7 # RUN: | FileCheck -check-prefixes=CHECK-BYTES,CHECK-ALIAS %s
9 # RUN: llvm-mc -triple riscv64 -mattr=-relax -riscv-no-aliases < %s \
10 # RUN: | FileCheck -check-prefix=CHECK-INST %s
11 # RUN: llvm-mc -filetype=obj -triple riscv64 < %s \
12 # RUN: | llvm-readobj -r | FileCheck -check-prefix=CHECK-RELOC %s
13 # RUN: llvm-mc -triple riscv64 -filetype=obj < %s \
14 # RUN: | llvm-objdump -triple riscv64 -mattr=+c -d - \
15 # RUN: | FileCheck -check-prefixes=CHECK-BYTES,CHECK-ALIAS %s
17 # Test the operation of the push and pop assembler directives when
18 # using .option relax and .option rvc. Checks that using .option pop
19 # correctly restores all target features to their state at the point
20 # where .option pop was last used.
22 # CHECK-INST: call foo
23 # CHECK-RELOC: R_RISCV_CALL foo 0x0
24 # CHECK-RELOC-NOT: R_RISCV_RELAX - 0x0
27 # CHECK-INST: addi s0, sp, 1020
28 # CHECK-BYTES: 13 04 c1 3f
29 # CHECK-ALIAS: addi s0, sp, 1020
32 .option push # Push relax=false, rvc=false
33 # CHECK-INST: .option push
36 # CHECK-INST: .option relax
37 # CHECK-INST: call bar
38 # CHECK-RELOC-NEXT: R_RISCV_CALL bar 0x0
39 # CHECK-RELOC-NEXT: R_RISCV_RELAX - 0x0
42 .option push # Push relax=true, rvc=false
43 # CHECK-INST: .option push
46 # CHECK-INST: .option rvc
47 # CHECK-INST: c.addi4spn s0, sp, 1020
49 # CHECK-ALIAS: addi s0, sp, 1020
52 .option pop # Pop relax=true, rvc=false
53 # CHECK-INST: .option pop
54 # CHECK-INST: addi s0, sp, 1020
55 # CHECK-BYTES: 13 04 c1 3f
56 # CHECK-ALIAS: addi s0, sp, 1020
59 # CHECK-INST: call bar
60 # CHECK-RELOC-NEXT: R_RISCV_CALL bar 0x0
61 # CHECK-RELOC-NEXT: R_RISCV_RELAX - 0x0
64 .option pop # Pop relax=false, rvc=false
65 # CHECK-INST: .option pop
66 # CHECK-INST: call baz
67 # CHECK-RELOC: R_RISCV_CALL baz 0x0
68 # CHECK-RELOC-NOT: R_RISCV_RELAX - 0x0
71 # CHECK-INST: addi s0, sp, 1020
72 # CHECK-BYTES: 13 04 c1 3f
73 # CHECK-ALIAS: addi s0, sp, 1020