# 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: I15 # ------------------------------------------------------------------------------------------------- # ---------------------------------------------------+--------------------------------------------- # 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 | imm15 # ---------------------------------------------------+--------------------------------------------- --- # CHECK-LABEL: test_DBAR: # CHECK-ENC: 0 0 1 1 1 0 0 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # CHECK-ASM: dbar 0 name: test_DBAR body: | bb.0: DBAR 0 ... --- # CHECK-LABEL: test_IBAR: # CHECK-ENC: 0 0 1 1 1 0 0 0 0 1 1 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # CHECK-ASM: ibar 0 name: test_IBAR body: | bb.0: IBAR 0 ... --- # CHECK-LABEL: test_SYSCALL: # CHECK-ENC: 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 # CHECK-ASM: syscall 100 name: test_SYSCALL body: | bb.0: SYSCALL 100 ... --- # CHECK-LABEL: test_BREAK: # CHECK-ENC: 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 1 # CHECK-ASM: break 199 name: test_BREAK body: | bb.0: BREAK 199 ... # ------------------------------------------------------------------------------------------------- # Encoding format: I26 # ------------------------------------------------------------------------------------------------- # ------------------+-----------------------------------------------+------------------------------ # 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 | imm26{15-0} | imm26{25-16} # ------------------+-----------------------------------------------+------------------------------ --- # CHECK-LABEL: test_B: # CHECK-ENC: 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 # CHECK-ASM: b 80 name: test_B body: | bb.0: B 80 ... --- # CHECK-LABEL: test_BL: # CHECK-ENC: 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 # CHECK-ASM: bl 136 name: test_BL body: | bb.0: BL 136 ... # -------------------------------------------------------------------------------------------------------- # Encoding format: BSTR_W # -------------------------------------------------------------------------------------------------------- # ---------------------------------+--------------+---------+--------------+--------------+--------------- # 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{11-1} | msb |opcode{0}| lsb | rj | rd # ---------------------------------+--------------+---------+--------------+--------------+--------------- --- # CHECK-LABEL: test_BSTRINS_W: # CHECK-ENC: 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 0 0 0 1 0 1 0 0 1 0 0 # CHECK-ASM: bstrins.w $a0, $a1, 7, 2 name: test_BSTRINS_W body: | bb.0: $r4 = BSTRINS_W $r4, $r5, 7, 2 ... --- # CHECK-LABEL: test_BSTRPICK_W: # CHECK-ENC: 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0 1 0 0 1 0 0 0 0 1 0 1 0 0 1 0 0 # CHECK-ASM: bstrpick.w $a0, $a1, 10, 4 name: test_BSTRPICK_W body: | bb.0: $r4 = BSTRPICK_W $r5, 10, 4 ... # ------------------------------------------------------------------------------------------------- # Encoding format: BSTR_D # ------------------------------------------------------------------------------------------------- # ------------------------------+-----------------+-----------------+--------------+--------------- # 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 | msb | lsb | rj | rd # ------------------------------+-----------------+-----------------+--------------+--------------- --- # CHECK-LABEL: test_BSTRINS_D: # CHECK-ENC: 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 1 0 1 0 0 1 0 0 # CHECK-ASM: bstrins.d $a0, $a1, 7, 2 name: test_BSTRINS_D body: | bb.0: $r4 = BSTRINS_D $r4, $r5, 7, 2 ... --- # CHECK-LABEL: test_BSTRPICK_D: # CHECK-ENC: 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 0 0 # CHECK-ASM: bstrpick.d $a0, $a1, 39, 22 name: test_BSTRPICK_D body: | bb.0: $r4 = BSTRPICK_D $r5, 39, 22 ... # ------------------------------------------------------------------------------------------------- # Encoding format: ASRT # ------------------------------------------------------------------------------------------------- # ---------------------------------------------------+--------------+--------------+--------------- # 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 | rk | rj | 0x0 # ---------------------------------------------------+--------------+--------------+--------------- --- # CHECK-LABEL: test_ASRTLE_D: # CHECK-ENC: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 # CHECK-ASM: asrtle.d $a0, $a1 name: test_ASRTLE_D body: | bb.0: ASRTLE_D $r4, $r5 ... --- # CHECK-LABEL: test_ASRTGT_D: # CHECK-ENC: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 # CHECK-ASM: asrtgt.d $a0, $a1 name: test_ASRTGT_D body: | bb.0: ASRTGT_D $r4, $r5 ... # ------------------------------------------------------------------------------------------------- # Encoding format: PRELD # ------------------------------------------------------------------------------------------------- # ------------------------------+-----------------------------------+--------------+--------------- # 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 | imm12 | rj | imm5 # ------------------------------+-----------------------------------+--------------+--------------- --- # CHECK-LABEL: test_PRELD: # CHECK-ENC: 0 0 1 0 1 0 1 0 1 1 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 0 0 1 1 1 1 # CHECK-ASM: preld 15, $a0, 21 name: test_PRELD body: | bb.0: PRELD 15, $r4, 21 ... # ------------------------------------------------------------------------------------------------- # Encoding format: PRELDX # ------------------------------------------------------------------------------------------------- # ---------------------------------------------------+--------------+--------------+--------------- # 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 | rk | rj | imm5 # ---------------------------------------------------+--------------+--------------+--------------- --- # CHECK-LABEL: test_PRELDX: # CHECK-ENC: 0 0 1 1 1 0 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 1 0 0 1 0 0 0 1 0 1 1 # CHECK-ASM: preldx 11, $a0, $a1 name: test_PRELDX body: | bb.0: PRELDX 11, $r4, $r5