From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1587226865; cv=none; d=zohomail.com; s=zohoarc; b=liFWOK/rTKzfZSTgciRCo+zJM5QXpKQV7JvY44j3RomRDk75PpBkTbY+bgj/4i0AOaG61CpK8t6Xp+YEYqzEDKBhXLXB0oR87CX8q1nTsOBDi1YDOKJgknhbmr0BKaVoSp1Ia7c9veJSxs170rS8mIOAptzqNFSYn10VaBtfUdo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587226865; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hY9ypQA6lau+BCL7v0kFVd0b+GolnNEN+YdpYYAzLrU=; b=kXBrkGnBwv28rQ+sTUJj7aFgEgHOZSvpJCG4FaQCTXpPanu5ivYZTTLNTgULa9L12NvzAKeN69HguoAre8cWWpXeW0QhyWr4b/hG/RIQ79HHiXrujMqHZr02aUmz0algkCNsy0H92sBgtkVBKuXKIs7o6dInv+e0e0VL+1tilNk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587226864982556.1797945111837; Sat, 18 Apr 2020 09:21:04 -0700 (PDT) Received: from localhost ([::1]:59582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqDG-0005oA-95 for importer@patchew.org; Sat, 18 Apr 2020 12:21:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48081) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBd-00044t-0B for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBb-0004lt-NG for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:20 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:43003) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBb-0004hR-Hi for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:19 -0400 Received: by mail-pl1-x642.google.com with SMTP id v2so2207976plp.9 for ; Sat, 18 Apr 2020 09:19:19 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=hY9ypQA6lau+BCL7v0kFVd0b+GolnNEN+YdpYYAzLrU=; b=Ns9/rZ3TDU/xSZmRtJpa8nhHuMwKisMjjwqCLgbyrUoBfc7w1fX7XsBfqTeDdlZ5JE N+cSduGL0b3enav7gRwr+cgoGJAnECW87tz3tvflm7CAh+b+Ubp4HJmnWNSpXjsIN1J2 NdruCgb+4bYOEbyUjd0pkBK/DvAMyr3/zA0IQH3B3oh9+a7J4KaY/S3hJaaOUgJr3DE9 q7kR1Nzl8JzRpPYnuK76YA6vXr/6VikeEKRkfNJI67AfmJZrMUeDwZOVLuCid+yNdvY8 z3ExR3gglCrJQM7zd82d8eUVh3IY5AjE7bKXi0QiiswsnVmGVvUuiSwKyBOSiX2DaAbi jqNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hY9ypQA6lau+BCL7v0kFVd0b+GolnNEN+YdpYYAzLrU=; b=qdwFg2FMvrfENasOoJKf41lvz6vJmeb1c5AuEPUSV8vU2IBXHhSFM4HXd3RN6O9YE7 LsxuK8c/0nNuDgD+th2RS0RPwuaUvGpat98CbvgusxvS/SVbL4JpwMun078hKODXV/G6 lbhNFExNl+l0fcWv8CwLnfuQIv0lUCAm5iRtI2Bwh4HvW5n04pOkfrkgC293h4P3ydAd xIDqcozwnCtP02ZFneSS/NKQurj4lDUa7ccugGJO+x9QEwLUVV8eLFC+WSuXZXtfjWYN Tx8f3gRtczpWaRfUOaZtO94j4ubILyW+ywSYFQRsCeSf6omIOgSqlQ8VutnPtNe6lEG/ 2sBg== X-Gm-Message-State: AGi0PuYLs2EUut8ngSGOQ5iYl/grnZ74Z6+1Dntlad+SKBXyZNgO2Mc5 Dt1uP7D2JBTiMaw7dXIMZ/EclCJET38= X-Google-Smtp-Source: APiQypK51UzwjkzOO3EhprykRzKxnrMmrjCBrMHgetyCIEWfGmswEBWhMZfmFlAo0G9yVbm3HrvO1A== X-Received: by 2002:a17:90b:3598:: with SMTP id mm24mr11892407pjb.132.1587226758142; Sat, 18 Apr 2020 09:19:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 01/16] tcg: Add temp_readonly Date: Sat, 18 Apr 2020 09:18:59 -0700 Message-Id: <20200418161914.4387-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::642 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" In most, but not all, places that we check for TEMP_FIXED, we are really testing that we do not modify the temporary. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/tcg/tcg.h | 5 +++++ tcg/tcg.c | 21 ++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 3534dce77f..27e1b509a6 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -678,6 +678,11 @@ struct TCGContext { target_ulong gen_insn_data[TCG_MAX_INSNS][TARGET_INSN_START_WORDS]; }; =20 +static inline bool temp_readonly(TCGTemp *ts) +{ + return ts->kind =3D=3D TEMP_FIXED; +} + extern TCGContext tcg_init_ctx; extern __thread TCGContext *tcg_ctx; extern TCGv_env cpu_env; diff --git a/tcg/tcg.c b/tcg/tcg.c index eaf81397a3..92b3767097 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3132,7 +3132,7 @@ static void temp_load(TCGContext *, TCGTemp *, TCGReg= Set, TCGRegSet, TCGRegSet); mark it free; otherwise mark it dead. */ static void temp_free_or_dead(TCGContext *s, TCGTemp *ts, int free_or_dead) { - if (ts->kind =3D=3D TEMP_FIXED) { + if (temp_readonly(ts)) { return; } if (ts->val_type =3D=3D TEMP_VAL_REG) { @@ -3156,7 +3156,7 @@ static inline void temp_dead(TCGContext *s, TCGTemp *= ts) static void temp_sync(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs, TCGRegSet preferred_regs, int free_or_dead) { - if (ts->kind =3D=3D TEMP_FIXED) { + if (temp_readonly(ts)) { return; } if (!ts->mem_coherent) { @@ -3314,8 +3314,7 @@ static void temp_save(TCGContext *s, TCGTemp *ts, TCG= RegSet allocated_regs) { /* The liveness analysis already ensures that globals are back in memory. Keep an tcg_debug_assert for safety. */ - tcg_debug_assert(ts->val_type =3D=3D TEMP_VAL_MEM - || ts->kind =3D=3D TEMP_FIXED); + tcg_debug_assert(ts->val_type =3D=3D TEMP_VAL_MEM || temp_readonly(ts)= ); } =20 /* save globals to their canonical location and assume they can be @@ -3373,7 +3372,7 @@ static void tcg_reg_alloc_do_movi(TCGContext *s, TCGT= emp *ots, TCGRegSet preferred_regs) { /* ENV should not be modified. */ - tcg_debug_assert(ots->kind !=3D TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ots)); =20 /* The movi is not explicitly generated here. */ if (ots->val_type =3D=3D TEMP_VAL_REG) { @@ -3413,7 +3412,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TC= GOp *op) ts =3D arg_temp(op->args[1]); =20 /* ENV should not be modified. */ - tcg_debug_assert(ots->kind !=3D TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ots)); =20 /* Note that otype !=3D itype for no-op truncation. */ otype =3D ots->type; @@ -3474,7 +3473,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TC= GOp *op) * Store the source register into the destination slot * and leave the destination temp as TEMP_VAL_MEM. */ - assert(ots->kind !=3D TEMP_FIXED); + assert(!temp_readonly(ots)); if (!ts->mem_allocated) { temp_allocate_frame(s, ots); } @@ -3511,7 +3510,7 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TC= GOp *op) its =3D arg_temp(op->args[1]); =20 /* ENV should not be modified. */ - tcg_debug_assert(ots->kind !=3D TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ots)); =20 itype =3D its->type; vece =3D TCGOP_VECE(op); @@ -3742,7 +3741,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) ts =3D arg_temp(arg); =20 /* ENV should not be modified. */ - tcg_debug_assert(ts->kind !=3D TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ts)); =20 if ((arg_ct->ct & TCG_CT_ALIAS) && !const_args[arg_ct->alias_index]) { @@ -3784,7 +3783,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) ts =3D arg_temp(op->args[i]); =20 /* ENV should not be modified. */ - tcg_debug_assert(ts->kind !=3D TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ts)); =20 if (NEED_SYNC_ARG(i)) { temp_sync(s, ts, o_allocated_regs, 0, IS_DEAD_ARG(i)); @@ -3916,7 +3915,7 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp *= op) ts =3D arg_temp(arg); =20 /* ENV should not be modified. */ - tcg_debug_assert(ts->kind !=3D TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ts)); =20 reg =3D tcg_target_call_oarg_regs[i]; tcg_debug_assert(s->reg_to_temp[reg] =3D=3D NULL); --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1587227016; cv=none; d=zohomail.com; s=zohoarc; b=W5+3gv5vHPJ/ZGbK9Iexr94aiRvsl7OnIAisVZ2Tb+cuCd0DDrU+Z/zm6FF8aet2P1ssrGMTc1L1LGY+quJTi0nAtshnDoxJHHQ0H7plUvovzZ79DzUaYD0snzpkvn8zBYay7gW+ZlpxRIuDI7b0WlVVeWnS/1FrMnrqukfr5H4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587227016; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3qRzDIJe35AYacmzNyFLQ1yNiwezF16i9LevP5JOC1c=; b=Ba3n/JVQcNZywZt0DgBvMUkrZF5xx+nLBxACNAJxTeuEDlcCNF9qQ28vOgHAZ0fonnpzObxN7fi8ZVMWjBnvY5OKNWjaiNc35F2lv/iUpNGsBryU2o3/Rd+RQJfhQi1DA0kcZeYTEYBFWdoV01pII7j3vAZI7Z6gOSr8ymz5Kig= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587227016387109.14541464500121; Sat, 18 Apr 2020 09:23:36 -0700 (PDT) Received: from localhost ([::1]:59638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqFj-00017K-3L for importer@patchew.org; Sat, 18 Apr 2020 12:23:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48101) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBf-00045K-62 for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBd-0004rf-CJ for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:23 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:45814) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBd-0004pl-5j for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:21 -0400 Received: by mail-pl1-x641.google.com with SMTP id t4so2199794plq.12 for ; Sat, 18 Apr 2020 09:19:21 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=3qRzDIJe35AYacmzNyFLQ1yNiwezF16i9LevP5JOC1c=; b=TesMxzcdnBGTOigm9JlYg+qzlMYy21SZP8Aju3gUJ+y6cH1mKP7QG5zhrnkOBr746o 0xDOcq/0iWxx2/DfPz/hHv5+1elzz1PWFory0nmuX6K1j6wrVg1Y7aELSO9JY1Na8caI 4XFvRDNq2GZtOyg4y/qgrq8UCHRFeHJJxqQSuYZmBUrYgBxo5nIpqnM3m7htK/WfNJFy gt+gR7koPg/quO7JVX8fYvycQQNh0AIXtGlNJ4GrnttiXBRuTMZr97esIrem6wvhBhdW O+28pRi3sKPxg5AiF8m3cvGI9wu23Ndqz+gDIdNfN6TgcMWkIuk4jv2+w6qWtR3edvxT aAnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3qRzDIJe35AYacmzNyFLQ1yNiwezF16i9LevP5JOC1c=; b=SLO14X8T74WsWFD26+4OGkOQZL9+H6AQea3LujsqWcoQZm6+8FjczhWKHuTvvY1kv1 3Ox8D55iCGuFae0A2YTMlllBGD3Mug5iMTD07gbneVpxE6aC0PEuH/9XdOoJxyNHXGCE zY058KBqkR1zQCRCYGBjmEtuk69aOnZjiQjcM8TQvVbN7WxEgNbqXkNfmFSGeYSoQoEg LUoP6H/0avImYVUMLNAcK8Zb4uvEo4C1e4aFnu64HwFERfG37hPSYoqk8oZ6dbJ4RMtf tBnhdKi4tx/I0MGIV7Mo7br3iSKy4dubdqcdDLq2NGA2VlNJN9msznUN6oF+PXHk+BZa mJgw== X-Gm-Message-State: AGi0PuY5KrOWcjI6OavsarIbe2dyQ0RBQ+/sarsJM2z4YMCfgqI9qRX4 IJ7Lm5Xt/pvTClL4DqctEziknNcqSNc= X-Google-Smtp-Source: APiQypKDzUWaJluJmIkrXoCEjySfN6gr0CnH1JylgCf+XdwoudusRyJxY8KXCm8MZ8jq869gUnDbQw== X-Received: by 2002:a17:90a:af8e:: with SMTP id w14mr10942943pjq.164.1587226759601; Sat, 18 Apr 2020 09:19:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 02/16] tcg: Introduce TYPE_CONST temporaries Date: Sat, 18 Apr 2020 09:19:00 -0700 Message-Id: <20200418161914.4387-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" These will hold a single constant for the duration of the TB. They are hashed, so that each value has one temp across the TB. Not used yet, this is all infrastructure. Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 27 ++++++++++- tcg/optimize.c | 40 ++++++++++------- tcg/tcg-op-vec.c | 17 +++++++ tcg/tcg.c | 111 +++++++++++++++++++++++++++++++++++++++++----- 4 files changed, 166 insertions(+), 29 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 27e1b509a6..f72530dfda 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -489,6 +489,8 @@ typedef enum TCGTempKind { TEMP_GLOBAL, /* Temp is in a fixed register. */ TEMP_FIXED, + /* Temp is a fixed constant. */ + TEMP_CONST, } TCGTempKind; =20 typedef struct TCGTemp { @@ -664,6 +666,7 @@ struct TCGContext { QSIMPLEQ_HEAD(, TCGOp) plugin_ops; #endif =20 + GHashTable *const_table[TCG_TYPE_COUNT]; TCGTempSet free_temps[TCG_TYPE_COUNT * 2]; TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */ =20 @@ -680,7 +683,7 @@ struct TCGContext { =20 static inline bool temp_readonly(TCGTemp *ts) { - return ts->kind =3D=3D TEMP_FIXED; + return ts->kind >=3D TEMP_FIXED; } =20 extern TCGContext tcg_init_ctx; @@ -1038,6 +1041,7 @@ TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *op, = TCGOpcode opc); =20 void tcg_optimize(TCGContext *s); =20 +/* Allocate a new temporary and initialize it with a constant. */ TCGv_i32 tcg_const_i32(int32_t val); TCGv_i64 tcg_const_i64(int64_t val); TCGv_i32 tcg_const_local_i32(int32_t val); @@ -1047,6 +1051,27 @@ TCGv_vec tcg_const_ones_vec(TCGType); TCGv_vec tcg_const_zeros_vec_matching(TCGv_vec); TCGv_vec tcg_const_ones_vec_matching(TCGv_vec); =20 +/* + * Locate or create a read-only temporary that is a constant. + * This kind of temporary need not and should not be freed. + */ +TCGTemp *tcg_constant_internal(TCGType type, tcg_target_long val); + +static inline TCGv_i32 tcg_constant_i32(int32_t val) +{ + return temp_tcgv_i32(tcg_constant_internal(TCG_TYPE_I32, val)); +} + +static inline TCGv_i64 tcg_constant_i64(int64_t val) +{ + if (TCG_TARGET_REG_BITS =3D=3D 32) { + qemu_build_not_reached(); + } + return temp_tcgv_i64(tcg_constant_internal(TCG_TYPE_I64, val)); +} + +TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val); + #if UINTPTR_MAX =3D=3D UINT32_MAX # define tcg_const_ptr(x) ((TCGv_ptr)tcg_const_i32((intptr_t)(x))) # define tcg_const_local_ptr(x) ((TCGv_ptr)tcg_const_local_i32((intptr_t)= (x))) diff --git a/tcg/optimize.c b/tcg/optimize.c index afb4a9a5a9..effb47eefd 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -99,8 +99,17 @@ static void init_ts_info(struct tcg_temp_info *infos, ts->state_ptr =3D ti; ti->next_copy =3D ts; ti->prev_copy =3D ts; - ti->is_const =3D false; - ti->mask =3D -1; + if (ts->kind =3D=3D TEMP_CONST) { + ti->is_const =3D true; + ti->val =3D ti->mask =3D ts->val; + if (TCG_TARGET_REG_BITS > 32 && ts->type =3D=3D TCG_TYPE_I32) { + /* High bits of a 32-bit quantity are garbage. */ + ti->mask |=3D ~0xffffffffull; + } + } else { + ti->is_const =3D false; + ti->mask =3D -1; + } set_bit(idx, temps_used->l); } } @@ -113,31 +122,28 @@ static void init_arg_info(struct tcg_temp_info *infos, =20 static TCGTemp *find_better_copy(TCGContext *s, TCGTemp *ts) { - TCGTemp *i; + TCGTemp *i, *g, *l; =20 - /* If this is already a global, we can't do better. */ - if (ts->kind >=3D TEMP_GLOBAL) { + /* If this is already readonly, we can't do better. */ + if (temp_readonly(ts)) { return ts; } =20 - /* Search for a global first. */ + g =3D l =3D NULL; for (i =3D ts_info(ts)->next_copy; i !=3D ts; i =3D ts_info(i)->next_c= opy) { - if (i->kind >=3D TEMP_GLOBAL) { + if (temp_readonly(i)) { return i; - } - } - - /* If it is a temp, search for a temp local. */ - if (ts->kind =3D=3D TEMP_NORMAL) { - for (i =3D ts_info(ts)->next_copy; i !=3D ts; i =3D ts_info(i)->ne= xt_copy) { - if (i->kind >=3D TEMP_LOCAL) { - return i; + } else if (i->kind > ts->kind) { + if (i->kind =3D=3D TEMP_GLOBAL) { + g =3D i; + } else if (i->kind =3D=3D TEMP_LOCAL) { + l =3D i; } } } =20 - /* Failure to find a better representation, return the same temp. */ - return ts; + /* If we didn't find a better representation, return the same temp. */ + return g ? g : l ? l : ts; } =20 static bool ts_are_copies(TCGTemp *ts1, TCGTemp *ts2) diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index b6937e8d64..f3927089a7 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -209,6 +209,23 @@ static void vec_gen_op3(TCGOpcode opc, unsigned vece, vec_gen_3(opc, type, vece, temp_arg(rt), temp_arg(at), temp_arg(bt)); } =20 +TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val) +{ + val =3D dup_const(vece, val); + + /* + * For MO_64 constants that can't be represented in tcg_target_long, + * we must use INDEX_op_dup2_vec, which requires a non-const temporary. + */ + if (TCG_TARGET_REG_BITS =3D=3D 32 && + val !=3D deposit64(val, 32, 32, val) && + val !=3D (uint64_t)(int32_t)val) { + g_assert_not_reached(); + } + + return temp_tcgv_vec(tcg_constant_internal(type, val)); +} + void tcg_gen_mov_vec(TCGv_vec r, TCGv_vec a) { if (r !=3D a) { diff --git a/tcg/tcg.c b/tcg/tcg.c index 92b3767097..59beb2bf29 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1127,6 +1127,7 @@ void tcg_func_start(TCGContext *s) =20 /* No temps have been previously allocated for size or locality. */ memset(s->free_temps, 0, sizeof(s->free_temps)); + memset(s->const_table, 0, sizeof(s->const_table)); =20 s->nb_ops =3D 0; s->nb_labels =3D 0; @@ -1199,13 +1200,19 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, = TCGv_ptr base, bigendian =3D 1; #endif =20 - if (base_ts->kind !=3D TEMP_FIXED) { + switch (base_ts->kind) { + case TEMP_FIXED: + break; + case TEMP_GLOBAL: /* We do not support double-indirect registers. */ tcg_debug_assert(!base_ts->indirect_reg); base_ts->indirect_base =3D 1; s->nb_indirects +=3D (TCG_TARGET_REG_BITS =3D=3D 32 && type =3D=3D= TCG_TYPE_I64 ? 2 : 1); indirect_reg =3D 1; + break; + default: + g_assert_not_reached(); } =20 if (TCG_TARGET_REG_BITS =3D=3D 32 && type =3D=3D TCG_TYPE_I64) { @@ -1346,6 +1353,37 @@ void tcg_temp_free_internal(TCGTemp *ts) set_bit(idx, s->free_temps[k].l); } =20 +TCGTemp *tcg_constant_internal(TCGType type, tcg_target_long val) +{ + TCGContext *s =3D tcg_ctx; + GHashTable *h =3D s->const_table[type]; + TCGTemp *ts; + + if (h =3D=3D NULL) { + if (sizeof(tcg_target_long) =3D=3D sizeof(gint64)) { + h =3D g_hash_table_new(g_int64_hash, g_int64_equal); + } else if (sizeof(tcg_target_long) =3D=3D sizeof(gint)) { + h =3D g_hash_table_new(g_int_hash, g_int_equal); + } else { + qemu_build_not_reached(); + } + s->const_table[type] =3D h; + } + + ts =3D g_hash_table_lookup(h, &val); + if (ts =3D=3D NULL) { + ts =3D tcg_temp_alloc(s); + ts->base_type =3D type; + ts->type =3D type; + ts->kind =3D TEMP_CONST; + ts->temp_allocated =3D 1; + ts->val =3D val; + g_hash_table_insert(h, &ts->val, ts); + } + + return ts; +} + TCGv_i32 tcg_const_i32(int32_t val) { TCGv_i32 t0; @@ -1871,6 +1909,9 @@ static void tcg_reg_alloc_start(TCGContext *s) TCGTempVal val =3D TEMP_VAL_MEM; =20 switch (ts->kind) { + case TEMP_CONST: + val =3D TEMP_VAL_CONST; + break; case TEMP_FIXED: val =3D TEMP_VAL_REG; break; @@ -1907,6 +1948,26 @@ static char *tcg_get_arg_str_ptr(TCGContext *s, char= *buf, int buf_size, case TEMP_NORMAL: snprintf(buf, buf_size, "tmp%d", idx - s->nb_globals); break; + case TEMP_CONST: + switch (ts->type) { + case TCG_TYPE_I32: + snprintf(buf, buf_size, "$0x%x", (int32_t)ts->val); + break; +#if TCG_TARGET_REG_BITS > 32 + case TCG_TYPE_I64: + snprintf(buf, buf_size, "$0x%" TCG_PRIlx, ts->val); + break; +#endif + case TCG_TYPE_V64: + case TCG_TYPE_V128: + case TCG_TYPE_V256: + snprintf(buf, buf_size, "v%d$0x%" TCG_PRIlx, + 64 << (ts->type - TCG_TYPE_V64), ts->val); + break; + default: + g_assert_not_reached(); + } + break; } return buf; } @@ -2513,6 +2574,7 @@ static void la_bb_end(TCGContext *s, int ng, int nt) state =3D TS_DEAD | TS_MEM; break; case TEMP_NORMAL: + case TEMP_CONST: state =3D TS_DEAD; break; default: @@ -3132,15 +3194,28 @@ static void temp_load(TCGContext *, TCGTemp *, TCGR= egSet, TCGRegSet, TCGRegSet); mark it free; otherwise mark it dead. */ static void temp_free_or_dead(TCGContext *s, TCGTemp *ts, int free_or_dead) { - if (temp_readonly(ts)) { + TCGTempVal new_type; + + switch (ts->kind) { + case TEMP_FIXED: return; + case TEMP_GLOBAL: + case TEMP_LOCAL: + new_type =3D TEMP_VAL_MEM; + break; + case TEMP_NORMAL: + new_type =3D free_or_dead < 0 ? TEMP_VAL_MEM : TEMP_VAL_DEAD; + break; + case TEMP_CONST: + new_type =3D TEMP_VAL_CONST; + break; + default: + g_assert_not_reached(); } if (ts->val_type =3D=3D TEMP_VAL_REG) { s->reg_to_temp[ts->reg] =3D NULL; } - ts->val_type =3D (free_or_dead < 0 - || ts->kind !=3D TEMP_NORMAL - ? TEMP_VAL_MEM : TEMP_VAL_DEAD); + ts->val_type =3D new_type; } =20 /* Mark a temporary as dead. */ @@ -3156,10 +3231,7 @@ static inline void temp_dead(TCGContext *s, TCGTemp = *ts) static void temp_sync(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs, TCGRegSet preferred_regs, int free_or_dead) { - if (temp_readonly(ts)) { - return; - } - if (!ts->mem_coherent) { + if (!temp_readonly(ts) && !ts->mem_coherent) { if (!ts->mem_allocated) { temp_allocate_frame(s, ts); } @@ -3352,12 +3424,22 @@ static void tcg_reg_alloc_bb_end(TCGContext *s, TCG= RegSet allocated_regs) =20 for (i =3D s->nb_globals; i < s->nb_temps; i++) { TCGTemp *ts =3D &s->temps[i]; - if (ts->kind =3D=3D TEMP_LOCAL) { + + switch (ts->kind) { + case TEMP_LOCAL: temp_save(s, ts, allocated_regs); - } else { + break; + case TEMP_NORMAL: /* The liveness analysis already ensures that temps are dead. Keep an tcg_debug_assert for safety. */ tcg_debug_assert(ts->val_type =3D=3D TEMP_VAL_DEAD); + break; + case TEMP_CONST: + /* Similarly, we should have freed any allocated register. */ + tcg_debug_assert(ts->val_type =3D=3D TEMP_VAL_CONST); + break; + default: + g_assert_not_reached(); } } =20 @@ -4148,6 +4230,13 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) } #endif =20 + for (i =3D 0; i < TCG_TYPE_COUNT; ++i) { + if (s->const_table[i]) { + g_hash_table_destroy(s->const_table[i]); + s->const_table[i] =3D NULL; + } + } + tcg_reg_alloc_start(s); =20 s->code_buf =3D tb->tc.ptr; --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1587226866; cv=none; d=zohomail.com; s=zohoarc; b=f3iOCuB/foV5Kg4wECnB9PIEeh77RrB0lbEud4FCOytNoXerEUoKeUorgKQgdXlIuPNtUsbEatVeRMYRCvIwSncjP2fP673mSSJsVBWia3GGb4sw0bA84WT7+d5A69tzmGyrTeNdytUDb+zmML8Tp+8yagp/ZJCaHx1wrCrLuX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587226866; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/fduq7+z5S6wjChMKi9oJb/vmTzyRgenbcyuQtF0AWE=; b=Bhs7iFgIjXZ0pP5b2sr4jwPHc8+kf8FDF1tnMQyjoc+mvhlZ0p6/aaEAX8xD7MNBEi2D5PQV5vD2FhgD6IV/yHNyqquNMbQ/fc5G/1iuvBym3DgObjt6dyy3gSy56WL+5vWo2MzvRJgXaonqb7DdNx2ttcQidRIQc8MCDIEG288= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 158722686676495.25113934746685; Sat, 18 Apr 2020 09:21:06 -0700 (PDT) Received: from localhost ([::1]:59590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqDJ-0005t3-9n for importer@patchew.org; Sat, 18 Apr 2020 12:21:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48114) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBg-00046r-JC for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBe-0004uO-FZ for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:24 -0400 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:51723) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBe-0004sR-9Q for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:22 -0400 Received: by mail-pj1-x1043.google.com with SMTP id kb16so2558703pjb.1 for ; Sat, 18 Apr 2020 09:19:22 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=/fduq7+z5S6wjChMKi9oJb/vmTzyRgenbcyuQtF0AWE=; b=kpu9n7i1gDNQH7fWevb1vvS82BmFoT8ajpqan0W86tzv3rJfWeqtEylutyfS8tydi1 5TWeEs0fpHppawRhv2WPcDexQmT9VIOojjNVVne23o5dQBVyV6pjile3uZEkjmG7FeFW olDsYIpt1h3UCv1PLjlM+exc0Oesr7LuPiD6ejcyXZzCtKnuUYCpsiD57oU1E9LsLq7M 5pLTyUAsa6oAgdAJ/m/h16AxlzDZqagP0LxWvA/x72nS2PvVcrZYL9GRHqGKc675O5gC csAC4Oz7dvBVVG5m1gTgY0H3ZPu+G4ZF4wplZgFTZ879TC+R6s3I+QuqhHu4FLt5P5Vw mIIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/fduq7+z5S6wjChMKi9oJb/vmTzyRgenbcyuQtF0AWE=; b=UEsuqhfB70FRSiCKIUuAXlrCGDEqBrvKHsQV4oE2c9MPscvTL3VEj2UpAOnNkM7PqT xJiKbRVP+N43Pc15DK3PEJaSN1AVbaH8Z//qcYAL5ZiOhQi4jZx9xPY3W2e+JQvCuL89 idf+qg7rqtIjtiwWvLokWYBYxaz4wacIW+GMfx1t1YyTtG6JOwT+ZGxvTKqhSM8De4Cv PYTFWiGgxTbqYHSYjbyi4dh3Ctmyv6asMlD2BZ1JmChq3eQZ0ZvFxj3S4nbvnzDCMz/a o6+/4bCSgyyKH2GO5tOmKLtJ9ZiIJoNS0Wdxa0Zg+wgcaPJOadXhdDojp8/OCzyxxNPO EviQ== X-Gm-Message-State: AGi0PubwPe+68MZqWhAH8jqJ17Nd/czbB8GFnqj16Cz392CjxXYX0FIk zoOYZsYEs4crU6+3X7F9qDNGmYL5Mw8= X-Google-Smtp-Source: APiQypITvEIym9Jxw021lDzSjm7haZ3gmV6Wy2dnO9zSg+MgFWYxrlh+6+sacaSq/jf2VhstpNoZCQ== X-Received: by 2002:a17:90a:2023:: with SMTP id n32mr11250411pjc.150.1587226760981; Sat, 18 Apr 2020 09:19:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 03/16] tcg: Use tcg_constant_i32 with icount expander Date: Sat, 18 Apr 2020 09:19:01 -0700 Message-Id: <20200418161914.4387-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::1043 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" We must do this before we adjust how tcg_out_movi_i32, lest the under-the-hood poking that we do be broken. Signed-off-by: Richard Henderson --- include/exec/gen-icount.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h index 822c43cfd3..404732518a 100644 --- a/include/exec/gen-icount.h +++ b/include/exec/gen-icount.h @@ -34,7 +34,7 @@ static inline void gen_io_end(void) =20 static inline void gen_tb_start(TranslationBlock *tb) { - TCGv_i32 count, imm; + TCGv_i32 count; =20 tcg_ctx->exitreq_label =3D gen_new_label(); if (tb_cflags(tb) & CF_USE_ICOUNT) { @@ -48,15 +48,13 @@ static inline void gen_tb_start(TranslationBlock *tb) offsetof(ArchCPU, env)); =20 if (tb_cflags(tb) & CF_USE_ICOUNT) { - imm =3D tcg_temp_new_i32(); - /* We emit a movi with a dummy immediate argument. Keep the insn i= ndex - * of the movi so that we later (when we know the actual insn coun= t) - * can update the immediate argument with the actual insn count. = */ - tcg_gen_movi_i32(imm, 0xdeadbeef); + /* + * We emit a sub with a dummy immediate argument. Keep the insn in= dex + * of the sub so that we later (when we know the actual insn count) + * can update the argument with the actual insn count. + */ + tcg_gen_sub_i32(count, count, tcg_constant_i32(0)); icount_start_insn =3D tcg_last_op(); - - tcg_gen_sub_i32(count, count, imm); - tcg_temp_free_i32(imm); } =20 tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, tcg_ctx->exitreq_label); @@ -74,9 +72,12 @@ static inline void gen_tb_start(TranslationBlock *tb) static inline void gen_tb_end(TranslationBlock *tb, int num_insns) { if (tb_cflags(tb) & CF_USE_ICOUNT) { - /* Update the num_insn immediate parameter now that we know - * the actual insn count. */ - tcg_set_insn_param(icount_start_insn, 1, num_insns); + /* + * Update the num_insn immediate parameter now that we know + * the actual insn count. + */ + tcg_set_insn_param(icount_start_insn, 2, + tcgv_i32_arg(tcg_constant_i32(num_insns))); } =20 gen_set_label(tcg_ctx->exitreq_label); --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1587227138; cv=none; d=zohomail.com; s=zohoarc; b=LptHIy9+yBTA9eq+hLBZIPYtaiO3YN1FB7hbco2j2KnER8alxhk8yirLXA895uSjZWCqIRd/bjg79wa1sBSzwmVQSsSIW58SfcYTZkt5tv7I7Jg8CGSJEClZwC7xeptsPqhLgfZutzY2XVJWRnpZHhp2VZrDMs8pui/jswtdP8c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587227138; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3L4RfFRSjz+k9D2woCHu0bThFj4aBhRBA4gE0EtRBC4=; b=i9N8tLm5qpv3WncH+FklgLfAGs1uD5OzKtdJsWfP3fbqxKkXJ9pBngOlv4RBgamFolIHHECG8PKAGYNAjqKuNmAE+jqgcRwAapQ6lboCGdSqPbgHe7tU0vTug5aAlyTE2q2Xmhv5KpVzMN655QbFjq7Yw93iaytDQYGdLPCUiwo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587227138320590.993141409703; Sat, 18 Apr 2020 09:25:38 -0700 (PDT) Received: from localhost ([::1]:59690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqHh-0004ga-1L for importer@patchew.org; Sat, 18 Apr 2020 12:25:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48145) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBj-00049X-VU for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBg-0004zJ-BI for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:27 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:43395) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBf-0004vy-W7 for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:24 -0400 Received: by mail-pl1-x62a.google.com with SMTP id z6so2205213plk.10 for ; Sat, 18 Apr 2020 09:19:23 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=3L4RfFRSjz+k9D2woCHu0bThFj4aBhRBA4gE0EtRBC4=; b=cPXdQ/4cZcZoxVW0RsoSCQZy4AA2HLmTYKJRsqzDgALQa6wQG3qCV+c5qGWgrBloSu UO/NGmfpRt5LeV/6MhnL94wyDzAAMIs/3keM3+UCztFrC8R52CTJuv14cQg+UFw+LvFN 3m2NLUk6bM/QizfExogWsNM//i6y/PB+aLaL3nMvnWl0I91SeqjAD5vjL+JSxR9z2YA4 j55LQLsHCiQNB4uYhtXY+nqWQcLuJRsIIMtBVJc4G1JojhQCaA+0ylpQa8vwwDlFARk4 DWj/zHdQkwqfyszIl1KM5XYGD8eaNWFFgr+DOsMTl2o9naXy1ZUX1xj6IWCHyAMrIEC7 jIqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3L4RfFRSjz+k9D2woCHu0bThFj4aBhRBA4gE0EtRBC4=; b=LrWCgm8/JO3TI0e2mfbxSzkZRh633bGHE3JH1xM+7yWFAYWwiPeGZxdiAfjD6jqUtA ncKdyyjHfwJdQolfhMQpkMQyPjN6c11jQ6tw+1XnFQ3bZbq4NGhC3oD2F9VNSqfRnxtg YLj3q0F4/ci8HP1jOH4Qa1tqwTe0Gc9llqEiicqPHPGprtgWgvIqIbHaOM9PBA0TfaK2 v2gMuNopCjrmdGasYaepCo5Oqj1NBW8MEqOa9URaumXuo9cwtTlJKIfVH9Dern6uMOrO mAeOqEE7mjf1TKoa1vH5HZcVSlOHV68GM78u3bcf6t+pltb8G/tbrSJbaJ8Q3MD5s2T4 4P5A== X-Gm-Message-State: AGi0PuZb7kkGjQQRMugcVKZftmdtuxs8/0e7jw8qR4CHLLhg10qnMVU+ K7LRfXpZtFvn9grlnmzQdUohTvtTBkg= X-Google-Smtp-Source: APiQypKbJoZ7wAWkIkFZBa0ZO9kZ86SelkHOoZCDm/KNckZrP6Vt+zVF+qMXdPEBtvafAkqYcWQo1g== X-Received: by 2002:a17:90a:32ea:: with SMTP id l97mr11043527pjb.50.1587226762164; Sat, 18 Apr 2020 09:19:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 04/16] tcg: Use tcg_constant_{i32,i64} with tcg int expanders Date: Sat, 18 Apr 2020 09:19:02 -0700 Message-Id: <20200418161914.4387-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::62a X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- include/tcg/tcg-op.h | 13 +-- tcg/tcg-op.c | 216 ++++++++++++++++++++----------------------- 2 files changed, 100 insertions(+), 129 deletions(-) diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 230db6e022..11ed9192f7 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -271,6 +271,7 @@ void tcg_gen_mb(TCGBar); =20 /* 32 bit ops */ =20 +void tcg_gen_movi_i32(TCGv_i32 ret, int32_t arg); void tcg_gen_addi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); void tcg_gen_subfi_i32(TCGv_i32 ret, int32_t arg1, TCGv_i32 arg2); void tcg_gen_subi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); @@ -349,11 +350,6 @@ static inline void tcg_gen_mov_i32(TCGv_i32 ret, TCGv_= i32 arg) } } =20 -static inline void tcg_gen_movi_i32(TCGv_i32 ret, int32_t arg) -{ - tcg_gen_op2i_i32(INDEX_op_movi_i32, ret, arg); -} - static inline void tcg_gen_ld8u_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset) { @@ -467,6 +463,7 @@ static inline void tcg_gen_not_i32(TCGv_i32 ret, TCGv_i= 32 arg) =20 /* 64 bit ops */ =20 +void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg); void tcg_gen_addi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); void tcg_gen_subfi_i64(TCGv_i64 ret, int64_t arg1, TCGv_i64 arg2); void tcg_gen_subi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); @@ -550,11 +547,6 @@ static inline void tcg_gen_mov_i64(TCGv_i64 ret, TCGv_= i64 arg) } } =20 -static inline void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg) -{ - tcg_gen_op2i_i64(INDEX_op_movi_i64, ret, arg); -} - static inline void tcg_gen_ld8u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset) { @@ -698,7 +690,6 @@ static inline void tcg_gen_sub_i64(TCGv_i64 ret, TCGv_i= 64 arg1, TCGv_i64 arg2) =20 void tcg_gen_discard_i64(TCGv_i64 arg); void tcg_gen_mov_i64(TCGv_i64 ret, TCGv_i64 arg); -void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg); void tcg_gen_ld8u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset); void tcg_gen_ld8s_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset); void tcg_gen_ld16u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset= ); diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index e2e25ebf7d..07eb661a07 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -104,15 +104,18 @@ void tcg_gen_mb(TCGBar mb_type) =20 /* 32 bit ops */ =20 +void tcg_gen_movi_i32(TCGv_i32 ret, int32_t arg) +{ + tcg_gen_mov_i32(ret, tcg_constant_i32(arg)); +} + void tcg_gen_addi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { /* some cases can be optimized here */ if (arg2 =3D=3D 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_add_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_add_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 @@ -122,9 +125,7 @@ void tcg_gen_subfi_i32(TCGv_i32 ret, int32_t arg1, TCGv= _i32 arg2) /* Don't recurse with tcg_gen_neg_i32. */ tcg_gen_op2_i32(INDEX_op_neg_i32, ret, arg2); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg1); - tcg_gen_sub_i32(ret, t0, arg2); - tcg_temp_free_i32(t0); + tcg_gen_sub_i32(ret, tcg_constant_i32(arg1), arg2); } } =20 @@ -134,15 +135,12 @@ void tcg_gen_subi_i32(TCGv_i32 ret, TCGv_i32 arg1, in= t32_t arg2) if (arg2 =3D=3D 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_sub_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_sub_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 void tcg_gen_andi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { - TCGv_i32 t0; /* Some cases can be optimized here. */ switch (arg2) { case 0: @@ -165,9 +163,8 @@ void tcg_gen_andi_i32(TCGv_i32 ret, TCGv_i32 arg1, int3= 2_t arg2) } break; } - t0 =3D tcg_const_i32(arg2); - tcg_gen_and_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + + tcg_gen_and_i32(ret, arg1, tcg_constant_i32(arg2)); } =20 void tcg_gen_ori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) @@ -178,9 +175,7 @@ void tcg_gen_ori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32= _t arg2) } else if (arg2 =3D=3D 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_or_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_or_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 @@ -193,9 +188,7 @@ void tcg_gen_xori_i32(TCGv_i32 ret, TCGv_i32 arg1, int3= 2_t arg2) /* Don't recurse with tcg_gen_not_i32. */ tcg_gen_op2_i32(INDEX_op_not_i32, ret, arg1); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_xor_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_xor_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 @@ -205,9 +198,7 @@ void tcg_gen_shli_i32(TCGv_i32 ret, TCGv_i32 arg1, int3= 2_t arg2) if (arg2 =3D=3D 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_shl_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_shl_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 @@ -217,9 +208,7 @@ void tcg_gen_shri_i32(TCGv_i32 ret, TCGv_i32 arg1, int3= 2_t arg2) if (arg2 =3D=3D 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_shr_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_shr_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 @@ -229,9 +218,7 @@ void tcg_gen_sari_i32(TCGv_i32 ret, TCGv_i32 arg1, int3= 2_t arg2) if (arg2 =3D=3D 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_sar_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_sar_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 @@ -250,9 +237,7 @@ void tcg_gen_brcondi_i32(TCGCond cond, TCGv_i32 arg1, i= nt32_t arg2, TCGLabel *l) if (cond =3D=3D TCG_COND_ALWAYS) { tcg_gen_br(l); } else if (cond !=3D TCG_COND_NEVER) { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_brcond_i32(cond, arg1, t0, l); - tcg_temp_free_i32(t0); + tcg_gen_brcond_i32(cond, arg1, tcg_constant_i32(arg2), l); } } =20 @@ -271,9 +256,7 @@ void tcg_gen_setcond_i32(TCGCond cond, TCGv_i32 ret, void tcg_gen_setcondi_i32(TCGCond cond, TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_setcond_i32(cond, ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_setcond_i32(cond, ret, arg1, tcg_constant_i32(arg2)); } =20 void tcg_gen_muli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) @@ -283,9 +266,7 @@ void tcg_gen_muli_i32(TCGv_i32 ret, TCGv_i32 arg1, int3= 2_t arg2) } else if (is_power_of_2(arg2)) { tcg_gen_shli_i32(ret, arg1, ctz32(arg2)); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_mul_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_mul_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 @@ -433,9 +414,7 @@ void tcg_gen_clz_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_= i32 arg2) =20 void tcg_gen_clzi_i32(TCGv_i32 ret, TCGv_i32 arg1, uint32_t arg2) { - TCGv_i32 t =3D tcg_const_i32(arg2); - tcg_gen_clz_i32(ret, arg1, t); - tcg_temp_free_i32(t); + tcg_gen_clz_i32(ret, arg1, tcg_constant_i32(arg2)); } =20 void tcg_gen_ctz_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) @@ -468,10 +447,9 @@ void tcg_gen_ctz_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv= _i32 arg2) tcg_gen_clzi_i32(t, t, 32); tcg_gen_xori_i32(t, t, 31); } - z =3D tcg_const_i32(0); + z =3D tcg_constant_i32(0); tcg_gen_movcond_i32(TCG_COND_EQ, ret, arg1, z, arg2, t); tcg_temp_free_i32(t); - tcg_temp_free_i32(z); } else { gen_helper_ctz_i32(ret, arg1, arg2); } @@ -487,9 +465,7 @@ void tcg_gen_ctzi_i32(TCGv_i32 ret, TCGv_i32 arg1, uint= 32_t arg2) tcg_gen_ctpop_i32(ret, t); tcg_temp_free_i32(t); } else { - TCGv_i32 t =3D tcg_const_i32(arg2); - tcg_gen_ctz_i32(ret, arg1, t); - tcg_temp_free_i32(t); + tcg_gen_ctz_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 @@ -547,9 +523,7 @@ void tcg_gen_rotli_i32(TCGv_i32 ret, TCGv_i32 arg1, uns= igned arg2) if (arg2 =3D=3D 0) { tcg_gen_mov_i32(ret, arg1); } else if (TCG_TARGET_HAS_rot_i32) { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_rotl_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_rotl_i32(ret, arg1, tcg_constant_i32(arg2)); } else { TCGv_i32 t0, t1; t0 =3D tcg_temp_new_i32(); @@ -653,9 +627,8 @@ void tcg_gen_deposit_z_i32(TCGv_i32 ret, TCGv_i32 arg, tcg_gen_andi_i32(ret, arg, (1u << len) - 1); } else if (TCG_TARGET_HAS_deposit_i32 && TCG_TARGET_deposit_i32_valid(ofs, len)) { - TCGv_i32 zero =3D tcg_const_i32(0); + TCGv_i32 zero =3D tcg_constant_i32(0); tcg_gen_op5ii_i32(INDEX_op_deposit_i32, ret, zero, arg, ofs, len); - tcg_temp_free_i32(zero); } else { /* To help two-operand hosts we prefer to zero-extend first, which allows ARG to stay live. */ @@ -1052,7 +1025,7 @@ void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg) } else { TCGv_i32 t0 =3D tcg_temp_new_i32(); TCGv_i32 t1 =3D tcg_temp_new_i32(); - TCGv_i32 t2 =3D tcg_const_i32(0x00ff00ff); + TCGv_i32 t2 =3D tcg_constant_i32(0x00ff00ff); =20 /* arg =3D abcd */ tcg_gen_shri_i32(t0, arg, 8); /* t0 =3D .abc */ @@ -1067,7 +1040,6 @@ void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg) =20 tcg_temp_free_i32(t0); tcg_temp_free_i32(t1); - tcg_temp_free_i32(t2); } } =20 @@ -1237,6 +1209,14 @@ void tcg_gen_mul_i64(TCGv_i64 ret, TCGv_i64 arg1, TC= Gv_i64 arg2) tcg_temp_free_i64(t0); tcg_temp_free_i32(t1); } + +#else + +void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg) +{ + tcg_gen_mov_i64(ret, tcg_constant_i64(arg)); +} + #endif /* TCG_TARGET_REG_SIZE =3D=3D 32 */ =20 void tcg_gen_addi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) @@ -1244,10 +1224,12 @@ void tcg_gen_addi_i64(TCGv_i64 ret, TCGv_i64 arg1, = int64_t arg2) /* some cases can be optimized here */ if (arg2 =3D=3D 0) { tcg_gen_mov_i64(ret, arg1); + } else if (TCG_TARGET_REG_BITS =3D=3D 64) { + tcg_gen_add_i64(ret, arg1, tcg_constant_i64(arg2)); } else { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_add_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + tcg_gen_add2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), + TCGV_LOW(arg1), TCGV_HIGH(arg1), + tcg_constant_i32(arg2), tcg_constant_i32(arg2 >> = 32)); } } =20 @@ -1256,10 +1238,12 @@ void tcg_gen_subfi_i64(TCGv_i64 ret, int64_t arg1, = TCGv_i64 arg2) if (arg1 =3D=3D 0 && TCG_TARGET_HAS_neg_i64) { /* Don't recurse with tcg_gen_neg_i64. */ tcg_gen_op2_i64(INDEX_op_neg_i64, ret, arg2); + } else if (TCG_TARGET_REG_BITS =3D=3D 64) { + tcg_gen_sub_i64(ret, tcg_constant_i64(arg1), arg2); } else { - TCGv_i64 t0 =3D tcg_const_i64(arg1); - tcg_gen_sub_i64(ret, t0, arg2); - tcg_temp_free_i64(t0); + tcg_gen_sub2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), + tcg_constant_i32(arg1), tcg_constant_i32(arg1 >> = 32), + TCGV_LOW(arg2), TCGV_HIGH(arg2)); } } =20 @@ -1268,17 +1252,17 @@ void tcg_gen_subi_i64(TCGv_i64 ret, TCGv_i64 arg1, = int64_t arg2) /* some cases can be optimized here */ if (arg2 =3D=3D 0) { tcg_gen_mov_i64(ret, arg1); + } else if (TCG_TARGET_REG_BITS =3D=3D 64) { + tcg_gen_sub_i64(ret, arg1, tcg_constant_i64(arg2)); } else { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_sub_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + tcg_gen_sub2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), + TCGV_LOW(arg1), TCGV_HIGH(arg1), + tcg_constant_i32(arg2), tcg_constant_i32(arg2 >> = 32)); } } =20 void tcg_gen_andi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) { - TCGv_i64 t0; - if (TCG_TARGET_REG_BITS =3D=3D 32) { tcg_gen_andi_i32(TCGV_LOW(ret), TCGV_LOW(arg1), arg2); tcg_gen_andi_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), arg2 >> 32); @@ -1313,9 +1297,8 @@ void tcg_gen_andi_i64(TCGv_i64 ret, TCGv_i64 arg1, in= t64_t arg2) } break; } - t0 =3D tcg_const_i64(arg2); - tcg_gen_and_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + + tcg_gen_and_i64(ret, arg1, tcg_constant_i64(arg2)); } =20 void tcg_gen_ori_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) @@ -1331,9 +1314,7 @@ void tcg_gen_ori_i64(TCGv_i64 ret, TCGv_i64 arg1, int= 64_t arg2) } else if (arg2 =3D=3D 0) { tcg_gen_mov_i64(ret, arg1); } else { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_or_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + tcg_gen_or_i64(ret, arg1, tcg_constant_i64(arg2)); } } =20 @@ -1351,9 +1332,7 @@ void tcg_gen_xori_i64(TCGv_i64 ret, TCGv_i64 arg1, in= t64_t arg2) /* Don't recurse with tcg_gen_not_i64. */ tcg_gen_op2_i64(INDEX_op_not_i64, ret, arg1); } else { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_xor_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + tcg_gen_xor_i64(ret, arg1, tcg_constant_i64(arg2)); } } =20 @@ -1415,9 +1394,7 @@ void tcg_gen_shli_i64(TCGv_i64 ret, TCGv_i64 arg1, in= t64_t arg2) } else if (arg2 =3D=3D 0) { tcg_gen_mov_i64(ret, arg1); } else { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_shl_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + tcg_gen_shl_i64(ret, arg1, tcg_constant_i64(arg2)); } } =20 @@ -1429,9 +1406,7 @@ void tcg_gen_shri_i64(TCGv_i64 ret, TCGv_i64 arg1, in= t64_t arg2) } else if (arg2 =3D=3D 0) { tcg_gen_mov_i64(ret, arg1); } else { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_shr_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + tcg_gen_shr_i64(ret, arg1, tcg_constant_i64(arg2)); } } =20 @@ -1443,9 +1418,7 @@ void tcg_gen_sari_i64(TCGv_i64 ret, TCGv_i64 arg1, in= t64_t arg2) } else if (arg2 =3D=3D 0) { tcg_gen_mov_i64(ret, arg1); } else { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_sar_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + tcg_gen_sar_i64(ret, arg1, tcg_constant_i64(arg2)); } } =20 @@ -1468,12 +1441,17 @@ void tcg_gen_brcond_i64(TCGCond cond, TCGv_i64 arg1= , TCGv_i64 arg2, TCGLabel *l) =20 void tcg_gen_brcondi_i64(TCGCond cond, TCGv_i64 arg1, int64_t arg2, TCGLab= el *l) { - if (cond =3D=3D TCG_COND_ALWAYS) { + if (TCG_TARGET_REG_BITS =3D=3D 64) { + tcg_gen_brcond_i64(cond, arg1, tcg_constant_i64(arg2), l); + } else if (cond =3D=3D TCG_COND_ALWAYS) { tcg_gen_br(l); } else if (cond !=3D TCG_COND_NEVER) { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_brcond_i64(cond, arg1, t0, l); - tcg_temp_free_i64(t0); + l->refs++; + tcg_gen_op6ii_i32(INDEX_op_brcond2_i32, + TCGV_LOW(arg1), TCGV_HIGH(arg1), + tcg_constant_i32(arg2), + tcg_constant_i32(arg2 >> 32), + cond, label_arg(l)); } } =20 @@ -1499,9 +1477,19 @@ void tcg_gen_setcond_i64(TCGCond cond, TCGv_i64 ret, void tcg_gen_setcondi_i64(TCGCond cond, TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_setcond_i64(cond, ret, arg1, t0); - tcg_temp_free_i64(t0); + if (TCG_TARGET_REG_BITS =3D=3D 64) { + tcg_gen_setcond_i64(cond, ret, arg1, tcg_constant_i64(arg2)); + } else if (cond =3D=3D TCG_COND_ALWAYS) { + tcg_gen_movi_i64(ret, 1); + } else if (cond =3D=3D TCG_COND_NEVER) { + tcg_gen_movi_i64(ret, 0); + } else { + tcg_gen_op6i_i32(INDEX_op_setcond2_i32, TCGV_LOW(ret), + TCGV_LOW(arg1), TCGV_HIGH(arg1), + tcg_constant_i32(arg2), + tcg_constant_i32(arg2 >> 32), cond); + tcg_gen_movi_i32(TCGV_HIGH(ret), 0); + } } =20 void tcg_gen_muli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) @@ -1690,7 +1678,7 @@ void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg) } else { TCGv_i64 t0 =3D tcg_temp_new_i64(); TCGv_i64 t1 =3D tcg_temp_new_i64(); - TCGv_i64 t2 =3D tcg_const_i64(0x00ff00ff); + TCGv_i64 t2 =3D tcg_constant_i64(0x00ff00ff); =20 /* arg =3D ....abcd */ tcg_gen_shri_i64(t0, arg, 8); /* t0 =3D .....abc */ @@ -1706,7 +1694,6 @@ void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg) =20 tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); - tcg_temp_free_i64(t2); } } =20 @@ -1850,16 +1837,16 @@ void tcg_gen_clzi_i64(TCGv_i64 ret, TCGv_i64 arg1, = uint64_t arg2) if (TCG_TARGET_REG_BITS =3D=3D 32 && TCG_TARGET_HAS_clz_i32 && arg2 <=3D 0xffffffffu) { - TCGv_i32 t =3D tcg_const_i32((uint32_t)arg2 - 32); - tcg_gen_clz_i32(t, TCGV_LOW(arg1), t); + TCGv_i32 t =3D tcg_temp_new_i32(); + tcg_gen_clzi_i32(t, TCGV_LOW(arg1), arg2 - 32); tcg_gen_addi_i32(t, t, 32); tcg_gen_clz_i32(TCGV_LOW(ret), TCGV_HIGH(arg1), t); tcg_gen_movi_i32(TCGV_HIGH(ret), 0); tcg_temp_free_i32(t); } else { - TCGv_i64 t =3D tcg_const_i64(arg2); - tcg_gen_clz_i64(ret, arg1, t); - tcg_temp_free_i64(t); + TCGv_i64 t0 =3D tcg_const_i64(arg2); + tcg_gen_clz_i64(ret, arg1, t0); + tcg_temp_free_i64(t0); } } =20 @@ -1881,7 +1868,7 @@ void tcg_gen_ctz_i64(TCGv_i64 ret, TCGv_i64 arg1, TCG= v_i64 arg2) tcg_gen_clzi_i64(t, t, 64); tcg_gen_xori_i64(t, t, 63); } - z =3D tcg_const_i64(0); + z =3D tcg_constant_i64(0); tcg_gen_movcond_i64(TCG_COND_EQ, ret, arg1, z, arg2, t); tcg_temp_free_i64(t); tcg_temp_free_i64(z); @@ -1895,8 +1882,8 @@ void tcg_gen_ctzi_i64(TCGv_i64 ret, TCGv_i64 arg1, ui= nt64_t arg2) if (TCG_TARGET_REG_BITS =3D=3D 32 && TCG_TARGET_HAS_ctz_i32 && arg2 <=3D 0xffffffffu) { - TCGv_i32 t32 =3D tcg_const_i32((uint32_t)arg2 - 32); - tcg_gen_ctz_i32(t32, TCGV_HIGH(arg1), t32); + TCGv_i32 t32 =3D tcg_temp_new_i32(); + tcg_gen_ctzi_i32(t32, TCGV_HIGH(arg1), arg2 - 32); tcg_gen_addi_i32(t32, t32, 32); tcg_gen_ctz_i32(TCGV_LOW(ret), TCGV_LOW(arg1), t32); tcg_gen_movi_i32(TCGV_HIGH(ret), 0); @@ -1911,9 +1898,9 @@ void tcg_gen_ctzi_i64(TCGv_i64 ret, TCGv_i64 arg1, ui= nt64_t arg2) tcg_gen_ctpop_i64(ret, t); tcg_temp_free_i64(t); } else { - TCGv_i64 t64 =3D tcg_const_i64(arg2); - tcg_gen_ctz_i64(ret, arg1, t64); - tcg_temp_free_i64(t64); + TCGv_i64 t0 =3D tcg_const_i64(arg2); + tcg_gen_ctz_i64(ret, arg1, t0); + tcg_temp_free_i64(t0); } } =20 @@ -1969,9 +1956,7 @@ void tcg_gen_rotli_i64(TCGv_i64 ret, TCGv_i64 arg1, u= nsigned arg2) if (arg2 =3D=3D 0) { tcg_gen_mov_i64(ret, arg1); } else if (TCG_TARGET_HAS_rot_i64) { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_rotl_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + tcg_gen_rotl_i64(ret, arg1, tcg_constant_i64(arg2)); } else { TCGv_i64 t0, t1; t0 =3D tcg_temp_new_i64(); @@ -2089,9 +2074,8 @@ void tcg_gen_deposit_z_i64(TCGv_i64 ret, TCGv_i64 arg, tcg_gen_andi_i64(ret, arg, (1ull << len) - 1); } else if (TCG_TARGET_HAS_deposit_i64 && TCG_TARGET_deposit_i64_valid(ofs, len)) { - TCGv_i64 zero =3D tcg_const_i64(0); + TCGv_i64 zero =3D tcg_constant_i64(0); tcg_gen_op5ii_i64(INDEX_op_deposit_i64, ret, zero, arg, ofs, len); - tcg_temp_free_i64(zero); } else { if (TCG_TARGET_REG_BITS =3D=3D 32) { if (ofs >=3D 32) { @@ -3102,9 +3086,8 @@ void tcg_gen_atomic_cmpxchg_i32(TCGv_i32 retv, TCGv a= ddr, TCGv_i32 cmpv, =20 #ifdef CONFIG_SOFTMMU { - TCGv_i32 oi =3D tcg_const_i32(make_memop_idx(memop & ~MO_SIGN,= idx)); - gen(retv, cpu_env, addr, cmpv, newv, oi); - tcg_temp_free_i32(oi); + TCGMemOpIdx oi =3D make_memop_idx(memop & ~MO_SIGN, idx); + gen(retv, cpu_env, addr, cmpv, newv, tcg_constant_i32(oi)); } #else gen(retv, cpu_env, addr, cmpv, newv); @@ -3147,9 +3130,8 @@ void tcg_gen_atomic_cmpxchg_i64(TCGv_i64 retv, TCGv a= ddr, TCGv_i64 cmpv, =20 #ifdef CONFIG_SOFTMMU { - TCGv_i32 oi =3D tcg_const_i32(make_memop_idx(memop, idx)); - gen(retv, cpu_env, addr, cmpv, newv, oi); - tcg_temp_free_i32(oi); + TCGMemOpIdx oi =3D make_memop_idx(memop, idx); + gen(retv, cpu_env, addr, cmpv, newv, tcg_constant_i32(oi)); } #else gen(retv, cpu_env, addr, cmpv, newv); @@ -3210,9 +3192,8 @@ static void do_atomic_op_i32(TCGv_i32 ret, TCGv addr,= TCGv_i32 val, =20 #ifdef CONFIG_SOFTMMU { - TCGv_i32 oi =3D tcg_const_i32(make_memop_idx(memop & ~MO_SIGN, idx= )); - gen(ret, cpu_env, addr, val, oi); - tcg_temp_free_i32(oi); + TCGMemOpIdx oi =3D make_memop_idx(memop & ~MO_SIGN, idx); + gen(ret, cpu_env, addr, val, tcg_constant_i32(oi)); } #else gen(ret, cpu_env, addr, val); @@ -3255,9 +3236,8 @@ static void do_atomic_op_i64(TCGv_i64 ret, TCGv addr,= TCGv_i64 val, =20 #ifdef CONFIG_SOFTMMU { - TCGv_i32 oi =3D tcg_const_i32(make_memop_idx(memop & ~MO_SIGN,= idx)); - gen(ret, cpu_env, addr, val, oi); - tcg_temp_free_i32(oi); + TCGMemOpIdx oi =3D make_memop_idx(memop & ~MO_SIGN, idx); + gen(ret, cpu_env, addr, val, tcg_constant_i32(oi)); } #else gen(ret, cpu_env, addr, val); --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1587227016; cv=none; d=zohomail.com; s=zohoarc; b=I9Ggp0SkA89cdiSwQvpHbmptPzHwvLzJ/+bPPyMQq99glCZ47JQB2mo4HYER5EOSeEGry5w+fLMcI5hhEO+RrB+/gaRfnrXSnV4oqEpPA36a3EnsJCQ8+7+AqSMkkkdikmWji2P+sfuQPalQJOJo0sBpXmZSd2T2X2/D2qMYb1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587227016; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jnoGz1Jnxdfh+y+NorE/kRAs3qyr4Q4Rbpyv23cxSxY=; b=GFhzUxc8bfatTZbOdtvb+AEvVy8L9OymipVK56W5jmFC1kwVEaprqvIjwjNFE7tGOehx7nHx5VF3yTbXZ3A7yZLGcjPVTT3NLPIG8ICX3EkkKIqlqsKn06VrEsVN+4pTkOpb6GgWf3mNDzLMG2uIqQV6uGs5brQZ5PafSPCDPfw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587227016319976.1416251155129; Sat, 18 Apr 2020 09:23:36 -0700 (PDT) Received: from localhost ([::1]:59636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqFi-00017C-UO for importer@patchew.org; Sat, 18 Apr 2020 12:23:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48131) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBi-00048S-8z for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBg-00050q-SZ for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:26 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:33859) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBg-0004yy-Mg for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:24 -0400 Received: by mail-pf1-x444.google.com with SMTP id d1so2704261pfh.1 for ; Sat, 18 Apr 2020 09:19:24 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=jnoGz1Jnxdfh+y+NorE/kRAs3qyr4Q4Rbpyv23cxSxY=; b=WXSbWM+kCCFQSkXgZ8HzhR59qFBZ2mFxmuuW97ha4MYxtkTO2FT61LqbKedi0vyJpe uP3MDJEoBZMQuepLtap6GyAATbcKO5bquR7Pv0tEomjfOiAafa80ESckpAcIeSvpBj11 m+KwxvmWC8HUpD6nitY6q346nzh3JmekU2BaZzKGaKGz1nKunwmJM75n/uiqV9PQGGVO afwdUfxc3ZtKmBzdkIPpeVnQiVZWk8TU/TcHibEi2FhkHTSs7Yl/1IO2U4q0jN27lOQR CvofDOi6eU9p+4NOwS5FIiZxUECEwuryfPzlvWquqbhZROlBkLyge4qhRFvLI5G9E3op BO3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jnoGz1Jnxdfh+y+NorE/kRAs3qyr4Q4Rbpyv23cxSxY=; b=njQgn7A5sCSd3EekJNQoaQH7FSFjYRKEdWexxWc4Qcyuz+CLTGXYfoex4u3RHV7Jrz f0aG6CMF9LriLBe6PFOnQolr9ZFfxEA8SWZQ/f0NaiLDtPvJjV3O4qy8jX51W4ZTHTsq TyGjP7MfPy4k0cSjTX9LMDoisebXMZbBl1oL1dIZ0Nm4sSFlxRkeoSAXz9OL8/V7ifjr urnkfosoGdIfP3Jby6Sad7VKljnHUXMQhB1WkaccHgQgtYPFHpNuCUDT+tBjpH1UdE33 C3pDszO8zVKmIOdH4V6TlvpMP0BZS+ITjBoIFizpjuzsscAU9xWAUZhaQXC+I2Grrgey m2OQ== X-Gm-Message-State: AGi0PuYCi7KqKcZFOCc0+SbVrDZOlbCNhSfzk9oC15gJ7fbPuuLP8rKP CUxK8POkZhqx5ICpDtKS6hoiKb8M+ZQ= X-Google-Smtp-Source: APiQypJTbeyp/8kA94pYszo1r5NWz8CHdXVEi0ctCOLZBuljy1sy4L++kkgkHEdE3hnGbnpwgIFFvw== X-Received: by 2002:aa7:9f03:: with SMTP id g3mr9174714pfr.287.1587226763198; Sat, 18 Apr 2020 09:19:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 05/16] tcg: Use tcg_constant_{i32,vec} with tcg vec expanders Date: Sat, 18 Apr 2020 09:19:03 -0700 Message-Id: <20200418161914.4387-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- tcg/tcg-op-vec.c | 63 ++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index f3927089a7..655b3ae32d 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -233,25 +233,17 @@ void tcg_gen_mov_vec(TCGv_vec r, TCGv_vec a) } } =20 -#define MO_REG (TCG_TARGET_REG_BITS =3D=3D 64 ? MO_64 : MO_32) - -static void do_dupi_vec(TCGv_vec r, unsigned vece, TCGArg a) -{ - TCGTemp *rt =3D tcgv_vec_temp(r); - vec_gen_2(INDEX_op_dupi_vec, rt->base_type, vece, temp_arg(rt), a); -} - TCGv_vec tcg_const_zeros_vec(TCGType type) { TCGv_vec ret =3D tcg_temp_new_vec(type); - do_dupi_vec(ret, MO_REG, 0); + tcg_gen_mov_vec(ret, tcg_constant_vec(type, MO_8, 0)); return ret; } =20 TCGv_vec tcg_const_ones_vec(TCGType type) { TCGv_vec ret =3D tcg_temp_new_vec(type); - do_dupi_vec(ret, MO_REG, -1); + tcg_gen_mov_vec(ret, tcg_constant_vec(type, MO_8, -1)); return ret; } =20 @@ -267,37 +259,50 @@ TCGv_vec tcg_const_ones_vec_matching(TCGv_vec m) return tcg_const_ones_vec(t->base_type); } =20 -void tcg_gen_dup64i_vec(TCGv_vec r, uint64_t a) +void tcg_gen_dupi_vec(unsigned vece, TCGv_vec dest, uint64_t val) { - if (TCG_TARGET_REG_BITS =3D=3D 32 && a =3D=3D deposit64(a, 32, 32, a))= { - do_dupi_vec(r, MO_32, a); - } else if (TCG_TARGET_REG_BITS =3D=3D 64 || a =3D=3D (uint64_t)(int32_= t)a) { - do_dupi_vec(r, MO_64, a); - } else { - TCGv_i64 c =3D tcg_const_i64(a); - tcg_gen_dup_i64_vec(MO_64, r, c); - tcg_temp_free_i64(c); + TCGType type =3D tcgv_vec_temp(dest)->base_type; + + /* + * For MO_64 constants that can't be represented in tcg_target_long, + * we must use INDEX_op_dup2_vec. + */ + if (TCG_TARGET_REG_BITS =3D=3D 32) { + val =3D dup_const(vece, val); + if (val !=3D deposit64(val, 32, 32, val) && + val !=3D (uint64_t)(int32_t)val) { + uint32_t vl =3D extract64(val, 0, 32); + uint32_t vh =3D extract64(val, 32, 32); + TCGArg al =3D tcgv_i32_arg(tcg_constant_i32(vl)); + TCGArg ah =3D tcgv_i32_arg(tcg_constant_i32(vh)); + TCGArg di =3D tcgv_vec_arg(dest); + + vec_gen_3(INDEX_op_dup2_vec, type, MO_64, di, al, ah); + return; + } } + + tcg_gen_mov_vec(dest, tcg_constant_vec(type, vece, val)); } =20 -void tcg_gen_dup32i_vec(TCGv_vec r, uint32_t a) +void tcg_gen_dup64i_vec(TCGv_vec dest, uint64_t val) { - do_dupi_vec(r, MO_REG, dup_const(MO_32, a)); + tcg_gen_dupi_vec(MO_64, dest, val); } =20 -void tcg_gen_dup16i_vec(TCGv_vec r, uint32_t a) +void tcg_gen_dup32i_vec(TCGv_vec dest, uint32_t val) { - do_dupi_vec(r, MO_REG, dup_const(MO_16, a)); + tcg_gen_dupi_vec(MO_32, dest, val); } =20 -void tcg_gen_dup8i_vec(TCGv_vec r, uint32_t a) +void tcg_gen_dup16i_vec(TCGv_vec dest, uint32_t val) { - do_dupi_vec(r, MO_REG, dup_const(MO_8, a)); + tcg_gen_dupi_vec(MO_16, dest, val); } =20 -void tcg_gen_dupi_vec(unsigned vece, TCGv_vec r, uint64_t a) +void tcg_gen_dup8i_vec(TCGv_vec dest, uint32_t val) { - do_dupi_vec(r, MO_REG, dup_const(vece, a)); + tcg_gen_dupi_vec(MO_8, dest, val); } =20 void tcg_gen_dup_i64_vec(unsigned vece, TCGv_vec r, TCGv_i64 a) @@ -502,8 +507,8 @@ void tcg_gen_abs_vec(unsigned vece, TCGv_vec r, TCGv_ve= c a) if (tcg_can_emit_vec_op(INDEX_op_sari_vec, type, vece) > 0) { tcg_gen_sari_vec(vece, t, a, (8 << vece) - 1); } else { - do_dupi_vec(t, MO_REG, 0); - tcg_gen_cmp_vec(TCG_COND_LT, vece, t, a, t); + tcg_gen_cmp_vec(TCG_COND_LT, vece, t, a, + tcg_constant_vec(type, vece, 0)); } tcg_gen_xor_vec(vece, r, a, t); tcg_gen_sub_vec(vece, r, r, t); --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1587226878; cv=none; d=zohomail.com; s=zohoarc; b=ilf6cbDqL6B1jO7dWOmSYfVXU4RrbNIRcUtHVHt8sQQ9T+yaY2Y6wRj0QzBeN3GH8hnyTshtzdrIptioqTdlFNXdRoKw/J2xjaN/cYaP4j0GPWL2ldDymUC0wVBg83jc0N1+ClkeWlLqd6iGyCHW4Nh21ckLrq3sxK4Ftkl5jOE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587226878; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UBTvpXnQhX/NB3BncFrtFDo86VAuYzf/XHrJqnCZIJI=; b=WRAVlvxWP6gWRjk3ILqaYK38E9tKlxbHuz+vKdgUp5/OLQv7K0QWThB+A6zAaJafFVhgnBdfcvDpptMYwCISfvYMBp4F7WNCODSRcrmFKfoTaPt95uiZv/Zr1iIkZ6kOeZABrt6acbduN/uWppS82NGoMt9ZBellaekcy2P61DA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 158722687826998.29815580029833; Sat, 18 Apr 2020 09:21:18 -0700 (PDT) Received: from localhost ([::1]:59594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqDU-00065i-TZ for importer@patchew.org; Sat, 18 Apr 2020 12:21:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48150) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBk-0004AA-78 for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBi-00056k-18 for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:28 -0400 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]:51724) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBh-000531-RY for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:25 -0400 Received: by mail-pj1-x1044.google.com with SMTP id kb16so2558754pjb.1 for ; Sat, 18 Apr 2020 09:19:25 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=UBTvpXnQhX/NB3BncFrtFDo86VAuYzf/XHrJqnCZIJI=; b=w6CYIEJABMQudswv/V+rdbAPAP/PHYPiCyCQjrhkl6CEBQdoVOoaQofTqX+StZj7oU g1Lsjgabnsf3F+VzfCnOpkAsHXkl2S5tiJyce3lDSPkFDpc6TRN2nsHLkCH50chx6kNT E+wM3OV9I8V/YJ8kaMF/uUi9W31FEuMaMqrqCazLEZP6aMPfZOf0ykYZDCnicLV5iFNl EslWZdJ4qQfTjesOHgUlotkkc6JhKoTds6n9+eKioLc2vJ8SAy+zxL8rYKm9bnqGvCLw JPeMMpndldCiPEg6+eEQwHVs3gJnc9jM+FJXJX4/Wn6cIxOBZVat+03NfUg9kiZvqip3 Yr3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UBTvpXnQhX/NB3BncFrtFDo86VAuYzf/XHrJqnCZIJI=; b=KzHstsbN4spJmJNZs2ylJy7+wE125ehTryFpDC1qx9kAWajQino9VFLJE5aYyQI0/1 2YfOCZ9C/FY9tCoqcF0j52ijvLsfFXStmn9t0wQiQmsLvXVdLd5nAUlKrvTmOL42GXKF uRv24jS4CAqe1/oOk8F5W2f478oS1ouP7ITdyj+Ta3CYAtKS8YcxjtS+yGMb3Feml4D/ hsL80MRI7SrnfgeL1XFr3ZuA+GEfNp4H9A425BHDynWYgw0bmyqqJfM7wkrtp7tuhkhL DtZMFbQY8mzOSKcHEKcy/QpHqUwg0z1B5t5lagKRBkdNUQvNfGVpMWctPpTHyakulh2C TXkA== X-Gm-Message-State: AGi0PuZV+qLkaY9lq+em/NFu7Q4SZDnubMqLH2pjTWicgO3mzbH3SOgG jTsu6O+PGrFnBofyYx985F/gYUw2bek= X-Google-Smtp-Source: APiQypLPWHIMEJkZYGUOjaSSOo92gIESVXmChfYc2XmuL+kJJBNAOGXa6r6m8YCUByte7gHtLGqAwg== X-Received: by 2002:a17:90a:a113:: with SMTP id s19mr11535140pjp.161.1587226764399; Sat, 18 Apr 2020 09:19:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 06/16] tcg: Use tcg_constant_{i32,i64} with tcg plugins Date: Sat, 18 Apr 2020 09:19:04 -0700 Message-Id: <20200418161914.4387-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::1044 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 49 +++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 51580d51a0..e5dc9d0ca9 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -284,8 +284,8 @@ static TCGOp *copy_extu_i32_i64(TCGOp **begin_op, TCGOp= *op) if (TCG_TARGET_REG_BITS =3D=3D 32) { /* mov_i32 */ op =3D copy_op(begin_op, op, INDEX_op_mov_i32); - /* movi_i32 */ - op =3D copy_op(begin_op, op, INDEX_op_movi_i32); + /* mov_i32 w/ $0 */ + op =3D copy_op(begin_op, op, INDEX_op_mov_i32); } else { /* extu_i32_i64 */ op =3D copy_op(begin_op, op, INDEX_op_extu_i32_i64); @@ -306,39 +306,34 @@ static TCGOp *copy_mov_i64(TCGOp **begin_op, TCGOp *o= p) return op; } =20 -static TCGOp *copy_movi_i64(TCGOp **begin_op, TCGOp *op, uint64_t v) -{ - if (TCG_TARGET_REG_BITS =3D=3D 32) { - /* 2x movi_i32 */ - op =3D copy_op(begin_op, op, INDEX_op_movi_i32); - op->args[1] =3D v; - - op =3D copy_op(begin_op, op, INDEX_op_movi_i32); - op->args[1] =3D v >> 32; - } else { - /* movi_i64 */ - op =3D copy_op(begin_op, op, INDEX_op_movi_i64); - op->args[1] =3D v; - } - return op; -} - static TCGOp *copy_const_ptr(TCGOp **begin_op, TCGOp *op, void *ptr) { if (UINTPTR_MAX =3D=3D UINT32_MAX) { - /* movi_i32 */ - op =3D copy_op(begin_op, op, INDEX_op_movi_i32); - op->args[1] =3D (uintptr_t)ptr; + /* mov_i32 */ + op =3D copy_op(begin_op, op, INDEX_op_mov_i32); + op->args[1] =3D tcgv_i32_arg(tcg_constant_i32((uintptr_t)ptr)); } else { - /* movi_i64 */ - op =3D copy_movi_i64(begin_op, op, (uint64_t)(uintptr_t)ptr); + /* mov_i64 */ + op =3D copy_op(begin_op, op, INDEX_op_mov_i64); + op->args[1] =3D tcgv_i64_arg(tcg_constant_i64((uintptr_t)ptr)); } return op; } =20 static TCGOp *copy_const_i64(TCGOp **begin_op, TCGOp *op, uint64_t v) { - return copy_movi_i64(begin_op, op, v); + if (TCG_TARGET_REG_BITS =3D=3D 32) { + /* 2x mov_i32 */ + op =3D copy_op(begin_op, op, INDEX_op_mov_i32); + op->args[1] =3D tcgv_i32_arg(tcg_constant_i32(v)); + op =3D copy_op(begin_op, op, INDEX_op_mov_i32); + op->args[1] =3D tcgv_i32_arg(tcg_constant_i32(v >> 32)); + } else { + /* mov_i64 */ + op =3D copy_op(begin_op, op, INDEX_op_mov_i64); + op->args[1] =3D tcgv_i64_arg(tcg_constant_i64(v)); + } + return op; } =20 static TCGOp *copy_extu_tl_i64(TCGOp **begin_op, TCGOp *op) @@ -486,8 +481,8 @@ static TCGOp *append_mem_cb(const struct qemu_plugin_dy= n_cb *cb, =20 tcg_debug_assert(type =3D=3D PLUGIN_GEN_CB_MEM); =20 - /* const_i32 =3D=3D movi_i32 ("info", so it remains as is) */ - op =3D copy_op(&begin_op, op, INDEX_op_movi_i32); + /* const_i32 =3D=3D mov_i32 ("info", so it remains as is) */ + op =3D copy_op(&begin_op, op, INDEX_op_mov_i32); =20 /* const_ptr */ op =3D copy_const_ptr(&begin_op, op, cb->userp); --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1587227270; cv=none; d=zohomail.com; s=zohoarc; b=Facz73sO6njaZtmpvy70oGKhU3HTw/kvWcmDG6CHAv8Z38Ji/BzZGFsyDHI09KOjC/+4AFUYXZFqeB6fH20ZuRghqtjGQdB4zj4eNN22cN02uthPYdnZlJz/LgnjDEsBJ9jWh8N/1Cu48l8KjEEG9zq2DbQIYJu00nZQKuFoMPw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587227270; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=g8/p+PUrUK9+1D4LpE0xAeSYjcuN7ROr/u3zdSbPNQc=; b=XTLZfypa6/8ToQHK7hF4pMm4Bve6oITX7uaIGa4/a7dImkVTUMRsNADzK+f356HS9x0YXQuw7U/d4uMUbkmZwYaV3TkiaUcXlGhVJiS//Or0dOAVgFmqOOj1clwMg/c/krKNCpeg0Vc4tDdIq4zxxaG2bYDlkjyG5VQn8N2Y83I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587227270463662.6662190245073; Sat, 18 Apr 2020 09:27:50 -0700 (PDT) Received: from localhost ([::1]:59742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqJo-00084N-Pu for importer@patchew.org; Sat, 18 Apr 2020 12:27:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48162) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBl-0004Am-E3 for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBk-0005CH-38 for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:29 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:34889) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBj-00059k-Tc for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:28 -0400 Received: by mail-pf1-x442.google.com with SMTP id r14so2701293pfg.2 for ; Sat, 18 Apr 2020 09:19:27 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=g8/p+PUrUK9+1D4LpE0xAeSYjcuN7ROr/u3zdSbPNQc=; b=yfoibbcJtsv9Ht7WzNfYGiVy9K50wZK8X9+bAtkN9qltdtoqfWfKl/TaRRbDAMC5zn se9HPkwpV8fe6BAqrtEXFkw3E/BwHcImYj/Yn3+sZVqeOtlQv4Dcnenkt22RNhUD+jto 7kE+M+NOsIqaITUXvRmowlumPvy0NmU8DviqZ/fAThRRzUq/TG+x/VkZqECfXJepmoFM i76lyrtQtv+rLOsLl3j74GPs69rlP4jWi5m9qTTBFO3xNQE5a/JWeGzABrCGW6gPyt5d ASzTItYvAw+BmMGGf43lvvb25NbJkvbFRtMZ4LMehk1fQ/LqN3gbA4EA5Q8WyzxeTHkx 0O3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g8/p+PUrUK9+1D4LpE0xAeSYjcuN7ROr/u3zdSbPNQc=; b=V+QWk/bNUCTzZUMqboJO+eH8buL/nZqpbUlSt1kGQKhOxOiGafAiQtxZdpHlQ0RnUv 9Hb1Wr0o6rbf17x+U93Ark4KR3mpAvPo8loDtkA2sNfN0OmSR7K6yppv0aRo0JmUak0b PylrEl9q4gxccIgYmkCBqOP/k8URCT1YPnGMajfmYvNvi+tbEXCaKY7lOxk+tohDgp+D ltAA41jPgF8/PJAeasfpXrSLWgie8+bWvlQP816VFWv4D66gdXeZDbfTNn3aJFip56Bb 1QwnoxorXGy1ZYhLp0klZF8kHcHoxRRrOF0c0nB7P483x41OU3obAr+kwcatMDEEqiNs biKA== X-Gm-Message-State: AGi0PuYkt3wR16LXi+Xni6dwohQyqhdEYCyUMirZg740pZSXWzdgPu1b IRLbaRYUR4d2R3WK1LiZTVAWRSNi4sk= X-Google-Smtp-Source: APiQypKtv2zEPHjKxrndHFc1fvbtRuAKx0OhBM8MegPqZ5NMIHkcUdOwY7UDSjnGFMicUqL2P3PTDw== X-Received: by 2002:a63:c6:: with SMTP id 189mr1711357pga.239.1587226765918; Sat, 18 Apr 2020 09:19:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 07/16] tcg: Rename struct tcg_temp_info to TempOptInfo Date: Sat, 18 Apr 2020 09:19:05 -0700 Message-Id: <20200418161914.4387-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Fix this name vs our coding style. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tcg/optimize.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index effb47eefd..b86bf3d707 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -35,20 +35,20 @@ glue(glue(case INDEX_op_, x), _i64): \ glue(glue(case INDEX_op_, x), _vec) =20 -struct tcg_temp_info { +typedef struct TempOptInfo { bool is_const; TCGTemp *prev_copy; TCGTemp *next_copy; tcg_target_ulong val; tcg_target_ulong mask; -}; +} TempOptInfo; =20 -static inline struct tcg_temp_info *ts_info(TCGTemp *ts) +static inline TempOptInfo *ts_info(TCGTemp *ts) { return ts->state_ptr; } =20 -static inline struct tcg_temp_info *arg_info(TCGArg arg) +static inline TempOptInfo *arg_info(TCGArg arg) { return ts_info(arg_temp(arg)); } @@ -71,9 +71,9 @@ static inline bool ts_is_copy(TCGTemp *ts) /* Reset TEMP's state, possibly removing the temp for the list of copies. = */ static void reset_ts(TCGTemp *ts) { - struct tcg_temp_info *ti =3D ts_info(ts); - struct tcg_temp_info *pi =3D ts_info(ti->prev_copy); - struct tcg_temp_info *ni =3D ts_info(ti->next_copy); + TempOptInfo *ti =3D ts_info(ts); + TempOptInfo *pi =3D ts_info(ti->prev_copy); + TempOptInfo *ni =3D ts_info(ti->next_copy); =20 ni->prev_copy =3D ti->prev_copy; pi->next_copy =3D ti->next_copy; @@ -89,12 +89,12 @@ static void reset_temp(TCGArg arg) } =20 /* Initialize and activate a temporary. */ -static void init_ts_info(struct tcg_temp_info *infos, +static void init_ts_info(TempOptInfo *infos, TCGTempSet *temps_used, TCGTemp *ts) { size_t idx =3D temp_idx(ts); if (!test_bit(idx, temps_used->l)) { - struct tcg_temp_info *ti =3D &infos[idx]; + TempOptInfo *ti =3D &infos[idx]; =20 ts->state_ptr =3D ti; ti->next_copy =3D ts; @@ -114,7 +114,7 @@ static void init_ts_info(struct tcg_temp_info *infos, } } =20 -static void init_arg_info(struct tcg_temp_info *infos, +static void init_arg_info(TempOptInfo *infos, TCGTempSet *temps_used, TCGArg arg) { init_ts_info(infos, temps_used, arg_temp(arg)); @@ -177,7 +177,7 @@ static void tcg_opt_gen_movi(TCGContext *s, TCGOp *op, = TCGArg dst, TCGArg val) const TCGOpDef *def; TCGOpcode new_op; tcg_target_ulong mask; - struct tcg_temp_info *di =3D arg_info(dst); + TempOptInfo *di =3D arg_info(dst); =20 def =3D &tcg_op_defs[op->opc]; if (def->flags & TCG_OPF_VECTOR) { @@ -208,8 +208,8 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, T= CGArg dst, TCGArg src) TCGTemp *dst_ts =3D arg_temp(dst); TCGTemp *src_ts =3D arg_temp(src); const TCGOpDef *def; - struct tcg_temp_info *di; - struct tcg_temp_info *si; + TempOptInfo *di; + TempOptInfo *si; tcg_target_ulong mask; TCGOpcode new_op; =20 @@ -242,7 +242,7 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, T= CGArg dst, TCGArg src) di->mask =3D mask; =20 if (src_ts->type =3D=3D dst_ts->type) { - struct tcg_temp_info *ni =3D ts_info(si->next_copy); + TempOptInfo *ni =3D ts_info(si->next_copy); =20 di->next_copy =3D si->next_copy; di->prev_copy =3D src_ts; @@ -605,7 +605,7 @@ void tcg_optimize(TCGContext *s) { int nb_temps, nb_globals; TCGOp *op, *op_next, *prev_mb =3D NULL; - struct tcg_temp_info *infos; + TempOptInfo *infos; TCGTempSet temps_used; =20 /* Array VALS has an element for each temp. @@ -616,7 +616,7 @@ void tcg_optimize(TCGContext *s) nb_temps =3D s->nb_temps; nb_globals =3D s->nb_globals; bitmap_zero(temps_used.l, nb_temps); - infos =3D tcg_malloc(sizeof(struct tcg_temp_info) * nb_temps); + infos =3D tcg_malloc(sizeof(TempOptInfo) * nb_temps); =20 QTAILQ_FOREACH_SAFE(op, &s->ops, link, op_next) { tcg_target_ulong mask, partmask, affected; --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1587227029; cv=none; d=zohomail.com; s=zohoarc; b=c4gYj9k+AzmkDMeqctmRhXQN17cMbO5RkMDulocY6vjqg3rI8wNjQBkdIAkyWwz9X5bTTudOVpEEAPIP5VMBrthHbXMuEqRFGNrpzmcEpk4/n/0pH/a7eYMI4KF7KVi6F+g+cuoKjEGkl1G7R2w9JSfM3V8ektaldp8DdPUiHzA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587227029; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DuJkDhPEOnaROoc/1JyNu5wUbGL/01Lw8KOKVY4KSao=; b=FQ5QjZwXp6U6BVtPMEWAu3SD6sLsiZ2+X/jHxEWtPcFzI7ba4m110c0m7TDAZ4YKybfRcCoSWFa9rdlAsotBx1z3va/9KzkCXWSm73lHx6kuu/So9LjhwV2+LVdNsI/kedLNT9wpWZhaKAoDNavXfmUp/jYz9wDO1YGAiQYqUYU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587227029713472.8847255382732; Sat, 18 Apr 2020 09:23:49 -0700 (PDT) Received: from localhost ([::1]:59644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqFw-0001CF-Iw for importer@patchew.org; Sat, 18 Apr 2020 12:23:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48179) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBm-0004Ce-HJ for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBl-0005FQ-8n for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:30 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:36456) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBl-0005CF-2H for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:29 -0400 Received: by mail-pj1-x102a.google.com with SMTP id nu11so2474860pjb.1 for ; Sat, 18 Apr 2020 09:19:28 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=DuJkDhPEOnaROoc/1JyNu5wUbGL/01Lw8KOKVY4KSao=; b=T23yHe/Gr6i1dtamJBmXgruKsQmfGotnEi8hYEzqD+kVWQelxkqEPZfIpluhDa2hIU eMsbrN3skiuBbDBjZ9Txw5A+hFx1DpmMyhlIJef3+tme2f2c5R6r3heWeIrI96WT3yEH jIVdPbQgtGoVgzheW33yd88sJAUiaORJ2gH+qQvoPVEFd/5gceTEygWnxFENVbWDpxwn KMeHl5bqG4P1M4VtBO1qXYbY8kdO7SWWx905iu2X5P7/8Kc/nxFKlJbv1tzjq8qdi9AJ oeRdPNwtmHq7XCd3af7txIgKb7h51AUy3aj4YbJ2OeUaqCkM/t/uf9z+LOqXyI02QPHX Itdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DuJkDhPEOnaROoc/1JyNu5wUbGL/01Lw8KOKVY4KSao=; b=redk1x+Am4zvRYBCXFdcyGvtDYFoq1gbD2OF05DNCfS+0JZJTSdfFkoKFOvUjm60Wl CewMAOW7fXLQrD8XroElKNYExmAQEhjOVYLTKUGGfLviCtVb5afF0WG/U7zeBPZlDTou 37HqZsR5VcCMyMMPmWszGN+nx2s9uSt4I/GXnbd1vFcGX4++w9QsgBtn0+rZYL21Ff+d cyDWYZqxw4+P1O3tjPAGLsmgcs260AqhAKYYYolTQO4Yp+Kk8FdYpUr5jligdUp3f+iy T0PIVQyqTVXBqN7pUfyFGzG5m47YFvxQIgbSgrtgdAIp52aTodxqR3PLnj3/iNQQIu/l /8/g== X-Gm-Message-State: AGi0PuaWpvPidtfT/9uCZwS7YMRgU8B3efnR6l5/XrWAZxbfEsKzh3Zt 9PoJ7ztcK6Rbp1rfQVs+Eh5x6jEoxwI= X-Google-Smtp-Source: APiQypLuKyMJkNoKQtdrPcj16j0GK8ziTaGQ4hq/X1PdMIkRE4TusKWiDazIBnQsGFbp4E36OjdSfg== X-Received: by 2002:a17:90a:1743:: with SMTP id 3mr11389559pjm.106.1587226767247; Sat, 18 Apr 2020 09:19:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 08/16] tcg/optimize: Adjust TempOptInfo allocation Date: Sat, 18 Apr 2020 09:19:06 -0700 Message-Id: <20200418161914.4387-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::102a X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Do not allocate a large block for indexing. Instead, allocate for each temporary as they are seen. In general, this will use less memory, if we consider that most TBs do not touch every target register. This also allows us to allocate TempOptInfo for new temps created during optimization. Signed-off-by: Richard Henderson --- tcg/optimize.c | 60 ++++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index b86bf3d707..d36d7e1d7f 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -89,35 +89,41 @@ static void reset_temp(TCGArg arg) } =20 /* Initialize and activate a temporary. */ -static void init_ts_info(TempOptInfo *infos, - TCGTempSet *temps_used, TCGTemp *ts) +static void init_ts_info(TCGTempSet *temps_used, TCGTemp *ts) { size_t idx =3D temp_idx(ts); - if (!test_bit(idx, temps_used->l)) { - TempOptInfo *ti =3D &infos[idx]; + TempOptInfo *ti; =20 + if (test_bit(idx, temps_used->l)) { + return; + } + set_bit(idx, temps_used->l); + + ti =3D ts->state_ptr; + if (ti =3D=3D NULL) { + ti =3D tcg_malloc(sizeof(TempOptInfo)); ts->state_ptr =3D ti; - ti->next_copy =3D ts; - ti->prev_copy =3D ts; - if (ts->kind =3D=3D TEMP_CONST) { - ti->is_const =3D true; - ti->val =3D ti->mask =3D ts->val; - if (TCG_TARGET_REG_BITS > 32 && ts->type =3D=3D TCG_TYPE_I32) { - /* High bits of a 32-bit quantity are garbage. */ - ti->mask |=3D ~0xffffffffull; - } - } else { - ti->is_const =3D false; - ti->mask =3D -1; + } + + ti->next_copy =3D ts; + ti->prev_copy =3D ts; + if (ts->kind =3D=3D TEMP_CONST) { + ti->is_const =3D true; + ti->val =3D ts->val; + ti->mask =3D ts->val; + if (TCG_TARGET_REG_BITS > 32 && ts->type =3D=3D TCG_TYPE_I32) { + /* High bits of a 32-bit quantity are garbage. */ + ti->mask |=3D ~0xffffffffull; } - set_bit(idx, temps_used->l); + } else { + ti->is_const =3D false; + ti->mask =3D -1; } } =20 -static void init_arg_info(TempOptInfo *infos, - TCGTempSet *temps_used, TCGArg arg) +static void init_arg_info(TCGTempSet *temps_used, TCGArg arg) { - init_ts_info(infos, temps_used, arg_temp(arg)); + init_ts_info(temps_used, arg_temp(arg)); } =20 static TCGTemp *find_better_copy(TCGContext *s, TCGTemp *ts) @@ -603,9 +609,8 @@ static bool swap_commutative2(TCGArg *p1, TCGArg *p2) /* Propagate constants and copies, fold constant expressions. */ void tcg_optimize(TCGContext *s) { - int nb_temps, nb_globals; + int nb_temps, nb_globals, i; TCGOp *op, *op_next, *prev_mb =3D NULL; - TempOptInfo *infos; TCGTempSet temps_used; =20 /* Array VALS has an element for each temp. @@ -615,12 +620,15 @@ void tcg_optimize(TCGContext *s) =20 nb_temps =3D s->nb_temps; nb_globals =3D s->nb_globals; + bitmap_zero(temps_used.l, nb_temps); - infos =3D tcg_malloc(sizeof(TempOptInfo) * nb_temps); + for (i =3D 0; i < nb_temps; ++i) { + s->temps[i].state_ptr =3D NULL; + } =20 QTAILQ_FOREACH_SAFE(op, &s->ops, link, op_next) { tcg_target_ulong mask, partmask, affected; - int nb_oargs, nb_iargs, i; + int nb_oargs, nb_iargs; TCGArg tmp; TCGOpcode opc =3D op->opc; const TCGOpDef *def =3D &tcg_op_defs[opc]; @@ -633,14 +641,14 @@ void tcg_optimize(TCGContext *s) for (i =3D 0; i < nb_oargs + nb_iargs; i++) { TCGTemp *ts =3D arg_temp(op->args[i]); if (ts) { - init_ts_info(infos, &temps_used, ts); + init_ts_info(&temps_used, ts); } } } else { nb_oargs =3D def->nb_oargs; nb_iargs =3D def->nb_iargs; for (i =3D 0; i < nb_oargs + nb_iargs; i++) { - init_arg_info(infos, &temps_used, op->args[i]); + init_arg_info(&temps_used, op->args[i]); } } =20 --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1587227143; cv=none; d=zohomail.com; s=zohoarc; b=Ug0qn6a+99hanUnD/c282W7BiZqphNs3bDB39rYPGRADTQF+5NriKW3qogkGb5ecvsBwgdP+kjl6R8as69ykWi98yV38SA0BrcGx9G+M7s29K+qpn9G4EEPCfgDh6O28FQLtHKgdpYQgFxsiqWkQAUPl5d+cIEHEXUC8boR6jGU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587227143; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8se14kJpotzBe1gBeAfalsCzpFa61zbk2HVh3S7WLCI=; b=IiJMoAmc1oxb44F9+nA1HLYgJmbwGGUFl+QGlBDiBQ6U/hUYOid+6ks74AfRNIQ+PPwhLzd1U30TP3H48iCSip17UEZasWeU37cSWzDMzhvS7pTUewgJT7VupxGF2Aq0bF0PXWHHRhs1SUHgAPgtgCB+BfJPAO7KgiIO2cs+qaY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587227143127163.09266683732392; Sat, 18 Apr 2020 09:25:43 -0700 (PDT) Received: from localhost ([::1]:59698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqHl-0004vv-Nh for importer@patchew.org; Sat, 18 Apr 2020 12:25:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48195) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBn-0004HA-VQ for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBm-0005I1-5M for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:31 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:45815) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBl-0005GT-Uz for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:30 -0400 Received: by mail-pl1-x641.google.com with SMTP id t4so2199907plq.12 for ; Sat, 18 Apr 2020 09:19:29 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=8se14kJpotzBe1gBeAfalsCzpFa61zbk2HVh3S7WLCI=; b=anLSx5RDfhtaLwQ5j5ZLIKoszdcztGoA2XT/OR+94hb28Xb0S8+sbfp6y9Xo2O6Xii xovGbVu81Q+KgSnAcLMEaRBKDeJz1i+U2Bbf3sLntK8X3W2DEv7cCIKJHdEc4/r0URFa vjpzTJwnTB+PX/3HFR6ZfvbeGzfGLbaLof8roTwqB2IY2r8R8K2OinVs5y+Bi2FgLhpz qUgpnx88gylLsbx1O6l6DU7H73soealqXtEIS+Ck+qc/kOb62wS1SkjyY5gCGW7auj3j oNNDM+4wCNlisJaRYOdmzGBSAbX8Le6akF8HrZpVjVGgfpPDDckZN3cvAzhpBkVT+CoH ngSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8se14kJpotzBe1gBeAfalsCzpFa61zbk2HVh3S7WLCI=; b=K1Mhxen4eUDw9Bcjk4o3YSSuHX4R2jFpQjpokMfF4sSrdBqPp//oIeNrzZ41Q4v7nV mmgl0FZBzIxnBYDGPvX7Q1JAtz0tbQBzWHjZmg45iT8hISc+pX6NlxXLYDi/SHVbCb0b bJ1/Vt5DACP7vi7+OEaabamhXwuEV07Kfucvbdij032yvLU4+y3e+CDYWRytpstWsnQj LG22pN20nBoK/jFkFomEbmvaRI2sOI9OpkcgkTC7xEFqy+Ic4bgGU8MIk3F2wVzM/FPE vmZEOPe1486E5CfK3ZQDL2IxYiWTRpn2y5W8TDG7VE9wK7paCRJyKRbMyNDNsZ1BmT+P Hsxw== X-Gm-Message-State: AGi0Pub8hsAyWxO/r11y4z4BC6AM+I8LcTCRAQr9kxSb3ZWRQqX9l69V JN45r4M7IhZv0+hxoHPz8E9r/IEQNsc= X-Google-Smtp-Source: APiQypLL3WFFHS8n3Gf79qq7Pxou0lVU27YNlBiejhF3RwjHU4VpVqG7MlTxHhC2qe+N+Am6f5cybQ== X-Received: by 2002:a17:902:9a82:: with SMTP id w2mr8928874plp.117.1587226768563; Sat, 18 Apr 2020 09:19:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 09/16] tcg/optimize: Use tcg_constant_internal with constant folding Date: Sat, 18 Apr 2020 09:19:07 -0700 Message-Id: <20200418161914.4387-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- tcg/optimize.c | 106 ++++++++++++++++++++++--------------------------- 1 file changed, 48 insertions(+), 58 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index d36d7e1d7f..dd5187be31 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -178,37 +178,6 @@ static bool args_are_copies(TCGArg arg1, TCGArg arg2) return ts_are_copies(arg_temp(arg1), arg_temp(arg2)); } =20 -static void tcg_opt_gen_movi(TCGContext *s, TCGOp *op, TCGArg dst, TCGArg = val) -{ - const TCGOpDef *def; - TCGOpcode new_op; - tcg_target_ulong mask; - TempOptInfo *di =3D arg_info(dst); - - def =3D &tcg_op_defs[op->opc]; - if (def->flags & TCG_OPF_VECTOR) { - new_op =3D INDEX_op_dupi_vec; - } else if (def->flags & TCG_OPF_64BIT) { - new_op =3D INDEX_op_movi_i64; - } else { - new_op =3D INDEX_op_movi_i32; - } - op->opc =3D new_op; - /* TCGOP_VECL and TCGOP_VECE remain unchanged. */ - op->args[0] =3D dst; - op->args[1] =3D val; - - reset_temp(dst); - di->is_const =3D true; - di->val =3D val; - mask =3D val; - if (TCG_TARGET_REG_BITS > 32 && new_op =3D=3D INDEX_op_movi_i32) { - /* High bits of the destination are now garbage. */ - mask |=3D ~0xffffffffull; - } - di->mask =3D mask; -} - static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, TCGArg dst, TCGArg s= rc) { TCGTemp *dst_ts =3D arg_temp(dst); @@ -259,6 +228,27 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, = TCGArg dst, TCGArg src) } } =20 +static void tcg_opt_gen_movi(TCGContext *s, TCGTempSet *temps_used, + TCGOp *op, TCGArg dst, TCGArg val) +{ + const TCGOpDef *def =3D &tcg_op_defs[op->opc]; + TCGType type; + TCGTemp *tv; + + if (def->flags & TCG_OPF_VECTOR) { + type =3D TCGOP_VECL(op) + TCG_TYPE_V64; + } else if (def->flags & TCG_OPF_64BIT) { + type =3D TCG_TYPE_I64; + } else { + type =3D TCG_TYPE_I32; + } + + /* Convert movi to mov with constant temp. */ + tv =3D tcg_constant_internal(type, val); + init_ts_info(temps_used, tv); + tcg_opt_gen_mov(s, op, dst, temp_arg(tv)); +} + static TCGArg do_constant_folding_2(TCGOpcode op, TCGArg x, TCGArg y) { uint64_t l64, h64; @@ -621,7 +611,7 @@ void tcg_optimize(TCGContext *s) nb_temps =3D s->nb_temps; nb_globals =3D s->nb_globals; =20 - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); for (i =3D 0; i < nb_temps; ++i) { s->temps[i].state_ptr =3D NULL; } @@ -727,7 +717,7 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64(rotr): if (arg_is_const(op->args[1]) && arg_info(op->args[1])->val =3D=3D 0) { - tcg_opt_gen_movi(s, op, op->args[0], 0); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], 0); continue; } break; @@ -1050,7 +1040,7 @@ void tcg_optimize(TCGContext *s) =20 if (partmask =3D=3D 0) { tcg_debug_assert(nb_oargs =3D=3D 1); - tcg_opt_gen_movi(s, op, op->args[0], 0); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], 0); continue; } if (affected =3D=3D 0) { @@ -1067,7 +1057,7 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64(mulsh): if (arg_is_const(op->args[2]) && arg_info(op->args[2])->val =3D=3D 0) { - tcg_opt_gen_movi(s, op, op->args[0], 0); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], 0); continue; } break; @@ -1094,7 +1084,7 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64_VEC(sub): CASE_OP_32_64_VEC(xor): if (args_are_copies(op->args[1], op->args[2])) { - tcg_opt_gen_movi(s, op, op->args[0], 0); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], 0); continue; } break; @@ -1111,14 +1101,14 @@ void tcg_optimize(TCGContext *s) break; CASE_OP_32_64(movi): case INDEX_op_dupi_vec: - tcg_opt_gen_movi(s, op, op->args[0], op->args[1]); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], op->args[1]); break; =20 case INDEX_op_dup_vec: if (arg_is_const(op->args[1])) { tmp =3D arg_info(op->args[1])->val; tmp =3D dup_const(TCGOP_VECE(op), tmp); - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } goto do_default; @@ -1141,7 +1131,7 @@ void tcg_optimize(TCGContext *s) case INDEX_op_extrh_i64_i32: if (arg_is_const(op->args[1])) { tmp =3D do_constant_folding(opc, arg_info(op->args[1])->va= l, 0); - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } goto do_default; @@ -1171,7 +1161,7 @@ void tcg_optimize(TCGContext *s) if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { tmp =3D do_constant_folding(opc, arg_info(op->args[1])->va= l, arg_info(op->args[2])->val); - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } goto do_default; @@ -1182,7 +1172,7 @@ void tcg_optimize(TCGContext *s) TCGArg v =3D arg_info(op->args[1])->val; if (v !=3D 0) { tmp =3D do_constant_folding(opc, v, 0); - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); } else { tcg_opt_gen_mov(s, op, op->args[0], op->args[2]); } @@ -1195,7 +1185,7 @@ void tcg_optimize(TCGContext *s) tmp =3D deposit64(arg_info(op->args[1])->val, op->args[3], op->args[4], arg_info(op->args[2])->val); - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } goto do_default; @@ -1204,7 +1194,7 @@ void tcg_optimize(TCGContext *s) if (arg_is_const(op->args[1])) { tmp =3D extract64(arg_info(op->args[1])->val, op->args[2], op->args[3]); - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } goto do_default; @@ -1213,7 +1203,7 @@ void tcg_optimize(TCGContext *s) if (arg_is_const(op->args[1])) { tmp =3D sextract64(arg_info(op->args[1])->val, op->args[2], op->args[3]); - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } goto do_default; @@ -1229,7 +1219,7 @@ void tcg_optimize(TCGContext *s) tmp =3D (int32_t)(((uint32_t)v1 >> op->args[3]) | ((uint32_t)v2 << (32 - op->args[3]))); } - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } goto do_default; @@ -1238,7 +1228,7 @@ void tcg_optimize(TCGContext *s) tmp =3D do_constant_folding_cond(opc, op->args[1], op->args[2], op->args[3]); if (tmp !=3D 2) { - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } goto do_default; @@ -1248,7 +1238,7 @@ void tcg_optimize(TCGContext *s) op->args[1], op->args[2]); if (tmp !=3D 2) { if (tmp) { - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); op->opc =3D INDEX_op_br; op->args[0] =3D op->args[3]; } else { @@ -1293,7 +1283,7 @@ void tcg_optimize(TCGContext *s) uint64_t a =3D ((uint64_t)ah << 32) | al; uint64_t b =3D ((uint64_t)bh << 32) | bl; TCGArg rl, rh; - TCGOp *op2 =3D tcg_op_insert_before(s, op, INDEX_op_movi_i= 32); + TCGOp *op2 =3D tcg_op_insert_before(s, op, INDEX_op_mov_i3= 2); =20 if (opc =3D=3D INDEX_op_add2_i32) { a +=3D b; @@ -1303,8 +1293,8 @@ void tcg_optimize(TCGContext *s) =20 rl =3D op->args[0]; rh =3D op->args[1]; - tcg_opt_gen_movi(s, op, rl, (int32_t)a); - tcg_opt_gen_movi(s, op2, rh, (int32_t)(a >> 32)); + tcg_opt_gen_movi(s, &temps_used, op, rl, (int32_t)a); + tcg_opt_gen_movi(s, &temps_used, op2, rh, (int32_t)(a >> 3= 2)); break; } goto do_default; @@ -1315,12 +1305,12 @@ void tcg_optimize(TCGContext *s) uint32_t b =3D arg_info(op->args[3])->val; uint64_t r =3D (uint64_t)a * b; TCGArg rl, rh; - TCGOp *op2 =3D tcg_op_insert_before(s, op, INDEX_op_movi_i= 32); + TCGOp *op2 =3D tcg_op_insert_before(s, op, INDEX_op_mov_i3= 2); =20 rl =3D op->args[0]; rh =3D op->args[1]; - tcg_opt_gen_movi(s, op, rl, (int32_t)r); - tcg_opt_gen_movi(s, op2, rh, (int32_t)(r >> 32)); + tcg_opt_gen_movi(s, &temps_used, op, rl, (int32_t)r); + tcg_opt_gen_movi(s, &temps_used, op2, rh, (int32_t)(r >> 3= 2)); break; } goto do_default; @@ -1331,7 +1321,7 @@ void tcg_optimize(TCGContext *s) if (tmp !=3D 2) { if (tmp) { do_brcond_true: - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); op->opc =3D INDEX_op_br; op->args[0] =3D op->args[5]; } else { @@ -1347,7 +1337,7 @@ void tcg_optimize(TCGContext *s) /* Simplify LT/GE comparisons vs zero to a single compare vs the high word of the input. */ do_brcond_high: - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); op->opc =3D INDEX_op_brcond_i32; op->args[0] =3D op->args[1]; op->args[1] =3D op->args[3]; @@ -1373,7 +1363,7 @@ void tcg_optimize(TCGContext *s) goto do_default; } do_brcond_low: - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); op->opc =3D INDEX_op_brcond_i32; op->args[1] =3D op->args[2]; op->args[2] =3D op->args[4]; @@ -1408,7 +1398,7 @@ void tcg_optimize(TCGContext *s) op->args[5]); if (tmp !=3D 2) { do_setcond_const: - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); } else if ((op->args[5] =3D=3D TCG_COND_LT || op->args[5] =3D=3D TCG_COND_GE) && arg_is_const(op->args[3]) @@ -1493,7 +1483,7 @@ void tcg_optimize(TCGContext *s) block, otherwise we only trash the output args. "mask" is the non-zero bits mask for the first output arg. */ if (def->flags & TCG_OPF_BB_END) { - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); } else { do_reset_output: for (i =3D 0; i < nb_oargs; i++) { --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1587227038; cv=none; d=zohomail.com; s=zohoarc; b=KqgE6Mwc4hp4sgTV3IakMnZLLkNDA+FSMEQeXW4TNT3hwduJdyGIkU9bK+sicJ8sBot/kVg8tdpLYXkhH02aX81xhsJXDAo/rIXCBqXT66CdOVjcWTKK9xyVEINTAPYscx7u5vmC02M2CYpHPC/X6ArUZkw0/NJknunmRkf1t9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587227038; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Zdjt8WpN4waxB25J3ykCncF8gpDtxEJVdnhsqarrM50=; b=mguYbqZiR+6I7NJZ+jJ/FyWcNX4PJouNr1MNtqyeSTIWpdnY4k4x7BTEbEDxOHYov1BZpUCHnSTzkAzYSbAnKkfbaQmTlpX8EbWfGPdc5oC/XNcdyn1J4k10mhvQZw4JKOdt/HgeHzBR4Enpkh7Wmz1UcpanLchq9VHoXJI2qEo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587227038723755.8454367237795; Sat, 18 Apr 2020 09:23:58 -0700 (PDT) Received: from localhost ([::1]:59648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqG5-0001JR-G5 for importer@patchew.org; Sat, 18 Apr 2020 12:23:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48200) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBo-0004Iz-IH for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBn-0005Lc-Bo for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:32 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:41536) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBn-0005Ii-5y for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:31 -0400 Received: by mail-pg1-x544.google.com with SMTP id h69so2754936pgc.8 for ; Sat, 18 Apr 2020 09:19:31 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Zdjt8WpN4waxB25J3ykCncF8gpDtxEJVdnhsqarrM50=; b=QwtnPhgrhOXmMsn5hHVTSYL6WN5GsmWrg4zkIQUdfrJde0kF067gpRLj+SPPQK/nHi GG6t/U3QvIZSm6oeClE2vY6y2fedj5uftEENO1YEZ3Bj9wmFdEqNywAPYnGBM3UEgaES d5dpiQZ+F6u7ALkGJVUbj855Zu/SY8GQJti970BSif7jBq/2nGcZuDKjxvT8es67F4Oz HGrwl2Q89BwwirzurxT9l+VrO/IzAGNF7gpc72K15FbJ2F73EfsBOr/Ra14/HQwbGZRc lssz1cppqTTpk1xp42HjDPT54cOJ79UtctyWzh3QD2NKlu9q7DPMlUWQlXKiv7g9TLYN 6tpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Zdjt8WpN4waxB25J3ykCncF8gpDtxEJVdnhsqarrM50=; b=QHe+bvN72krQrTQs/vZM3+ACHoByX3SLk9/Wsl7Gl5Fj3oY7EbSVvcHNYANIEugUrc sh/qz/D7ZDoQntbCb2/h/+3La0ON6WEpKlXN8MQjx7GlMPeyIRhSaVRJ6wb0IzOOrpUF QHcVe2GfhmGh9f+TQNb6IAuHAq++LQDDvBSaBR0ORWu1DeMW4AKX8Tv3xO9zJPGvpN9D 28OaHUDkwJhuNp/4fsoniiglx8oeCljWNDPMDjUdnjpTiuPMH5NgWK61un0+Mm75CDtu 9i4XK3vmQfG0uNeX81ond+W4mAEytlc4Rt6++Q8gFChqkAjsU/EKKeoEczNO7NisSTKs YsWg== X-Gm-Message-State: AGi0PubarhSHkkELsO+hRSewIYg4VPLMjiU3rR2WbwbIZ85QCK0UQ7x0 wRvAnl7lchFM6G6doeKkhgTF5unAQxk= X-Google-Smtp-Source: APiQypKDg0AkuSVsHB1urbNkgRijU4ptJbLKxeAME0OPyBz0WT56X7vaYYGlCMf+soRVGp/ENJrbrA== X-Received: by 2002:aa7:93c2:: with SMTP id y2mr8580079pff.50.1587226769846; Sat, 18 Apr 2020 09:19:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 10/16] tcg/tci: Add special tci_movi_{i32,i64} opcodes Date: Sat, 18 Apr 2020 09:19:08 -0700 Message-Id: <20200418161914.4387-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" The normal movi opcodes are going away. We need something for TCI to use internally. Signed-off-by: Richard Henderson --- include/tcg/tcg-opc.h | 8 ++++++++ tcg/tci.c | 4 ++-- tcg/tci/tcg-target.inc.c | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h index 9288a04946..7dee9b38f7 100644 --- a/include/tcg/tcg-opc.h +++ b/include/tcg/tcg-opc.h @@ -268,6 +268,14 @@ DEF(last_generic, 0, 0, 0, TCG_OPF_NOT_PRESENT) #include "tcg-target.opc.h" #endif =20 +#ifdef TCG_TARGET_INTERPRETER +/* These opcodes are only for use between the tci generator and interprete= r. */ +DEF(tci_movi_i32, 1, 0, 1, TCG_OPF_NOT_PRESENT) +#if TCG_TARGET_REG_BITS =3D=3D 64 +DEF(tci_movi_i64, 1, 0, 1, TCG_OPF_64BIT | TCG_OPF_NOT_PRESENT) +#endif +#endif + #undef TLADDR_ARGS #undef DATA64_ARGS #undef IMPL diff --git a/tcg/tci.c b/tcg/tci.c index 46fe9ce63f..a6c1aaf5af 100644 --- a/tcg/tci.c +++ b/tcg/tci.c @@ -576,7 +576,7 @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *= tb_ptr) t1 =3D tci_read_r32(regs, &tb_ptr); tci_write_reg32(regs, t0, t1); break; - case INDEX_op_movi_i32: + case INDEX_op_tci_movi_i32: t0 =3D *tb_ptr++; t1 =3D tci_read_i32(&tb_ptr); tci_write_reg32(regs, t0, t1); @@ -847,7 +847,7 @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *= tb_ptr) t1 =3D tci_read_r64(regs, &tb_ptr); tci_write_reg64(regs, t0, t1); break; - case INDEX_op_movi_i64: + case INDEX_op_tci_movi_i64: t0 =3D *tb_ptr++; t1 =3D tci_read_i64(&tb_ptr); tci_write_reg64(regs, t0, t1); diff --git a/tcg/tci/tcg-target.inc.c b/tcg/tci/tcg-target.inc.c index 992d50cb1e..1f1639df0d 100644 --- a/tcg/tci/tcg-target.inc.c +++ b/tcg/tci/tcg-target.inc.c @@ -530,13 +530,13 @@ static void tcg_out_movi(TCGContext *s, TCGType type, uint8_t *old_code_ptr =3D s->code_ptr; uint32_t arg32 =3D arg; if (type =3D=3D TCG_TYPE_I32 || arg =3D=3D arg32) { - tcg_out_op_t(s, INDEX_op_movi_i32); + tcg_out_op_t(s, INDEX_op_tci_movi_i32); tcg_out_r(s, t0); tcg_out32(s, arg32); } else { tcg_debug_assert(type =3D=3D TCG_TYPE_I64); #if TCG_TARGET_REG_BITS =3D=3D 64 - tcg_out_op_t(s, INDEX_op_movi_i64); + tcg_out_op_t(s, INDEX_op_tci_movi_i64); tcg_out_r(s, t0); tcg_out64(s, arg); #else --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1587227369; cv=none; d=zohomail.com; s=zohoarc; b=Cf3Utulsqldgsd0xWknw2M75QbCWBTPZp+xWo0VvKmEtUV+cHF27myUZtPgW9QobtPrPOVVoHYetWHFc5Xnka445Mpm0AvQ1OPr8axPN3fk8G2Lq+Zkfk1RG9rs+9YjavDHHnQhRVM0g04KujTKmHa5KB9ZMbtDpafHCHMu3S+c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587227369; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rhrw9pekgEH5BB8vddUs+wUSUQ/QGWXX4jtEuHwbb9o=; b=iCF96yFyB5ozvSacHgYe6+dF794peVNICdgqFPAUB2yi/Ew4WAp/lAP0drEgQmvvaGwriMi5pGm/PdxL3ONcyCXhbzwQzBI9VMSMUSgREQlww6W9P2FFfFX5mws+ztk7NQZIQD4MHnlI2rYjWqjkSXHO9ttj6CfOXbyX6NgoHaM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587227369652199.9255264861455; Sat, 18 Apr 2020 09:29:29 -0700 (PDT) Received: from localhost ([::1]:59774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqLO-0001c0-UR for importer@patchew.org; Sat, 18 Apr 2020 12:29:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48233) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBs-0004N8-Ib for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBo-0005PW-Qf for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:36 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:43045) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBo-0005Mj-KA for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:32 -0400 Received: by mail-pg1-x542.google.com with SMTP id x26so2750874pgc.10 for ; Sat, 18 Apr 2020 09:19:32 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=rhrw9pekgEH5BB8vddUs+wUSUQ/QGWXX4jtEuHwbb9o=; b=mFGtyIm8aXtwepM3X0K2kdrbPl/k3xePMM5pFou8hIqpRMnEE01dV0sDcCKL2EtuQ9 y2S/SmnkXMoa19g/UN9Q84cqpGl2Bf4iNXt+YfC/Z2aOY3tA6V8Z4c6iUVjIeGd3Xmp7 K6MArCQkx+ahlrYEJIIUetiWDVjemvvyRx/xZtA+Bn2A6/p6l6OPVzS/SLnU+5S6G0+8 yKmlHk63zlQWIAoCGObk+1FV+KMKUHwJn2mOJjCTZWHC5H4h5erFFLlhx9lzM0GrwnE1 lX+twH6qQeY8lQl9bkaufT8OugWhkojzCQ87tf7bWni0VMGKoYqSmAAruYIo6hd8ays9 CYJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rhrw9pekgEH5BB8vddUs+wUSUQ/QGWXX4jtEuHwbb9o=; b=d/9+yQM/KVUH2/LZ9ZcnsqOgJJreQlU05uXS8HKE0Yl6hHAhV93VM0hL+eBSnhpjAV ZMmdLMkB4zXs+OdrS5LgZj9eq0LvCehiDOfQoxDcM3n5DisrcxiQHsDGQ13l4HDdXklj EHoWx5iTk9/yxRQzUN6ZcogZa18nilGLWeABfabNCGmKOv6wXyDAR0Ja6Fk1Fo9HyUKv 2rN1+up7cOooNA/J2id2b+oOsCenNNA5DVY9wySTX7Lad6ctTntEOrpXOUyaBKa/gS/U A+4acgYa+FJcIRwkmKjFIWJy3X1QlGQI91GEqdx39Ll4laXFlvsbnIicwOjWDlNMkRZm w3+A== X-Gm-Message-State: AGi0PuZpWEpdAAGjH/fhS9MVdoiGUNxMb5b0xKdmx7ANBFkq7kx26uVQ HH9Rbsvthlof17ZRsQXrpusTu7Cn2eM= X-Google-Smtp-Source: APiQypIOkc/s4wGMOdEB0B6hw17T8Q1JKNRcpvrRPEy3kdpFfipbSN3cM34eTyrVgx2D5A6zh7Hzbg== X-Received: by 2002:a05:6a00:5:: with SMTP id h5mr8727050pfk.57.1587226771076; Sat, 18 Apr 2020 09:19:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 11/16] tcg: Remove movi and dupi opcodes Date: Sat, 18 Apr 2020 09:19:09 -0700 Message-Id: <20200418161914.4387-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" These are now completely covered by mov from a TYPE_CONST temporary. Signed-off-by: Richard Henderson --- include/tcg/tcg-opc.h | 3 --- tcg/aarch64/tcg-target.inc.c | 3 --- tcg/arm/tcg-target.inc.c | 1 - tcg/i386/tcg-target.inc.c | 3 --- tcg/mips/tcg-target.inc.c | 2 -- tcg/optimize.c | 4 ---- tcg/ppc/tcg-target.inc.c | 3 --- tcg/riscv/tcg-target.inc.c | 2 -- tcg/s390/tcg-target.inc.c | 2 -- tcg/sparc/tcg-target.inc.c | 2 -- tcg/tcg-op-vec.c | 1 - tcg/tcg.c | 18 +----------------- tcg/tci/tcg-target.inc.c | 2 -- 13 files changed, 1 insertion(+), 45 deletions(-) diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h index 7dee9b38f7..4a9cbf5426 100644 --- a/include/tcg/tcg-opc.h +++ b/include/tcg/tcg-opc.h @@ -45,7 +45,6 @@ DEF(br, 0, 0, 1, TCG_OPF_BB_END) DEF(mb, 0, 0, 1, 0) =20 DEF(mov_i32, 1, 1, 0, TCG_OPF_NOT_PRESENT) -DEF(movi_i32, 1, 0, 1, TCG_OPF_NOT_PRESENT) DEF(setcond_i32, 1, 2, 1, 0) DEF(movcond_i32, 1, 4, 1, IMPL(TCG_TARGET_HAS_movcond_i32)) /* load/store */ @@ -110,7 +109,6 @@ DEF(ctz_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_ctz_i32)) DEF(ctpop_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_ctpop_i32)) =20 DEF(mov_i64, 1, 1, 0, TCG_OPF_64BIT | TCG_OPF_NOT_PRESENT) -DEF(movi_i64, 1, 0, 1, TCG_OPF_64BIT | TCG_OPF_NOT_PRESENT) DEF(setcond_i64, 1, 2, 1, IMPL64) DEF(movcond_i64, 1, 4, 1, IMPL64 | IMPL(TCG_TARGET_HAS_movcond_i64)) /* load/store */ @@ -215,7 +213,6 @@ DEF(qemu_st_i64, 0, TLADDR_ARGS + DATA64_ARGS, 1, #define IMPLVEC TCG_OPF_VECTOR | IMPL(TCG_TARGET_MAYBE_vec) =20 DEF(mov_vec, 1, 1, 0, TCG_OPF_VECTOR | TCG_OPF_NOT_PRESENT) -DEF(dupi_vec, 1, 0, 1, TCG_OPF_VECTOR | TCG_OPF_NOT_PRESENT) =20 DEF(dup_vec, 1, 1, 0, IMPLVEC) DEF(dup2_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_REG_BITS =3D=3D 32)) diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index 843fd0ca69..7918aeb9d5 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -2261,8 +2261,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, =20 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(); @@ -2467,7 +2465,6 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode o= pc, break; =20 case INDEX_op_mov_vec: /* Always emitted via tcg_out_mov. */ - case INDEX_op_dupi_vec: /* Always emitted via tcg_out_movi. */ case INDEX_op_dup_vec: /* Always emitted via tcg_out_dup_vec. */ default: g_assert_not_reached(); diff --git a/tcg/arm/tcg-target.inc.c b/tcg/arm/tcg-target.inc.c index 6aa7757aac..b967499fa4 100644 --- a/tcg/arm/tcg-target.inc.c +++ b/tcg/arm/tcg-target.inc.c @@ -2068,7 +2068,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcod= e opc, break; =20 case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ - case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ case INDEX_op_call: /* Always emitted via tcg_out_call. */ default: tcg_abort(); diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index ec083bddcf..320a4bddd1 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -2678,8 +2678,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcod= e opc, 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: tcg_abort(); @@ -2965,7 +2963,6 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode o= pc, break; =20 case INDEX_op_mov_vec: /* Always emitted via tcg_out_mov. */ - case INDEX_op_dupi_vec: /* Always emitted via tcg_out_movi. */ case INDEX_op_dup_vec: /* Always emitted via tcg_out_dup_vec. */ default: g_assert_not_reached(); diff --git a/tcg/mips/tcg-target.inc.c b/tcg/mips/tcg-target.inc.c index 4d32ebc1df..09dc5a94fa 100644 --- a/tcg/mips/tcg-target.inc.c +++ b/tcg/mips/tcg-target.inc.c @@ -2155,8 +2155,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcod= e opc, 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: tcg_abort(); diff --git a/tcg/optimize.c b/tcg/optimize.c index dd5187be31..9a2c945dbe 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1099,10 +1099,6 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64_VEC(mov): tcg_opt_gen_mov(s, op, op->args[0], op->args[1]); break; - CASE_OP_32_64(movi): - case INDEX_op_dupi_vec: - tcg_opt_gen_movi(s, &temps_used, op, op->args[0], op->args[1]); - break; =20 case INDEX_op_dup_vec: if (arg_is_const(op->args[1])) { diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index ee1f9227c1..fb390ad978 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -2967,8 +2967,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, = const TCGArg *args, =20 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: tcg_abort(); @@ -3310,7 +3308,6 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode o= pc, return; =20 case INDEX_op_mov_vec: /* Always emitted via tcg_out_mov. */ - case INDEX_op_dupi_vec: /* Always emitted via tcg_out_movi. */ case INDEX_op_dup_vec: /* Always emitted via tcg_out_dup_vec. */ default: g_assert_not_reached(); diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index 2bc0ba71f2..ec609272ad 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -1606,8 +1606,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, =20 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(); diff --git a/tcg/s390/tcg-target.inc.c b/tcg/s390/tcg-target.inc.c index b07e9ff7d6..f6b003a700 100644 --- a/tcg/s390/tcg-target.inc.c +++ b/tcg/s390/tcg-target.inc.c @@ -2310,8 +2310,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcod= e opc, =20 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: tcg_abort(); diff --git a/tcg/sparc/tcg-target.inc.c b/tcg/sparc/tcg-target.inc.c index 65fddb310d..0808b79eee 100644 --- a/tcg/sparc/tcg-target.inc.c +++ b/tcg/sparc/tcg-target.inc.c @@ -1591,8 +1591,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, =20 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: tcg_abort(); diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index 655b3ae32d..6343046e18 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -83,7 +83,6 @@ bool tcg_can_emit_vecop_list(const TCGOpcode *list, case INDEX_op_xor_vec: case INDEX_op_mov_vec: case INDEX_op_dup_vec: - case INDEX_op_dupi_vec: case INDEX_op_dup2_vec: case INDEX_op_ld_vec: case INDEX_op_st_vec: diff --git a/tcg/tcg.c b/tcg/tcg.c index 59beb2bf29..adb71f16ae 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1463,7 +1463,6 @@ bool tcg_op_supported(TCGOpcode op) return TCG_TARGET_HAS_goto_ptr; =20 case INDEX_op_mov_i32: - case INDEX_op_movi_i32: case INDEX_op_setcond_i32: case INDEX_op_brcond_i32: case INDEX_op_ld8u_i32: @@ -1557,7 +1556,6 @@ bool tcg_op_supported(TCGOpcode op) return TCG_TARGET_REG_BITS =3D=3D 32; =20 case INDEX_op_mov_i64: - case INDEX_op_movi_i64: case INDEX_op_setcond_i64: case INDEX_op_brcond_i64: case INDEX_op_ld8u_i64: @@ -1663,7 +1661,6 @@ bool tcg_op_supported(TCGOpcode op) =20 case INDEX_op_mov_vec: case INDEX_op_dup_vec: - case INDEX_op_dupi_vec: case INDEX_op_dupm_vec: case INDEX_op_ld_vec: case INDEX_op_st_vec: @@ -3447,7 +3444,7 @@ static void tcg_reg_alloc_bb_end(TCGContext *s, TCGRe= gSet allocated_regs) } =20 /* - * Specialized code generation for INDEX_op_movi_*. + * Specialized code generation for INDEX_op_mov_* with a constant. */ static void tcg_reg_alloc_do_movi(TCGContext *s, TCGTemp *ots, tcg_target_ulong val, TCGLifeData arg_li= fe, @@ -3470,14 +3467,6 @@ static void tcg_reg_alloc_do_movi(TCGContext *s, TCG= Temp *ots, } } =20 -static void tcg_reg_alloc_movi(TCGContext *s, const TCGOp *op) -{ - TCGTemp *ots =3D arg_temp(op->args[0]); - tcg_target_ulong val =3D op->args[1]; - - tcg_reg_alloc_do_movi(s, ots, val, op->life, op->output_pref[0]); -} - /* * Specialized code generation for INDEX_op_mov_*. */ @@ -4263,11 +4252,6 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) case INDEX_op_mov_vec: tcg_reg_alloc_mov(s, op); break; - case INDEX_op_movi_i32: - case INDEX_op_movi_i64: - case INDEX_op_dupi_vec: - tcg_reg_alloc_movi(s, op); - break; case INDEX_op_dup_vec: tcg_reg_alloc_dup(s, op); break; diff --git a/tcg/tci/tcg-target.inc.c b/tcg/tci/tcg-target.inc.c index 1f1639df0d..b796f4fc19 100644 --- a/tcg/tci/tcg-target.inc.c +++ b/tcg/tci/tcg-target.inc.c @@ -815,8 +815,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, co= nst TCGArg *args, 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: tcg_abort(); --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1587227133; cv=none; d=zohomail.com; s=zohoarc; b=ZINfmOYjT41MUHhk7HJ6Vy3nU75nRUlC09AsyShHlpOTo4BE/DntQY93etejGIfBWdFtRiykZEE3j8ErMMjh/ETXqAgPZF+2PRzP576/G9kgAyuCpAmvtUuZEbtwvqrEUmYx4Bx5t9evVRKfmYH5/dhGD+vkitsFmmdxFH4+Upg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587227133; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kclyvX98JRyE2ZEPw+1FzvyDeiJrVyjendlYPY0jgDw=; b=dz5g+IyxFWSkrG3YCvjKm3R1MaAe4DpPcQ8rl/zdSgd1gI77OQbZTH96ESf+/89xrgVSdLF9ka6+5M0UrnLnbjD+dGFdK2QAniTHb3k7gn1kXw0M1+5b1REA+JRimqxll6AxHVbbej0y0fdPeeJkwLv52P9dL2kRFJ94pgXfqPI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 158722713324844.6967912610005; Sat, 18 Apr 2020 09:25:33 -0700 (PDT) Received: from localhost ([::1]:59687 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqHb-0004c9-U5 for importer@patchew.org; Sat, 18 Apr 2020 12:25:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48227) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBr-0004Lz-B9 for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBq-0005T5-1C for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:35 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:33288) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBp-0005Qb-Rl for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:33 -0400 Received: by mail-pg1-x542.google.com with SMTP id d17so2773372pgo.0 for ; Sat, 18 Apr 2020 09:19:33 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=kclyvX98JRyE2ZEPw+1FzvyDeiJrVyjendlYPY0jgDw=; b=HBH+tZhOTz/WAgvIXbrTM8pILG21icBtXOkoX6OXvCiZ3Dd1sjUSww20BHi7BI2jJO sZ5jANC5aYN/vMOGSkq+r5f7a044cgkbM5QhZ6WBo4clywVJNsa2W758BB1uEKKZo/5h GJdeax6CLy4uEGoCzLQw6zDwH+pLIXsFVHBhRw5LNFVuD8VWNRfxbMz3yimYqaJ6xmWs IzU6yWPVYScbXiuOotWpgVuF+rmqhMxmsUcGxD9XOaWOYd137OZKKsSCBGNuPYKNLC4J DD6JegWBBeBAMdUmFf23MPTlSDGgZcwY7Ouybu6Fem9VW1DMf1RcfX+QlCaE+E0WiA28 7C6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kclyvX98JRyE2ZEPw+1FzvyDeiJrVyjendlYPY0jgDw=; b=jRuTUI8lEmZzetGobJdLMP7cPHjdKV6gYU5eytOc2YxrMHdA+G3/sawfgTmZNG5w8w vUxGO8EkXc7u6y9dOERqbTyGdnPTCQbN5J4RHvZnfugXi47GylLJcTt6SSBnQQmhn/Ts Zr3Z0+Et7AfrHp2x/SZZNrgBSz5fQeMzBpsV5xQ3z5xcvqxZF9cHQdaNoSTNxUrCKY+n VpqXh8ud01YcZvV1c+YfkfFOWXS3NZcV/QvHBXfHcgKApCtVdvHT1lrK/BVInn3FM185 gk1caCUDrGRS4iLup76Wete9MU0JfMrb3b2OhM73cxKIK1QvWH3qkmVY5jaoxIV5OJux Hg3g== X-Gm-Message-State: AGi0PuYg1ucSmvHJ+0HYqi0jAdI2/Oi4iRYyDyGXTv+EsMntsZ1HlZEw F8Ux00Z15FjF4w6LFO5Cn/tdQJjojBo= X-Google-Smtp-Source: APiQypLtiRqZ9ENkxc/0xP3XIH6YV+IXSrQ2khBx8CSgFtrrLLO+2pEb4Ahc9zu0BY6y8t/R1CAP4g== X-Received: by 2002:a62:8001:: with SMTP id j1mr8922341pfd.202.1587226772430; Sat, 18 Apr 2020 09:19:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 12/16] tcg: Use tcg_out_dupi_vec from temp_load Date: Sat, 18 Apr 2020 09:19:10 -0700 Message-Id: <20200418161914.4387-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Having dupi pass though movi is confusing and arguably wrong. Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.inc.c | 7 ---- tcg/i386/tcg-target.inc.c | 63 ++++++++++++++++++++++++------------ tcg/ppc/tcg-target.inc.c | 6 ---- tcg/tcg.c | 8 ++++- 4 files changed, 49 insertions(+), 35 deletions(-) diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index 7918aeb9d5..e5c9ab70a9 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -1009,13 +1009,6 @@ static void tcg_out_movi(TCGContext *s, TCGType type= , TCGReg rd, case TCG_TYPE_I64: tcg_debug_assert(rd < 32); break; - - case TCG_TYPE_V64: - case TCG_TYPE_V128: - tcg_debug_assert(rd >=3D 32); - tcg_out_dupi_vec(s, type, rd, value); - return; - default: g_assert_not_reached(); } diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 320a4bddd1..07424f7ef9 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -977,30 +977,32 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType t= ype, } } =20 -static void tcg_out_movi(TCGContext *s, TCGType type, - TCGReg ret, tcg_target_long arg) +static void tcg_out_movi_vec(TCGContext *s, TCGType type, + TCGReg ret, tcg_target_long arg) +{ + if (arg =3D=3D 0) { + tcg_out_vex_modrm(s, OPC_PXOR, ret, ret, ret); + return; + } + if (arg =3D=3D -1) { + tcg_out_vex_modrm(s, OPC_PCMPEQB, ret, ret, ret); + return; + } + + int rexw =3D (type =3D=3D TCG_TYPE_I32 ? 0 : P_REXW); + tcg_out_vex_modrm_pool(s, OPC_MOVD_VyEy + rexw, ret); + if (TCG_TARGET_REG_BITS =3D=3D 64) { + new_pool_label(s, arg, R_386_PC32, s->code_ptr - 4, -4); + } else { + new_pool_label(s, arg, R_386_32, s->code_ptr - 4, 0); + } +} + +static void tcg_out_movi_int(TCGContext *s, TCGType type, + TCGReg ret, tcg_target_long arg) { tcg_target_long diff; =20 - switch (type) { - case TCG_TYPE_I32: -#if TCG_TARGET_REG_BITS =3D=3D 64 - case TCG_TYPE_I64: -#endif - if (ret < 16) { - break; - } - /* fallthru */ - case TCG_TYPE_V64: - case TCG_TYPE_V128: - case TCG_TYPE_V256: - tcg_debug_assert(ret >=3D 16); - tcg_out_dupi_vec(s, type, ret, arg); - return; - default: - g_assert_not_reached(); - } - if (arg =3D=3D 0) { tgen_arithr(s, ARITH_XOR, ret, ret); return; @@ -1029,6 +1031,25 @@ static void tcg_out_movi(TCGContext *s, TCGType type, tcg_out64(s, arg); } =20 +static void tcg_out_movi(TCGContext *s, TCGType type, + TCGReg ret, tcg_target_long arg) +{ + switch (type) { + case TCG_TYPE_I32: +#if TCG_TARGET_REG_BITS =3D=3D 64 + case TCG_TYPE_I64: +#endif + if (ret < 16) { + tcg_out_movi_int(s, type, ret, arg); + } else { + tcg_out_movi_vec(s, type, ret, arg); + } + break; + default: + g_assert_not_reached(); + } +} + static inline void tcg_out_pushi(TCGContext *s, tcg_target_long val) { if (val =3D=3D (int8_t)val) { diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index fb390ad978..7ab1e32064 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -987,12 +987,6 @@ static void tcg_out_movi(TCGContext *s, TCGType type, = TCGReg ret, tcg_out_movi_int(s, type, ret, arg, false); break; =20 - case TCG_TYPE_V64: - case TCG_TYPE_V128: - tcg_debug_assert(ret >=3D TCG_REG_V0); - tcg_out_dupi_vec(s, type, ret, arg); - break; - default: g_assert_not_reached(); } diff --git a/tcg/tcg.c b/tcg/tcg.c index adb71f16ae..4f1ed1d2fe 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3359,7 +3359,13 @@ static void temp_load(TCGContext *s, TCGTemp *ts, TC= GRegSet desired_regs, case TEMP_VAL_CONST: reg =3D tcg_reg_alloc(s, desired_regs, allocated_regs, preferred_regs, ts->indirect_base); - tcg_out_movi(s, ts->type, reg, ts->val); + if (ts->type <=3D TCG_TYPE_I64) { + tcg_out_movi(s, ts->type, reg, ts->val); + } else if (TCG_TARGET_REG_BITS =3D=3D 64) { + tcg_out_dupi_vec(s, ts->type, reg, ts->val); + } else { + tcg_out_dupi_vec(s, ts->type, reg, dup_const(MO_32, ts->val)); + } ts->mem_coherent =3D 0; break; case TEMP_VAL_MEM: --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1587227142; cv=none; d=zohomail.com; s=zohoarc; b=noXjCBKPvG0fpFtNKtaDW3ytvzWwIWftYzpVHLYDD0OwGNMB2iwsK9E/miVWbch84AwqMz7RMGHsfLCVUvv0+lYl+hloYDZzqe3eVSkPuJ8KkLOqJKavTHPBTI87aa/yxofVnIVHYVNpWjgPfdS6J2wQ/RCsavGmcWL9llmTZNI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587227142; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zkNLdD4lJapTD7P5RW5mO/2wUgiJHORElGCA3liJ3rI=; b=JhqeuOv84PlDx9x8Oh2vNaztX0ArT+A/XsDEjZqj8rFA+r4eyNcqxGEh/VJvU9q+Z5V5gMLXYt6Fd3QkdbSTc3MpHN4O4v6Xu51igzS3Ue1vMw8gaXE2QZQmXcmKliDtou9M3IyMU6VSq+QP7Sv6uijTmv08Y9TChevaAsPemG4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587227142437438.3485145626771; Sat, 18 Apr 2020 09:25:42 -0700 (PDT) Received: from localhost ([::1]:59694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqHl-0004t7-3n for importer@patchew.org; Sat, 18 Apr 2020 12:25:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48262) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBu-0004PV-Kk for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBs-0005ZW-Ma for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:38 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:36572) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBs-0005Uv-Gs for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:36 -0400 Received: by mail-pg1-x543.google.com with SMTP id o185so2227286pgo.3 for ; Sat, 18 Apr 2020 09:19:35 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=zkNLdD4lJapTD7P5RW5mO/2wUgiJHORElGCA3liJ3rI=; b=lkmyaufxgDgAeRd20gRRYRSjqEU8rI/MdLyqRNB1ZEX122KslQmPwH2OxhHGlbCuT2 yfW/UU7IHsQ68ukZoUuTif7LMGgKLPC6J+PUXDJoefyIfU42VO8neqAst/tRX7vSmNy+ 7EX4P1mf+iwkJNCknlfHBWuSEuTnA8sB/uv5HR14+e4v51twBQyIUYO8g+WtWFci7hJJ 0aiiWgkfK761MFoCSrn7lP36zyYHVY8JKWNH0/k8takwAABnPKaWDYdu03EUouWHgqtQ qmU2pHHK0T2wUdWFTbo9ZTAmL85NXKaqBkZW+CawBhk+966pCa/ufRZvFsWjADT9jZ4f lz+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zkNLdD4lJapTD7P5RW5mO/2wUgiJHORElGCA3liJ3rI=; b=Yea/QCIjzaH/jVe5ruv9XyjAMZ3umSgLYRkxBPh+fw3LKv2YU5xpNVu6qDeyNWDZI6 yk8kyvPFI46xDBqJkiMwX9JKRagEQvxPD1+RY4MmpFcAHp5VbiwaykUveeyl+JIZofha YsfSnEOi6Qu7RnRhIAX2faBNeTSC9FpvyBh+SRgku7Nk+KIey6FQBySxnRGxfvJ1qn02 Ande5bYU6Y2nG3okLaedT301shH1B0x+vxeUkXn/p2tV3fyJsJ1A+3bzOm3drrm+bz8o ciDFSR1YlDjAD/j7KusVM87wzBuZR7ME+y7JFriv+ppKqzJOSMj+uNPXQwhasR0U6OTG 80GA== X-Gm-Message-State: AGi0PubrbNJaTOMCBvsf7t0F9EG7ggydVjObxGW8dk392mdILpTSKZRw +wft2MG+cBeO6WWNiM5qKjDaS1VSD8o= X-Google-Smtp-Source: APiQypL9YA206Vw3qpO7lDZEtV+rHbQLFIJ/9QOdyBYBcSFtiwmYaQ8SxU/4fdoKCENh0xBRsEA+ew== X-Received: by 2002:a62:1a53:: with SMTP id a80mr9143767pfa.157.1587226774067; Sat, 18 Apr 2020 09:19:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 13/16] tcg: Increase tcg_out_dupi_vec immediate to int64_t Date: Sat, 18 Apr 2020 09:19:11 -0700 Message-Id: <20200418161914.4387-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::543 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" While we don't store more than tcg_target_long in TCGTemp, we shouldn't be limited to that for code generation. We will be able to use this for INDEX_op_dup2_vec with 2 constants. Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.inc.c | 2 +- tcg/i386/tcg-target.inc.c | 20 ++++++++++++-------- tcg/ppc/tcg-target.inc.c | 15 ++++++++------- tcg/tcg.c | 4 ++-- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index e5c9ab70a9..3b5a5d78c7 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -856,7 +856,7 @@ static void tcg_out_logicali(TCGContext *s, AArch64Insn= insn, TCGType ext, } =20 static void tcg_out_dupi_vec(TCGContext *s, TCGType type, - TCGReg rd, tcg_target_long v64) + TCGReg rd, int64_t v64) { bool q =3D type =3D=3D TCG_TYPE_V128; int cmode, imm8, i; diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 07424f7ef9..9cb627d6eb 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -945,7 +945,7 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType typ= e, unsigned vece, } =20 static void tcg_out_dupi_vec(TCGContext *s, TCGType type, - TCGReg ret, tcg_target_long arg) + TCGReg ret, int64_t arg) { int vex_l =3D (type =3D=3D TCG_TYPE_V256 ? P_VEXL : 0); =20 @@ -958,7 +958,14 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType ty= pe, return; } =20 - if (TCG_TARGET_REG_BITS =3D=3D 64) { + if (TCG_TARGET_REG_BITS =3D=3D 32 && arg =3D=3D dup_const(MO_32, arg))= { + if (have_avx2) { + tcg_out_vex_modrm_pool(s, OPC_VPBROADCASTW + vex_l, ret); + } else { + tcg_out_vex_modrm_pool(s, OPC_VBROADCASTSS, ret); + } + new_pool_label(s, arg, R_386_32, s->code_ptr - 4, 0); + } else { if (type =3D=3D TCG_TYPE_V64) { tcg_out_vex_modrm_pool(s, OPC_MOVQ_VqWq, ret); } else if (have_avx2) { @@ -966,14 +973,11 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType t= ype, } else { tcg_out_vex_modrm_pool(s, OPC_MOVDDUP, ret); } - new_pool_label(s, arg, R_386_PC32, s->code_ptr - 4, -4); - } else { - if (have_avx2) { - tcg_out_vex_modrm_pool(s, OPC_VPBROADCASTW + vex_l, ret); + if (TCG_TARGET_REG_BITS =3D=3D 64) { + new_pool_label(s, arg, R_386_PC32, s->code_ptr - 4, -4); } else { - tcg_out_vex_modrm_pool(s, OPC_VBROADCASTSS, ret); + new_pool_l2(s, R_386_32, s->code_ptr - 4, 0, arg, arg >> 32); } - new_pool_label(s, arg, R_386_32, s->code_ptr - 4, 0); } } =20 diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index 7ab1e32064..3333b55766 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -913,7 +913,7 @@ static void tcg_out_movi_int(TCGContext *s, TCGType typ= e, TCGReg ret, } =20 static void tcg_out_dupi_vec(TCGContext *s, TCGType type, TCGReg ret, - tcg_target_long val) + int64_t val) { uint32_t load_insn; int rel, low; @@ -921,20 +921,20 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType t= ype, TCGReg ret, =20 low =3D (int8_t)val; if (low >=3D -16 && low < 16) { - if (val =3D=3D (tcg_target_long)dup_const(MO_8, low)) { + if (val =3D=3D dup_const(MO_8, low)) { tcg_out32(s, VSPLTISB | VRT(ret) | ((val & 31) << 16)); return; } - if (val =3D=3D (tcg_target_long)dup_const(MO_16, low)) { + if (val =3D=3D dup_const(MO_16, low)) { tcg_out32(s, VSPLTISH | VRT(ret) | ((val & 31) << 16)); return; } - if (val =3D=3D (tcg_target_long)dup_const(MO_32, low)) { + if (val =3D=3D dup_const(MO_32, low)) { tcg_out32(s, VSPLTISW | VRT(ret) | ((val & 31) << 16)); return; } } - if (have_isa_3_00 && val =3D=3D (tcg_target_long)dup_const(MO_8, val))= { + if (have_isa_3_00 && val =3D=3D dup_const(MO_8, val)) { tcg_out32(s, XXSPLTIB | VRT(ret) | ((val & 0xff) << 11)); return; } @@ -956,14 +956,15 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType t= ype, TCGReg ret, if (TCG_TARGET_REG_BITS =3D=3D 64) { new_pool_label(s, val, rel, s->code_ptr, add); } else { - new_pool_l2(s, rel, s->code_ptr, add, val, val); + new_pool_l2(s, rel, s->code_ptr, add, val >> 32, val); } } else { load_insn =3D LVX | VRT(ret) | RB(TCG_REG_TMP1); if (TCG_TARGET_REG_BITS =3D=3D 64) { new_pool_l2(s, rel, s->code_ptr, add, val, val); } else { - new_pool_l4(s, rel, s->code_ptr, add, val, val, val, val); + new_pool_l4(s, rel, s->code_ptr, add, + val >> 32, val, val >> 32, val); } } =20 diff --git a/tcg/tcg.c b/tcg/tcg.c index 4f1ed1d2fe..fc1c97d586 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -117,7 +117,7 @@ static bool tcg_out_dup_vec(TCGContext *s, TCGType type= , unsigned vece, static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, TCGReg dst, TCGReg base, intptr_t offset); static void tcg_out_dupi_vec(TCGContext *s, TCGType type, - TCGReg dst, tcg_target_long arg); + TCGReg dst, int64_t arg); static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, unsigned vecl, unsigned vece, const TCGArg *args, const int *const_args); @@ -133,7 +133,7 @@ static inline bool tcg_out_dupm_vec(TCGContext *s, TCGT= ype type, unsigned vece, g_assert_not_reached(); } static inline void tcg_out_dupi_vec(TCGContext *s, TCGType type, - TCGReg dst, tcg_target_long arg) + TCGReg dst, int64_t arg) { g_assert_not_reached(); } --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1587227477; cv=none; d=zohomail.com; s=zohoarc; b=WhkrE9isPQxNupJXQCzlXior+NQ0Wf173R3gaIJX4OZhJpR2djCD3618EXwomCqrark6nuxQ+u1g8JIwlGDgektO676iKA1DB3idS9gtZlP0oaJSFy6VQRRwycN5yayfODVwvxd0GqA/+a0kZBJnL0fmppWpsWC6apTsCbHkMCY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587227477; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GuLBXp+DHzvjBbWtLt3J1mN+KRme5ZQDBMNQ1V2Bki4=; b=N3f+i9gqJRQ6R/mQNzRLurqBgxOpBYWf/Hf/fqPgXIEDTG6jnecEU38QJelgCwOedKJxu+NjytKb+z6i9RlTEGWvq/OWWLUHCjp9TZSC72SUQjRf7i1UJ3cm0+hHJeJuveYSf3MYYX1DaGLEFFVOAT3JLMoaY5scPEqiFdY+WqY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587227477762131.04163586948732; Sat, 18 Apr 2020 09:31:17 -0700 (PDT) Received: from localhost ([::1]:59840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqNA-0004Jy-HJ for importer@patchew.org; Sat, 18 Apr 2020 12:31:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48263) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBu-0004PX-L6 for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBt-0005ay-0M for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:38 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:35716) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBs-0005YH-R1 for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:36 -0400 Received: by mail-pg1-x541.google.com with SMTP id t11so2768523pgg.2 for ; Sat, 18 Apr 2020 09:19:36 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=GuLBXp+DHzvjBbWtLt3J1mN+KRme5ZQDBMNQ1V2Bki4=; b=qUW1bOw+SBbr6zLeMUTBFcV2tFSKdCgabbs5tgg/hXhDOFe9NounJu8binVdQxOL01 FsxwdkDY5FofahDlsGbSoasi3FnUmI1VOFK9q9O4zsrS9UGSb2yBBowegf9Y4/jx33za 4WflFVrj0MoCtBMFlY1SWkEiIGOWkLQpsnl3EoOMijhZX5Am3SVlRdnSQo+HjY/+RCO0 YVloAeSjOdjCF7RhDbaZVmgZkNJj04LLkW8zpuigWPxx/7PcMidXZzTTsE2roYKR//+x O5DJ42xASeQptR4zLqV1V9r4llJg8MbQLzwX/DAWnBiuErb9Ljdah9tsW1RUtTBX/1y2 8Bfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GuLBXp+DHzvjBbWtLt3J1mN+KRme5ZQDBMNQ1V2Bki4=; b=rbSx/RjAlebvsDeKr5FGU4jJqeSaMEI8LPqT7Kc2Cjfq8lPB1vP8XQx9NIdBj3H9+n +M8upLzinUi4vfL9Wpu2Tw41CXSu7mQPJJOoq+p/7kr0x14rfgAffVYCzD0EMi2xB2+H bJyKkXlwy3oUinLO2MmwdnFL3+PS42MuelU4tbg+USZ2stIy/s1cNoNTSyAm50kiCkRP Mcj3eaS32/Cb63dOMvZfvK0K7Ts2ISfzThhHcHnikfkVkknuI6/hQQvimmTb6o5T0d0r 5rUHedO8iwHre7usxfsCa+ZJH5ZOHYaoUMsNFKbmgjrhRjv+clCpsbH+IRxRzmxOul2r 2oTA== X-Gm-Message-State: AGi0Pub+1zwrUfQcZd0Ari5Hg30cVoRGlhuI6zRklht0I19BA6ht9NI+ fnUgHT/iEkneicQwhD5AcNfEp/wfVMQ= X-Google-Smtp-Source: APiQypKAQhrTmArN+c2D/K5LPUEFzJW8wT/hbovUcfl2i4nq14T/24CjTJb8l7t2YiwNYcUJ6DKFgQ== X-Received: by 2002:a63:6c83:: with SMTP id h125mr8941032pgc.168.1587226775385; Sat, 18 Apr 2020 09:19:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 14/16] tcg: Add tcg_reg_alloc_dup2 Date: Sat, 18 Apr 2020 09:19:12 -0700 Message-Id: <20200418161914.4387-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::541 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" There are several ways we can expand a vector dup of a 64-bit element on a 32-bit host. Signed-off-by: Richard Henderson --- tcg/tcg.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/tcg/tcg.c b/tcg/tcg.c index fc1c97d586..d712d19842 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3870,6 +3870,91 @@ static void tcg_reg_alloc_op(TCGContext *s, const TC= GOp *op) } } =20 +static void tcg_reg_alloc_dup2(TCGContext *s, const TCGOp *op) +{ + const TCGLifeData arg_life =3D op->life; + TCGTemp *ots, *itsl, *itsh; + TCGType vtype =3D TCGOP_VECL(op) + TCG_TYPE_V64; + + /* This opcode is only valid for 32-bit hosts, for 64-bit elements. */ + tcg_debug_assert(TCG_TARGET_REG_BITS =3D=3D 32); + tcg_debug_assert(TCGOP_VECE(op) =3D=3D MO_64); + + ots =3D arg_temp(op->args[0]); + itsl =3D arg_temp(op->args[1]); + itsh =3D arg_temp(op->args[2]); + + /* ENV should not be modified. */ + tcg_debug_assert(!temp_readonly(ots)); + + /* Allocate the output register now. */ + if (ots->val_type !=3D TEMP_VAL_REG) { + TCGRegSet allocated_regs =3D s->reserved_regs; + TCGRegSet dup_out_regs =3D + tcg_op_defs[INDEX_op_dup_vec].args_ct[0].u.regs; + + /* Make sure to not spill the input registers. */ + if (!IS_DEAD_ARG(1) && itsl->val_type =3D=3D TEMP_VAL_REG) { + tcg_regset_set_reg(allocated_regs, itsl->reg); + } + if (!IS_DEAD_ARG(2) && itsh->val_type =3D=3D TEMP_VAL_REG) { + tcg_regset_set_reg(allocated_regs, itsh->reg); + } + + ots->reg =3D tcg_reg_alloc(s, dup_out_regs, allocated_regs, + op->output_pref[0], ots->indirect_base); + ots->val_type =3D TEMP_VAL_REG; + ots->mem_coherent =3D 0; + s->reg_to_temp[ots->reg] =3D ots; + } + + /* Promote dup2 of immediates to dupi_vec. */ + if (itsl->val_type =3D=3D TEMP_VAL_CONST && + itsh->val_type =3D=3D TEMP_VAL_CONST) { + tcg_out_dupi_vec(s, vtype, ots->reg, + (uint32_t)itsl->val | ((uint64_t)itsh->val << 32)= ); + goto done; + } + + /* If the two inputs form one 64-bit value, try dupm_vec. */ + if (itsl + 1 =3D=3D itsh && + itsl->base_type =3D=3D TCG_TYPE_I64 && + itsh->base_type =3D=3D TCG_TYPE_I64) { + if (!itsl->mem_coherent) { + temp_sync(s, itsl, s->reserved_regs, 0, 0); + } + if (!itsl->mem_coherent) { + temp_sync(s, itsl, s->reserved_regs, 0, 0); + } +#ifdef HOST_WORDS_BIGENDIAN + TCGTemp *its =3D itsh; +#else + TCGTemp *its =3D itsl; +#endif + if (tcg_out_dupm_vec(s, vtype, MO_64, ots->reg, + its->mem_base->reg, its->mem_offset)) { + goto done; + } + } + + /* Fall back to generic expansion. */ + tcg_reg_alloc_op(s, op); + return; + + done: + if (IS_DEAD_ARG(1)) { + temp_dead(s, itsl); + } + if (IS_DEAD_ARG(2)) { + temp_dead(s, itsh); + } + if (NEED_SYNC_ARG(0)) { + temp_sync(s, ots, s->reserved_regs, 0, IS_DEAD_ARG(0)); + } else if (IS_DEAD_ARG(0)) { + temp_dead(s, ots); + } +} + #ifdef TCG_TARGET_STACK_GROWSUP #define STACK_DIR(x) (-(x)) #else @@ -4261,6 +4346,9 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) case INDEX_op_dup_vec: tcg_reg_alloc_dup(s, op); break; + case INDEX_op_dup2_vec: + tcg_reg_alloc_dup2(s, op); + break; case INDEX_op_insn_start: if (num_insns >=3D 0) { size_t off =3D tcg_current_code_size(s); --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1587227636; cv=none; d=zohomail.com; s=zohoarc; b=IMh7N+zulEMxkTZIU/NUFKrrCyPZ0XdGGG7r9ApjGWkWBwnY+LuFBHtPmebcEc6iJ3AvXDOBwhv6+xIvMtF4Y08/nPiW8bYjTwnfjM5Ntio/Wen3r2/OsIAhw4PkKpPHRXzQR1HuyrOleMspP5lTwvCWHpEoD6b3R4iGUbwY3F4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587227636; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5EBqK+tM4Y7xOqKxuEa+KWDMy/xyFBtPmoMR4ACbhCI=; b=GT0uftJFWoAayqXncbIqc+bDT/e2gxTFm8edBv11CI1bt1BuDX419apelPkha5kdYPwUB8Zh2TZOCMrqvqCCiKjFiAopvy88tru7Jx9LYQSWtb0s4cCBp5yPlzIxrVhUyI+AVRDzUnkOfmloCQZZa29s/uH5mgbQMi5s2/AO0t8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587227636125780.1565040046685; Sat, 18 Apr 2020 09:33:56 -0700 (PDT) Received: from localhost ([::1]:59880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqPh-0007GK-Pr for importer@patchew.org; Sat, 18 Apr 2020 12:33:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48307) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBy-0004Tm-CP for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBu-0005fd-Og for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:42 -0400 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]:35695) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBu-0005cM-Is for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:38 -0400 Received: by mail-pj1-x1044.google.com with SMTP id ms17so2475909pjb.0 for ; Sat, 18 Apr 2020 09:19:38 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=5EBqK+tM4Y7xOqKxuEa+KWDMy/xyFBtPmoMR4ACbhCI=; b=W60N9OXyx7ub7eJyM6bNMuEhCl6l5tLDnpMR/1B83NV2xQ15N/khrf8GRbS9c7kAOP SnHLL2pAMA1tQJk7Txz4oTRtTRUjFUE8UbF2bI9S9vanG29MWPichT2dBGuJOG8r7SjV n+94X+EfZ2OkpP9kWh819zzVK72hJB+G1/0PTIJ9b0MVT5lE6/M3brK7Dc/lFmcsG0LI l8+Xu7KY+fYuuVO/ju8ZybhM0aIFGhGJAy9XPVACk0apDMSMQK7vD8mXCAWCjLkLKHtw gO1QixRXeqoIHOI8AiJeftPQFXqnYPIzFF33Yn9lrR/xrJJ08L+xEDkHtTc2Len0WqUR 7hPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5EBqK+tM4Y7xOqKxuEa+KWDMy/xyFBtPmoMR4ACbhCI=; b=FhfDn00R0xEmcbgOkLqnPgBm3O+iXHEt4uySpzQc46CPf8eE02TE6JBj9/kvceoaHw 9umA0QzXoauwBSo4ONN6jwza8UrhaOIKlV29NkxRhyw4DgYO7zFm7eOousIVVWaPQzIb hTAFxptNKsnPS1jHVaM3Fj44BTp/TKsnI/i2FyRdK+YrQX3RRxhg61DJ0pBIzRGhx2Wr AVsgKWAlFm9Z+nluBYAydE0dav0ZivHcpbwBM6g7MSy7rMgKlztTR/CIW31s8qU+V/3H rpJazSLxflXrf0G6LmG/qnjfMstN3yOc53a1d89kL63dof0qSplBDsPs/tydgDWduG0U 09jg== X-Gm-Message-State: AGi0PuZiRb2sgHywTV9Pr7rWG0v/SADn7ufc4e1iwkFyhjaHEFjPI9V2 7a2rlpZPxurmcimjy+O896EN6DE8QUU= X-Google-Smtp-Source: APiQypI9gwFPFD1q5Uexmfg96tGkmilqa5C46uvcfLp6PRk7nD2IiUX0QRifYSxz4iPE0E8uPZKVDg== X-Received: by 2002:a17:902:a40e:: with SMTP id p14mr8406466plq.297.1587226776818; Sat, 18 Apr 2020 09:19:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 15/16] tcg/i386: Use tcg_constant_vec with tcg vec expanders Date: Sat, 18 Apr 2020 09:19:13 -0700 Message-Id: <20200418161914.4387-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::1044 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.inc.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 9cb627d6eb..deace219d2 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -3452,7 +3452,7 @@ static void expand_vec_sari(TCGType type, unsigned ve= ce, static void expand_vec_mul(TCGType type, unsigned vece, TCGv_vec v0, TCGv_vec v1, TCGv_vec v2) { - TCGv_vec t1, t2, t3, t4; + TCGv_vec t1, t2, t3, t4, zero; =20 tcg_debug_assert(vece =3D=3D MO_8); =20 @@ -3470,11 +3470,11 @@ static void expand_vec_mul(TCGType type, unsigned v= ece, case TCG_TYPE_V64: t1 =3D tcg_temp_new_vec(TCG_TYPE_V128); t2 =3D tcg_temp_new_vec(TCG_TYPE_V128); - tcg_gen_dup16i_vec(t2, 0); + zero =3D tcg_constant_vec(TCG_TYPE_V128, MO_8, 0); vec_gen_3(INDEX_op_x86_punpckl_vec, TCG_TYPE_V128, MO_8, - tcgv_vec_arg(t1), tcgv_vec_arg(v1), tcgv_vec_arg(t2)); + tcgv_vec_arg(t1), tcgv_vec_arg(v1), tcgv_vec_arg(zero)); vec_gen_3(INDEX_op_x86_punpckl_vec, TCG_TYPE_V128, MO_8, - tcgv_vec_arg(t2), tcgv_vec_arg(t2), tcgv_vec_arg(v2)); + tcgv_vec_arg(t2), tcgv_vec_arg(zero), tcgv_vec_arg(v2)); tcg_gen_mul_vec(MO_16, t1, t1, t2); tcg_gen_shri_vec(MO_16, t1, t1, 8); vec_gen_3(INDEX_op_x86_packus_vec, TCG_TYPE_V128, MO_8, @@ -3489,15 +3489,15 @@ static void expand_vec_mul(TCGType type, unsigned v= ece, t2 =3D tcg_temp_new_vec(type); t3 =3D tcg_temp_new_vec(type); t4 =3D tcg_temp_new_vec(type); - tcg_gen_dup16i_vec(t4, 0); + zero =3D tcg_constant_vec(TCG_TYPE_V128, MO_8, 0); vec_gen_3(INDEX_op_x86_punpckl_vec, type, MO_8, - tcgv_vec_arg(t1), tcgv_vec_arg(v1), tcgv_vec_arg(t4)); + tcgv_vec_arg(t1), tcgv_vec_arg(v1), tcgv_vec_arg(zero)); vec_gen_3(INDEX_op_x86_punpckl_vec, type, MO_8, - tcgv_vec_arg(t2), tcgv_vec_arg(t4), tcgv_vec_arg(v2)); + tcgv_vec_arg(t2), tcgv_vec_arg(zero), tcgv_vec_arg(v2)); vec_gen_3(INDEX_op_x86_punpckh_vec, type, MO_8, - tcgv_vec_arg(t3), tcgv_vec_arg(v1), tcgv_vec_arg(t4)); + tcgv_vec_arg(t3), tcgv_vec_arg(v1), tcgv_vec_arg(zero)); vec_gen_3(INDEX_op_x86_punpckh_vec, type, MO_8, - tcgv_vec_arg(t4), tcgv_vec_arg(t4), tcgv_vec_arg(v2)); + tcgv_vec_arg(t4), tcgv_vec_arg(zero), tcgv_vec_arg(v2)); tcg_gen_mul_vec(MO_16, t1, t1, t2); tcg_gen_mul_vec(MO_16, t3, t3, t4); tcg_gen_shri_vec(MO_16, t1, t1, 8); @@ -3525,7 +3525,7 @@ static bool expand_vec_cmp_noinv(TCGType type, unsign= ed vece, TCGv_vec v0, NEED_UMIN =3D 8, NEED_UMAX =3D 16, }; - TCGv_vec t1, t2; + TCGv_vec t1, t2, t3; uint8_t fixup; =20 switch (cond) { @@ -3596,9 +3596,9 @@ static bool expand_vec_cmp_noinv(TCGType type, unsign= ed vece, TCGv_vec v0, } else if (fixup & NEED_BIAS) { t1 =3D tcg_temp_new_vec(type); t2 =3D tcg_temp_new_vec(type); - tcg_gen_dupi_vec(vece, t2, 1ull << ((8 << vece) - 1)); - tcg_gen_sub_vec(vece, t1, v1, t2); - tcg_gen_sub_vec(vece, t2, v2, t2); + t3 =3D tcg_constant_vec(type, vece, 1ull << ((8 << vece) - 1)); + tcg_gen_sub_vec(vece, t1, v1, t3); + tcg_gen_sub_vec(vece, t2, v2, t3); v1 =3D t1; v2 =3D t2; cond =3D tcg_signed_cond(cond); --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1587227560; cv=none; d=zohomail.com; s=zohoarc; b=UyGkeEPlZ8xKevvnNnR0GelYMCoAj7PnB32vo1zzOLupW1n4Tn+TYWd78rCxcTmcOwkpDHCGzxa8xn2Az1b+o+Lyp2H2v9+KFsxbKzpPX50/lZlWiUsj6G8smVFCFtKLKv1OGWBw2LBxesug+a4BTEQ9D4MZe9ipdn00uGIqtYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587227560; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2sdxv3dgmobchGTZXq4ItSud4I5lO54dfCluBdiq+N0=; b=DhY/s4kIudWz0Cjb7Q7JhPZcyIDFHu1WE+a8C61/tOXGorwLDIjMMrsjybo6svYahmw+oeCoU6XKrQofk5onPX7O347A7nmxAUUg7gVFqu06pi1yR1RzUU6SBtoku4uvhaPfwVP+w3TyWITlrrr9UelTy6d/dwqT2fnPEB906QU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587227560183326.0083568105455; Sat, 18 Apr 2020 09:32:40 -0700 (PDT) Received: from localhost ([::1]:59866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqOU-0005rz-UA for importer@patchew.org; Sat, 18 Apr 2020 12:32:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48306) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBy-0004Tl-Bi for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBv-0005hW-Vj for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:41 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:51400) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBv-0005fL-Ql for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:39 -0400 Received: by mail-pj1-x1032.google.com with SMTP id kb16so2558964pjb.1 for ; Sat, 18 Apr 2020 09:19:39 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=2sdxv3dgmobchGTZXq4ItSud4I5lO54dfCluBdiq+N0=; b=DYS4STqKvTGO2Zq4E16mZ6siBha+tBQcYeatzf8PFRxvQQXmF54OFjsHn+CVLWto/f g+Ac6mi5c+bJb4aKNnCRiJS4vzxUylxBGUxE5yyDukBkmCj7tc+11z8ZRAcr4rXZmjHH LeZrdwY7Ib88a3kmnq04K9PxOCAGnRq08yP512G0kvfSKZ/oUThiVTo1gd5o2LaXZezv sFNgF+dyU98JDrplBU93rcE1v99zgAMbAe51ubI2fhkHBcksOq6smMASM76dw8jIPjVd MsLAFow/Gq1iXJs6IAzDODBxvfJmV5fPP0q0L3Q7FaOOp3SrcfoXHb+tKP3g0FEeu0tb +Asw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2sdxv3dgmobchGTZXq4ItSud4I5lO54dfCluBdiq+N0=; b=e0FWE2oYtJ6TxcPfHnWEdNozcYrABdAeUdWrCT0FeQy5rJW+uEglWCUMe4oN7r4/WG GPirJHwak9zoTuvyaSLCG+kQ5taXoOIUPgjoA06BZWFC29Mn3Ox9jDhFF9ARtSVqce04 kPmZXjQK9J92VoMZ4z32NWSRvuZaYYS7TWpPr5JMWd5pcRk64mwXE8Z6OmcDq8oyyU7j ooiiwKNBt1O2g7URUTXjZgdiH4aX01TXwm25Hgvr2VftpK20u4JLHssqVkp0FRu1/MP3 zdvKnyIvdxi3A+OP3edpj/8n0T26R5ZAkVHLRXKJgO2S0ENmKZ3hecD/5aYss2c6z67V bApQ== X-Gm-Message-State: AGi0PuZ0rhGbNFHWCw1yqYijZsg/0VAGWKTxbq9nF1cCo/DJWj/U0cnP ZEMqCGUYIFm8whHfRlDjDas0EzbUrPM= X-Google-Smtp-Source: APiQypIHepFsyDhndjoHvsJcuOFLby8AQUhWl67Uz7ES/AOqJbMtlGzN+6fwp24fQ3cUg3wk8xGcgw== X-Received: by 2002:a17:902:8ec1:: with SMTP id x1mr8965791plo.325.1587226777948; Sat, 18 Apr 2020 09:19:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 16/16] tcg: Remove tcg_gen_dup{8,16,32,64}i_vec Date: Sat, 18 Apr 2020 09:19:14 -0700 Message-Id: <20200418161914.4387-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::1032 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" These interfaces have been replaced by tcg_gen_dupi_vec and tcg_constant_vec. Signed-off-by: Richard Henderson --- include/tcg/tcg-op.h | 4 ---- tcg/tcg-op-vec.c | 20 -------------------- 2 files changed, 24 deletions(-) diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 11ed9192f7..a39eb13ff0 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -959,10 +959,6 @@ void tcg_gen_mov_vec(TCGv_vec, TCGv_vec); void tcg_gen_dup_i32_vec(unsigned vece, TCGv_vec, TCGv_i32); void tcg_gen_dup_i64_vec(unsigned vece, TCGv_vec, TCGv_i64); void tcg_gen_dup_mem_vec(unsigned vece, TCGv_vec, TCGv_ptr, tcg_target_lon= g); -void tcg_gen_dup8i_vec(TCGv_vec, uint32_t); -void tcg_gen_dup16i_vec(TCGv_vec, uint32_t); -void tcg_gen_dup32i_vec(TCGv_vec, uint32_t); -void tcg_gen_dup64i_vec(TCGv_vec, uint64_t); void tcg_gen_dupi_vec(unsigned vece, TCGv_vec, uint64_t); void tcg_gen_add_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); void tcg_gen_sub_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index 6343046e18..a9c16d85c5 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -284,26 +284,6 @@ void tcg_gen_dupi_vec(unsigned vece, TCGv_vec dest, ui= nt64_t val) tcg_gen_mov_vec(dest, tcg_constant_vec(type, vece, val)); } =20 -void tcg_gen_dup64i_vec(TCGv_vec dest, uint64_t val) -{ - tcg_gen_dupi_vec(MO_64, dest, val); -} - -void tcg_gen_dup32i_vec(TCGv_vec dest, uint32_t val) -{ - tcg_gen_dupi_vec(MO_32, dest, val); -} - -void tcg_gen_dup16i_vec(TCGv_vec dest, uint32_t val) -{ - tcg_gen_dupi_vec(MO_16, dest, val); -} - -void tcg_gen_dup8i_vec(TCGv_vec dest, uint32_t val) -{ - tcg_gen_dupi_vec(MO_8, dest, val); -} - void tcg_gen_dup_i64_vec(unsigned vece, TCGv_vec r, TCGv_i64 a) { TCGArg ri =3D tcgv_vec_arg(r); --=20 2.20.1