test_cases:
  -
    input:
      bytes: [ 0x1a, 0x78, 0x00, 0x04 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "csrrd $s3, 0x1e"
  -
    input:
      bytes: [ 0x38, 0x08, 0x03, 0x04 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "csrwr $s1, 0xc2"
  -
    input:
      bytes: [ 0x66, 0x5b, 0x03, 0x04 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "csrxchg $a2, $s4, 0xd6"
  -
    input:
      bytes: [ 0x1a, 0x03, 0x48, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "iocsrrd.b $s3, $s1"
  -
    input:
      bytes: [ 0x65, 0x07, 0x48, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "iocsrrd.h $a1, $s4"
  -
    input:
      bytes: [ 0x8a, 0x0a, 0x48, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "iocsrrd.w $a6, $t8"
  -
    input:
      bytes: [ 0xe4, 0x12, 0x48, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "iocsrwr.b $a0, $s0"
  -
    input:
      bytes: [ 0x0b, 0x14, 0x48, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "iocsrwr.h $a7, $zero"
  -
    input:
      bytes: [ 0x54, 0x1b, 0x48, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "iocsrwr.w $t8, $s3"
  -
    input:
      bytes: [ 0x40, 0x6d, 0x00, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "cacop 0, $a6, 0x1b"
  -
    input:
      bytes: [ 0x00, 0x20, 0x48, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "tlbclr"
  -
    input:
      bytes: [ 0x00, 0x24, 0x48, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "tlbflush"
  -
    input:
      bytes: [ 0x00, 0x28, 0x48, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "tlbsrch"
  -
    input:
      bytes: [ 0x00, 0x2c, 0x48, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "tlbrd"
  -
    input:
      bytes: [ 0x00, 0x30, 0x48, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "tlbwr"
  -
    input:
      bytes: [ 0x00, 0x34, 0x48, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "tlbfill"
  -
    input:
      bytes: [ 0xb0, 0xe7, 0x49, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "invtlb 0x10, $s6, $s2"
  -
    input:
      bytes: [ 0xcc, 0x73, 0x41, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "lddir $t0, $s7, 0x5c"
  -
    input:
      bytes: [ 0x40, 0x22, 0x47, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "ldpte $t6, 0xc8"
  -
    input:
      bytes: [ 0x00, 0x38, 0x48, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "ertn"
  -
    input:
      bytes: [ 0xc9, 0x80, 0x2a, 0x00 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "dbcl 0xc9"
  -
    input:
      bytes: [ 0xcc, 0x80, 0x48, 0x06 ]
      arch: "CS_ARCH_LOONGARCH"
      options: [ "CS_MODE_LOONGARCH64" ]
    expected:
      insns:
        -
          asm_text: "idle 0xcc"
