From nobody Tue Nov 18 11:51:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.218.54 as permitted sender) client-ip=209.85.218.54; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ej1-f54.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.54 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1610377292; cv=none; d=zohomail.com; s=zohoarc; b=TknxeLiAvbYNzD9NzBgk4WyHaZWJT/Koxt1hzyxy2EykVtFXd2PTgzLEwHFHiT5+rMDFT0qJJrX8gcrX4/Z4YwMACq5kPac6LofsK3G/p20rlkFwoWgqcHD1Myt+sOKkzX8JjENyRM8sD3fU0Mt6f39wLkP6b1Dp0NbMxN2LGd8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610377292; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vf/wZ0/y/41t2lXyI9D2kezLuMSTe1BhgghJsOVZPUU=; b=X116ZkDKDdWw322zvDFakzEDnXiVuRLEDIRbNYHemor0kKqn4+7uYMvqeQe6FOefmGAtHVaLcg7nI+qmeCEpv3Ehs1iHnbgJSM04FHrE3DLtwpc89WvenmIeINVR0iKu/rK4gqGraSSVBAjQ8tHTjpqsxP8JZZya9uLy9RAbFMc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.54 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by mx.zohomail.com with SMTPS id 1610377292660853.2785411646797; Mon, 11 Jan 2021 07:01:32 -0800 (PST) Received: by mail-ej1-f54.google.com with SMTP id qw4so25080025ejb.12 for ; Mon, 11 Jan 2021 07:01:31 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (129.red-88-21-205.staticip.rima-tde.net. [88.21.205.129]) by smtp.gmail.com with ESMTPSA id mc25sm7102202ejb.58.2021.01.11.07.01.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 07:01:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vf/wZ0/y/41t2lXyI9D2kezLuMSTe1BhgghJsOVZPUU=; b=T/O1VpQahTfQSxTND+Epa3K10kGhyPr4JFJWUlRboUKfymWu58/DYV7EsO9JlZR4Wo owyv7FiWnvYpfWVyplreK6uD9on35nlBmcA7V35qJ4OcxY75JR/BQR2pDLUz9osOJOeg AawAGG8HPE66nNBBr1jA48uBiOmMPcFPBhtHM44DUl7q+25q8QxOzI00CDjneqAQaxHC puAEcbvNae1ll8IIiTh5MhXBrc3af84XTQeZMkFis5ZqBgXz3oyhBBCleEluo2TYkAgc hnKqKrD26LnG1q5iMu+Z/JJWTdoBArVvagq0tTNu45DkMB115OPA5pKOPZEbGGBEz0hI tO7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=vf/wZ0/y/41t2lXyI9D2kezLuMSTe1BhgghJsOVZPUU=; b=n7G49wNKT5QBr0NZZfPokPxNXggK/ipKGiPLtF7DTjQOroYy2Q992Ko5yYROo3K2qh TgH8yR1XXtmjrYOn55uhgSjUFp8/nj4PxqADbI0IoMYcyo1I/iWxKymH+LerlfRQOCla f3Yqd3U8PjRe0SMCVg2E6zd2w3KnDcPM3H1WA/L5Z23ceVDySnQC1i5BnF1a+1JVZ1jh I1xFmWQZqMHjWEj/pC2A+83C4GpLYIF4xX9iMiGDHRbSaBvjwkWmb4p9FnEnZpvUCrKM l+QdQes7oup83FHW6c4OJ7WmghXsSaOe2Peypp69JCVjCUuroHNJHGyudJSJE53MTzPd Uv1A== X-Gm-Message-State: AOAM531L2R4SWtbPNIAvgFvOB1KnuKI0T4CgylKAWpzIhqnY9RTLUaeo xz7gT0URkgsSWOIDljX2fvo= X-Google-Smtp-Source: ABdhPJxBaleYdSx2Ns1d+A/mXqWtcAFzmwdZEzz+xPUdu3b8aObS789d/hP+MtNjQh1ipvWP3gTgVA== X-Received: by 2002:a17:906:4756:: with SMTP id j22mr11543878ejs.353.1610377290055; Mon, 11 Jan 2021 07:01:30 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Huacai Chen , Aurelien Jarno , Aleksandar Rikalo , Thomas Huth , Stefan Weil , qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Jiaxun Yang , qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cornelia Huck , Richard Henderson , Andrzej Zaborowski , Alistair Francis , Palmer Dabbelt Subject: [PATCH 2/5] tcg/ppc: Hoist common argument loads in tcg_out_op() Date: Mon, 11 Jan 2021 16:01:11 +0100 Message-Id: <20210111150114.1415930-3-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210111150114.1415930-1-f4bug@amsat.org> References: <20210111150114.1415930-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tcg/ppc/tcg-target.c.inc | 294 ++++++++++++++++++--------------------- 1 file changed, 138 insertions(+), 156 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 19a4a12f155..d37b519d693 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2357,15 +2357,23 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out32(s, BCLR | BO_ALWAYS); } =20 -static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, - const int *const_args) +static void tcg_out_op(TCGContext *s, TCGOpcode opc, + const TCGArg args[TCG_MAX_OP_ARGS], + const int const_args[TCG_MAX_OP_ARGS]) { TCGArg a0, a1, a2; - int c; + int c, c1, c2; + + /* Hoist the loads of the most common arguments. */ + a0 =3D args[0]; + a1 =3D args[1]; + a2 =3D args[2]; + c1 =3D const_args[1]; + c2 =3D const_args[2]; =20 switch (opc) { case INDEX_op_exit_tb: - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R3, args[0]); + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R3, a0); tcg_out_b(s, 0, tcg_code_gen_epilogue); break; case INDEX_op_goto_tb: @@ -2376,24 +2384,24 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, if ((uintptr_t)s->code_ptr & 7) { tcg_out32(s, NOP); } - s->tb_jmp_insn_offset[args[0]] =3D tcg_current_code_size(s= ); + s->tb_jmp_insn_offset[a0] =3D tcg_current_code_size(s); tcg_out32(s, ADDIS | TAI(TCG_REG_TB, TCG_REG_TB, 0)); tcg_out32(s, ADDI | TAI(TCG_REG_TB, TCG_REG_TB, 0)); } else { - s->tb_jmp_insn_offset[args[0]] =3D tcg_current_code_size(s= ); + s->tb_jmp_insn_offset[a0] =3D tcg_current_code_size(s); tcg_out32(s, B); - s->tb_jmp_reset_offset[args[0]] =3D tcg_current_code_size(= s); + s->tb_jmp_reset_offset[a0] =3D tcg_current_code_size(s); break; } } else { /* Indirect jump. */ tcg_debug_assert(s->tb_jmp_insn_offset =3D=3D NULL); tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TB, 0, - (intptr_t)(s->tb_jmp_insn_offset + args[0])); + (intptr_t)(s->tb_jmp_insn_offset + a0)); } tcg_out32(s, MTSPR | RS(TCG_REG_TB) | CTR); tcg_out32(s, BCCTR | BO_ALWAYS); - set_jmp_reset_offset(s, args[0]); + set_jmp_reset_offset(s, a0); if (USE_REG_TB) { /* For the unlinked case, need to reset TCG_REG_TB. */ tcg_out_mem_long(s, ADDI, ADD, TCG_REG_TB, TCG_REG_TB, @@ -2401,16 +2409,16 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, } break; case INDEX_op_goto_ptr: - tcg_out32(s, MTSPR | RS(args[0]) | CTR); + tcg_out32(s, MTSPR | RS(a0) | CTR); if (USE_REG_TB) { - tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_TB, args[0]); + tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_TB, a0); } tcg_out32(s, ADDI | TAI(TCG_REG_R3, 0, 0)); tcg_out32(s, BCCTR | BO_ALWAYS); break; case INDEX_op_br: { - TCGLabel *l =3D arg_label(args[0]); + TCGLabel *l =3D arg_label(a0); uint32_t insn =3D B; =20 if (l->has_value) { @@ -2424,50 +2432,49 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, break; case INDEX_op_ld8u_i32: case INDEX_op_ld8u_i64: - tcg_out_mem_long(s, LBZ, LBZX, args[0], args[1], args[2]); + tcg_out_mem_long(s, LBZ, LBZX, a0, a1, a2); break; case INDEX_op_ld8s_i32: case INDEX_op_ld8s_i64: - tcg_out_mem_long(s, LBZ, LBZX, args[0], args[1], args[2]); - tcg_out32(s, EXTSB | RS(args[0]) | RA(args[0])); + tcg_out_mem_long(s, LBZ, LBZX, a0, a1, a2); + tcg_out32(s, EXTSB | RS(a0) | RA(a0)); break; case INDEX_op_ld16u_i32: case INDEX_op_ld16u_i64: - tcg_out_mem_long(s, LHZ, LHZX, args[0], args[1], args[2]); + tcg_out_mem_long(s, LHZ, LHZX, a0, a1, a2); break; case INDEX_op_ld16s_i32: case INDEX_op_ld16s_i64: - tcg_out_mem_long(s, LHA, LHAX, args[0], args[1], args[2]); + tcg_out_mem_long(s, LHA, LHAX, a0, a1, a2); break; case INDEX_op_ld_i32: case INDEX_op_ld32u_i64: - tcg_out_mem_long(s, LWZ, LWZX, args[0], args[1], args[2]); + tcg_out_mem_long(s, LWZ, LWZX, a0, a1, a2); break; case INDEX_op_ld32s_i64: - tcg_out_mem_long(s, LWA, LWAX, args[0], args[1], args[2]); + tcg_out_mem_long(s, LWA, LWAX, a0, a1, a2); break; case INDEX_op_ld_i64: - tcg_out_mem_long(s, LD, LDX, args[0], args[1], args[2]); + tcg_out_mem_long(s, LD, LDX, a0, a1, a2); break; case INDEX_op_st8_i32: case INDEX_op_st8_i64: - tcg_out_mem_long(s, STB, STBX, args[0], args[1], args[2]); + tcg_out_mem_long(s, STB, STBX, a0, a1, a2); break; case INDEX_op_st16_i32: case INDEX_op_st16_i64: - tcg_out_mem_long(s, STH, STHX, args[0], args[1], args[2]); + tcg_out_mem_long(s, STH, STHX, a0, a1, a2); break; case INDEX_op_st_i32: case INDEX_op_st32_i64: - tcg_out_mem_long(s, STW, STWX, args[0], args[1], args[2]); + tcg_out_mem_long(s, STW, STWX, a0, a1, a2); break; case INDEX_op_st_i64: - tcg_out_mem_long(s, STD, STDX, args[0], args[1], args[2]); + tcg_out_mem_long(s, STD, STDX, a0, a1, a2); break; =20 case INDEX_op_add_i32: - a0 =3D args[0], a1 =3D args[1], a2 =3D args[2]; - if (const_args[2]) { + if (c2) { do_addi_32: tcg_out_mem_long(s, ADDI, ADD, a0, a1, (int32_t)a2); } else { @@ -2475,14 +2482,13 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, } break; case INDEX_op_sub_i32: - a0 =3D args[0], a1 =3D args[1], a2 =3D args[2]; - if (const_args[1]) { - if (const_args[2]) { + if (c1) { + if (c2) { tcg_out_movi(s, TCG_TYPE_I32, a0, a1 - a2); } else { tcg_out32(s, SUBFIC | TAI(a0, a2, a1)); } - } else if (const_args[2]) { + } else if (c2) { a2 =3D -a2; goto do_addi_32; } else { @@ -2491,16 +2497,14 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, break; =20 case INDEX_op_and_i32: - a0 =3D args[0], a1 =3D args[1], a2 =3D args[2]; - if (const_args[2]) { + if (c2) { tcg_out_andi32(s, a0, a1, a2); } else { tcg_out32(s, AND | SAB(a1, a0, a2)); } break; case INDEX_op_and_i64: - a0 =3D args[0], a1 =3D args[1], a2 =3D args[2]; - if (const_args[2]) { + if (c2) { tcg_out_andi64(s, a0, a1, a2); } else { tcg_out32(s, AND | SAB(a1, a0, a2)); @@ -2508,8 +2512,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, = const TCGArg *args, break; case INDEX_op_or_i64: case INDEX_op_or_i32: - a0 =3D args[0], a1 =3D args[1], a2 =3D args[2]; - if (const_args[2]) { + if (c2) { tcg_out_ori32(s, a0, a1, a2); } else { tcg_out32(s, OR | SAB(a1, a0, a2)); @@ -2517,83 +2520,75 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, break; case INDEX_op_xor_i64: case INDEX_op_xor_i32: - a0 =3D args[0], a1 =3D args[1], a2 =3D args[2]; - if (const_args[2]) { + if (c2) { tcg_out_xori32(s, a0, a1, a2); } else { tcg_out32(s, XOR | SAB(a1, a0, a2)); } break; case INDEX_op_andc_i32: - a0 =3D args[0], a1 =3D args[1], a2 =3D args[2]; - if (const_args[2]) { + if (c2) { tcg_out_andi32(s, a0, a1, ~a2); } else { tcg_out32(s, ANDC | SAB(a1, a0, a2)); } break; case INDEX_op_andc_i64: - a0 =3D args[0], a1 =3D args[1], a2 =3D args[2]; - if (const_args[2]) { + if (c2) { tcg_out_andi64(s, a0, a1, ~a2); } else { tcg_out32(s, ANDC | SAB(a1, a0, a2)); } break; case INDEX_op_orc_i32: - if (const_args[2]) { - tcg_out_ori32(s, args[0], args[1], ~args[2]); + if (c2) { + tcg_out_ori32(s, a0, a1, ~a2); break; } /* FALLTHRU */ case INDEX_op_orc_i64: - tcg_out32(s, ORC | SAB(args[1], args[0], args[2])); + tcg_out32(s, ORC | SAB(a1, a0, a2)); break; case INDEX_op_eqv_i32: - if (const_args[2]) { - tcg_out_xori32(s, args[0], args[1], ~args[2]); + if (c2) { + tcg_out_xori32(s, a0, a1, ~a2); break; } /* FALLTHRU */ case INDEX_op_eqv_i64: - tcg_out32(s, EQV | SAB(args[1], args[0], args[2])); + tcg_out32(s, EQV | SAB(a1, a0, a2)); break; case INDEX_op_nand_i32: case INDEX_op_nand_i64: - tcg_out32(s, NAND | SAB(args[1], args[0], args[2])); + tcg_out32(s, NAND | SAB(a1, a0, a2)); break; case INDEX_op_nor_i32: case INDEX_op_nor_i64: - tcg_out32(s, NOR | SAB(args[1], args[0], args[2])); + tcg_out32(s, NOR | SAB(a1, a0, a2)); break; =20 case INDEX_op_clz_i32: - tcg_out_cntxz(s, TCG_TYPE_I32, CNTLZW, args[0], args[1], - args[2], const_args[2]); + tcg_out_cntxz(s, TCG_TYPE_I32, CNTLZW, a0, a1, a2, c2); break; case INDEX_op_ctz_i32: - tcg_out_cntxz(s, TCG_TYPE_I32, CNTTZW, args[0], args[1], - args[2], const_args[2]); + tcg_out_cntxz(s, TCG_TYPE_I32, CNTTZW, a0, a1, a2, c2); break; case INDEX_op_ctpop_i32: - tcg_out32(s, CNTPOPW | SAB(args[1], args[0], 0)); + tcg_out32(s, CNTPOPW | SAB(a1, a0, 0)); break; =20 case INDEX_op_clz_i64: - tcg_out_cntxz(s, TCG_TYPE_I64, CNTLZD, args[0], args[1], - args[2], const_args[2]); + tcg_out_cntxz(s, TCG_TYPE_I64, CNTLZD, a0, a1, a2, c2); break; case INDEX_op_ctz_i64: - tcg_out_cntxz(s, TCG_TYPE_I64, CNTTZD, args[0], args[1], - args[2], const_args[2]); + tcg_out_cntxz(s, TCG_TYPE_I64, CNTTZD, a0, a1, a2, c2); break; case INDEX_op_ctpop_i64: - tcg_out32(s, CNTPOPD | SAB(args[1], args[0], 0)); + tcg_out32(s, CNTPOPD | SAB(a1, a0, 0)); break; =20 case INDEX_op_mul_i32: - a0 =3D args[0], a1 =3D args[1], a2 =3D args[2]; - if (const_args[2]) { + if (c2) { tcg_out32(s, MULLI | TAI(a0, a1, a2)); } else { tcg_out32(s, MULLW | TAB(a0, a1, a2)); @@ -2601,62 +2596,58 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, break; =20 case INDEX_op_div_i32: - tcg_out32(s, DIVW | TAB(args[0], args[1], args[2])); + tcg_out32(s, DIVW | TAB(a0, a1, a2)); break; =20 case INDEX_op_divu_i32: - tcg_out32(s, DIVWU | TAB(args[0], args[1], args[2])); + tcg_out32(s, DIVWU | TAB(a0, a1, a2)); break; =20 case INDEX_op_shl_i32: - if (const_args[2]) { + if (c2) { /* Limit immediate shift count lest we create an illegal insn.= */ - tcg_out_shli32(s, args[0], args[1], args[2] & 31); + tcg_out_shli32(s, a0, a1, a2 & 31); } else { - tcg_out32(s, SLW | SAB(args[1], args[0], args[2])); + tcg_out32(s, SLW | SAB(a1, a0, a2)); } break; case INDEX_op_shr_i32: - if (const_args[2]) { + if (c2) { /* Limit immediate shift count lest we create an illegal insn.= */ - tcg_out_shri32(s, args[0], args[1], args[2] & 31); + tcg_out_shri32(s, a0, a1, a2 & 31); } else { - tcg_out32(s, SRW | SAB(args[1], args[0], args[2])); + tcg_out32(s, SRW | SAB(a1, a0, a2)); } break; case INDEX_op_sar_i32: - if (const_args[2]) { + if (c2) { /* Limit immediate shift count lest we create an illegal insn.= */ - tcg_out32(s, SRAWI | RS(args[1]) | RA(args[0]) | SH(args[2] & = 31)); + tcg_out32(s, SRAWI | RS(a1) | RA(a0) | SH(a2 & 31)); } else { - tcg_out32(s, SRAW | SAB(args[1], args[0], args[2])); + tcg_out32(s, SRAW | SAB(a1, a0, a2)); } break; case INDEX_op_rotl_i32: - if (const_args[2]) { - tcg_out_rlw(s, RLWINM, args[0], args[1], args[2], 0, 31); + if (c2) { + tcg_out_rlw(s, RLWINM, a0, a1, a2, 0, 31); } else { - tcg_out32(s, RLWNM | SAB(args[1], args[0], args[2]) - | MB(0) | ME(31)); + tcg_out32(s, RLWNM | SAB(a1, a0, a2) | MB(0) | ME(31)); } break; case INDEX_op_rotr_i32: - if (const_args[2]) { - tcg_out_rlw(s, RLWINM, args[0], args[1], 32 - args[2], 0, 31); + if (c2) { + tcg_out_rlw(s, RLWINM, a0, a1, 32 - a2, 0, 31); } else { - tcg_out32(s, SUBFIC | TAI(TCG_REG_R0, args[2], 32)); - tcg_out32(s, RLWNM | SAB(args[1], args[0], TCG_REG_R0) - | MB(0) | ME(31)); + tcg_out32(s, SUBFIC | TAI(TCG_REG_R0, a2, 32)); + tcg_out32(s, RLWNM | SAB(a1, a0, TCG_REG_R0) | MB(0) | ME(31)); } break; =20 case INDEX_op_brcond_i32: - tcg_out_brcond(s, args[2], args[0], args[1], const_args[1], - arg_label(args[3]), TCG_TYPE_I32); + tcg_out_brcond(s, a2, a0, a1, c1, arg_label(args[3]), TCG_TYPE_I32= ); break; case INDEX_op_brcond_i64: - tcg_out_brcond(s, args[2], args[0], args[1], const_args[1], - arg_label(args[3]), TCG_TYPE_I64); + tcg_out_brcond(s, a2, a0, a1, c1, arg_label(args[3]), TCG_TYPE_I64= ); break; case INDEX_op_brcond2_i32: tcg_out_brcond2(s, args, const_args); @@ -2664,17 +2655,16 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, =20 case INDEX_op_neg_i32: case INDEX_op_neg_i64: - tcg_out32(s, NEG | RT(args[0]) | RA(args[1])); + tcg_out32(s, NEG | RT(a0) | RA(a1)); break; =20 case INDEX_op_not_i32: case INDEX_op_not_i64: - tcg_out32(s, NOR | SAB(args[1], args[0], args[1])); + tcg_out32(s, NOR | SAB(a1, a0, a1)); break; =20 case INDEX_op_add_i64: - a0 =3D args[0], a1 =3D args[1], a2 =3D args[2]; - if (const_args[2]) { + if (c2) { do_addi_64: tcg_out_mem_long(s, ADDI, ADD, a0, a1, a2); } else { @@ -2682,14 +2672,13 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, } break; case INDEX_op_sub_i64: - a0 =3D args[0], a1 =3D args[1], a2 =3D args[2]; - if (const_args[1]) { - if (const_args[2]) { + if (c1) { + if (c2) { tcg_out_movi(s, TCG_TYPE_I64, a0, a1 - a2); } else { tcg_out32(s, SUBFIC | TAI(a0, a2, a1)); } - } else if (const_args[2]) { + } else if (c2) { a2 =3D -a2; goto do_addi_64; } else { @@ -2698,58 +2687,57 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, break; =20 case INDEX_op_shl_i64: - if (const_args[2]) { + if (c2) { /* Limit immediate shift count lest we create an illegal insn.= */ - tcg_out_shli64(s, args[0], args[1], args[2] & 63); + tcg_out_shli64(s, a0, a1, a2 & 63); } else { - tcg_out32(s, SLD | SAB(args[1], args[0], args[2])); + tcg_out32(s, SLD | SAB(a1, a0, a2)); } break; case INDEX_op_shr_i64: - if (const_args[2]) { + if (c2) { /* Limit immediate shift count lest we create an illegal insn.= */ - tcg_out_shri64(s, args[0], args[1], args[2] & 63); + tcg_out_shri64(s, a0, a1, a2 & 63); } else { - tcg_out32(s, SRD | SAB(args[1], args[0], args[2])); + tcg_out32(s, SRD | SAB(a1, a0, a2)); } break; case INDEX_op_sar_i64: - if (const_args[2]) { - int sh =3D SH(args[2] & 0x1f) | (((args[2] >> 5) & 1) << 1); - tcg_out32(s, SRADI | RA(args[0]) | RS(args[1]) | sh); + if (c2) { + int sh =3D SH(a2 & 0x1f) | (((a2 >> 5) & 1) << 1); + tcg_out32(s, SRADI | RA(a0) | RS(a1) | sh); } else { - tcg_out32(s, SRAD | SAB(args[1], args[0], args[2])); + tcg_out32(s, SRAD | SAB(a1, a0, a2)); } break; case INDEX_op_rotl_i64: - if (const_args[2]) { - tcg_out_rld(s, RLDICL, args[0], args[1], args[2], 0); + if (c2) { + tcg_out_rld(s, RLDICL, a0, a1, a2, 0); } else { - tcg_out32(s, RLDCL | SAB(args[1], args[0], args[2]) | MB64(0)); + tcg_out32(s, RLDCL | SAB(a1, a0, a2) | MB64(0)); } break; case INDEX_op_rotr_i64: - if (const_args[2]) { - tcg_out_rld(s, RLDICL, args[0], args[1], 64 - args[2], 0); + if (c2) { + tcg_out_rld(s, RLDICL, a0, a1, 64 - a2, 0); } else { - tcg_out32(s, SUBFIC | TAI(TCG_REG_R0, args[2], 64)); - tcg_out32(s, RLDCL | SAB(args[1], args[0], TCG_REG_R0) | MB64(= 0)); + tcg_out32(s, SUBFIC | TAI(TCG_REG_R0, a2, 64)); + tcg_out32(s, RLDCL | SAB(a1, a0, TCG_REG_R0) | MB64(0)); } break; =20 case INDEX_op_mul_i64: - a0 =3D args[0], a1 =3D args[1], a2 =3D args[2]; - if (const_args[2]) { + if (c2) { tcg_out32(s, MULLI | TAI(a0, a1, a2)); } else { tcg_out32(s, MULLD | TAB(a0, a1, a2)); } break; case INDEX_op_div_i64: - tcg_out32(s, DIVD | TAB(args[0], args[1], args[2])); + tcg_out32(s, DIVD | TAB(a0, a1, a2)); break; case INDEX_op_divu_i64: - tcg_out32(s, DIVDU | TAB(args[0], args[1], args[2])); + tcg_out32(s, DIVDU | TAB(a0, a1, a2)); break; =20 case INDEX_op_qemu_ld_i32: @@ -2778,19 +2766,19 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, c =3D EXTSW; goto gen_ext; gen_ext: - tcg_out32(s, c | RS(args[1]) | RA(args[0])); + tcg_out32(s, c | RS(a1) | RA(a0)); break; case INDEX_op_extu_i32_i64: - tcg_out_ext32u(s, args[0], args[1]); + tcg_out_ext32u(s, a0, a1); break; =20 case INDEX_op_setcond_i32: - tcg_out_setcond(s, TCG_TYPE_I32, args[3], args[0], args[1], args[2= ], - const_args[2]); + tcg_out_setcond(s, TCG_TYPE_I32, args[3], a0, a1, a2, + c2); break; case INDEX_op_setcond_i64: - tcg_out_setcond(s, TCG_TYPE_I64, args[3], args[0], args[1], args[2= ], - const_args[2]); + tcg_out_setcond(s, TCG_TYPE_I64, args[3], a0, a1, a2, + c2); break; case INDEX_op_setcond2_i32: tcg_out_setcond2(s, args, const_args); @@ -2798,7 +2786,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, = const TCGArg *args, =20 case INDEX_op_bswap16_i32: case INDEX_op_bswap16_i64: - a0 =3D args[0], a1 =3D args[1]; /* a1 =3D abcd */ if (a0 !=3D a1) { /* a0 =3D (a1 r<< 24) & 0xff # 000c */ @@ -2818,10 +2805,9 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,= const TCGArg *args, case INDEX_op_bswap32_i32: case INDEX_op_bswap32_i64: /* Stolen from gcc's builtin_bswap32 */ - a1 =3D args[1]; - a0 =3D args[0] =3D=3D a1 ? TCG_REG_R0 : args[0]; + a0 =3D a0 =3D=3D a1 ? TCG_REG_R0 : a0; =20 - /* a1 =3D args[1] # abcd */ + /* a1 =3D a1 # abcd */ /* a0 =3D rotate_left (a1, 8) # bcda */ tcg_out_rlw(s, RLWINM, a0, a1, 8, 0, 31); /* a0 =3D (a0 & ~0xff000000) | ((a1 r<< 24) & 0xff000000) # dcda */ @@ -2830,12 +2816,12 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, tcg_out_rlw(s, RLWIMI, a0, a1, 24, 16, 23); =20 if (a0 =3D=3D TCG_REG_R0) { - tcg_out_mov(s, TCG_TYPE_REG, args[0], a0); + tcg_out_mov(s, TCG_TYPE_REG, a0, a0); } break; =20 case INDEX_op_bswap64_i64: - a0 =3D args[0], a1 =3D args[1], a2 =3D TCG_REG_R0; + a2 =3D TCG_REG_R0; if (a0 =3D=3D a1) { a0 =3D TCG_REG_R0; a2 =3D a1; @@ -2862,44 +2848,42 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, tcg_out_rlw(s, RLWIMI, a0, a2, 24, 16, 23); =20 if (a0 =3D=3D 0) { - tcg_out_mov(s, TCG_TYPE_REG, args[0], a0); + tcg_out_mov(s, TCG_TYPE_REG, a0, a0); } break; =20 case INDEX_op_deposit_i32: - if (const_args[2]) { + if (c2) { uint32_t mask =3D ((2u << (args[4] - 1)) - 1) << args[3]; - tcg_out_andi32(s, args[0], args[0], ~mask); + tcg_out_andi32(s, a0, a0, ~mask); } else { - tcg_out_rlw(s, RLWIMI, args[0], args[2], args[3], + tcg_out_rlw(s, RLWIMI, a0, a2, args[3], 32 - args[3] - args[4], 31 - args[3]); } break; case INDEX_op_deposit_i64: - if (const_args[2]) { + if (c2) { uint64_t mask =3D ((2ull << (args[4] - 1)) - 1) << args[3]; - tcg_out_andi64(s, args[0], args[0], ~mask); + tcg_out_andi64(s, a0, a0, ~mask); } else { - tcg_out_rld(s, RLDIMI, args[0], args[2], args[3], - 64 - args[3] - args[4]); + tcg_out_rld(s, RLDIMI, a0, a2, args[3], 64 - args[3] - args[4]= ); } break; =20 case INDEX_op_extract_i32: - tcg_out_rlw(s, RLWINM, args[0], args[1], - 32 - args[2], 32 - args[3], 31); + tcg_out_rlw(s, RLWINM, a0, a1, 32 - a2, 32 - args[3], 31); break; case INDEX_op_extract_i64: - tcg_out_rld(s, RLDICL, args[0], args[1], 64 - args[2], 64 - args[3= ]); + tcg_out_rld(s, RLDICL, a0, a1, 64 - a2, 64 - args[3]); break; =20 case INDEX_op_movcond_i32: - tcg_out_movcond(s, TCG_TYPE_I32, args[5], args[0], args[1], args[2= ], - args[3], args[4], const_args[2]); + tcg_out_movcond(s, TCG_TYPE_I32, args[5], a0, a1, a2, + args[3], args[4], c2); break; case INDEX_op_movcond_i64: - tcg_out_movcond(s, TCG_TYPE_I64, args[5], args[0], args[1], args[2= ], - args[3], args[4], const_args[2]); + tcg_out_movcond(s, TCG_TYPE_I64, args[5], a0, a1, a2, + args[3], args[4], c2); break; =20 #if TCG_TARGET_REG_BITS =3D=3D 64 @@ -2910,14 +2894,13 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, /* Note that the CA bit is defined based on the word size of the environment. So in 64-bit mode it's always carry-out of bit 63. The fallback code using deposit works just as well for 32-bit. = */ - a0 =3D args[0], a1 =3D args[1]; if (a0 =3D=3D args[3] || (!const_args[5] && a0 =3D=3D args[5])) { a0 =3D TCG_REG_R0; } if (const_args[4]) { - tcg_out32(s, ADDIC | TAI(a0, args[2], args[4])); + tcg_out32(s, ADDIC | TAI(a0, a2, args[4])); } else { - tcg_out32(s, ADDC | TAB(a0, args[2], args[4])); + tcg_out32(s, ADDC | TAB(a0, a2, args[4])); } if (const_args[5]) { tcg_out32(s, (args[5] ? ADDME : ADDZE) | RT(a1) | RA(args[3])); @@ -2925,7 +2908,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, = const TCGArg *args, tcg_out32(s, ADDE | TAB(a1, args[3], args[5])); } if (a0 !=3D args[0]) { - tcg_out_mov(s, TCG_TYPE_REG, args[0], a0); + tcg_out_mov(s, TCG_TYPE_REG, a0, a0); } break; =20 @@ -2934,14 +2917,13 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, #else case INDEX_op_sub2_i32: #endif - a0 =3D args[0], a1 =3D args[1]; if (a0 =3D=3D args[5] || (!const_args[3] && a0 =3D=3D args[3])) { a0 =3D TCG_REG_R0; } - if (const_args[2]) { - tcg_out32(s, SUBFIC | TAI(a0, args[4], args[2])); + if (c2) { + tcg_out32(s, SUBFIC | TAI(a0, args[4], a2)); } else { - tcg_out32(s, SUBFC | TAB(a0, args[4], args[2])); + tcg_out32(s, SUBFC | TAB(a0, args[4], a2)); } if (const_args[3]) { tcg_out32(s, (args[3] ? SUBFME : SUBFZE) | RT(a1) | RA(args[5]= )); @@ -2949,25 +2931,25 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, tcg_out32(s, SUBFE | TAB(a1, args[5], args[3])); } if (a0 !=3D args[0]) { - tcg_out_mov(s, TCG_TYPE_REG, args[0], a0); + tcg_out_mov(s, TCG_TYPE_REG, a0, a0); } break; =20 case INDEX_op_muluh_i32: - tcg_out32(s, MULHWU | TAB(args[0], args[1], args[2])); + tcg_out32(s, MULHWU | TAB(a0, a1, a2)); break; case INDEX_op_mulsh_i32: - tcg_out32(s, MULHW | TAB(args[0], args[1], args[2])); + tcg_out32(s, MULHW | TAB(a0, a1, a2)); break; case INDEX_op_muluh_i64: - tcg_out32(s, MULHDU | TAB(args[0], args[1], args[2])); + tcg_out32(s, MULHDU | TAB(a0, a1, a2)); break; case INDEX_op_mulsh_i64: - tcg_out32(s, MULHD | TAB(args[0], args[1], args[2])); + tcg_out32(s, MULHD | TAB(a0, a1, a2)); break; =20 case INDEX_op_mb: - tcg_out_mb(s, args[0]); + tcg_out_mb(s, a0); break; =20 case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ --=20 2.26.2