1 /* ------------------------------------------------------------------ */
2 /* WARNING: relative order of tokens is important. */
5 * The specifications are available under https://riscv.org/technical/specifications/
8 #define DEF_ASM_WITH_SUFFIX(x, y) \
9 DEF(TOK_ASM_ ## x ## _ ## y, #x "." #y)
11 #define DEF_ASM_WITH_SUFFIXES(x, y, z) \
12 DEF(TOK_ASM_ ## x ## _ ## y ## _ ## z, #x "." #y "." #z)
14 #define DEF_ASM_FENCE(x) \
15 DEF(TOK_ASM_ ## x ## _fence, #x)
85 /* register ABI mnemonics, refer to RISC-V ABI 1.0 */
235 /* Zifencei extension */
236 DEF_ASM_WITH_SUFFIX(fence
, i
)
240 /* used to be called scall and sbreak */
253 /* “M” Standard Extension for Integer Multiplication and Division, V2.0 */
269 /* "C" Extension for Compressed Instructions, V2.0 */
270 DEF_ASM_WITH_SUFFIX(c
, nop
)
272 DEF_ASM_WITH_SUFFIX(c
, li
)
273 DEF_ASM_WITH_SUFFIX(c
, lw
)
274 DEF_ASM_WITH_SUFFIX(c
, lwsp
)
276 DEF_ASM_WITH_SUFFIX(c
, flw
)
277 DEF_ASM_WITH_SUFFIX(c
, flwsp
)
279 DEF_ASM_WITH_SUFFIX(c
, fld
)
280 DEF_ASM_WITH_SUFFIX(c
, fldsp
)
282 DEF_ASM_WITH_SUFFIX(c
, ld
)
283 DEF_ASM_WITH_SUFFIX(c
, ldsp
)
287 DEF_ASM_WITH_SUFFIX(c
, sw
)
288 DEF_ASM_WITH_SUFFIX(c
, sd
)
289 DEF_ASM_WITH_SUFFIX(c
, swsp
)
290 DEF_ASM_WITH_SUFFIX(c
, sdsp
)
292 DEF_ASM_WITH_SUFFIX(c
, fsw
)
293 DEF_ASM_WITH_SUFFIX(c
, fswsp
)
295 DEF_ASM_WITH_SUFFIX(c
, fsd
)
296 DEF_ASM_WITH_SUFFIX(c
, fsdsp
)
299 DEF_ASM_WITH_SUFFIX(c
, slli
)
300 DEF_ASM_WITH_SUFFIX(c
, srli
)
301 DEF_ASM_WITH_SUFFIX(c
, srai
)
304 DEF_ASM_WITH_SUFFIX(c
, add
)
305 DEF_ASM_WITH_SUFFIX(c
, addi
)
306 DEF_ASM_WITH_SUFFIX(c
, addi16sp
)
307 DEF_ASM_WITH_SUFFIX(c
, addi4spn
)
308 DEF_ASM_WITH_SUFFIX(c
, lui
)
309 DEF_ASM_WITH_SUFFIX(c
, sub
)
310 DEF_ASM_WITH_SUFFIX(c
, mv
)
312 DEF_ASM_WITH_SUFFIX(c
, addw
)
313 DEF_ASM_WITH_SUFFIX(c
, addiw
)
314 DEF_ASM_WITH_SUFFIX(c
, subw
)
317 DEF_ASM_WITH_SUFFIX(c
, xor)
318 DEF_ASM_WITH_SUFFIX(c
, or)
319 DEF_ASM_WITH_SUFFIX(c
, and)
320 DEF_ASM_WITH_SUFFIX(c
, andi
)
323 DEF_ASM_WITH_SUFFIX(c
, beqz
)
324 DEF_ASM_WITH_SUFFIX(c
, bnez
)
327 DEF_ASM_WITH_SUFFIX(c
, j
)
328 DEF_ASM_WITH_SUFFIX(c
, jr
)
329 DEF_ASM_WITH_SUFFIX(c
, jal
)
330 DEF_ASM_WITH_SUFFIX(c
, jalr
)
333 DEF_ASM_WITH_SUFFIX(c
, ebreak
)
335 /* XXX F Extension: Single-Precision Floating Point */
336 /* XXX D Extension: Double-Precision Floating Point */
337 /* from the spec: Tables 16.5–16.7 list the RVC instructions. */
339 /* “Zicsr”, Control and Status Register (CSR) Instructions, V2.0 */
372 /* Privileged Instructions */
379 /* pseudoinstructions */
391 DEF_ASM_WITH_SUFFIX(fabs
, d
)
392 DEF_ASM_WITH_SUFFIX(fabs
, s
)
395 DEF_ASM_WITH_SUFFIX(fmv
, d
)
396 DEF_ASM_WITH_SUFFIX(fmv
, s
)
397 DEF_ASM_WITH_SUFFIX(fneg
, d
)
398 DEF_ASM_WITH_SUFFIX(fneg
, s
)
414 DEF_ASM_WITH_SUFFIX(sext
, w
)
420 /* Possible values for .option directive */
431 /* “A” Standard Extension for Atomic Instructions, Version 2.1 */
432 /* XXX: Atomic memory operations */
433 DEF_ASM_WITH_SUFFIX(lr
, w
)
434 DEF_ASM_WITH_SUFFIXES(lr
, w
, aq
)
435 DEF_ASM_WITH_SUFFIXES(lr
, w
, rl
)
436 DEF_ASM_WITH_SUFFIXES(lr
, w
, aqrl
)
438 DEF_ASM_WITH_SUFFIX(lr
, d
)
439 DEF_ASM_WITH_SUFFIXES(lr
, d
, aq
)
440 DEF_ASM_WITH_SUFFIXES(lr
, d
, rl
)
441 DEF_ASM_WITH_SUFFIXES(lr
, d
, aqrl
)
444 DEF_ASM_WITH_SUFFIX(sc
, w
)
445 DEF_ASM_WITH_SUFFIXES(sc
, w
, aq
)
446 DEF_ASM_WITH_SUFFIXES(sc
, w
, rl
)
447 DEF_ASM_WITH_SUFFIXES(sc
, w
, aqrl
)
449 DEF_ASM_WITH_SUFFIX(sc
, d
)
450 DEF_ASM_WITH_SUFFIXES(sc
, d
, aq
)
451 DEF_ASM_WITH_SUFFIXES(sc
, d
, rl
)
452 DEF_ASM_WITH_SUFFIXES(sc
, d
, aqrl
)
454 /* `fence` arguments */
455 /* NOTE: Order is important */
476 #undef DEF_ASM_WITH_SUFFIX
477 #undef DEF_ASM_WITH_SUFFIXES