• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llvm-mc %s -triple=riscv64 -riscv-no-aliases -show-encoding \
2# RUN:     | FileCheck -check-prefixes=CHECK,CHECK-INST %s
3# RUN: llvm-mc -filetype=obj -triple riscv64 < %s \
4# RUN:     | llvm-objdump -riscv-no-aliases -d - \
5# RUN:     | FileCheck -check-prefix=CHECK-INST %s
6
7# CHECK-INST: lwu zero, 4(ra)
8# CHECK: encoding: [0x03,0xe0,0x40,0x00]
9lwu x0, 4(x1)
10# CHECK-INST: lwu sp, 4(gp)
11# CHECK: encoding: [0x03,0xe1,0x41,0x00]
12lwu x2, +4(x3)
13# CHECK-INST: lwu tp, -2048(t0)
14# CHECK: encoding: [0x03,0xe2,0x02,0x80]
15lwu x4, -2048(x5)
16# CHECK-INST: lwu t1, -2048(t2)
17# CHECK: encoding: [0x03,0xe3,0x03,0x80]
18lwu x6, %lo(2048)(x7)
19# CHECK-INST: lwu s0, 2047(s1)
20# CHECK: encoding: [0x03,0xe4,0xf4,0x7f]
21lwu x8, 2047(x9)
22
23# CHECK-INST: ld a0, -2048(a1)
24# CHECK: encoding: [0x03,0xb5,0x05,0x80]
25ld x10, -2048(x11)
26# CHECK-INST: ld a2, -2048(a3)
27# CHECK: encoding: [0x03,0xb6,0x06,0x80]
28ld x12, %lo(2048)(x13)
29# CHECK-INST: ld a4, 2047(a5)
30# CHECK: encoding: [0x03,0xb7,0xf7,0x7f]
31ld x14, 2047(x15)
32
33# CHECK-INST: sd a6, -2048(a7)
34# CHECK: encoding: [0x23,0xb0,0x08,0x81]
35sd x16, -2048(x17)
36# CHECK-INST: sd s2, -2048(s3)
37# CHECK: encoding: [0x23,0xb0,0x29,0x81]
38sd x18, %lo(2048)(x19)
39# CHECK-INST: sd s4, 2047(s5)
40# CHECK: encoding: [0xa3,0xbf,0x4a,0x7f]
41sd x20, 2047(x21)
42
43# CHECK-INST: slli s6, s7, 45
44# CHECK: encoding: [0x13,0x9b,0xdb,0x02]
45slli x22, x23, 45
46# CHECK-INST: srli s8, s9, 0
47# CHECK: encoding: [0x13,0xdc,0x0c,0x00]
48srli x24, x25, 0
49# CHECK-INST: srai s10, s11, 31
50# CHECK: encoding: [0x13,0xdd,0xfd,0x41]
51srai x26, x27, 31
52
53# CHECK-INST: addiw t3, t4, -2048
54# CHECK: encoding: [0x1b,0x8e,0x0e,0x80]
55addiw x28, x29, -2048
56# CHECK-INST: addiw t5, t6, 2047
57# CHECK: encoding: [0x1b,0x8f,0xff,0x7f]
58addiw x30, x31, 2047
59
60# CHECK-INST: slliw zero, ra, 0
61# CHECK: encoding: [0x1b,0x90,0x00,0x00]
62slliw zero, ra, 0
63# CHECK-INST: slliw sp, gp, 31
64# CHECK: encoding: [0x1b,0x91,0xf1,0x01]
65slliw sp, gp, 31
66# CHECK-INST: srliw tp, t0, 0
67# CHECK: encoding: [0x1b,0xd2,0x02,0x00]
68srliw tp, t0, 0
69# CHECK-INST: srliw t1, t2, 31
70# CHECK: encoding: [0x1b,0xd3,0xf3,0x01]
71srliw t1, t2, 31
72# CHECK-INST: sraiw s0, s1, 0
73# CHECK: encoding: [0x1b,0xd4,0x04,0x40]
74sraiw s0, s1, 0
75# CHECK-INST: sraiw a0, a1, 31
76# CHECK: encoding: [0x1b,0xd5,0xf5,0x41]
77sraiw a0, a1, 31
78
79# CHECK-INST: addw a2, a3, a4
80# CHECK: encoding: [0x3b,0x86,0xe6,0x00]
81addw a2, a3, a4
82# CHECK-INST: addw a5, a6, a7
83# CHECK: encoding: [0xbb,0x07,0x18,0x01]
84addw a5, a6, a7
85# CHECK-INST: subw s2, s3, s4
86# CHECK: encoding: [0x3b,0x89,0x49,0x41]
87subw s2, s3, s4
88# CHECK-INST: subw s5, s6, s7
89# CHECK: encoding: [0xbb,0x0a,0x7b,0x41]
90subw s5, s6, s7
91# CHECK-INST: sllw s8, s9, s10
92# CHECK: encoding: [0x3b,0x9c,0xac,0x01]
93sllw s8, s9, s10
94# CHECK-INST: srlw s11, t3, t4
95# CHECK: encoding: [0xbb,0x5d,0xde,0x01]
96srlw s11, t3, t4
97# CHECK-INST: sraw t5, t6, zero
98# CHECK: encoding: [0x3b,0xdf,0x0f,0x40]
99sraw t5, t6, zero
100