From nobody Sat Nov 1 17:49:40 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail header.i=@wdc.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=wdc.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544645437898921.9118130305106; Wed, 12 Dec 2018 12:10:37 -0800 (PST) Received: from localhost ([::1]:47875 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXAq4-0006Ln-Lk for importer@patchew.org; Wed, 12 Dec 2018 15:10:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXAS5-0002U3-2z for qemu-devel@nongnu.org; Wed, 12 Dec 2018 14:45:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXAS0-00038g-Sk for qemu-devel@nongnu.org; Wed, 12 Dec 2018 14:45:49 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:39250) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gXARz-00036Q-3L; Wed, 12 Dec 2018 14:45:44 -0500 Received: from mail-by2nam01lp2057.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) ([104.47.34.57]) by ob1.hgst.iphmx.com with ESMTP; 13 Dec 2018 03:45:41 +0800 Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0446.namprd04.prod.outlook.com (10.173.48.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.21; Wed, 12 Dec 2018 19:45:38 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::9067:fb44:66b2:7604]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::9067:fb44:66b2:7604%3]) with mapi id 15.20.1425.016; Wed, 12 Dec 2018 19:45:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1544643943; x=1576179943; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Mr2K1ZUeybEAkGTw7hRCXhk+KP3wEOm1aYsUjB+L/9g=; b=V+xODDPWOalkyJcEhJbPRdjk1P4drxvh0/08ktQ8/w6ESN2yECBtyIDs jYuashYr+u1ycfiAZ4niCfh/d2EKuaoxxFPgNjzovNUYs2+BayBuRIDbv qMJOcc10WyAqKjhLetQayHiusChryPD7SWZIqmmCWv9DEFCH+KebnGseG uigcZKGLJ44/zUe9cCg+p5x7P8jF9k+caDmdqsRbsyeYXcgZoWss886Vk MHxhJIuRlK6nq2WL4cDzjzKr3PdXhvPSgBnM1VsJ/33eWIwLrP9ps5DQR WaHiFAGQC5ciKdrZ91v9JWqqV5R6rMq1Kd57AnF9HT4EC4sp5a9DjsH90 Q==; X-IronPort-AV: E=Sophos;i="5.56,345,1539619200"; d="scan'208";a="101342381" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wom+jldRLlWNRnfCvrv+vOQ95YOAZemCrlxvT0BR3nk=; b=YBbxZ0CBeyywNTbjbMsSAY4rYkURTOQr7urRYVkaOw/JLxDl7O2uzTPD8PrMHd1qzmVx4digAetq5QL2Ic59C5nSnf49/nK+2NaRmJkVLS3MGYtBUBSzFj0Bxf8qgcRcXXI6B1ThyhnGm4TuH2kGtwZMjAoSv95xPYNyozzvClw= From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [PATCH v1 18/23] riscv: tcg-target: Add the out op decoder Thread-Index: AQHUklNBkbyqBdcTaUifFP95NhzeZA== Date: Wed, 12 Dec 2018 19:45:38 +0000 Message-ID: <1696f7c9250606df42c6a6776b3ca0530d72fed0.1544643238.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR07CA0074.namprd07.prod.outlook.com (2603:10b6:a03:12b::15) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0446; 6:NFfKXParSOvQ8RvbkBRBKj4LTYAuzcELr2ATbjAZLzhItXLrH8BVvaC45z0jwLqr0g1M/n4d8iTE6yNyROEmwno8301smDxp9E+GI/Ek7qoSgcN5sFYbk2BzzHArLm+tOmvsrmxA6sCxhhHrkJqIGJH7kM7NQDVswCrrrVLHsQa1HU9Zg8WV1B3qmHrQiXq5NP0MyAckiUtRIq2w2Q/yjbqWv4iqWHB+FDuLFB473xHvtlSKh/O/VHWoeJKjBgM+2rJzDBRuoAbLjh38nzhUiEaJAdkVa+vOa61XYRTxQQZB9L9ZCCFpZ5GKJsQxwxAETUZGKCecf0ID+hQqsFQ7+l2bLH3x094QFHDkCSl/X2q28/LawjTV0koJQ7+11tqwBh+N7TU8NErzFlx0/RNSYS2OJQiTVhzW3d3i4PzDEhWVQEIj4bQJnNrekAqdWZv7zJ9sYxcg13RKxdvbCzYv1w==; 5:0q/0+LH5xC1e47jyi/uCmck8ehXXO2AUw7wmgFzqKZf19KdUfg3lTsY+rfQ1OengsNYly3OCAZqMTMOzkpWMqwJ4r8/g6VL21jreJ7YYk45OI4Vnb+3lVh9LM8PPkRP+5EjVIza7haoB9Vlwp/3L+2pO7PyB0WxYTrZZxhJaKGg=; 7:nTf+Bg2h7KPR5p0fp6mt4QqtzJMNz1K5AllwNuyUI/zw8CQU2X2FuEUGqcMq9atI3OJ08+Vk/T62w9/cLaTDnsTSjoA+3M/Ghx9CnG+z7zV+GwDGUBaFnDy+Up1slVdVMjLzEXHXeasyupOiT69VLQ== x-ms-office365-filtering-correlation-id: 35f8f506-f4c3-4158-d847-08d6606a644b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0446; x-ms-traffictypediagnostic: MWHPR04MB0446: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231455)(999002)(944501520)(52105112)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0446; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0446; x-forefront-prvs: 0884AAA693 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(39860400002)(366004)(346002)(396003)(376002)(189003)(199004)(3846002)(71190400001)(6512007)(97736004)(256004)(66066001)(2501003)(4744004)(81166006)(50226002)(53936002)(6436002)(71200400001)(8676002)(106356001)(4326008)(6116002)(39060400002)(53946003)(105586002)(478600001)(8936002)(6486002)(305945005)(386003)(6506007)(44832011)(110136005)(81156014)(186003)(72206003)(68736007)(7736002)(102836004)(486006)(316002)(54906003)(26005)(99286004)(76176011)(14454004)(86362001)(11346002)(476003)(5660300001)(2906002)(446003)(36756003)(52116002)(25786009)(118296001)(2616005); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0446; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: LsVoFtyIe6tDLNI7/7+gixhrkn4QRJb/oWvJnywp67YLmvzmgwsFb/UmdxeMsLTWH4B8/hHEQWBgwiAZzGKxD7eTJMPlJPchFe0V92V+y97Sm99UbwsEFjP32ilse1HfAYAJR6JKw8NaPRBRAjJXSm53AjRFgoYp4K7O89/IPNRcPAKIzgJ6IH9C1uegJadZlxXbOB3y97dm5AE/CX3JP79JWJ+gWQLzX8LH8KICtaeHc2RtLiY5uNmWGIaLB98AVc7XpTcnpx0lMr1DbSgJyxDoxxeW3l3Ou9GQmZViJNgynoVSz+kkhleBL+0UXx6p spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35f8f506-f4c3-4158-d847-08d6606a644b X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Dec 2018 19:45:38.7027 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0446 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.141 Subject: [Qemu-devel] [PATCH v1 18/23] riscv: tcg-target: Add the out op decoder X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , "richard.henderson@linaro.org" , Alistair Francis Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (found 2 invalid signatures) Content-Type: text/plain; charset="utf-8" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark Signed-off-by: Richard Henderson Reviewed-by: Richard Henderson --- tcg/riscv/tcg-target.inc.c | 493 +++++++++++++++++++++++++++++++++++++ 1 file changed, 493 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index b0061a7e83..f3708fe8e1 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -1292,3 +1292,496 @@ static void tcg_out_qemu_st(TCGContext *s, const TC= GArg *args, bool is_64) tcg_out_qemu_st_direct(s, data_regl, data_regh, base, opc); #endif } + +static tcg_insn_unit *tb_ret_addr; + +static void tcg_out_op(TCGContext *s, TCGOpcode opc, + const TCGArg *args, const int *const_args) +{ + TCGArg a0 =3D args[0]; + TCGArg a1 =3D args[1]; + TCGArg a2 =3D args[2]; + int c2 =3D const_args[2]; + + switch (opc) { + case INDEX_op_exit_tb: + /* Reuse the zeroing that exists for goto_ptr. */ + if (a0 =3D=3D 0) { + tcg_out_call_int(s, s->code_gen_epilogue, true); + } else { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_A0, a0); + tcg_out_call_int(s, tb_ret_addr, true); + } + break; + + case INDEX_op_goto_tb: + assert(s->tb_jmp_insn_offset =3D=3D 0); + /* indirect jump method */ + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP0, TCG_REG_ZERO, + (uintptr_t)(s->tb_jmp_target_addr + a0)); + tcg_out_opc_imm(s, OPC_JALR, TCG_REG_ZERO, TCG_REG_TMP0, 0); + set_jmp_reset_offset(s, a0); + break; + + case INDEX_op_goto_ptr: + tcg_out_opc_imm(s, OPC_JALR, TCG_REG_ZERO, a0, 0); + break; + + case INDEX_op_br: + tcg_out_reloc(s, s->code_ptr, R_RISCV_JAL, arg_label(a0), 0); + tcg_out_opc_jump(s, OPC_JAL, TCG_REG_ZERO, 0); + break; + + case INDEX_op_ld8u_i32: + case INDEX_op_ld8u_i64: + tcg_out_ldst(s, OPC_LBU, a0, a1, a2); + break; + case INDEX_op_ld8s_i32: + case INDEX_op_ld8s_i64: + tcg_out_ldst(s, OPC_LB, a0, a1, a2); + break; + case INDEX_op_ld16u_i32: + case INDEX_op_ld16u_i64: + tcg_out_ldst(s, OPC_LHU, a0, a1, a2); + break; + case INDEX_op_ld16s_i32: + case INDEX_op_ld16s_i64: + tcg_out_ldst(s, OPC_LH, a0, a1, a2); + break; + case INDEX_op_ld32u_i64: + tcg_out_ldst(s, OPC_LWU, a0, a1, a2); + break; + case INDEX_op_ld_i32: + case INDEX_op_ld32s_i64: + tcg_out_ldst(s, OPC_LW, a0, a1, a2); + break; + case INDEX_op_ld_i64: + tcg_out_ldst(s, OPC_LD, a0, a1, a2); + break; + + case INDEX_op_st8_i32: + case INDEX_op_st8_i64: + tcg_out_ldst(s, OPC_SB, a0, a1, a2); + break; + case INDEX_op_st16_i32: + case INDEX_op_st16_i64: + tcg_out_ldst(s, OPC_SH, a0, a1, a2); + break; + case INDEX_op_st_i32: + case INDEX_op_st32_i64: + tcg_out_ldst(s, OPC_SW, a0, a1, a2); + break; + case INDEX_op_st_i64: + tcg_out_ldst(s, OPC_SD, a0, a1, a2); + break; + + case INDEX_op_add_i32: + if (c2) { + tcg_out_opc_imm(s, OPC_ADDIW, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_ADDW, a0, a1, a2); + } + break; + case INDEX_op_add_i64: + if (c2) { + tcg_out_opc_imm(s, OPC_ADDI, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_ADD, a0, a1, a2); + } + break; + + case INDEX_op_sub_i32: + if (c2) { + tcg_out_opc_imm(s, OPC_ADDIW, a0, a1, -a2); + } else { + tcg_out_opc_reg(s, OPC_SUBW, a0, a1, a2); + } + break; + case INDEX_op_sub_i64: + if (c2) { + tcg_out_opc_imm(s, OPC_ADDI, a0, a1, -a2); + } else { + tcg_out_opc_reg(s, OPC_SUB, a0, a1, a2); + } + break; + + case INDEX_op_and_i32: + case INDEX_op_and_i64: + if (c2) { + tcg_out_opc_imm(s, OPC_ANDI, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_AND, a0, a1, a2); + } + break; + + case INDEX_op_or_i32: + case INDEX_op_or_i64: + if (c2) { + tcg_out_opc_imm(s, OPC_ORI, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_OR, a0, a1, a2); + } + break; + + case INDEX_op_xor_i32: + case INDEX_op_xor_i64: + if (c2) { + tcg_out_opc_imm(s, OPC_XORI, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_XOR, a0, a1, a2); + } + break; + + case INDEX_op_not_i32: + case INDEX_op_not_i64: + tcg_out_opc_imm(s, OPC_XORI, a0, a1, -1); + break; + + case INDEX_op_neg_i32: + tcg_out_opc_reg(s, OPC_SUBW, a0, TCG_REG_ZERO, a1); + break; + case INDEX_op_neg_i64: + tcg_out_opc_reg(s, OPC_SUB, a0, TCG_REG_ZERO, a1); + break; + + case INDEX_op_mul_i32: + tcg_out_opc_reg(s, OPC_MULW, a0, a1, a2); + break; + case INDEX_op_mul_i64: + tcg_out_opc_reg(s, OPC_MUL, a0, a1, a2); + break; + + case INDEX_op_div_i32: + tcg_out_opc_reg(s, OPC_DIVW, a0, a1, a2); + break; + case INDEX_op_div_i64: + tcg_out_opc_reg(s, OPC_DIV, a0, a1, a2); + break; + + case INDEX_op_divu_i32: + tcg_out_opc_reg(s, OPC_DIVUW, a0, a1, a2); + break; + case INDEX_op_divu_i64: + tcg_out_opc_reg(s, OPC_DIVU, a0, a1, a2); + break; + + case INDEX_op_rem_i32: + tcg_out_opc_reg(s, OPC_REMW, a0, a1, a2); + break; + case INDEX_op_rem_i64: + tcg_out_opc_reg(s, OPC_REM, a0, a1, a2); + break; + + case INDEX_op_remu_i32: + tcg_out_opc_reg(s, OPC_REMUW, a0, a1, a2); + break; + case INDEX_op_remu_i64: + tcg_out_opc_reg(s, OPC_REMU, a0, a1, a2); + break; + + case INDEX_op_shl_i32: + if (c2) { + tcg_out_opc_imm(s, OPC_SLLIW, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_SLLW, a0, a1, a2); + } + break; + case INDEX_op_shl_i64: + if (c2) { + tcg_out_opc_imm(s, OPC_SLLI, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_SLL, a0, a1, a2); + } + break; + + case INDEX_op_shr_i32: + if (c2) { + tcg_out_opc_imm(s, OPC_SRLIW, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_SRLW, a0, a1, a2); + } + break; + case INDEX_op_shr_i64: + if (c2) { + tcg_out_opc_imm(s, OPC_SRLI, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_SRL, a0, a1, a2); + } + break; + + case INDEX_op_sar_i32: + if (c2) { + tcg_out_opc_imm(s, OPC_SRAIW, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_SRAW, a0, a1, a2); + } + break; + case INDEX_op_sar_i64: + if (c2) { + tcg_out_opc_imm(s, OPC_SRAI, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_SRA, a0, a1, a2); + } + break; + + case INDEX_op_add2_i32: + tcg_out_addsub2(s, a0, a1, a2, args[3], args[4], args[5], + const_args[4], const_args[5], false, true); + break; + case INDEX_op_add2_i64: + tcg_out_addsub2(s, a0, a1, a2, args[3], args[4], args[5], + const_args[4], const_args[5], false, false); + break; + case INDEX_op_sub2_i32: + tcg_out_addsub2(s, a0, a1, a2, args[3], args[4], args[5], + const_args[4], const_args[5], true, true); + break; + case INDEX_op_sub2_i64: + tcg_out_addsub2(s, a0, a1, a2, args[3], args[4], args[5], + const_args[4], const_args[5], true, false); + break; + + case INDEX_op_brcond_i32: + case INDEX_op_brcond_i64: + tcg_out_brcond(s, a2, a0, a1, arg_label(args[3])); + break; + case INDEX_op_brcond2_i32: + tcg_out_brcond2(s, args[4], a0, a1, a2, args[3], arg_label(args[5]= )); + break; + + case INDEX_op_setcond_i32: + case INDEX_op_setcond_i64: + tcg_out_setcond(s, args[3], a0, a1, a2); + break; + case INDEX_op_setcond2_i32: + tcg_out_setcond2(s, args[5], a0, a1, a2, args[3], args[4]); + break; + + case INDEX_op_qemu_ld_i32: + tcg_out_qemu_ld(s, args, false); + break; + case INDEX_op_qemu_ld_i64: + tcg_out_qemu_ld(s, args, true); + break; + case INDEX_op_qemu_st_i32: + tcg_out_qemu_st(s, args, false); + break; + case INDEX_op_qemu_st_i64: + tcg_out_qemu_st(s, args, true); + break; + + case INDEX_op_ext8u_i32: + case INDEX_op_ext8u_i64: + tcg_out_ext8u(s, a0, a1); + break; + + case INDEX_op_ext16u_i32: + case INDEX_op_ext16u_i64: + tcg_out_ext16u(s, a0, a1); + break; + + case INDEX_op_ext32u_i64: + case INDEX_op_extu_i32_i64: + tcg_out_ext32u(s, a0, a1); + break; + + case INDEX_op_ext8s_i32: + case INDEX_op_ext8s_i64: + tcg_out_ext8s(s, a0, a1); + break; + + case INDEX_op_ext16s_i32: + case INDEX_op_ext16s_i64: + tcg_out_ext16s(s, a0, a1); + break; + + case INDEX_op_ext32s_i64: + case INDEX_op_extrl_i64_i32: + case INDEX_op_extrh_i64_i32: + case INDEX_op_ext_i32_i64: + tcg_out_ext32s(s, a0, a1); + break; + + case INDEX_op_mulsh_i32: + case INDEX_op_mulsh_i64: + tcg_out_opc_reg(s, OPC_MULH, a0, a1, a2); + break; + + case INDEX_op_muluh_i32: + case INDEX_op_muluh_i64: + tcg_out_opc_reg(s, OPC_MULHU, a0, a1, a2); + break; + + case INDEX_op_mb: + tcg_out_mb(s, a0); + break; + + case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ + case INDEX_op_mov_i64: + case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ + case INDEX_op_movi_i64: + case INDEX_op_call: /* Always emitted via tcg_out_call. */ + default: + g_assert_not_reached(); + } +} + +static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) +{ + static const TCGTargetOpDef r + =3D { .args_ct_str =3D { "r" } }; + static const TCGTargetOpDef r_r + =3D { .args_ct_str =3D { "r", "r" } }; + static const TCGTargetOpDef rZ_r + =3D { .args_ct_str =3D { "rZ", "r" } }; + static const TCGTargetOpDef rZ_rZ + =3D { .args_ct_str =3D { "rZ", "rZ" } }; + static const TCGTargetOpDef rZ_rZ_rZ_rZ + =3D { .args_ct_str =3D { "rZ", "rZ", "rZ", "rZ" } }; + static const TCGTargetOpDef r_r_ri + =3D { .args_ct_str =3D { "r", "r", "ri" } }; + static const TCGTargetOpDef r_r_rI + =3D { .args_ct_str =3D { "r", "r", "rI" } }; + static const TCGTargetOpDef r_rZ_rN + =3D { .args_ct_str =3D { "r", "rZ", "rN" } }; + static const TCGTargetOpDef r_rZ_rZ + =3D { .args_ct_str =3D { "r", "rZ", "rZ" } }; + static const TCGTargetOpDef r_rZ_rZ_rZ_rZ + =3D { .args_ct_str =3D { "r", "rZ", "rZ", "rZ", "rZ" } }; + static const TCGTargetOpDef r_L + =3D { .args_ct_str =3D { "r", "L" } }; + static const TCGTargetOpDef r_r_L + =3D { .args_ct_str =3D { "r", "r", "L" } }; + static const TCGTargetOpDef r_L_L + =3D { .args_ct_str =3D { "r", "L", "L" } }; + static const TCGTargetOpDef r_r_L_L + =3D { .args_ct_str =3D { "r", "r", "L", "L" } }; + static const TCGTargetOpDef LZ_L + =3D { .args_ct_str =3D { "LZ", "L" } }; + static const TCGTargetOpDef LZ_L_L + =3D { .args_ct_str =3D { "LZ", "L", "L" } }; + static const TCGTargetOpDef LZ_LZ_L + =3D { .args_ct_str =3D { "LZ", "LZ", "L" } }; + static const TCGTargetOpDef LZ_LZ_L_L + =3D { .args_ct_str =3D { "LZ", "LZ", "L", "L" } }; + static const TCGTargetOpDef r_r_rZ_rZ_rM_rM + =3D { .args_ct_str =3D { "r", "r", "rZ", "rZ", "rM", "rM" } }; + + switch (op) { + case INDEX_op_goto_ptr: + return &r; + + case INDEX_op_ld8u_i32: + case INDEX_op_ld8s_i32: + case INDEX_op_ld16u_i32: + case INDEX_op_ld16s_i32: + case INDEX_op_ld_i32: + case INDEX_op_not_i32: + case INDEX_op_neg_i32: + case INDEX_op_ld8u_i64: + case INDEX_op_ld8s_i64: + case INDEX_op_ld16u_i64: + case INDEX_op_ld16s_i64: + case INDEX_op_ld32s_i64: + case INDEX_op_ld32u_i64: + case INDEX_op_ld_i64: + case INDEX_op_not_i64: + case INDEX_op_neg_i64: + case INDEX_op_ext8u_i32: + case INDEX_op_ext8u_i64: + case INDEX_op_ext16u_i32: + case INDEX_op_ext16u_i64: + case INDEX_op_ext32u_i64: + case INDEX_op_extu_i32_i64: + case INDEX_op_ext8s_i32: + case INDEX_op_ext8s_i64: + case INDEX_op_ext16s_i32: + case INDEX_op_ext16s_i64: + case INDEX_op_ext32s_i64: + case INDEX_op_extrl_i64_i32: + case INDEX_op_extrh_i64_i32: + case INDEX_op_ext_i32_i64: + return &r_r; + + case INDEX_op_st8_i32: + case INDEX_op_st16_i32: + case INDEX_op_st_i32: + case INDEX_op_st8_i64: + case INDEX_op_st16_i64: + case INDEX_op_st32_i64: + case INDEX_op_st_i64: + return &rZ_r; + + case INDEX_op_add_i32: + case INDEX_op_and_i32: + case INDEX_op_or_i32: + case INDEX_op_xor_i32: + case INDEX_op_add_i64: + case INDEX_op_and_i64: + case INDEX_op_or_i64: + case INDEX_op_xor_i64: + return &r_r_rI; + + case INDEX_op_sub_i32: + case INDEX_op_sub_i64: + return &r_rZ_rN; + + case INDEX_op_mul_i32: + case INDEX_op_mulsh_i32: + case INDEX_op_muluh_i32: + case INDEX_op_div_i32: + case INDEX_op_divu_i32: + case INDEX_op_rem_i32: + case INDEX_op_remu_i32: + case INDEX_op_setcond_i32: + case INDEX_op_mul_i64: + case INDEX_op_mulsh_i64: + case INDEX_op_muluh_i64: + case INDEX_op_div_i64: + case INDEX_op_divu_i64: + case INDEX_op_rem_i64: + case INDEX_op_remu_i64: + case INDEX_op_setcond_i64: + return &r_rZ_rZ; + + case INDEX_op_shl_i32: + case INDEX_op_shr_i32: + case INDEX_op_sar_i32: + case INDEX_op_shl_i64: + case INDEX_op_shr_i64: + case INDEX_op_sar_i64: + return &r_r_ri; + + case INDEX_op_brcond_i32: + case INDEX_op_brcond_i64: + return &rZ_rZ; + + case INDEX_op_add2_i32: + case INDEX_op_add2_i64: + case INDEX_op_sub2_i32: + case INDEX_op_sub2_i64: + return &r_r_rZ_rZ_rM_rM; + + case INDEX_op_brcond2_i32: + return &rZ_rZ_rZ_rZ; + + case INDEX_op_setcond2_i32: + return &r_rZ_rZ_rZ_rZ; + + case INDEX_op_qemu_ld_i32: + return TARGET_LONG_BITS <=3D TCG_TARGET_REG_BITS ? &r_L : &r_L_L; + case INDEX_op_qemu_st_i32: + return TARGET_LONG_BITS <=3D TCG_TARGET_REG_BITS ? &LZ_L : &LZ_L_L; + case INDEX_op_qemu_ld_i64: + return TCG_TARGET_REG_BITS =3D=3D 64 ? &r_L + : TARGET_LONG_BITS <=3D TCG_TARGET_REG_BITS ? &r_r_L + : &r_r_L_L; + case INDEX_op_qemu_st_i64: + return TCG_TARGET_REG_BITS =3D=3D 64 ? &LZ_L + : TARGET_LONG_BITS <=3D TCG_TARGET_REG_BITS ? &LZ_LZ_L + : &LZ_LZ_L_L; + + default: + return NULL; + } +} --=20 2.19.1