[X86][MC,LLD][NFC] Rename R_X86_64_REX2_GOTPCRELX (#116737)
[llvm-project.git] / llvm / test / MC / RISCV / option-arch.s
blob7826252f66e6c810402344c28a6296064b554aa7
1 # RUN: llvm-mc -triple riscv32 -mattr=+experimental -show-encoding < %s \
2 # RUN: | FileCheck -check-prefixes=CHECK %s
3 # RUN: llvm-mc -triple riscv32 -mattr=+experimental -filetype=obj < %s \
4 # RUN: | llvm-objdump --triple=riscv32 --mattr=+c,+m,+a,+f,+zba,+experimental-zicfiss -d -M no-aliases - \
5 # RUN: | FileCheck -check-prefixes=CHECK-INST %s
7 # Test '.option arch, +' and '.option arch, -' directive
8 # The following test cases were copied from MC/RISCV/option-rvc.s
10 # CHECK-INST: addi a0, a1, 0x0
11 # CHECK: # encoding: [0x13,0x85,0x05,0x00]
12 addi a0, a1, 0
14 # CHECK-INST: addi s0, sp, 0x3fc
15 # CHECK: # encoding: [0x13,0x04,0xc1,0x3f]
16 addi s0, sp, 1020
18 # CHECK: .option arch, +c
19 .option arch, +c
20 # CHECK-INST: c.mv a0, a1
21 # CHECK: # encoding: [0x2e,0x85]
22 addi a0, a1, 0
24 # CHECK-INST: c.addi4spn s0, sp, 0x3fc
25 # CHECK: # encoding: [0xe0,0x1f]
26 addi s0, sp, 1020
28 # CHECK: .option arch, -c
29 .option arch, -c
30 # CHECK-INST: addi a0, a1, 0x0
31 # CHECK: # encoding: [0x13,0x85,0x05,0x00]
32 addi a0, a1, 0
34 # CHECK-INST: addi s0, sp, 0x3fc
35 # CHECK: # encoding: [0x13,0x04,0xc1,0x3f]
36 addi s0, sp, 1020
38 # CHECK: .option arch, +c
39 .option arch, +c
40 # CHECK-INST: c.mv a0, a1
41 # CHECK: # encoding: [0x2e,0x85]
42 addi a0, a1, 0
44 # CHECK-INST: c.addi4spn s0, sp, 0x3fc
45 # CHECK: # encoding: [0xe0,0x1f]
46 addi s0, sp, 1020
48 # CHECK: .option arch, -c
49 .option arch, -c
50 # CHECK-INST: addi a0, a1, 0x0
51 # CHECK: # encoding: [0x13,0x85,0x05,0x00]
52 addi a0, a1, 0
54 # CHECK-INST: addi s0, sp, 0x3fc
55 # CHECK: # encoding: [0x13,0x04,0xc1,0x3f]
56 addi s0, sp, 1020
58 # CHECK: .option arch, +d, -d
59 .option arch, +d, -d
60 # CHECK-INST: flw ft0, 0xc(a0)
61 # CHECK: # encoding: [0x07,0x20,0xc5,0x00]
62 flw f0, 12(a0)
64 # Test comma-separated list
65 # CHECK: arch, +m, +a
66 .option arch, +m, +a
67 # CHECK-INST: mul a4, ra, s0
68 # CHECK: # encoding: [0x33,0x87,0x80,0x02]
69 mul a4, ra, s0
70 # CHECK-INST: lr.w t0, (t1)
71 # CHECK: # encoding: [0xaf,0x22,0x03,0x10]
72 lr.w t0, (t1)
74 # Test multi-letter extension
75 # CHECK: .option arch, +zba
76 .option arch, +zba
77 # CHECK-INST: sh1add t0, t1, t2
78 # CHECK: encoding: [0xb3,0x22,0x73,0x20]
79 sh1add t0, t1, t2
81 # Test experimental extension
82 # CHECK: .option arch, +zicfiss
83 .option arch, +zicfiss
84 # CHECK-INST: sspopchk ra
85 # CHECK: encoding: [0x73,0xc0,0xc0,0xcd]
86 sspopchk ra
88 # Test '.option arch, <arch-string>' directive
89 # CHECK: .option arch, rv32i2p1_m2p0_a2p1_c2p0
90 .option arch, rv32i2p1_m2p0_a2p1_c2p0
92 # CHECK-INST: mul a4, ra, s0
93 # CHECK: # encoding: [0x33,0x87,0x80,0x02]
94 mul a4, ra, s0
95 # CHECK-INST: lr.w t0, (t1)
96 # CHECK: # encoding: [0xaf,0x22,0x03,0x10]
97 lr.w t0, (t1)
99 # Test arch string without version number
100 # CHECK: .option arch, rv32i2p1_m2p0_a2p1_c2p0
101 .option arch, rv32imac
102 # CHECK-INST: mul a4, ra, s0
103 # CHECK: # encoding: [0x33,0x87,0x80,0x02]
104 mul a4, ra, s0
105 # CHECK-INST: lr.w t0, (t1)
106 # CHECK: # encoding: [0xaf,0x22,0x03,0x10]
107 lr.w t0, (t1)
109 # Test +c, -c and vice-versa
110 .option arch, +c, -c
111 # CHECK-INST: addi a0, a1, 0x0
112 # CHECK: # encoding: [0x13,0x85,0x05,0x00]
113 addi a0, a1, 0
115 .option arch, -c, +c
116 # CHECK-INST: c.mv a0, a1
117 # CHECK: # encoding: [0x2e,0x85]
118 addi a0, a1, 0
120 .option arch, rv32ic
121 # CHECK-INST: c.mv a0, a1
122 # CHECK: # encoding: [0x2e,0x85]
123 addi a0, a1, 0
125 # Test extension name that has digits.
126 .option arch, +zve32x
127 # CHECK: .option arch, +zve32x
129 .option arch, rv32i
130 .option arch, +zce, +f
131 # CHECK-INST: flw fa0, 0x0(a0)
132 # CHECK: # encoding: [0x08,0x61]
133 c.flw fa0, 0(a0)