1# RUN: llvm-mc %s -triple=riscv32 -riscv-no-aliases \ 2# RUN: | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-INST %s 3# RUN: llvm-mc %s -triple=riscv32 \ 4# RUN: | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-ALIAS %s 5# RUN: llvm-mc %s -triple=riscv64 -riscv-no-aliases\ 6# RUN: | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-INST %s 7# RUN: llvm-mc %s -triple=riscv64 \ 8# RUN: | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-ALIAS %s 9# RUN: llvm-mc -filetype=obj -triple riscv32 < %s \ 10# RUN: | llvm-objdump -d -riscv-no-aliases - \ 11# RUN: | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-INST %s 12# RUN: llvm-mc -filetype=obj -triple riscv32 < %s \ 13# RUN: | llvm-objdump -d - \ 14# RUN: | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-ALIAS %s 15# RUN: llvm-mc -filetype=obj -triple riscv64 < %s \ 16# RUN: | llvm-objdump -d -riscv-no-aliases - \ 17# RUN: | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-INST %s 18# RUN: llvm-mc -filetype=obj -triple riscv64 < %s \ 19# RUN: | llvm-objdump -d - \ 20# RUN: | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-ALIAS %s 21 22# The following check prefixes are used in this test: 23# CHECK-INST.....Match the canonical instr (tests alias to instr. mapping) 24# CHECK-ALIAS....Match the alias (tests instr. to alias mapping) 25# CHECK-EXPAND...Match canonical instr. unconditionally (tests alias expansion) 26 27# TODO la 28# TODO lb lh lw 29# TODO sb sh sw 30 31# CHECK-INST: addi zero, zero, 0 32# CHECK-ALIAS: nop 33nop 34 35# CHECK-INST: addi t6, zero, 0 36# CHECK-ALIAS: mv t6, zero 37mv x31, zero 38# CHECK-INST: xori t6, ra, -1 39# CHECK-ALIAS: not t6, ra 40not x31, x1 41# CHECK-INST: sub t6, zero, ra 42# CHECK-ALIAS: neg t6, ra 43neg x31, x1 44# CHECK-INST: sltiu t6, ra, 1 45# CHECK-ALIAS: seqz t6, ra 46seqz x31, x1 47# CHECK-INST: sltu t6, zero, ra 48# CHECK-ALIAS: snez t6, ra 49snez x31, x1 50# CHECK-INST: slt t6, ra, zero 51# CHECK-ALIAS: sltz t6, ra 52sltz x31, x1 53# CHECK-INST: slt t6, zero, ra 54# CHECK-ALIAS: sgtz t6, ra 55sgtz x31, x1 56 57# CHECK-INST: slt ra, gp, sp 58# CHECK-ALIAS: slt ra, gp, sp 59sgt x1, x2, x3 60# CHECK-INST: sltu tp, t1, t0 61# CHECK-ALIAS: sltu tp, t1, t0 62sgtu x4, x5, x6 63 64# CHECK-INST: beq a0, zero, 512 65# CHECK-ALIAS: beqz a0, 512 66beqz x10, 512 67# CHECK-INST: bne a1, zero, 1024 68# CHECK-ALIAS: bnez a1, 1024 69bnez x11, 1024 70# CHECK-INST: bge zero, a2, 4 71# CHECK-ALIAS: blez a2, 4 72blez x12, 4 73# CHECK-INST: bge a3, zero, 8 74# CHECK-ALIAS: bgez a3, 8 75bgez x13, 8 76# CHECK-INST: blt a4, zero, 12 77# CHECK-ALIAS: bltz a4, 12 78bltz x14, 12 79# CHECK-INST: blt zero, a5, 16 80# CHECK-ALIAS: bgtz a5, 16 81bgtz x15, 16 82 83# Always output the canonical mnemonic for the pseudo branch instructions. 84# CHECK-INST: blt a6, a5, 20 85# CHECK-ALIAS: blt a6, a5, 20 86bgt x15, x16, 20 87# CHECK-INST: bge a7, a6, 24 88# CHECK-ALIAS: bge a7, a6, 24 89ble x16, x17, 24 90# CHECK-INST: bltu s2, a7, 28 91# CHECK-ALIAS: bltu s2, a7, 28 92bgtu x17, x18, 28 93# CHECK-INST: bgeu s3, s2, 32 94# CHECK-ALIAS: bgeu s3, s2, 32 95bleu x18, x19, 32 96 97# CHECK-INST: jal zero, 2044 98# CHECK-ALIAS: j 2044 99j 2044 100# CHECK-INST: jal ra, 2040 101# CHECK-ALIAS: jal 2040 102jal 2040 103# CHECK-INST: jalr zero, s4, 0 104# CHECK-ALIAS: jr s4 105jr x20 106# CHECK-INST: jalr ra, s5, 0 107# CHECK-ALIAS: jalr s5 108jalr x21 109# CHECK-INST: jalr zero, ra, 0 110# CHECK-ALIAS: ret 111ret 112# TODO call 113# TODO tail 114 115# CHECK-INST: fence iorw, iorw 116# CHECK-ALIAS: fence 117fence 118 119# CHECK-INST: csrrs s10, 3074, zero 120# CHECK-ALIAS: rdinstret s10 121rdinstret x26 122# CHECK-INST: csrrs s8, 3072, zero 123# CHECK-ALIAS: rdcycle s8 124rdcycle x24 125# CHECK-INST: csrrs s9, 3073, zero 126# CHECK-ALIAS: rdtime s9 127rdtime x25 128 129# CHECK-INST: csrrs s0, 336, zero 130# CHECK-ALIAS: csrr s0, 336 131csrr x8, 0x150 132# CHECK-INST: csrrw zero, 320, s1 133# CHECK-ALIAS: csrw 320, s1 134csrw 0x140, x9 135# CHECK-INST: csrrs zero, 4095, s6 136# CHECK-ALIAS: csrs 4095, s6 137csrs 0xfff, x22 138# CHECK-INST: csrrc zero, 4095, s7 139# CHECK-ALIAS: csrc 4095, s7 140csrc 0xfff, x23 141 142# CHECK-INST: csrrwi zero, 336, 15 143# CHECK-ALIAS: csrwi 336, 15 144csrwi 0x150, 0xf 145# CHECK-INST: csrrsi zero, 4095, 16 146# CHECK-ALIAS: csrsi 4095, 16 147csrsi 0xfff, 0x10 148# CHECK-INST: csrrci zero, 320, 17 149# CHECK-ALIAS: csrci 320, 17 150csrci 0x140, 0x11 151 152# CHECK-INST: sfence.vma zero, zero 153# CHECK-ALIAS: sfence.vma 154sfence.vma 155# CHECK-INST: sfence.vma a0, zero 156# CHECK-ALIAS: sfence.vma a0 157sfence.vma a0 158