| # 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: 2RI5 |
| # ------------------------------------------------------------------------------------------------- |
| # ---------------------------------------------------+--------------+--------------+--------------- |
| # 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 | imm5 | rj | rd |
| # ---------------------------------------------------+--------------+--------------+--------------- |
| |
| --- |
| # CHECK-LABEL: test_SLLI_W: |
| # CHECK-ENC: 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: slli.w $a0, $a1, 0 |
| name: test_SLLI_W |
| body: | |
| bb.0: |
| $r4 = SLLI_W $r5, 0 |
| ... |
| --- |
| # CHECK-LABEL: test_SRLI_W: |
| # CHECK-ENC: 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 1 1 1 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: srli.w $a0, $a1, 30 |
| name: test_SRLI_W |
| body: | |
| bb.0: |
| $r4 = SRLI_W $r5, 30 |
| ... |
| --- |
| # CHECK-LABEL: test_SRAI_W: |
| # CHECK-ENC: 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 0 0 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: srai.w $a0, $a1, 24 |
| name: test_SRAI_W |
| body: | |
| bb.0: |
| $r4 = SRAI_W $r5, 24 |
| ... |
| --- |
| # CHECK-LABEL: test_ROTRI_W: |
| # CHECK-ENC: 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 1 1 0 1 1 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: rotri.w $a0, $a1, 23 |
| name: test_ROTRI_W |
| body: | |
| bb.0: |
| $r4 = ROTRI_W $r5, 23 |
| ... |
| |
| # ------------------------------------------------------------------------------------------------- |
| # Encoding format: 2RI6 |
| # ------------------------------------------------------------------------------------------------- |
| # ------------------------------------------------+-----------------+--------------+--------------- |
| # 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 | imm6 | rj | rd |
| # ------------------------------------------------+-----------------+--------------+--------------- |
| |
| --- |
| # CHECK-LABEL: test_SLLI_D: |
| # CHECK-ENC: 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 1 1 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: slli.d $a0, $a1, 39 |
| name: test_SLLI_D |
| body: | |
| bb.0: |
| $r4 = SLLI_D $r5, 39 |
| ... |
| --- |
| # CHECK-LABEL: test_SRLI_D: |
| # CHECK-ENC: 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: srli.d $a0, $a1, 38 |
| name: test_SRLI_D |
| body: | |
| bb.0: |
| $r4 = SRLI_D $r5, 38 |
| ... |
| --- |
| # CHECK-LABEL: test_SRAI_D: |
| # CHECK-ENC: 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 1 1 0 1 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: srai.d $a0, $a1, 27 |
| name: test_SRAI_D |
| body: | |
| bb.0: |
| $r4 = SRAI_D $r5, 27 |
| ... |
| --- |
| # CHECK-LABEL: test_ROTRI_D: |
| # CHECK-ENC: 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 0 1 1 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: rotri.d $a0, $a1, 7 |
| name: test_ROTRI_D |
| body: | |
| bb.0: |
| $r4 = ROTRI_D $r5, 7 |
| ... |
| |
| # ------------------------------------------------------------------------------------------------- |
| # Encoding format: 2RI12 |
| # ------------------------------------------------------------------------------------------------- |
| # ------------------------------+-----------------------------------+--------------+--------------- |
| # 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 | rd |
| # ------------------------------+-----------------------------------+--------------+--------------- |
| |
| --- |
| # CHECK-LABEL: test_SLTI: |
| # CHECK-ENC: 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: slti $a0, $a1, 235 |
| name: test_SLTI |
| body: | |
| bb.0: |
| $r4 = SLTI $r5, 235 |
| ... |
| --- |
| # CHECK-LABEL: test_SLTUI: |
| # CHECK-ENC: 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 1 0 0 0 1 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: sltui $a0, $a1, 162 |
| name: test_SLTUI |
| body: | |
| bb.0: |
| $r4 = SLTUI $r5, 162 |
| ... |
| --- |
| # CHECK-LABEL: test_ADDI_W: |
| # CHECK-ENC: 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 1 1 0 1 1 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: addi.w $a0, $a1, 246 |
| name: test_ADDI_W |
| body: | |
| bb.0: |
| $r4 = ADDI_W $r5, 246 |
| ... |
| --- |
| # CHECK-LABEL: test_ADDI_D: |
| # CHECK-ENC: 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: addi.d $a0, $a1, 75 |
| name: test_ADDI_D |
| body: | |
| bb.0: |
| $r4 = ADDI_D $r5, 75 |
| ... |
| --- |
| # CHECK-LABEL: test_LU52I_D: |
| # CHECK-ENC: 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: lu52i.d $a0, $a1, 195 |
| name: test_LU52I_D |
| body: | |
| bb.0: |
| $r4 = LU52I_D $r5, 195 |
| ... |
| --- |
| # CHECK-LABEL: test_ANDI: |
| # CHECK-ENC: 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 1 0 1 0 1 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: andi $a0, $a1, 106 |
| name: test_ANDI |
| body: | |
| bb.0: |
| $r4 = ANDI $r5, 106 |
| ... |
| --- |
| # CHECK-LABEL: test_ORI: |
| # CHECK-ENC: 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: ori $a0, $a1, 47 |
| name: test_ORI |
| body: | |
| bb.0: |
| $r4 = ORI $r5, 47 |
| ... |
| --- |
| # CHECK-LABEL: test_XORI: |
| # CHECK-ENC: 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 1 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: xori $a0, $a1, 99 |
| name: test_XORI |
| body: | |
| bb.0: |
| $r4 = XORI $r5, 99 |
| ... |
| --- |
| # CHECK-LABEL: test_LD_B: |
| # CHECK-ENC: 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: ld.b $a0, $a1, 21 |
| name: test_LD_B |
| body: | |
| bb.0: |
| $r4 = LD_B $r5, 21 |
| ... |
| --- |
| # CHECK-LABEL: test_LD_H: |
| # CHECK-ENC: 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: ld.h $a0, $a1, 80 |
| name: test_LD_H |
| body: | |
| bb.0: |
| $r4 = LD_H $r5, 80 |
| ... |
| --- |
| # CHECK-LABEL: test_LD_W: |
| # CHECK-ENC: 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 1 0 1 1 1 0 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: ld.w $a0, $a1, 92 |
| name: test_LD_W |
| body: | |
| bb.0: |
| $r4 = LD_W $r5, 92 |
| ... |
| --- |
| # CHECK-LABEL: test_LD_BU: |
| # CHECK-ENC: 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 1 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: ld.bu $a0, $a1, 150 |
| name: test_LD_BU |
| body: | |
| bb.0: |
| $r4 = LD_BU $r5, 150 |
| ... |
| --- |
| # CHECK-LABEL: test_LD_HU: |
| # CHECK-ENC: 0 0 1 0 1 0 1 0 0 1 0 0 0 0 1 1 0 0 0 1 1 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: ld.hu $a0, $a1, 198 |
| name: test_LD_HU |
| body: | |
| bb.0: |
| $r4 = LD_HU $r5, 198 |
| ... |
| --- |
| # CHECK-LABEL: test_LD_WU: |
| # CHECK-ENC: 0 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: ld.wu $a0, $a1, 31 |
| name: test_LD_WU |
| body: | |
| bb.0: |
| $r4 = LD_WU $r5, 31 |
| ... |
| --- |
| # CHECK-LABEL: test_ST_B: |
| # CHECK-ENC: 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: st.b $a0, $a1, 95 |
| name: test_ST_B |
| body: | |
| bb.0: |
| ST_B $r4, $r5, 95 |
| ... |
| --- |
| # CHECK-LABEL: test_ST_H: |
| # CHECK-ENC: 0 0 1 0 1 0 0 1 0 1 0 0 0 0 0 1 1 1 1 0 1 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: st.h $a0, $a1, 122 |
| name: test_ST_H |
| body: | |
| bb.0: |
| ST_H $r4, $r5, 122 |
| ... |
| --- |
| # CHECK-LABEL: test_ST_W: |
| # CHECK-ENC: 0 0 1 0 1 0 0 1 1 0 0 0 0 0 1 0 1 0 1 1 1 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: st.w $a0, $a1, 175 |
| name: test_ST_W |
| body: | |
| bb.0: |
| ST_W $r4, $r5, 175 |
| ... |
| --- |
| # CHECK-LABEL: test_ST_D: |
| # CHECK-ENC: 0 0 1 0 1 0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: st.d $a0, $a1, 60 |
| name: test_ST_D |
| body: | |
| bb.0: |
| ST_D $r4, $r5, 60 |
| ... |
| |
| # ------------------------------------------------------------------------------------------------- |
| # Encoding format: 2RI14 |
| # ------------------------------------------------------------------------------------------------- |
| # ------------------------+-----------------------------------------+--------------+--------------- |
| # 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 | imm14 | rj | rd |
| # ------------------------+-----------------------------------------+--------------+--------------- |
| |
| --- |
| # CHECK-LABEL: test_LDPTR_W: |
| # CHECK-ENC: 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: ldptr.w $a0, $a1, 264 |
| name: test_LDPTR_W |
| body: | |
| bb.0: |
| $r4 = LDPTR_W $r5, 264 |
| ... |
| --- |
| # CHECK-LABEL: test_LDPTR_D: |
| # CHECK-ENC: 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: ldptr.d $a0, $a1, 224 |
| name: test_LDPTR_D |
| body: | |
| bb.0: |
| $r4 = LDPTR_D $r5, 224 |
| ... |
| --- |
| # CHECK-LABEL: test_STPTR_W: |
| # CHECK-ENC: 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 1 1 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: stptr.w $a0, $a1, 348 |
| name: test_STPTR_W |
| body: | |
| bb.0: |
| STPTR_W $r4, $r5, 348 |
| ... |
| --- |
| # CHECK-LABEL: test_STPTR_D: |
| # CHECK-ENC: 0 0 1 0 0 1 1 1 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: stptr.d $a0, $a1, 580 |
| name: test_STPTR_D |
| body: | |
| bb.0: |
| STPTR_D $r4, $r5, 580 |
| ... |
| --- |
| # CHECK-LABEL: test_LL_W: |
| # CHECK-ENC: 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: ll.w $a0, $a1, 972 |
| name: test_LL_W |
| body: | |
| bb.0: |
| $r4 = LL_W $r5, 972 |
| ... |
| --- |
| # CHECK-LABEL: test_LL_D: |
| # CHECK-ENC: 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: ll.d $a0, $a1, 296 |
| name: test_LL_D |
| body: | |
| bb.0: |
| $r4 = LL_D $r5, 296 |
| ... |
| --- |
| # CHECK-LABEL: test_SC_W: |
| # CHECK-ENC: 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: sc.w $a0, $a1, 384 |
| name: test_SC_W |
| body: | |
| bb.0: |
| $r4 = SC_W $r4, $r5, 384 |
| ... |
| --- |
| # CHECK-LABEL: test_SC_D: |
| # CHECK-ENC: 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: sc.d $a0, $a1, 420 |
| name: test_SC_D |
| body: | |
| bb.0: |
| $r4 = SC_D $r4, $r5, 420 |
| ... |
| |
| # ------------------------------------------------------------------------------------------------- |
| # Encoding format: 2RI16 |
| # ------------------------------------------------------------------------------------------------- |
| # ------------------+-----------------------------------------------+--------------+--------------- |
| # 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 | imm16 | rj | rd |
| # ------------------+-----------------------------------------------+--------------+--------------- |
| |
| --- |
| # CHECK-LABEL: test_ADDU16I_D: |
| # CHECK-ENC: 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: addu16i.d $a0, $a1, 23 |
| name: test_ADDU16I_D |
| body: | |
| bb.0: |
| $r4 = ADDU16I_D $r5, 23 |
| ... |
| --- |
| # CHECK-LABEL: test_JIRL: |
| # CHECK-ENC: 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 1 0 1 0 0 1 0 0 |
| # CHECK-ASM: jirl $a0, $a1, 196 |
| name: test_JIRL |
| body: | |
| bb.0: |
| $r4 = JIRL $r5, 196 |
| ... |
| --- |
| # CHECK-LABEL: test_BEQ: |
| # CHECK-ENC: 0 1 0 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 1 |
| # CHECK-ASM: beq $a0, $a1, 784 |
| name: test_BEQ |
| body: | |
| bb.0: |
| BEQ $r4, $r5, 784 |
| ... |
| --- |
| # CHECK-LABEL: test_BNE: |
| # CHECK-ENC: 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 1 0 0 0 0 1 0 1 |
| # CHECK-ASM: bne $a0, $a1, 76 |
| name: test_BNE |
| body: | |
| bb.0: |
| BNE $r4, $r5, 76 |
| ... |
| --- |
| # CHECK-LABEL: test_BLT: |
| # CHECK-ENC: 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1 0 0 1 0 0 0 0 1 0 1 |
| # CHECK-ASM: blt $a0, $a1, 492 |
| name: test_BLT |
| body: | |
| bb.0: |
| BLT $r4, $r5, 492 |
| ... |
| --- |
| # CHECK-LABEL: test_BGE: |
| # CHECK-ENC: 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 1 0 1 |
| # CHECK-ASM: bge $a0, $a1, 48 |
| name: test_BGE |
| body: | |
| bb.0: |
| BGE $r4, $r5, 48 |
| ... |
| --- |
| # CHECK-LABEL: test_BLTU: |
| # CHECK-ENC: 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 1 0 1 |
| # CHECK-ASM: bltu $a0, $a1, 68 |
| name: test_BLTU |
| body: | |
| bb.0: |
| BLTU $r4, $r5, 68 |
| ... |
| --- |
| # CHECK-LABEL: test_BGEU: |
| # CHECK-ENC: 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 0 0 0 1 0 1 |
| # CHECK-ASM: bgeu $a0, $a1, 352 |
| name: test_BGEU |
| body: | |
| bb.0: |
| BGEU $r4, $r5, 352 |