• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llvm-mc %s -triple=riscv64 -riscv-no-aliases \
2# RUN:     | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-INST %s
3# RUN: llvm-mc %s -triple=riscv64 \
4# RUN:     | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-ALIAS %s
5# RUN: llvm-mc -filetype=obj -triple riscv64 < %s \
6# RUN:     | llvm-objdump -riscv-no-aliases -d - \
7# RUN:     | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-INST %s
8# RUN: llvm-mc -filetype=obj -triple riscv64 < %s \
9# RUN:     | llvm-objdump -d - \
10# RUN:     | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-ALIAS %s
11
12# The following check prefixes are used in this test:
13# CHECK-INST.....Match the canonical instr (tests alias to instr. mapping)
14# CHECK-ALIAS....Match the alias (tests instr. to alias mapping)
15# CHECK-EXPAND...Match canonical instr. unconditionally (tests alias expansion)
16
17# TODO ld
18# TODO sd
19
20# CHECK-INST: addiw a0, zero, 0
21# CHECK-ALIAS: sext.w a0, zero
22li x10, 0
23# CHECK-EXPAND: addiw a0, zero, 1
24li x10, 1
25# CHECK-EXPAND: addiw a0, zero, -1
26li x10, -1
27# CHECK-EXPAND: addiw a0, zero, 2047
28li x10, 2047
29# CHECK-EXPAND: addiw a0, zero, -2047
30li x10, -2047
31# CHECK-EXPAND: lui a1, 1
32# CHECK-EXPAND: addiw a1, a1, -2048
33li x11, 2048
34# CHECK-EXPAND: addiw a1, zero, -2048
35li x11, -2048
36# CHECK-EXPAND: lui a1, 1
37# CHECK-EXPAND: addiw a1, a1, -2047
38li x11, 2049
39# CHECK-EXPAND: lui a1, 1048575
40# CHECK-EXPAND: addiw a1, a1, 2047
41li x11, -2049
42# CHECK-EXPAND: lui a1, 1
43# CHECK-EXPAND: addiw a1, a1, -1
44li x11, 4095
45# CHECK-EXPAND: lui a1, 1048575
46# CHECK-EXPAND: addiw a1, a1, 1
47li x11, -4095
48# CHECK-EXPAND: lui a2, 1
49li x12, 4096
50# CHECK-EXPAND: lui a2, 1048575
51li x12, -4096
52# CHECK-EXPAND: lui a2, 1
53# CHECK-EXPAND: addiw a2, a2, 1
54li x12, 4097
55# CHECK-EXPAND: lui a2, 1048575
56# CHECK-EXPAND: addiw a2, a2, -1
57li x12, -4097
58# CHECK-EXPAND: lui a2, 524288
59# CHECK-EXPAND: addiw a2, a2, -1
60li x12, 2147483647
61# CHECK-EXPAND: lui a2, 524288
62# CHECK-EXPAND: addiw a2, a2, 1
63li x12, -2147483647
64# CHECK-EXPAND: lui a2, 524288
65li x12, -2147483648
66# CHECK-EXPAND: lui a2, 524288
67li x12, -0x80000000
68
69# CHECK-EXPAND: addiw a2, zero, 1
70# CHECK-EXPAND: slli a2, a2, 31
71li x12, 0x80000000
72# CHECK-EXPAND: addiw a2, zero, 1
73# CHECK-EXPAND: slli a2, a2, 32
74# CHECK-EXPAND: addi a2, a2, -1
75li x12, 0xFFFFFFFF
76
77# CHECK-EXPAND: addiw t0, zero, 1
78# CHECK-EXPAND: slli t0, t0, 32
79li t0, 0x100000000
80# CHECK-EXPAND: addiw t1, zero, -1
81# CHECK-EXPAND: slli t1, t1, 63
82li t1, 0x8000000000000000
83# CHECK-EXPAND: addiw t1, zero, -1
84# CHECK-EXPAND: slli t1, t1, 63
85li t1, -0x8000000000000000
86# CHECK-EXPAND: lui t2, 9321
87# CHECK-EXPAND: addiw t2, t2, -1329
88# CHECK-EXPAND: slli t2, t2, 35
89li t2, 0x1234567800000000
90# CHECK-EXPAND: addiw t3, zero, 7
91# CHECK-EXPAND: slli t3, t3, 36
92# CHECK-EXPAND: addi t3, t3, 11
93# CHECK-EXPAND: slli t3, t3, 24
94# CHECK-EXPAND: addi t3, t3, 15
95li t3, 0x700000000B00000F
96# CHECK-EXPAND: lui t4, 583
97# CHECK-EXPAND: addiw t4, t4, -1875
98# CHECK-EXPAND: slli t4, t4, 14
99# CHECK-EXPAND: addi t4, t4, -947
100# CHECK-EXPAND: slli t4, t4, 12
101# CHECK-EXPAND: addi t4, t4, 1511
102# CHECK-EXPAND: slli t4, t4, 13
103# CHECK-EXPAND: addi t4, t4, -272
104li t4, 0x123456789abcdef0
105# CHECK-EXPAND: addiw t5, zero, -1
106li t5, 0xFFFFFFFFFFFFFFFF
107
108# CHECK-INST: subw t6, zero, ra
109# CHECK-ALIAS: negw t6, ra
110negw x31, x1
111# CHECK-INST: addiw t6, ra, 0
112# CHECK-ALIAS: sext.w t6, ra
113sext.w x31, x1
114