[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 09/30] tcg/loongarch64: Implement tcg_out_mov and tcg_out_
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v6 09/30] tcg/loongarch64: Implement tcg_out_mov and tcg_out_movi |
Date: |
Sun, 26 Sep 2021 08:48:40 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 |
On 9/25/21 19:30, WANG Xuerui wrote:
> Signed-off-by: WANG Xuerui <git@xen0n.name>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/loongarch64/tcg-target.c.inc | 137 +++++++++++++++++++++++++++++++
> 1 file changed, 137 insertions(+)
> +static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg)
> +{
> + if (ret == arg) {
> + return true;
> + }
> + switch (type) {
> + case TCG_TYPE_I32:
> + case TCG_TYPE_I64:
> + /*
> + * Conventional register-register move used in LoongArch is
> + * `or dst, src, zero`.
> + */
> + tcg_out_opc_or(s, ret, arg, TCG_REG_ZERO);
> + break;
> + default:
> + g_assert_not_reached();
> + }
> + return true;
> +}
> +static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg rd,
> + tcg_target_long val)
> +{
> + /*
> + * LoongArch conventionally loads 64-bit immediates in at most 4 steps,
> + * with dedicated instructions for filling the respective bitfields
> + * below:
> + *
> + * 6 5 4 3
> + * 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2
> + * +-----------------------+---------------------------------------+...
> + * | hi52 | hi32 |
> + * +-----------------------+---------------------------------------+...
> + * 3 2 1
> + * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
> + * ...+-------------------------------------+-------------------------+
> + * | hi12 | lo |
> + * ...+-------------------------------------+-------------------------+
> + *
> + * Check if val belong to one of the several fast cases, before falling
> + * back to the slow path.
> + */
Lovely :)
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
- [PATCH v6 03/30] tcg/loongarch64: Add the tcg-target.h file, (continued)
- [PATCH v6 03/30] tcg/loongarch64: Add the tcg-target.h file, WANG Xuerui, 2021/09/25
- [PATCH v6 01/30] elf: Add machine type value for LoongArch, WANG Xuerui, 2021/09/25
- [PATCH v6 02/30] MAINTAINERS: Add tcg/loongarch64 entry with myself as maintainer, WANG Xuerui, 2021/09/25
- [PATCH v6 04/30] tcg/loongarch64: Add generated instruction opcodes and encoding helpers, WANG Xuerui, 2021/09/25
- [PATCH v6 05/30] tcg/loongarch64: Add register names, allocation order and input/output sets, WANG Xuerui, 2021/09/25
- [PATCH v6 08/30] tcg/loongarch64: Implement the memory barrier op, WANG Xuerui, 2021/09/25
- [PATCH v6 11/30] tcg/loongarch64: Implement sign-/zero-extension ops, WANG Xuerui, 2021/09/25
- [PATCH v6 07/30] tcg/loongarch64: Implement necessary relocation operations, WANG Xuerui, 2021/09/25
- [PATCH v6 12/30] tcg/loongarch64: Implement not/and/or/xor/nor/andc/orc ops, WANG Xuerui, 2021/09/25
- [PATCH v6 09/30] tcg/loongarch64: Implement tcg_out_mov and tcg_out_movi, WANG Xuerui, 2021/09/25
- Re: [PATCH v6 09/30] tcg/loongarch64: Implement tcg_out_mov and tcg_out_movi,
Philippe Mathieu-Daudé <=
- [PATCH v6 10/30] tcg/loongarch64: Implement goto_ptr, WANG Xuerui, 2021/09/25
- [PATCH v6 15/30] tcg/loongarch64: Implement clz/ctz ops, WANG Xuerui, 2021/09/25
- [PATCH v6 06/30] tcg/loongarch64: Define the operand constraints, WANG Xuerui, 2021/09/25
- [PATCH v6 26/30] tcg/loongarch64: Implement tcg_target_init, WANG Xuerui, 2021/09/25
- [PATCH v6 21/30] tcg/loongarch64: Implement tcg_out_call, WANG Xuerui, 2021/09/25