Compiler projects using llvm
# RUN: llc %s -mtriple=loongarch64 -start-after=prologepilog -O0 -filetype=obj -o - \
# RUN:   | extract-section .text \
# RUN:   | FileCheck %s -check-prefix=CHECK-ENC
# RUN: llc %s -mtriple=loongarch64 -start-after=prologepilog -O0 -filetype=asm -o - \
# RUN:   | FileCheck %s -check-prefix=CHECK-ASM

# -------------------------------------------------------------------------------------------------
#                                           Encoding format: 1RI20
# -------------------------------------------------------------------------------------------------
# ---------------------+-----------------------------------------------------------+---------------
#  31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
# ---------------------+-----------------------------------------------------------+---------------
#        opcode        |                       imm20                               |      rd
# ---------------------+-----------------------------------------------------------+---------------

---
# CHECK-LABEL: test_LU12I_W:
# CHECK-ENC: 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0
# CHECK-ASM: lu12i.w	$a0, 49
name: test_LU12I_W
body: |
  bb.0:
    $r4 = LU12I_W 49
...
---
# CHECK-LABEL: test_LU32I_D:
# CHECK-ENC: 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0
# CHECK-ASM: lu32i.d	$a0, 196
name: test_LU32I_D
body: |
  bb.0:
    $r4 = LU32I_D $r4, 196
...
---
# CHECK-LABEL: test_PCADDI:
# CHECK-ENC: 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 1 1 0 0 1 0 0
# CHECK-ASM: pcaddi	$a0, 187
name: test_PCADDI
body: |
  bb.0:
    $r4 = PCADDI 187
...
---
# CHECK-LABEL: test_PCALAU12I:
# CHECK-ENC: 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0
# CHECK-ASM: pcalau12i	$a0, 89
name: test_PCALAU12I
body: |
  bb.0:
    $r4 = PCALAU12I 89
...
---
# CHECK-LABEL: test_PCADDU12I:
# CHECK-ENC: 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0
# CHECK-ASM: pcaddu12i	$a0, 37
name: test_PCADDU12I
body: |
  bb.0:
    $r4 = PCADDU12I 37
...
---
# CHECK-LABEL: test_PCADDU18I:
# CHECK-ENC: 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 1 0 0
# CHECK-ASM: pcaddu18i	$a0, 26
name: test_PCADDU18I
body: |
  bb.0:
    $r4 = PCADDU18I 26
...

# -------------------------------------------------------------------------------------------------
#                                           Encoding format: 1RI21
# -------------------------------------------------------------------------------------------------
# ------------------+-----------------------------------------------+--------------+---------------
#  31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
# ------------------+-----------------------------------------------+--------------+---------------
#      opcode       |                    imm21{15-0}                |      rj      | imm21{20-16}
# ------------------+-----------------------------------------------+--------------+---------------

---
# CHECK-LABEL: test_BEQZ:
# CHECK-ENC: 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 0 1 0 0 0 0 0 0 0
# CHECK-ASM: beqz	$a0, 92
name: test_BEQZ
body: |
  bb.0:
    BEQZ $r4, 92
...
---
# CHECK-LABEL: test_BNEZ:
# CHECK-ENC: 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 0 0 0 0 0 0
# CHECK-ASM: bnez	$a0, 84
name: test_BNEZ
body: |
  bb.0:
    BNEZ $r4, 84