2022-06-06 15:42:53 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/*
|
|
|
|
* LoongArch translation routines.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2021 Loongson Technology Corporation Limited
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TARGET_LOONGARCH_TRANSLATE_H
|
|
|
|
#define TARGET_LOONGARCH_TRANSLATE_H
|
|
|
|
|
|
|
|
#include "exec/translator.h"
|
|
|
|
|
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 15:42:54 +03:00
|
|
|
#define TRANS(NAME, FUNC, ...) \
|
|
|
|
static bool trans_##NAME(DisasContext *ctx, arg_##NAME * a) \
|
|
|
|
{ return FUNC(ctx, a, __VA_ARGS__); }
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If an operation is being performed on less than TARGET_LONG_BITS,
|
|
|
|
* it may require the inputs to be sign- or zero-extended; which will
|
|
|
|
* depend on the exact operation being performed.
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
EXT_NONE,
|
|
|
|
EXT_SIGN,
|
|
|
|
EXT_ZERO,
|
|
|
|
} DisasExtend;
|
|
|
|
|
2022-06-06 15:42:53 +03:00
|
|
|
typedef struct DisasContext {
|
|
|
|
DisasContextBase base;
|
|
|
|
target_ulong page_start;
|
|
|
|
uint32_t opcode;
|
2022-11-07 05:45:25 +03:00
|
|
|
uint16_t mem_idx;
|
|
|
|
uint16_t plv;
|
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 15:42:54 +03:00
|
|
|
TCGv zero;
|
2022-06-06 15:42:53 +03:00
|
|
|
} DisasContext;
|
|
|
|
|
|
|
|
void generate_exception(DisasContext *ctx, int excp);
|
|
|
|
|
|
|
|
extern TCGv cpu_gpr[32], cpu_pc;
|
|
|
|
extern TCGv_i32 cpu_fscr0;
|
|
|
|
extern TCGv_i64 cpu_fpr[32];
|
|
|
|
|
|
|
|
#endif
|