target/loongarch: Add fixed point arithmetic instruction translation
This includes:
- ADD.{W/D}, SUB.{W/D}
- ADDI.{W/D}, ADDU16ID
- ALSL.{W[U]/D}
- LU12I.W, LU32I.D LU52I.D
- SLT[U], SLT[U]I
- PCADDI, PCADDU12I, PCADDU18I, PCALAU12I
- AND, OR, NOR, XOR, ANDN, ORN
- MUL.{W/D}, MULH.{W[U]/D[U]}
- MULW.D.W[U]
- DIV.{W[U]/D[U]}, MOD.{W[U]/D[U]}
- ANDI, ORI, XORI
Signed-off-by: Song Gao <gaosong@loongson.cn>
Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220606124333.2060567-5-yangxiaojuan@loongson.cn>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2022-06-06 14:42:54 +02:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#
|
|
|
|
# LoongArch instruction decode definitions.
|
|
|
|
#
|
|
|
|
# Copyright (c) 2021 Loongson Technology Corporation Limited
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Fields
|
|
|
|
#
|
|
|
|
%sa2p1 15:2 !function=plus_1
|
|
|
|
|
|
|
|
#
|
|
|
|
# Argument sets
|
|
|
|
#
|
|
|
|
&r_i rd imm
|
2022-06-06 14:42:56 +02:00
|
|
|
&rr rd rj
|
target/loongarch: Add fixed point arithmetic instruction translation
This includes:
- ADD.{W/D}, SUB.{W/D}
- ADDI.{W/D}, ADDU16ID
- ALSL.{W[U]/D}
- LU12I.W, LU32I.D LU52I.D
- SLT[U], SLT[U]I
- PCADDI, PCADDU12I, PCADDU18I, PCALAU12I
- AND, OR, NOR, XOR, ANDN, ORN
- MUL.{W/D}, MULH.{W[U]/D[U]}
- MULW.D.W[U]
- DIV.{W[U]/D[U]}, MOD.{W[U]/D[U]}
- ANDI, ORI, XORI
Signed-off-by: Song Gao <gaosong@loongson.cn>
Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220606124333.2060567-5-yangxiaojuan@loongson.cn>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2022-06-06 14:42:54 +02:00
|
|
|
&rrr rd rj rk
|
|
|
|
&rr_i rd rj imm
|
|
|
|
&rrr_sa rd rj rk sa
|
2022-06-06 14:42:56 +02:00
|
|
|
&rr_ms_ls rd rj ms ls
|
target/loongarch: Add fixed point arithmetic instruction translation
This includes:
- ADD.{W/D}, SUB.{W/D}
- ADDI.{W/D}, ADDU16ID
- ALSL.{W[U]/D}
- LU12I.W, LU32I.D LU52I.D
- SLT[U], SLT[U]I
- PCADDI, PCADDU12I, PCADDU18I, PCALAU12I
- AND, OR, NOR, XOR, ANDN, ORN
- MUL.{W/D}, MULH.{W[U]/D[U]}
- MULW.D.W[U]
- DIV.{W[U]/D[U]}, MOD.{W[U]/D[U]}
- ANDI, ORI, XORI
Signed-off-by: Song Gao <gaosong@loongson.cn>
Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220606124333.2060567-5-yangxiaojuan@loongson.cn>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2022-06-06 14:42:54 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Formats
|
|
|
|
#
|
2022-06-06 14:42:56 +02:00
|
|
|
@rr .... ........ ..... ..... rj:5 rd:5 &rr
|
target/loongarch: Add fixed point arithmetic instruction translation
This includes:
- ADD.{W/D}, SUB.{W/D}
- ADDI.{W/D}, ADDU16ID
- ALSL.{W[U]/D}
- LU12I.W, LU32I.D LU52I.D
- SLT[U], SLT[U]I
- PCADDI, PCADDU12I, PCADDU18I, PCALAU12I
- AND, OR, NOR, XOR, ANDN, ORN
- MUL.{W/D}, MULH.{W[U]/D[U]}
- MULW.D.W[U]
- DIV.{W[U]/D[U]}, MOD.{W[U]/D[U]}
- ANDI, ORI, XORI
Signed-off-by: Song Gao <gaosong@loongson.cn>
Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220606124333.2060567-5-yangxiaojuan@loongson.cn>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2022-06-06 14:42:54 +02:00
|
|
|
@rrr .... ........ ..... rk:5 rj:5 rd:5 &rrr
|
|
|
|
@r_i20 .... ... imm:s20 rd:5 &r_i
|
target/loongarch: Add fixed point shift instruction translation
This includes:
- SLL.W, SRL.W, SRA.W, ROTR.W
- SLLI.W, SRLI.W, SRAI.W, ROTRI.W
- SLL.D, SRL.D, SRA.D, ROTR.D
- SLLI.D, SRLI.D, SRAI.D, ROTRI.D
Signed-off-by: Song Gao <gaosong@loongson.cn>
Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220606124333.2060567-6-yangxiaojuan@loongson.cn>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2022-06-06 14:42:55 +02:00
|
|
|
@rr_ui5 .... ........ ..... imm:5 rj:5 rd:5 &rr_i
|
|
|
|
@rr_ui6 .... ........ .... imm:6 rj:5 rd:5 &rr_i
|
target/loongarch: Add fixed point arithmetic instruction translation
This includes:
- ADD.{W/D}, SUB.{W/D}
- ADDI.{W/D}, ADDU16ID
- ALSL.{W[U]/D}
- LU12I.W, LU32I.D LU52I.D
- SLT[U], SLT[U]I
- PCADDI, PCADDU12I, PCADDU18I, PCALAU12I
- AND, OR, NOR, XOR, ANDN, ORN
- MUL.{W/D}, MULH.{W[U]/D[U]}
- MULW.D.W[U]
- DIV.{W[U]/D[U]}, MOD.{W[U]/D[U]}
- ANDI, ORI, XORI
Signed-off-by: Song Gao <gaosong@loongson.cn>
Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220606124333.2060567-5-yangxiaojuan@loongson.cn>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2022-06-06 14:42:54 +02:00
|
|
|
@rr_i12 .... ...... imm:s12 rj:5 rd:5 &rr_i
|
|
|
|
@rr_ui12 .... ...... imm:12 rj:5 rd:5 &rr_i
|
|
|
|
@rr_i16 .... .. imm:s16 rj:5 rd:5 &rr_i
|
|
|
|
@rrr_sa2p1 .... ........ ... .. rk:5 rj:5 rd:5 &rrr_sa sa=%sa2p1
|
2022-06-06 14:42:56 +02:00
|
|
|
@rrr_sa2 .... ........ ... sa:2 rk:5 rj:5 rd:5 &rrr_sa
|
|
|
|
@rrr_sa3 .... ........ .. sa:3 rk:5 rj:5 rd:5 &rrr_sa
|
|
|
|
@rr_2bw .... ....... ms:5 . ls:5 rj:5 rd:5 &rr_ms_ls
|
|
|
|
@rr_2bd .... ...... ms:6 ls:6 rj:5 rd:5 &rr_ms_ls
|
target/loongarch: Add fixed point arithmetic instruction translation
This includes:
- ADD.{W/D}, SUB.{W/D}
- ADDI.{W/D}, ADDU16ID
- ALSL.{W[U]/D}
- LU12I.W, LU32I.D LU52I.D
- SLT[U], SLT[U]I
- PCADDI, PCADDU12I, PCADDU18I, PCALAU12I
- AND, OR, NOR, XOR, ANDN, ORN
- MUL.{W/D}, MULH.{W[U]/D[U]}
- MULW.D.W[U]
- DIV.{W[U]/D[U]}, MOD.{W[U]/D[U]}
- ANDI, ORI, XORI
Signed-off-by: Song Gao <gaosong@loongson.cn>
Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220606124333.2060567-5-yangxiaojuan@loongson.cn>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2022-06-06 14:42:54 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Fixed point arithmetic operation instruction
|
|
|
|
#
|
|
|
|
add_w 0000 00000001 00000 ..... ..... ..... @rrr
|
|
|
|
add_d 0000 00000001 00001 ..... ..... ..... @rrr
|
|
|
|
sub_w 0000 00000001 00010 ..... ..... ..... @rrr
|
|
|
|
sub_d 0000 00000001 00011 ..... ..... ..... @rrr
|
|
|
|
slt 0000 00000001 00100 ..... ..... ..... @rrr
|
|
|
|
sltu 0000 00000001 00101 ..... ..... ..... @rrr
|
|
|
|
slti 0000 001000 ............ ..... ..... @rr_i12
|
|
|
|
sltui 0000 001001 ............ ..... ..... @rr_i12
|
|
|
|
nor 0000 00000001 01000 ..... ..... ..... @rrr
|
|
|
|
and 0000 00000001 01001 ..... ..... ..... @rrr
|
|
|
|
or 0000 00000001 01010 ..... ..... ..... @rrr
|
|
|
|
xor 0000 00000001 01011 ..... ..... ..... @rrr
|
|
|
|
orn 0000 00000001 01100 ..... ..... ..... @rrr
|
|
|
|
andn 0000 00000001 01101 ..... ..... ..... @rrr
|
|
|
|
mul_w 0000 00000001 11000 ..... ..... ..... @rrr
|
|
|
|
mulh_w 0000 00000001 11001 ..... ..... ..... @rrr
|
|
|
|
mulh_wu 0000 00000001 11010 ..... ..... ..... @rrr
|
|
|
|
mul_d 0000 00000001 11011 ..... ..... ..... @rrr
|
|
|
|
mulh_d 0000 00000001 11100 ..... ..... ..... @rrr
|
|
|
|
mulh_du 0000 00000001 11101 ..... ..... ..... @rrr
|
|
|
|
mulw_d_w 0000 00000001 11110 ..... ..... ..... @rrr
|
|
|
|
mulw_d_wu 0000 00000001 11111 ..... ..... ..... @rrr
|
|
|
|
div_w 0000 00000010 00000 ..... ..... ..... @rrr
|
|
|
|
mod_w 0000 00000010 00001 ..... ..... ..... @rrr
|
|
|
|
div_wu 0000 00000010 00010 ..... ..... ..... @rrr
|
|
|
|
mod_wu 0000 00000010 00011 ..... ..... ..... @rrr
|
|
|
|
div_d 0000 00000010 00100 ..... ..... ..... @rrr
|
|
|
|
mod_d 0000 00000010 00101 ..... ..... ..... @rrr
|
|
|
|
div_du 0000 00000010 00110 ..... ..... ..... @rrr
|
|
|
|
mod_du 0000 00000010 00111 ..... ..... ..... @rrr
|
|
|
|
alsl_w 0000 00000000 010 .. ..... ..... ..... @rrr_sa2p1
|
|
|
|
alsl_wu 0000 00000000 011 .. ..... ..... ..... @rrr_sa2p1
|
|
|
|
alsl_d 0000 00000010 110 .. ..... ..... ..... @rrr_sa2p1
|
|
|
|
lu12i_w 0001 010 .................... ..... @r_i20
|
|
|
|
lu32i_d 0001 011 .................... ..... @r_i20
|
|
|
|
lu52i_d 0000 001100 ............ ..... ..... @rr_i12
|
|
|
|
pcaddi 0001 100 .................... ..... @r_i20
|
|
|
|
pcalau12i 0001 101 .................... ..... @r_i20
|
|
|
|
pcaddu12i 0001 110 .................... ..... @r_i20
|
|
|
|
pcaddu18i 0001 111 .................... ..... @r_i20
|
|
|
|
addi_w 0000 001010 ............ ..... ..... @rr_i12
|
|
|
|
addi_d 0000 001011 ............ ..... ..... @rr_i12
|
|
|
|
addu16i_d 0001 00 ................ ..... ..... @rr_i16
|
|
|
|
andi 0000 001101 ............ ..... ..... @rr_ui12
|
|
|
|
ori 0000 001110 ............ ..... ..... @rr_ui12
|
|
|
|
xori 0000 001111 ............ ..... ..... @rr_ui12
|
target/loongarch: Add fixed point shift instruction translation
This includes:
- SLL.W, SRL.W, SRA.W, ROTR.W
- SLLI.W, SRLI.W, SRAI.W, ROTRI.W
- SLL.D, SRL.D, SRA.D, ROTR.D
- SLLI.D, SRLI.D, SRAI.D, ROTRI.D
Signed-off-by: Song Gao <gaosong@loongson.cn>
Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220606124333.2060567-6-yangxiaojuan@loongson.cn>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2022-06-06 14:42:55 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Fixed point shift operation instruction
|
|
|
|
#
|
|
|
|
sll_w 0000 00000001 01110 ..... ..... ..... @rrr
|
|
|
|
srl_w 0000 00000001 01111 ..... ..... ..... @rrr
|
|
|
|
sra_w 0000 00000001 10000 ..... ..... ..... @rrr
|
|
|
|
sll_d 0000 00000001 10001 ..... ..... ..... @rrr
|
|
|
|
srl_d 0000 00000001 10010 ..... ..... ..... @rrr
|
|
|
|
sra_d 0000 00000001 10011 ..... ..... ..... @rrr
|
|
|
|
rotr_w 0000 00000001 10110 ..... ..... ..... @rrr
|
|
|
|
rotr_d 0000 00000001 10111 ..... ..... ..... @rrr
|
|
|
|
slli_w 0000 00000100 00001 ..... ..... ..... @rr_ui5
|
|
|
|
slli_d 0000 00000100 0001 ...... ..... ..... @rr_ui6
|
|
|
|
srli_w 0000 00000100 01001 ..... ..... ..... @rr_ui5
|
|
|
|
srli_d 0000 00000100 0101 ...... ..... ..... @rr_ui6
|
|
|
|
srai_w 0000 00000100 10001 ..... ..... ..... @rr_ui5
|
|
|
|
srai_d 0000 00000100 1001 ...... ..... ..... @rr_ui6
|
|
|
|
rotri_w 0000 00000100 11001 ..... ..... ..... @rr_ui5
|
|
|
|
rotri_d 0000 00000100 1101 ...... ..... ..... @rr_ui6
|
2022-06-06 14:42:56 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Fixed point bit operation instruction
|
|
|
|
#
|
|
|
|
ext_w_h 0000 00000000 00000 10110 ..... ..... @rr
|
|
|
|
ext_w_b 0000 00000000 00000 10111 ..... ..... @rr
|
|
|
|
clo_w 0000 00000000 00000 00100 ..... ..... @rr
|
|
|
|
clz_w 0000 00000000 00000 00101 ..... ..... @rr
|
|
|
|
cto_w 0000 00000000 00000 00110 ..... ..... @rr
|
|
|
|
ctz_w 0000 00000000 00000 00111 ..... ..... @rr
|
|
|
|
clo_d 0000 00000000 00000 01000 ..... ..... @rr
|
|
|
|
clz_d 0000 00000000 00000 01001 ..... ..... @rr
|
|
|
|
cto_d 0000 00000000 00000 01010 ..... ..... @rr
|
|
|
|
ctz_d 0000 00000000 00000 01011 ..... ..... @rr
|
|
|
|
revb_2h 0000 00000000 00000 01100 ..... ..... @rr
|
|
|
|
revb_4h 0000 00000000 00000 01101 ..... ..... @rr
|
|
|
|
revb_2w 0000 00000000 00000 01110 ..... ..... @rr
|
|
|
|
revb_d 0000 00000000 00000 01111 ..... ..... @rr
|
|
|
|
revh_2w 0000 00000000 00000 10000 ..... ..... @rr
|
|
|
|
revh_d 0000 00000000 00000 10001 ..... ..... @rr
|
|
|
|
bitrev_4b 0000 00000000 00000 10010 ..... ..... @rr
|
|
|
|
bitrev_8b 0000 00000000 00000 10011 ..... ..... @rr
|
|
|
|
bitrev_w 0000 00000000 00000 10100 ..... ..... @rr
|
|
|
|
bitrev_d 0000 00000000 00000 10101 ..... ..... @rr
|
|
|
|
bytepick_w 0000 00000000 100 .. ..... ..... ..... @rrr_sa2
|
|
|
|
bytepick_d 0000 00000000 11 ... ..... ..... ..... @rrr_sa3
|
|
|
|
maskeqz 0000 00000001 00110 ..... ..... ..... @rrr
|
|
|
|
masknez 0000 00000001 00111 ..... ..... ..... @rrr
|
|
|
|
bstrins_w 0000 0000011 ..... 0 ..... ..... ..... @rr_2bw
|
|
|
|
bstrpick_w 0000 0000011 ..... 1 ..... ..... ..... @rr_2bw
|
|
|
|
bstrins_d 0000 000010 ...... ...... ..... ..... @rr_2bd
|
|
|
|
bstrpick_d 0000 000011 ...... ...... ..... ..... @rr_2bd
|