From nobody Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.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=1588951324; cv=none; d=zohomail.com; s=zohoarc; b=grzoJ5QHsRSDHIXjWXKhDCbIVz85i9k8bo2g/8tVqAT20tHlZWPC/Q3FQ67WCDqXCO7P5f4D6Rtd1iPktF0NG8TxEoIRtOVl0DTmni/FcVmdua2XkkCZ37LcVBTWVhoKKV/1+kxv7anVuocyRoYcf1IscSd/j6KM1ejeFWGSvck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951324; h=Content-Transfer-Encoding:Cc: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=VCMBUQIc+8B9DRRmRBPkJ2lHeMYEvH8P6JQWFH82G68=; b=YMsuSM8GuoXDtnxupnIueTg28lWsALIlb2Ek6FjPWKBqqEJczTH3JTHgEjhiOLVV2FIrdsdssgbQTgMUiKixxZcUfTlsj11QgIl7HimPrT4pw6YBCG/c9anUOk1H+9rrr6H1kD+NizblnAAo75AmT2Iaq2J5yYdcFyfG3GeVa/g= 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 158895132405614.819253672273362; Fri, 8 May 2020 08:22:04 -0700 (PDT) Received: from localhost ([::1]:45460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4p8-00031s-M1 for importer@patchew.org; Fri, 08 May 2020 11:22:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4l8-0005ZO-1n for qemu-devel@nongnu.org; Fri, 08 May 2020 11:17:54 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:46144) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4l6-0002nE-L3 for qemu-devel@nongnu.org; Fri, 08 May 2020 11:17:53 -0400 Received: by mail-pf1-x442.google.com with SMTP id 145so1057692pfw.13 for ; Fri, 08 May 2020 08:17:52 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:17:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VCMBUQIc+8B9DRRmRBPkJ2lHeMYEvH8P6JQWFH82G68=; b=avoztDjpDklznlo0h7fJx1ZxnradWfQxECeVkQDUfQ50e3DilXHS4HTJaTGIlOs3dB VtTpuQ1NmJdznmxZJPe5VfOKsNZX669II/PwgBUnP4bT1VlaehZcGzwyaEvzl7LbZbI3 i1UW51+k6wPFdjhmgm+aFpE9V5H26lavk5zwUqM66DKwIIasrKoL/YuUVYvpy2vIFMjB xlIEumyBlh7ZkA1RMn39EX5TIqCuSN9Fs9r2w+Lmvo+OhLd8Den8q+DCc7saMZFxKtmi ceN5lHiNwDwQekA9ZqKV0M695EHfLPRWjJqNom9GOCmFuExvQc3sS6VBvJhiqdUknGi3 bcmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VCMBUQIc+8B9DRRmRBPkJ2lHeMYEvH8P6JQWFH82G68=; b=arFTKYa6igR/opgI8FN0pLyOJB4Bc7FVsUMzR6yUqueAbg+fitIxv3OBs2FzpVveC9 cT4rr8ltCnSZERRCFE4mSvSVihJbF5de/GHiRL5LeF5Ocu6D71S/05tW+Bzp5JbKrC+l c4nEDypNc4Rji8AlTY4ZyIZqnNZE1ZQq9IZLTZPsd/tsuUxFpbjIHBTBD2LeXQQSgi3n zEOg5zuBniZiUJYRh6L/PXWhm7YBtRqMU8Igp7s/xO5ZoRhsGBGDPI9I06/n9+2N0uxj IbHp4Ft0hggjZyzsHw85+s4CF9a3ZkJqNkVqsi128iiNJmdA33S20lhTbR4vRfX9PAMb SHrQ== X-Gm-Message-State: AGi0PubUbU0DVyPf/V/RawNufiR5wABvDEGVHvbeUNMOBH7mixOHp9gt cAzbx1M3gr8wmw8JFJmyroZhaKNgYjw= X-Google-Smtp-Source: APiQypLmsbXis4l0qbMaffnOjRLhVfc5dPIudzY0c9UBwC8lkQgoZjzaBxDAxXkXPTmjFwDYeU1N2g== X-Received: by 2002:a65:6652:: with SMTP id z18mr2595789pgv.76.1588951070411; Fri, 08 May 2020 08:17:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 01/19] tcg: Consolidate 3 bits into enum TCGTempKind Date: Fri, 8 May 2020 08:17:29 -0700 Message-Id: <20200508151747.6166-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::442; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x442.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org 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 temp_fixed, temp_global, temp_local bits are all related. Combine them into a single enumeration. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/tcg/tcg.h | 20 +++++--- tcg/optimize.c | 8 +-- tcg/tcg.c | 122 ++++++++++++++++++++++++++++------------------ 3 files changed, 90 insertions(+), 60 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 380014ed80..06486635e6 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -483,23 +483,27 @@ typedef enum TCGTempVal { TEMP_VAL_CONST, } TCGTempVal; =20 +typedef enum TCGTempKind { + /* Temp is dead at the end of all basic blocks. */ + TEMP_NORMAL, + /* Temp is saved across basic blocks but dead at the end of TBs. */ + TEMP_LOCAL, + /* Temp is saved across both basic blocks and translation blocks. */ + TEMP_GLOBAL, + /* Temp is in a fixed register. */ + TEMP_FIXED, +} TCGTempKind; + typedef struct TCGTemp { TCGReg reg:8; TCGTempVal val_type:8; TCGType base_type:8; TCGType type:8; - unsigned int fixed_reg:1; + TCGTempKind kind:3; unsigned int indirect_reg:1; unsigned int indirect_base:1; unsigned int mem_coherent:1; unsigned int mem_allocated:1; - /* If true, the temp is saved across both basic blocks and - translation blocks. */ - unsigned int temp_global:1; - /* If true, the temp is saved across basic blocks but dead - at the end of translation blocks. If false, the temp is - dead at the end of basic blocks. */ - unsigned int temp_local:1; unsigned int temp_allocated:1; =20 tcg_target_long val; diff --git a/tcg/optimize.c b/tcg/optimize.c index 53aa8e5329..afb4a9a5a9 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -116,21 +116,21 @@ static TCGTemp *find_better_copy(TCGContext *s, TCGTe= mp *ts) TCGTemp *i; =20 /* If this is already a global, we can't do better. */ - if (ts->temp_global) { + if (ts->kind >=3D TEMP_GLOBAL) { return ts; } =20 /* Search for a global first. */ for (i =3D ts_info(ts)->next_copy; i !=3D ts; i =3D ts_info(i)->next_c= opy) { - if (i->temp_global) { + if (i->kind >=3D TEMP_GLOBAL) { return i; } } =20 /* If it is a temp, search for a temp local. */ - if (!ts->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 (ts->temp_local) { + if (i->kind >=3D TEMP_LOCAL) { return i; } } diff --git a/tcg/tcg.c b/tcg/tcg.c index 216a6963b3..2c022c9621 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1155,7 +1155,7 @@ static inline TCGTemp *tcg_global_alloc(TCGContext *s) tcg_debug_assert(s->nb_globals =3D=3D s->nb_temps); s->nb_globals++; ts =3D tcg_temp_alloc(s); - ts->temp_global =3D 1; + ts->kind =3D TEMP_GLOBAL; =20 return ts; } @@ -1172,7 +1172,7 @@ static TCGTemp *tcg_global_reg_new_internal(TCGContex= t *s, TCGType type, ts =3D tcg_global_alloc(s); ts->base_type =3D type; ts->type =3D type; - ts->fixed_reg =3D 1; + ts->kind =3D TEMP_FIXED; ts->reg =3D reg; ts->name =3D name; tcg_regset_set_reg(s->reserved_regs, reg); @@ -1199,7 +1199,7 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TC= Gv_ptr base, bigendian =3D 1; #endif =20 - if (!base_ts->fixed_reg) { + if (base_ts->kind !=3D TEMP_FIXED) { /* We do not support double-indirect registers. */ tcg_debug_assert(!base_ts->indirect_reg); base_ts->indirect_base =3D 1; @@ -1247,6 +1247,7 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TC= Gv_ptr base, TCGTemp *tcg_temp_new_internal(TCGType type, bool temp_local) { TCGContext *s =3D tcg_ctx; + TCGTempKind kind =3D temp_local ? TEMP_LOCAL : TEMP_NORMAL; TCGTemp *ts; int idx, k; =20 @@ -1259,7 +1260,7 @@ TCGTemp *tcg_temp_new_internal(TCGType type, bool tem= p_local) ts =3D &s->temps[idx]; ts->temp_allocated =3D 1; tcg_debug_assert(ts->base_type =3D=3D type); - tcg_debug_assert(ts->temp_local =3D=3D temp_local); + tcg_debug_assert(ts->kind =3D=3D kind); } else { ts =3D tcg_temp_alloc(s); if (TCG_TARGET_REG_BITS =3D=3D 32 && type =3D=3D TCG_TYPE_I64) { @@ -1268,18 +1269,18 @@ TCGTemp *tcg_temp_new_internal(TCGType type, bool t= emp_local) ts->base_type =3D type; ts->type =3D TCG_TYPE_I32; ts->temp_allocated =3D 1; - ts->temp_local =3D temp_local; + ts->kind =3D kind; =20 tcg_debug_assert(ts2 =3D=3D ts + 1); ts2->base_type =3D TCG_TYPE_I64; ts2->type =3D TCG_TYPE_I32; ts2->temp_allocated =3D 1; - ts2->temp_local =3D temp_local; + ts2->kind =3D kind; } else { ts->base_type =3D type; ts->type =3D type; ts->temp_allocated =3D 1; - ts->temp_local =3D temp_local; + ts->kind =3D kind; } } =20 @@ -1336,12 +1337,12 @@ void tcg_temp_free_internal(TCGTemp *ts) } #endif =20 - tcg_debug_assert(ts->temp_global =3D=3D 0); + tcg_debug_assert(ts->kind < TEMP_GLOBAL); tcg_debug_assert(ts->temp_allocated !=3D 0); ts->temp_allocated =3D 0; =20 idx =3D temp_idx(ts); - k =3D ts->base_type + (ts->temp_local ? TCG_TYPE_COUNT : 0); + k =3D ts->base_type + (ts->kind =3D=3D TEMP_NORMAL ? 0 : TCG_TYPE_COUN= T); set_bit(idx, s->free_temps[k].l); } =20 @@ -1871,17 +1872,27 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int na= rgs, TCGTemp **args) static void tcg_reg_alloc_start(TCGContext *s) { int i, n; - TCGTemp *ts; =20 - for (i =3D 0, n =3D s->nb_globals; i < n; i++) { - ts =3D &s->temps[i]; - ts->val_type =3D (ts->fixed_reg ? TEMP_VAL_REG : TEMP_VAL_MEM); - } - for (n =3D s->nb_temps; i < n; i++) { - ts =3D &s->temps[i]; - ts->val_type =3D (ts->temp_local ? TEMP_VAL_MEM : TEMP_VAL_DEAD); - ts->mem_allocated =3D 0; - ts->fixed_reg =3D 0; + for (i =3D 0, n =3D s->nb_temps; i < n; i++) { + TCGTemp *ts =3D &s->temps[i]; + TCGTempVal val =3D TEMP_VAL_MEM; + + switch (ts->kind) { + case TEMP_FIXED: + val =3D TEMP_VAL_REG; + break; + case TEMP_GLOBAL: + break; + case TEMP_NORMAL: + val =3D TEMP_VAL_DEAD; + /* fall through */ + case TEMP_LOCAL: + ts->mem_allocated =3D 0; + break; + default: + g_assert_not_reached(); + } + ts->val_type =3D val; } =20 memset(s->reg_to_temp, 0, sizeof(s->reg_to_temp)); @@ -1892,12 +1903,17 @@ static char *tcg_get_arg_str_ptr(TCGContext *s, cha= r *buf, int buf_size, { int idx =3D temp_idx(ts); =20 - if (ts->temp_global) { + switch (ts->kind) { + case TEMP_FIXED: + case TEMP_GLOBAL: pstrcpy(buf, buf_size, ts->name); - } else if (ts->temp_local) { + break; + case TEMP_LOCAL: snprintf(buf, buf_size, "loc%d", idx - s->nb_globals); - } else { + break; + case TEMP_NORMAL: snprintf(buf, buf_size, "tmp%d", idx - s->nb_globals); + break; } return buf; } @@ -2493,15 +2509,24 @@ static void la_bb_end(TCGContext *s, int ng, int nt) { int i; =20 - for (i =3D 0; i < ng; ++i) { - s->temps[i].state =3D TS_DEAD | TS_MEM; - la_reset_pref(&s->temps[i]); - } - for (i =3D ng; i < nt; ++i) { - s->temps[i].state =3D (s->temps[i].temp_local - ? TS_DEAD | TS_MEM - : TS_DEAD); - la_reset_pref(&s->temps[i]); + for (i =3D 0; i < nt; ++i) { + TCGTemp *ts =3D &s->temps[i]; + int state; + + switch (ts->kind) { + case TEMP_FIXED: + case TEMP_GLOBAL: + case TEMP_LOCAL: + state =3D TS_DEAD | TS_MEM; + break; + case TEMP_NORMAL: + state =3D TS_DEAD; + break; + default: + g_assert_not_reached(); + } + ts->state =3D state; + la_reset_pref(ts); } } =20 @@ -3110,7 +3135,8 @@ static void check_regs(TCGContext *s) } for (k =3D 0; k < s->nb_temps; k++) { ts =3D &s->temps[k]; - if (ts->val_type =3D=3D TEMP_VAL_REG && !ts->fixed_reg + if (ts->val_type =3D=3D TEMP_VAL_REG + && ts->kind !=3D TEMP_FIXED && s->reg_to_temp[ts->reg] !=3D ts) { printf("Inconsistency for temp %s:\n", tcg_get_arg_str_ptr(s, buf, sizeof(buf), ts)); @@ -3147,15 +3173,14 @@ 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 (ts->fixed_reg) { + if (ts->kind =3D=3D TEMP_FIXED) { return; } 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->temp_local - || ts->temp_global + || ts->kind !=3D TEMP_NORMAL ? TEMP_VAL_MEM : TEMP_VAL_DEAD); } =20 @@ -3172,7 +3197,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->fixed_reg) { + if (ts->kind =3D=3D TEMP_FIXED) { return; } if (!ts->mem_coherent) { @@ -3330,7 +3355,8 @@ 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->fixed_reg); + tcg_debug_assert(ts->val_type =3D=3D TEMP_VAL_MEM + || ts->kind =3D=3D TEMP_FIXED); } =20 /* save globals to their canonical location and assume they can be @@ -3355,7 +3381,7 @@ static void sync_globals(TCGContext *s, TCGRegSet all= ocated_regs) for (i =3D 0, n =3D s->nb_globals; i < n; i++) { TCGTemp *ts =3D &s->temps[i]; tcg_debug_assert(ts->val_type !=3D TEMP_VAL_REG - || ts->fixed_reg + || ts->kind =3D=3D TEMP_FIXED || ts->mem_coherent); } } @@ -3368,7 +3394,7 @@ static void tcg_reg_alloc_bb_end(TCGContext *s, TCGRe= gSet allocated_regs) =20 for (i =3D s->nb_globals; i < s->nb_temps; i++) { TCGTemp *ts =3D &s->temps[i]; - if (ts->temp_local) { + if (ts->kind =3D=3D TEMP_LOCAL) { temp_save(s, ts, allocated_regs); } else { /* The liveness analysis already ensures that temps are dead. @@ -3388,7 +3414,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->fixed_reg); + tcg_debug_assert(ots->kind !=3D TEMP_FIXED); =20 /* The movi is not explicitly generated here. */ if (ots->val_type =3D=3D TEMP_VAL_REG) { @@ -3428,7 +3454,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->fixed_reg); + tcg_debug_assert(ots->kind !=3D TEMP_FIXED); =20 /* Note that otype !=3D itype for no-op truncation. */ otype =3D ots->type; @@ -3467,7 +3493,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TC= GOp *op) } temp_dead(s, ots); } else { - if (IS_DEAD_ARG(1) && !ts->fixed_reg) { + if (IS_DEAD_ARG(1) && ts->kind !=3D TEMP_FIXED) { /* the mov can be suppressed */ if (ots->val_type =3D=3D TEMP_VAL_REG) { s->reg_to_temp[ots->reg] =3D NULL; @@ -3489,7 +3515,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->fixed_reg); + assert(ots->kind !=3D TEMP_FIXED); if (!ts->mem_allocated) { temp_allocate_frame(s, ots); } @@ -3526,7 +3552,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->fixed_reg); + tcg_debug_assert(ots->kind !=3D TEMP_FIXED); =20 itype =3D its->type; vece =3D TCGOP_VECE(op); @@ -3666,7 +3692,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) i_preferred_regs =3D o_preferred_regs =3D 0; if (arg_ct->ct & TCG_CT_IALIAS) { o_preferred_regs =3D op->output_pref[arg_ct->alias_index]; - if (ts->fixed_reg) { + if (ts->kind =3D=3D TEMP_FIXED) { /* if fixed register, we must allocate a new register if the alias is not the same register */ if (arg !=3D op->args[arg_ct->alias_index]) { @@ -3757,7 +3783,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->fixed_reg); + tcg_debug_assert(ts->kind !=3D TEMP_FIXED); =20 if ((arg_ct->ct & TCG_CT_ALIAS) && !const_args[arg_ct->alias_index]) { @@ -3799,7 +3825,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->fixed_reg); + tcg_debug_assert(ts->kind !=3D TEMP_FIXED); =20 if (NEED_SYNC_ARG(i)) { temp_sync(s, ts, o_allocated_regs, 0, IS_DEAD_ARG(i)); @@ -3931,7 +3957,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->fixed_reg); + tcg_debug_assert(ts->kind !=3D TEMP_FIXED); =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 Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.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=1588951331; cv=none; d=zohomail.com; s=zohoarc; b=Xz9Gc0zpXQhX57N8mCTNlw3bCqC1RxvznMkD79TfzzWCeLnJ5o0/pkLRp8wSAWfhAfcTkl2urRdA0+S123b2u1RIEtKlVTseVNh1MJ1QP2VTR0m8jAuHnzE+rA3v7iFu0xAwCwoCJA12RGVYPSrytmJhClDrRrJNnF1kgcz62+Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951331; h=Content-Type:Content-Transfer-Encoding:Cc: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=6U9k1uhyDn85vPSFrFIwM0ONxS2wD3t03ZIkgvfeY9w=; b=OmdMOjDjqWkBjkAUGoDVM6bvPDXmGbChJe/FsNFSXBASkwdFYtfun3LkvtWpiQwFYgA8zIFSv+mTCBBkR6FmBeZ1RCjt371qOEGoEM4wNSZtjgjBltKOQ9ed5IrGW58Z+fhkDYcjA3Tu1qepPxOg9c4hA9GWuoCgWQQ1zDDpfvg= 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 1588951331517571.2984044910284; Fri, 8 May 2020 08:22:11 -0700 (PDT) Received: from localhost ([::1]:46108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4pG-0003T1-3u for importer@patchew.org; Fri, 08 May 2020 11:22:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33778) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4l8-0005bf-Qd for qemu-devel@nongnu.org; Fri, 08 May 2020 11:17:54 -0400 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]:36542) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4l7-0002pX-E5 for qemu-devel@nongnu.org; Fri, 08 May 2020 11:17:54 -0400 Received: by mail-pj1-x1042.google.com with SMTP id q24so4378818pjd.1 for ; Fri, 08 May 2020 08:17:53 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.17.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:17:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6U9k1uhyDn85vPSFrFIwM0ONxS2wD3t03ZIkgvfeY9w=; b=P5AtST/CaUnao1jN/+vFah7CW94RcUhrNrJyLa1PMsUeZkO1uY2lIzjyRscf1I3wZF xLnH6CUKZAS23ilcTmjcqk0c2rD5uQl2BCiDkKRIynOQSesix+S40+cKy0vmdG43Esh1 YkMOyrhTcGQHNge/47Mk4CFjhS6MlQxMyIKzUEDQIgdlVUxEO6rflSAb0VwpK+XBFAUB MVy0Z2PhHrwuq/D16OpYiTDcVR1ss09Tj/CSVvW9vl2SfON0d0p44zpzMVRl3XXVa4DU fYTKuZo255/qMuTpGRixModKmwuFWbOVHUnzxBk35OECqSXJtzdlTB5vR/KD9t8iNrx3 EWdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6U9k1uhyDn85vPSFrFIwM0ONxS2wD3t03ZIkgvfeY9w=; b=cuU6T3Zyt9ccfiPE/9kLTVKkmfaxMTo3+yrNDHm/va2adKPLMI7kSr2r4oVpNFXUkP DdX1912pKambMfCPjlOLuft1yHEErUreU0lRJazfWOjM01pd3V/qXL+S2yOafeGSqerH w5d3JYZyX+YGM4MzMHeeUd7lqEohYgWdlKSkpibCP3UnH+sfn9W4pdXZXThiw18doInD HRA5gfzY0mSD867QzH1HWitgu8fS9pysuQ0jmsskZ6Xk5WYC5DcuhJ2BCGXekz1yreLP ZzuLqVowvGUJh73SDuTvfiL3bcCjgMxRrGOWR6yzye46TXZ47Egq36gr8I58DEWQB7iu IVNQ== X-Gm-Message-State: AGi0PuYvUu0JUpyAVedtYW2LdlI1pGF0TbR3NQ+kLO/KDY+XkhCh9yHk 4LKFYOzUnzkorLspzCt9BVe7xaUG6uk= X-Google-Smtp-Source: APiQypIz4957Fw7IUabuCV7gq+Qy+dNfIBauS03O1cKt60TlFOvlRaCWS7oOO/wwPGndWTX7vwGIbQ== X-Received: by 2002:a17:90a:24e6:: with SMTP id i93mr6657128pje.13.1588951071556; Fri, 08 May 2020 08:17:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 02/19] tcg: Add temp_readonly Date: Fri, 8 May 2020 08:17:30 -0700 Message-Id: <20200508151747.6166-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::1042; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1042.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) In most, but not all, places that we check for TEMP_FIXED, we are really testing that we do not modify the temporary. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- 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 06486635e6..0d09ea7822 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -681,6 +681,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 2c022c9621..a529166026 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3173,7 +3173,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) { @@ -3197,7 +3197,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) { @@ -3355,8 +3355,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 @@ -3414,7 +3413,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) { @@ -3454,7 +3453,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; @@ -3515,7 +3514,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); } @@ -3552,7 +3551,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); @@ -3783,7 +3782,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]) { @@ -3825,7 +3824,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)); @@ -3957,7 +3956,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 Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.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=1588951212; cv=none; d=zohomail.com; s=zohoarc; b=hhUOfmizQ7UYrOEpS5go629lryI3ifffGCAfw9yJZ52HTrZtIM6hMpAYSPhxlRtihCdEKvQlA9mojJ6AsKS50ItHcXMgt7IINmG0wXpEtc7GaAUZjzKkrWMk4Vm11HNdJcNrdTnmdCkhRoOoPDuX8nwF1N7NTRYAIk2onSobbcQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951212; h=Content-Transfer-Encoding:Cc: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=q2Hu6R+yXoo2zdjGVfH6/b6E3wPdHyA+Gme+a50XUmw=; b=YWPjP4dnN9Wu4Wu9d5SvtCRw+TRRQr4+V0Pq264asir73RODcyi2nm1yiYK5jrDuyUzJ8piHi8dpe5I/4WVw1JP3uYoc3LV/u1wbTCPesD0LnIhBdd1gRTSCNp4Cb88LfASMyeKowYbHXFcvWHoCJIkHd8YNDPO/2BrPg8Hzizw= 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 1588951212232595.5735319364076; Fri, 8 May 2020 08:20:12 -0700 (PDT) Received: from localhost ([::1]:39186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4nJ-0008Lu-7k for importer@patchew.org; Fri, 08 May 2020 11:20:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lA-0005gL-FI for qemu-devel@nongnu.org; Fri, 08 May 2020 11:17:56 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:42609) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4l8-0002po-Uk for qemu-devel@nongnu.org; Fri, 08 May 2020 11:17:56 -0400 Received: by mail-pf1-x441.google.com with SMTP id f7so1069859pfa.9 for ; Fri, 08 May 2020 08:17:54 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.17.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=q2Hu6R+yXoo2zdjGVfH6/b6E3wPdHyA+Gme+a50XUmw=; b=yNDVhxW0CMRKMlY/6thoPnO6u+7+LuIF8JUHGhKte78QxhrU0Lv7Ci5yoUmUbM+MxR pjN+ZVj/XCI/J9m4xCv3BDdSIBc3fDngUfvNrDBNpn6RXcLYM4RNH4LI77QqcJryQ7oH GxU0uz3q9HGGS97ZVK6egfy6qVgZZSPbGWhetzi6aC4rGB3d4hYCGFzfQmR/gOBjC85d bE1hubp9Y4o5a8Tw0cmeH0vSgRDi/vP/uXG6taUBXjQupowFEcg/MwcCX5OFPVPyOene EoskflGcAWXDkcmZMe4+iVxpsYPU0X6e5MQjI6OKwX5Av19fzjSDSVooaqylN1uoE7L8 je4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=q2Hu6R+yXoo2zdjGVfH6/b6E3wPdHyA+Gme+a50XUmw=; b=e+niqlJgsYH53P7xSxztv+4lzU5c/rI7kFo4L5tSdcCGDFoq6Vav2SNpeGEXdHnnzD fPBYPq258vDUSWsMsCKV8yiAhdyYlGIpxR1Gn4c5l9S9LTnrO+QroGHz5oe0KP2xphrz KqtwoLlC167G2r8qpbSDOruDTiRwGPhIq66MvXqosV/oSDMDObfDEBCVVys1VZ/9FXyU 0jr7B2kPtagYqTOA5E1Ro1h/HSxBnRpObnmMlc/pPw8J+DGVHp3JsYD6+7plAcp6VcRM XlKYpXyTgNmsB04r6Xcz2NxVV70wK65wnoO/t8VqWLNn9WUA/00+KP9Kgr+xSPHV2xI4 Buew== X-Gm-Message-State: AGi0PuYBe15AUgZkdFoBX3WqNU7w3M+VjCTtQ6EaGH7K+INa0/3LUZnT ToxfRlH+80gAerRJI6uIWi+QOb+b1/E= X-Google-Smtp-Source: APiQypLhOx16kDQnfs9qaa0vPA1f96jnWDkf6UfNM9FeYstV1F6w3C6nD81kYWhIBnjJ8CQzI5m6QQ== X-Received: by 2002:a63:1160:: with SMTP id 32mr2543513pgr.441.1588951072772; Fri, 08 May 2020 08:17:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 03/19] tcg: Introduce TYPE_CONST temporaries Date: Fri, 8 May 2020 08:17:31 -0700 Message-Id: <20200508151747.6166-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::441; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x441.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org 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 | 13 +++- tcg/tcg-op-vec.c | 17 +++++ tcg/tcg.c | 170 ++++++++++++++++++++++++++++++++++------------ 4 files changed, 182 insertions(+), 45 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 0d09ea7822..57d6b0216c 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -492,6 +492,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 { @@ -667,6 +669,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 @@ -683,7 +686,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; @@ -1041,6 +1044,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); @@ -1050,6 +1054,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..8f3bd99ff4 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); } } diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index f784517d84..43101defe4 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 a529166026..94f7898317 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; @@ -1878,6 +1916,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; @@ -1914,6 +1955,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; } @@ -2520,6 +2581,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: @@ -3173,15 +3235,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. */ @@ -3197,10 +3272,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); } @@ -3393,12 +3465,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 @@ -3691,46 +3773,43 @@ static void tcg_reg_alloc_op(TCGContext *s, const T= CGOp *op) i_preferred_regs =3D o_preferred_regs =3D 0; if (arg_ct->ct & TCG_CT_IALIAS) { o_preferred_regs =3D op->output_pref[arg_ct->alias_index]; - if (ts->kind =3D=3D TEMP_FIXED) { - /* if fixed register, we must allocate a new register - if the alias is not the same register */ - if (arg !=3D op->args[arg_ct->alias_index]) { - goto allocate_in_reg; - } - } else { - /* if the input is aliased to an output and if it is - not dead after the instruction, we must allocate - a new register and move it */ - if (!IS_DEAD_ARG(i)) { - goto allocate_in_reg; - } =20 - /* check if the current register has already been allocated - for another input aliased to an output */ - if (ts->val_type =3D=3D TEMP_VAL_REG) { - int k2, i2; - reg =3D ts->reg; - for (k2 =3D 0 ; k2 < k ; k2++) { - i2 =3D def->sorted_args[nb_oargs + k2]; - if ((def->args_ct[i2].ct & TCG_CT_IALIAS) && - reg =3D=3D new_args[i2]) { - goto allocate_in_reg; - } + /* + * If the input is readonly, then it cannot also be an + * output and aliased to itself. If the input is not + * dead after the instruction, we must allocate a new + * register and move it. + */ + if (temp_readonly(ts) || !IS_DEAD_ARG(i)) { + goto allocate_in_reg; + } + + /* + * Check if the current register has already been allocated + * for another input aliased to an output. + */ + if (ts->val_type =3D=3D TEMP_VAL_REG) { + reg =3D ts->reg; + for (int k2 =3D 0; k2 < k; k2++) { + int i2 =3D def->sorted_args[nb_oargs + k2]; + if ((def->args_ct[i2].ct & TCG_CT_IALIAS) && + reg =3D=3D new_args[i2]) { + goto allocate_in_reg; } } - i_preferred_regs =3D o_preferred_regs; } + i_preferred_regs =3D o_preferred_regs; } =20 temp_load(s, ts, arg_ct->u.regs, i_allocated_regs, i_preferred_reg= s); reg =3D ts->reg; =20 - if (tcg_regset_test_reg(arg_ct->u.regs, reg)) { - /* nothing to do : the constraint is satisfied */ - } else { - allocate_in_reg: - /* allocate a new register matching the constraint=20 - and move the temporary register into it */ + if (!tcg_regset_test_reg(arg_ct->u.regs, reg)) { + allocate_in_reg: + /* + * Allocate a new register matching the constraint + * and move the temporary register into it. + */ temp_load(s, ts, tcg_target_available_regs[ts->type], i_allocated_regs, 0); reg =3D tcg_reg_alloc(s, arg_ct->u.regs, i_allocated_regs, @@ -4189,6 +4268,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 Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.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=1588951466; cv=none; d=zohomail.com; s=zohoarc; b=LoOCajs3aKrUT0hyFAqqvMurN5tdJpqhYn1TycwvY0glNVkiCZ+6viNaZIj+wVCbyUstYQwwXYlK4SJNMy8ApuvSfD0i8zF2b095G1uN76ngt6P2hznlDihljCZI+Vi9Wh81gh6uiGCH1zGQ8zxIMyxSRBYB4u9+/5+PwhdEbbg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951466; h=Content-Transfer-Encoding:Cc: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=mKj9pe6dRuinQxz4Fqjv6+PqBpNFZyT1IApiuNlUqA+N6Bo9XxnGtmXRAT/50228ca4KgJXDzpPbK7I2Mmhy/hwJMvH0DBwCv41vZlcRRc+A0Iwe57cfeVz/C5LHPEn5Baxg0/EVBJ5s3lXPKc2i86qRSpmtc6LEBX85insptGc= 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 1588951466249688.7312252025207; Fri, 8 May 2020 08:24:26 -0700 (PDT) Received: from localhost ([::1]:54144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4rQ-0007yV-Uo for importer@patchew.org; Fri, 08 May 2020 11:24:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lA-0005gS-I4 for qemu-devel@nongnu.org; Fri, 08 May 2020 11:17:56 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:40557) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4l9-0002r4-Jz for qemu-devel@nongnu.org; Fri, 08 May 2020 11:17:56 -0400 Received: by mail-pl1-x643.google.com with SMTP id t16so844274plo.7 for ; Fri, 08 May 2020 08:17:55 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.17.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:17:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/fduq7+z5S6wjChMKi9oJb/vmTzyRgenbcyuQtF0AWE=; b=kP9vfsS6mU+w+/s0cHojKrgYZX0+o6QqwSBs8wunPn1MvkbWx2387Cz4cDvLwauMap LBHILrwniX35YH5+itqWily8s7m51BF1PHCM2eSRs15TnXW/hTK19rfLjdlgAXdxJD5T XlI3g6uygR9ugyFmJz6W4tR1BI5jn7FTn2S/i51eOfvM8bdhf4amXiP7QNX6zi52xhvP GabF3XYSLjHhEFj4YZ3r0y7KyuNZcGxrn69Bd6sOyZxd3lh1JYKGQ+zn/mYgjgTA46uu v6FXauhDUW5UC4XuUknEU4jnzxhLbfXIqmoD7dpyjUzkPs5L2pE0eeTrqhuW7YBo2WyQ 1z5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/fduq7+z5S6wjChMKi9oJb/vmTzyRgenbcyuQtF0AWE=; b=PAWSsoG0jh/0U8UpQlBMXp2d46ZsIEoGWNYuK2WALBJtHKkRccHpNWp2DCCrku5U47 1UQ+ceroGQDVO3GoJnXJuwdIrRDPhMHsYjYSqARILESQo42h8EvjKvHkcoqWBm4+s7co 3MdFMnBohdQf9twYOdqAYE2UPtJCC/0u3UYA/x4/BFP3UkgJ/uhmoWBadcBpVLhRvsAm +brFLY8oDCOY6VYkx+0YB4Xe7hnqln0QFcQNK3QUx2kJtwhp9uB6XRc2lv+iUwTzeprz smOLbqqDKdoNHFZQ1nWgjIJC86ZplrhPhWG25YbMdNm+YrCsZ7BJWEvVWMhIdn4aBUKH 38Lw== X-Gm-Message-State: AGi0PuZ6F1xUcXwRvw2MrvrQAALqJMtwJI6Kc9sgLqrgjK/dad9aBN9A pD2GA8y4SrJdoDHWprJ0yG+5nzAZgYA= X-Google-Smtp-Source: APiQypJDjSCpIafh6/81aN+t0Bn+jtlPZ6co2pCf9FpSgDf2WRBoA/JjT/OvtpRZrOA0G3Q1rIFV/g== X-Received: by 2002:a17:90b:8c8:: with SMTP id ds8mr6546551pjb.164.1588951073860; Fri, 08 May 2020 08:17:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 04/19] tcg: Use tcg_constant_i32 with icount expander Date: Fri, 8 May 2020 08:17:32 -0700 Message-Id: <20200508151747.6166-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::643; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x643.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org 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 Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1588951446; cv=none; d=zohomail.com; s=zohoarc; b=ZGK4POKLwLoJTyk3pzW23GV00ZttHNTJxwIlbNea/Z3zo+0EZlni9VciwRnlCQMuMJPs/JU/QWFDaZbcERPl/h0bnRwceA4arq1/74/MMsEdEqTGfxcbVkcYqpr5iau11+SQAvjANsGgDnXLJobNt7rUYmzpPcbuWEalLohHpCE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951446; h=Content-Transfer-Encoding:Cc: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=0pFsWjjkSv/lNt2oB1g68LqNXC1gZCdXZXIDN+6WFDs=; b=K0rvtl40yQ3MGiYdpIl/y1Ypq1bY/0cSsyOIGPx+h+JL5T0pMXbHhzL3hJMquwJRrX5Co7YJ3ooOPJk3swxzIh89pnnqMl5PXDv2LM9eapSOD7Tc+8K2yDkCz9aEJvFHP1txsv1pZh5ET1BzPgWCeSJTnJPbrGgwZ5zTZDyu2GA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 15889514467361001.6036196754665; Fri, 8 May 2020 08:24:06 -0700 (PDT) Received: from localhost ([::1]:52266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4r7-00070r-Bz for importer@patchew.org; Fri, 08 May 2020 11:24:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lD-0005oI-6e for qemu-devel@nongnu.org; Fri, 08 May 2020 11:17:59 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:54356) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4lB-0002wW-CF for qemu-devel@nongnu.org; Fri, 08 May 2020 11:17:58 -0400 Received: by mail-pj1-x102c.google.com with SMTP id y6so4395853pjc.4 for ; Fri, 08 May 2020 08:17:56 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0pFsWjjkSv/lNt2oB1g68LqNXC1gZCdXZXIDN+6WFDs=; b=jy1sy8GtYFC2f90f8BbLlXuqogX0GLmbZk/AXXoRXTUSsf2sh00CcT1sbEL8dMY04I IXev9erHhtvIiTYrYt1v5KxvURy9r3an92fJgh07PIuMAcQMA0TRppYvtTFiCgFFdsPt dDqCp0mo+5/kzzPXNb+8aiu1iCSFyTmdvtT1hIsh0Tm5wcUvKbxsHpPRX/4c1+XHcLSH CweZuIOshB+yfWOvzhyvyhNnK51zI90pR8wjVrH5AlXXdyK8xqN1M7hEFZNDRaSOoWG5 zrOPsJIeOqpPziTFG2n61rluay8xl9QtHtFgeJUIwemLzepSNc57Te5XiwaLA2cFVpHQ xcIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0pFsWjjkSv/lNt2oB1g68LqNXC1gZCdXZXIDN+6WFDs=; b=Qrc7NpkzohuVV3kDigg2fjnOs/HCj9+vw4nWrc23y8+3JYk544FC8/gmuz1DQ0DKES 5demRHOeeN9mPai4vMJ/R0kvNe7gINrGx+s99FpO71xUrw2dhaMAoCich5L2J3INfa6M DBVPEBB07mbtEIAKzO1fWeZ1AW4jXBlsQpl/FeXAUhIi+V/qaVkw/Tz2wOFkcPQZgn2w gqvNxFoTiSUI2Bo/V7oE6qJsTnWfy29WUzoJD5utDVhkTnKJWvEc/j/O3X5fen8+YGUn 0+q9E7lDLRlsgXkKB1uj4THLGbz1FpzliSFKCVU3uJPQgk0vzD2DSDVWPErQxzQXQ7/i eZHQ== X-Gm-Message-State: AGi0PuaXdlvSe7WFYIG6Nbhizd006uRHqEhhwbDtx1r4XH9PEdFFoP2m YfbrDtOhSZejqoNDNsShx8TqBS2mFOY= X-Google-Smtp-Source: APiQypJv36KS5v2pd813O8+0drJC9myb4nPcMR4fT78sgDdB1mDUdR9fJu6K6pfey0E7by3WJz0a6Q== X-Received: by 2002:a17:902:7249:: with SMTP id c9mr2851304pll.23.1588951074985; Fri, 08 May 2020 08:17:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 05/19] tcg: Use tcg_constant_{i32, i64} with tcg int expanders Date: Fri, 8 May 2020 08:17:33 -0700 Message-Id: <20200508151747.6166-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 5abf17fecc..b4fba35e87 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 e60b74fb82..202d8057c5 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, int= 32_t 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, i= nt64_t 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 Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1588951393; cv=none; d=zohomail.com; s=zohoarc; b=Hb2G3VSHoBFvEDfSNzufBCulUdUPxzd7V7xrvwh+9IoDuhDsqBpyWRNN9PrG3T681f4Keo0Qds7hFqIA1hNK5NXNudXg+cF2W5NSLyqWVnJ/94NfQ3lWmAl6B4ib3yiStD5eUtmj77jsGhO3Z9BP5799i8cf6UTebSRzgKT2F10= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951393; h=Content-Transfer-Encoding:Cc: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=Ffqmtu5anvlOz3MWFAh7dIs6kb9n+nAaQuOqSU6gXKY=; b=K8r20LHijl6tt2xqqyjwyFhC1NahwvWS7h2CRa4dFwm5D9Xy1foWbx+yh3W8Fnd3Fv4Zs5GVGlOPVKTLujDTpL7MdBF6jZcSOvSCo9FD9vfqVfSWt3hpMlW7fxMdQQzs10IaRp3aZNBagTaJ7CoO2COuuhQY/d/x+alFi7tLWQE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1588951393927518.2727968387784; Fri, 8 May 2020 08:23:13 -0700 (PDT) Received: from localhost ([::1]:48020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4qG-0004X6-Ic for importer@patchew.org; Fri, 08 May 2020 11:23:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lD-0005pd-Ml for qemu-devel@nongnu.org; Fri, 08 May 2020 11:17:59 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:37643) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4lC-0002wt-60 for qemu-devel@nongnu.org; Fri, 08 May 2020 11:17:59 -0400 Received: by mail-pg1-x543.google.com with SMTP id f23so325091pgj.4 for ; Fri, 08 May 2020 08:17:57 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:17:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ffqmtu5anvlOz3MWFAh7dIs6kb9n+nAaQuOqSU6gXKY=; b=H8lepMkFtyYuig0Ha4WofilcUgYKipB94ksuMV38Mtl1ERYPI+QHvtLR05xvDPGG4j X6cB8yP73TM0WJ6gqYb6HBC8r/BLmI8s20axvYzMVkWiygtpK9y3iG7w20mX4UfIN3Ne zOxH/c7fiBghvign72EGgZeKqKh4ANS12Bb7t0FeSaF4k0q+Z+lEqZsA6lW0jBJkLdoH Kb3eGlB3UU6aDQ/iRGiro5YhxRpSkkn4blC9QN5SfL8tQyThOdH4A1VKJiAGOpC5ygxR W7nZjks+FEtCBdSl1+THHuELDteFUoM8Km/cxgL87spRZLOs2n1eyBLltCqBHk802iYf AOTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ffqmtu5anvlOz3MWFAh7dIs6kb9n+nAaQuOqSU6gXKY=; b=tqZqPdhcmrJR9OH/5GKFGgNm3ubXOkZiFh8o41S3pl3S9IicWIrWl9d49ARA4IQvPR 4V32i94eJwtIan/xPGgHYFem3lgsflUSgbJdORhycvF5zUkH5OTKyx1aIXKorO8xWTi9 RiO89Hfq8kcPnzfZ2zhn88Lwh3hcLKsFmR2kImvDlT8AVh0GSnz/sflYaO1tzB04FUIP h0NbCkPvMTaOjoku2QN8TKZWAcpLfi53GEIdjqngnYp4pe9VIXz9KQi/8+eLTfqwrP5o u4ZVxl/+N4e3SXn/c7WO1TSDTJn1hyjWcuyzC+3zmrY2LLyqfpTuPSmHbUQ53JLyhyGX uy0A== X-Gm-Message-State: AGi0PuZ5Lg2bdHhfuShn0+b03hniI5062vH7rUj/ZG0T4LvI0j5XRDOd F36x8Qlk40iva9Kpjh6iHXfSVMhzFJU= X-Google-Smtp-Source: APiQypKSmqaurpt6kTXYRIP5tp3oXcA604KOjm/+tE2uJhTxL1QMl1MBlW/8JGihgnj9Vkws1KD7Dg== X-Received: by 2002:a62:1985:: with SMTP id 127mr3218752pfz.175.1588951076362; Fri, 08 May 2020 08:17:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 06/19] tcg: Use tcg_constant_{i32, vec} with tcg vec expanders Date: Fri, 8 May 2020 08:17:34 -0700 Message-Id: <20200508151747.6166-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::543; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x543.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 43101defe4..0e3e80a612 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 Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1588951659; cv=none; d=zohomail.com; s=zohoarc; b=Z/lHjGdAi6v0WaOmFgjhbnlVXBMjbP7UnxGAKMb5ps9qoMNDUqAgPj7t4Nna6ZLV2BNIyU1zsHqXUJFokB0xRVU+FiaBzEbMBEGolbAItp0BkubNPV1b8+cDcZD9phoZQEuQkFZeuTBwXJxj3DrT1drICrHDRFTsoTX83Ahl3Mc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951659; h=Content-Transfer-Encoding:Cc: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=xmadSpOQwsQc/jlcXZb4SKOmMYrqNW8ASv1JO/0wGNg=; b=Ki/eEeCh9VffwZnnAwGPoDbLuPU+2ZeloJDCEeKUjHY3z2t7DWSQrSlLE7ya5ly96Fm+9DIdufJPMWLprwH0GSFZf+un16gPr1cohbY9EeFWX5QPI2oKOWJgAtqylWWyg6nW2DibUVTAL3J8cm+I6Xr1ff6KWN/K1qR3Epnun/Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1588951659204986.2283298412517; Fri, 8 May 2020 08:27:39 -0700 (PDT) Received: from localhost ([::1]:34662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4uX-0004Fh-Sv for importer@patchew.org; Fri, 08 May 2020 11:27:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lF-0005tO-6z for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:01 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:45475) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4lD-0002xO-KB for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:00 -0400 Received: by mail-pg1-x542.google.com with SMTP id s18so978863pgl.12 for ; Fri, 08 May 2020 08:17:59 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.17.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xmadSpOQwsQc/jlcXZb4SKOmMYrqNW8ASv1JO/0wGNg=; b=T5iJ1cP5PMVadSWIkoCPtfWXr0yVyosnDbaOQHn6mVVizdKt0pbii4ekq7O5sCir0M Cwd+WQ61iIDLTWDOnvP17bTDuQX8fo59YPmv0nDbjaBOHDTTFRtndnjcRCUKYUJYhd3F xtEfaD5KHeVGxIQ5PfieCRXy7DYLLXNymKDG5WzOxOWo8ci1HNnEAiSXVSu4bZI5Zh+z BS4EjUYD+Lg/w+nLzG2f8bYBCnvfggTJIj/q6MXzeqgzkmYgNYEzPCJpwcJmVcKplZSQ ye7pUnyqAnnj9RchgB90xEAc/mpdYtjvl2EUp52jKsUw/QkBBm93kWc/qOjDZWdTBjwe 8iLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xmadSpOQwsQc/jlcXZb4SKOmMYrqNW8ASv1JO/0wGNg=; b=J4byhUYGLnP5X9iZeRmNDMoXFHqoisNFlxFTCmWo9RG4pO8iQtvikHVdtB5S5rwTt4 Va4hPUGltZg6mpEsSSy6mPN/0Td3Yt/za17ao9s4YfVH/dCb1PLR3RN6ScVX80EcICnz xVuQaIsjIiuQkowe8KFIpsRFiSjOhU9IcrnfG7zpbi36C/ES0P7aGkdAIjWLKbQpn0N+ b8dqXLcIr55zJQ7MwGLQE6aifajOkf/WRsZv5VgiyIcCJHdoW6m5m8eoqZjoi+dDXugo M1fyKpQAVbh2ApBE6CDVayNuBERFY+reBCN8CA198pdPRN5eX5+GfxD8/i76tcczZS38 6LOg== X-Gm-Message-State: AGi0PuZuN0PD7zIybNxdoBUsKzMVFqi9Hra9Pi13/qDPEPK+p8LsXW3q Xr7GbYdhmGtgDcdNED0buVbx0Pi0ehg= X-Google-Smtp-Source: APiQypLc2QN1jAXwWjYVy1j/tzyTEAvUnwAivAF/adEL1x95TDDNClydSGDQTSlmgpq5B82L2JoUMA== X-Received: by 2002:a62:dbc2:: with SMTP id f185mr3320223pfg.65.1588951077533; Fri, 08 May 2020 08:17:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 07/19] tcg: Use tcg_constant_{i32, i64, vec} with tcg gvec expanders Date: Fri, 8 May 2020 08:17:35 -0700 Message-Id: <20200508151747.6166-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::542; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x542.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- tcg/tcg-op-gvec.c | 125 +++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 75 deletions(-) diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 3707c0effb..8ecaf4d67e 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -96,7 +96,7 @@ void tcg_gen_gvec_2_ool(uint32_t dofs, uint32_t aofs, gen_helper_gvec_2 *fn) { TCGv_ptr a0, a1; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -108,7 +108,6 @@ void tcg_gen_gvec_2_ool(uint32_t dofs, uint32_t aofs, =20 tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); - tcg_temp_free_i32(desc); } =20 /* Generate a call to a gvec-style helper with two vector operands @@ -118,7 +117,7 @@ void tcg_gen_gvec_2i_ool(uint32_t dofs, uint32_t aofs, = TCGv_i64 c, gen_helper_gvec_2i *fn) { TCGv_ptr a0, a1; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -130,7 +129,6 @@ void tcg_gen_gvec_2i_ool(uint32_t dofs, uint32_t aofs, = TCGv_i64 c, =20 tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); - tcg_temp_free_i32(desc); } =20 /* Generate a call to a gvec-style helper with three vector operands. */ @@ -139,7 +137,7 @@ void tcg_gen_gvec_3_ool(uint32_t dofs, uint32_t aofs, u= int32_t bofs, gen_helper_gvec_3 *fn) { TCGv_ptr a0, a1, a2; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -154,7 +152,6 @@ void tcg_gen_gvec_3_ool(uint32_t dofs, uint32_t aofs, u= int32_t bofs, tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); tcg_temp_free_ptr(a2); - tcg_temp_free_i32(desc); } =20 /* Generate a call to a gvec-style helper with four vector operands. */ @@ -163,7 +160,7 @@ void tcg_gen_gvec_4_ool(uint32_t dofs, uint32_t aofs, u= int32_t bofs, int32_t data, gen_helper_gvec_4 *fn) { TCGv_ptr a0, a1, a2, a3; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -181,7 +178,6 @@ void tcg_gen_gvec_4_ool(uint32_t dofs, uint32_t aofs, u= int32_t bofs, tcg_temp_free_ptr(a1); tcg_temp_free_ptr(a2); tcg_temp_free_ptr(a3); - tcg_temp_free_i32(desc); } =20 /* Generate a call to a gvec-style helper with five vector operands. */ @@ -190,7 +186,7 @@ void tcg_gen_gvec_5_ool(uint32_t dofs, uint32_t aofs, u= int32_t bofs, uint32_t maxsz, int32_t data, gen_helper_gvec_5 *f= n) { TCGv_ptr a0, a1, a2, a3, a4; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -211,7 +207,6 @@ void tcg_gen_gvec_5_ool(uint32_t dofs, uint32_t aofs, u= int32_t bofs, tcg_temp_free_ptr(a2); tcg_temp_free_ptr(a3); tcg_temp_free_ptr(a4); - tcg_temp_free_i32(desc); } =20 /* Generate a call to a gvec-style helper with three vector operands @@ -221,7 +216,7 @@ void tcg_gen_gvec_2_ptr(uint32_t dofs, uint32_t aofs, int32_t data, gen_helper_gvec_2_ptr *fn) { TCGv_ptr a0, a1; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -233,7 +228,6 @@ void tcg_gen_gvec_2_ptr(uint32_t dofs, uint32_t aofs, =20 tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); - tcg_temp_free_i32(desc); } =20 /* Generate a call to a gvec-style helper with three vector operands @@ -243,7 +237,7 @@ void tcg_gen_gvec_3_ptr(uint32_t dofs, uint32_t aofs, u= int32_t bofs, int32_t data, gen_helper_gvec_3_ptr *fn) { TCGv_ptr a0, a1, a2; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -258,7 +252,6 @@ void tcg_gen_gvec_3_ptr(uint32_t dofs, uint32_t aofs, u= int32_t bofs, tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); tcg_temp_free_ptr(a2); - tcg_temp_free_i32(desc); } =20 /* Generate a call to a gvec-style helper with four vector operands @@ -269,7 +262,7 @@ void tcg_gen_gvec_4_ptr(uint32_t dofs, uint32_t aofs, u= int32_t bofs, gen_helper_gvec_4_ptr *fn) { TCGv_ptr a0, a1, a2, a3; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -287,7 +280,6 @@ void tcg_gen_gvec_4_ptr(uint32_t dofs, uint32_t aofs, u= int32_t bofs, tcg_temp_free_ptr(a1); tcg_temp_free_ptr(a2); tcg_temp_free_ptr(a3); - tcg_temp_free_i32(desc); } =20 /* Generate a call to a gvec-style helper with five vector operands @@ -298,7 +290,7 @@ void tcg_gen_gvec_5_ptr(uint32_t dofs, uint32_t aofs, u= int32_t bofs, gen_helper_gvec_5_ptr *fn) { TCGv_ptr a0, a1, a2, a3, a4; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -319,7 +311,6 @@ void tcg_gen_gvec_5_ptr(uint32_t dofs, uint32_t aofs, u= int32_t bofs, tcg_temp_free_ptr(a2); tcg_temp_free_ptr(a3); tcg_temp_free_ptr(a4); - tcg_temp_free_i32(desc); } =20 /* Return true if we want to implement something of OPRSZ bytes @@ -609,16 +600,13 @@ static void do_dup(unsigned vece, uint32_t dofs, uint= 32_t oprsz, /* Otherwise implement out of line. */ t_ptr =3D tcg_temp_new_ptr(); tcg_gen_addi_ptr(t_ptr, cpu_env, dofs); - t_desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, 0)); + t_desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, 0)); =20 if (vece =3D=3D MO_64) { - if (in_64) { - gen_helper_gvec_dup64(t_ptr, t_desc, in_64); - } else { - t_64 =3D tcg_const_i64(in_c); - gen_helper_gvec_dup64(t_ptr, t_desc, t_64); - tcg_temp_free_i64(t_64); + if (!in_64) { + in_64 =3D tcg_constant_i64(in_c); } + gen_helper_gvec_dup64(t_ptr, t_desc, in_64); } else { typedef void dup_fn(TCGv_ptr, TCGv_i32, TCGv_i32); static dup_fn * const fns[3] =3D { @@ -646,7 +634,6 @@ static void do_dup(unsigned vece, uint32_t dofs, uint32= _t oprsz, } =20 tcg_temp_free_ptr(t_ptr); - tcg_temp_free_i32(t_desc); return; =20 done: @@ -1196,10 +1183,8 @@ void tcg_gen_gvec_2i(uint32_t dofs, uint32_t aofs, u= int32_t oprsz, if (g->fno) { tcg_gen_gvec_2_ool(dofs, aofs, oprsz, maxsz, c, g->fno); } else { - TCGv_i64 tcg_c =3D tcg_const_i64(c); - tcg_gen_gvec_2i_ool(dofs, aofs, tcg_c, oprsz, - maxsz, c, g->fnoi); - tcg_temp_free_i64(tcg_c); + tcg_gen_gvec_2i_ool(dofs, aofs, tcg_constant_i64(c), + oprsz, maxsz, 0, g->fnoi); } oprsz =3D maxsz; } @@ -1647,16 +1632,14 @@ static void gen_addv_mask(TCGv_i64 d, TCGv_i64 a, T= CGv_i64 b, TCGv_i64 m) =20 void tcg_gen_vec_add8_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 m =3D tcg_const_i64(dup_const(MO_8, 0x80)); + TCGv_i64 m =3D tcg_constant_i64(dup_const(MO_8, 0x80)); gen_addv_mask(d, a, b, m); - tcg_temp_free_i64(m); } =20 void tcg_gen_vec_add16_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 m =3D tcg_const_i64(dup_const(MO_16, 0x8000)); + TCGv_i64 m =3D tcg_constant_i64(dup_const(MO_16, 0x8000)); gen_addv_mask(d, a, b, m); - tcg_temp_free_i64(m); } =20 void tcg_gen_vec_add32_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) @@ -1740,9 +1723,8 @@ void tcg_gen_gvec_adds(unsigned vece, uint32_t dofs, = uint32_t aofs, void tcg_gen_gvec_addi(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t c, uint32_t oprsz, uint32_t maxsz) { - TCGv_i64 tmp =3D tcg_const_i64(c); + TCGv_i64 tmp =3D tcg_constant_i64(c); tcg_gen_gvec_adds(vece, dofs, aofs, tmp, oprsz, maxsz); - tcg_temp_free_i64(tmp); } =20 static const TCGOpcode vecop_list_sub[] =3D { INDEX_op_sub_vec, 0 }; @@ -1800,16 +1782,14 @@ static void gen_subv_mask(TCGv_i64 d, TCGv_i64 a, T= CGv_i64 b, TCGv_i64 m) =20 void tcg_gen_vec_sub8_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 m =3D tcg_const_i64(dup_const(MO_8, 0x80)); + TCGv_i64 m =3D tcg_constant_i64(dup_const(MO_8, 0x80)); gen_subv_mask(d, a, b, m); - tcg_temp_free_i64(m); } =20 void tcg_gen_vec_sub16_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 m =3D tcg_const_i64(dup_const(MO_16, 0x8000)); + TCGv_i64 m =3D tcg_constant_i64(dup_const(MO_16, 0x8000)); gen_subv_mask(d, a, b, m); - tcg_temp_free_i64(m); } =20 void tcg_gen_vec_sub32_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) @@ -1920,9 +1900,8 @@ void tcg_gen_gvec_muls(unsigned vece, uint32_t dofs, = uint32_t aofs, void tcg_gen_gvec_muli(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t c, uint32_t oprsz, uint32_t maxsz) { - TCGv_i64 tmp =3D tcg_const_i64(c); + TCGv_i64 tmp =3D tcg_constant_i64(c); tcg_gen_gvec_muls(vece, dofs, aofs, tmp, oprsz, maxsz); - tcg_temp_free_i64(tmp); } =20 void tcg_gen_gvec_ssadd(unsigned vece, uint32_t dofs, uint32_t aofs, @@ -1979,18 +1958,16 @@ void tcg_gen_gvec_sssub(unsigned vece, uint32_t dof= s, uint32_t aofs, =20 static void tcg_gen_usadd_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) { - TCGv_i32 max =3D tcg_const_i32(-1); + TCGv_i32 max =3D tcg_constant_i32(-1); tcg_gen_add_i32(d, a, b); tcg_gen_movcond_i32(TCG_COND_LTU, d, d, a, max, d); - tcg_temp_free_i32(max); } =20 static void tcg_gen_usadd_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 max =3D tcg_const_i64(-1); + TCGv_i64 max =3D tcg_constant_i64(-1); tcg_gen_add_i64(d, a, b); tcg_gen_movcond_i64(TCG_COND_LTU, d, d, a, max, d); - tcg_temp_free_i64(max); } =20 void tcg_gen_gvec_usadd(unsigned vece, uint32_t dofs, uint32_t aofs, @@ -2023,18 +2000,16 @@ void tcg_gen_gvec_usadd(unsigned vece, uint32_t dof= s, uint32_t aofs, =20 static void tcg_gen_ussub_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) { - TCGv_i32 min =3D tcg_const_i32(0); + TCGv_i32 min =3D tcg_constant_i32(0); tcg_gen_sub_i32(d, a, b); tcg_gen_movcond_i32(TCG_COND_LTU, d, a, b, min, d); - tcg_temp_free_i32(min); } =20 static void tcg_gen_ussub_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 min =3D tcg_const_i64(0); + TCGv_i64 min =3D tcg_constant_i64(0); tcg_gen_sub_i64(d, a, b); tcg_gen_movcond_i64(TCG_COND_LTU, d, a, b, min, d); - tcg_temp_free_i64(min); } =20 void tcg_gen_gvec_ussub(unsigned vece, uint32_t dofs, uint32_t aofs, @@ -2195,16 +2170,14 @@ static void gen_negv_mask(TCGv_i64 d, TCGv_i64 b, T= CGv_i64 m) =20 void tcg_gen_vec_neg8_i64(TCGv_i64 d, TCGv_i64 b) { - TCGv_i64 m =3D tcg_const_i64(dup_const(MO_8, 0x80)); + TCGv_i64 m =3D tcg_constant_i64(dup_const(MO_8, 0x80)); gen_negv_mask(d, b, m); - tcg_temp_free_i64(m); } =20 void tcg_gen_vec_neg16_i64(TCGv_i64 d, TCGv_i64 b) { - TCGv_i64 m =3D tcg_const_i64(dup_const(MO_16, 0x8000)); + TCGv_i64 m =3D tcg_constant_i64(dup_const(MO_16, 0x8000)); gen_negv_mask(d, b, m); - tcg_temp_free_i64(m); } =20 void tcg_gen_vec_neg32_i64(TCGv_i64 d, TCGv_i64 b) @@ -2472,9 +2445,8 @@ void tcg_gen_gvec_ands(unsigned vece, uint32_t dofs, = uint32_t aofs, void tcg_gen_gvec_andi(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t c, uint32_t oprsz, uint32_t maxsz) { - TCGv_i64 tmp =3D tcg_const_i64(dup_const(vece, c)); + TCGv_i64 tmp =3D tcg_constant_i64(dup_const(vece, c)); tcg_gen_gvec_2s(dofs, aofs, oprsz, maxsz, tmp, &gop_ands); - tcg_temp_free_i64(tmp); } =20 static const GVecGen2s gop_xors =3D { @@ -2497,9 +2469,8 @@ void tcg_gen_gvec_xors(unsigned vece, uint32_t dofs, = uint32_t aofs, void tcg_gen_gvec_xori(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t c, uint32_t oprsz, uint32_t maxsz) { - TCGv_i64 tmp =3D tcg_const_i64(dup_const(vece, c)); + TCGv_i64 tmp =3D tcg_constant_i64(dup_const(vece, c)); tcg_gen_gvec_2s(dofs, aofs, oprsz, maxsz, tmp, &gop_xors); - tcg_temp_free_i64(tmp); } =20 static const GVecGen2s gop_ors =3D { @@ -2522,9 +2493,8 @@ void tcg_gen_gvec_ors(unsigned vece, uint32_t dofs, u= int32_t aofs, void tcg_gen_gvec_ori(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t c, uint32_t oprsz, uint32_t maxsz) { - TCGv_i64 tmp =3D tcg_const_i64(dup_const(vece, c)); + TCGv_i64 tmp =3D tcg_constant_i64(dup_const(vece, c)); tcg_gen_gvec_2s(dofs, aofs, oprsz, maxsz, tmp, &gop_ors); - tcg_temp_free_i64(tmp); } =20 void tcg_gen_vec_shl8i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c) @@ -3011,10 +2981,11 @@ void tcg_gen_gvec_rotls(unsigned vece, uint32_t dof= s, uint32_t aofs, static void tcg_gen_shlv_mod_vec(unsigned vece, TCGv_vec d, TCGv_vec a, TCGv_vec b) { - TCGv_vec t =3D tcg_temp_new_vec_matching(d); + TCGType type =3D tcgv_vec_temp(d)->type; + TCGv_vec t =3D tcg_temp_new_vec(type); + TCGv_vec m =3D tcg_constant_vec(type, vece, (8 << vece) - 1); =20 - tcg_gen_dupi_vec(vece, t, (8 << vece) - 1); - tcg_gen_and_vec(vece, t, t, b); + tcg_gen_and_vec(vece, t, b, m); tcg_gen_shlv_vec(vece, d, a, t); tcg_temp_free_vec(t); } @@ -3074,10 +3045,11 @@ void tcg_gen_gvec_shlv(unsigned vece, uint32_t dofs= , uint32_t aofs, static void tcg_gen_shrv_mod_vec(unsigned vece, TCGv_vec d, TCGv_vec a, TCGv_vec b) { - TCGv_vec t =3D tcg_temp_new_vec_matching(d); + TCGType type =3D tcgv_vec_temp(d)->type; + TCGv_vec t =3D tcg_temp_new_vec(type); + TCGv_vec m =3D tcg_constant_vec(type, vece, (8 << vece) - 1); =20 - tcg_gen_dupi_vec(vece, t, (8 << vece) - 1); - tcg_gen_and_vec(vece, t, t, b); + tcg_gen_and_vec(vece, t, b, m); tcg_gen_shrv_vec(vece, d, a, t); tcg_temp_free_vec(t); } @@ -3137,10 +3109,11 @@ void tcg_gen_gvec_shrv(unsigned vece, uint32_t dofs= , uint32_t aofs, static void tcg_gen_sarv_mod_vec(unsigned vece, TCGv_vec d, TCGv_vec a, TCGv_vec b) { - TCGv_vec t =3D tcg_temp_new_vec_matching(d); + TCGType type =3D tcgv_vec_temp(d)->type; + TCGv_vec t =3D tcg_temp_new_vec(type); + TCGv_vec m =3D tcg_constant_vec(type, vece, (8 << vece) - 1); =20 - tcg_gen_dupi_vec(vece, t, (8 << vece) - 1); - tcg_gen_and_vec(vece, t, t, b); + tcg_gen_and_vec(vece, t, b, m); tcg_gen_sarv_vec(vece, d, a, t); tcg_temp_free_vec(t); } @@ -3200,10 +3173,11 @@ void tcg_gen_gvec_sarv(unsigned vece, uint32_t dofs= , uint32_t aofs, static void tcg_gen_rotlv_mod_vec(unsigned vece, TCGv_vec d, TCGv_vec a, TCGv_vec b) { - TCGv_vec t =3D tcg_temp_new_vec_matching(d); + TCGType type =3D tcgv_vec_temp(d)->type; + TCGv_vec t =3D tcg_temp_new_vec(type); + TCGv_vec m =3D tcg_constant_vec(type, vece, (8 << vece) - 1); =20 - tcg_gen_dupi_vec(vece, t, (8 << vece) - 1); - tcg_gen_and_vec(vece, t, t, b); + tcg_gen_and_vec(vece, t, b, m); tcg_gen_rotlv_vec(vece, d, a, t); tcg_temp_free_vec(t); } @@ -3259,10 +3233,11 @@ void tcg_gen_gvec_rotlv(unsigned vece, uint32_t dof= s, uint32_t aofs, static void tcg_gen_rotrv_mod_vec(unsigned vece, TCGv_vec d, TCGv_vec a, TCGv_vec b) { - TCGv_vec t =3D tcg_temp_new_vec_matching(d); + TCGType type =3D tcgv_vec_temp(d)->type; + TCGv_vec t =3D tcg_temp_new_vec(type); + TCGv_vec m =3D tcg_constant_vec(type, vece, (8 << vece) - 1); =20 - tcg_gen_dupi_vec(vece, t, (8 << vece) - 1); - tcg_gen_and_vec(vece, t, t, b); + tcg_gen_and_vec(vece, t, b, m); tcg_gen_rotrv_vec(vece, d, a, t); tcg_temp_free_vec(t); } --=20 2.20.1 From nobody Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.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=1588951513; cv=none; d=zohomail.com; s=zohoarc; b=fNjmv+G8KvCj9h4kL9RbyuJ6EugAm2sdLhTh1cJQFRZIgZ6x1LjVm/lZqbFRMX4z7iTEFc2Cw11BWUVJcfRHRmZq3tl5lH1lXk1h3pYcGG/KMOLHCNOZL7C0mWTN5XL0n+wDAFPeQP/A8papRFZGQ8KeBACoH/E2VMFqjEdty1w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951513; h=Content-Transfer-Encoding:Cc: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=Ku9G+6NJ7okGCIRcxLcW6SaUROENd5XjefssqKSS9DYNviIHG4pAK3+8UHNP5L4donqmuCvYmCAdAkxkA7HGRM4JB9nE0RzfoCu0y6utmGvmFzsT1j4PqSSHfSetAiGHZ3LHAaQonPXT4yfhts68sZSDeDbx9jBS8YQpGVTIuUQ= 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 1588951513550939.2705993928714; Fri, 8 May 2020 08:25:13 -0700 (PDT) Received: from localhost ([::1]:56582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4sC-0000r2-B6 for importer@patchew.org; Fri, 08 May 2020 11:25:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lG-0005x5-Hr for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:02 -0400 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:52941) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4lE-0002yL-9X for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:02 -0400 Received: by mail-pj1-x1043.google.com with SMTP id a5so4398688pjh.2 for ; Fri, 08 May 2020 08:17:59 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.17.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:17:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UBTvpXnQhX/NB3BncFrtFDo86VAuYzf/XHrJqnCZIJI=; b=TnCj1xMJY4IE2Ybc4amV58DvRB4eizBZO6b2h7x++IVoMj4Y9hIEQWhJFXYDrBrBZE p4wOc5+N0tiV+MJxEEPp1BO87fQqDtNdGIRgCKyI/8Y5zHnDxYpVaoMyCONp0x2gUmm0 U0wMxZnSZzRyuVJ9VbV//3xkBb08Vd1KrGOBCmdDk5Swb8wJduWj5X2bz+4mIfHyR3Rs vGvN51Xz1nMt6omnXm3BOaD+yPIKX9X1tLZF31XOPt6RYHwHmv/hW+t1y39AsnIkADLd JhmMkQXj4LC+mZ1k39DUFtAzE7/tAloOlt0BzI10LtyEbDtJu+B15pZk4wrrdUpnEyJ+ 6Q/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UBTvpXnQhX/NB3BncFrtFDo86VAuYzf/XHrJqnCZIJI=; b=Dqho/z98CH6xfcEC1Wspv9SpOojM0dQFNlSa4baONUdJePvFS1sdsigTj85Xaz199Y UFNtgDq9TumRpRC7Q/etiWnrLYbeNUJmxG1NjxzmoB6wzXSG6Ri4QG2kg3x8h/zoNDoh eYO0KtTJ3JvcI96PIRpgGCMZBOXAUNE1gyLw2ARCa5KmmoiRNK4KNNupyhPchnjQf1et 9rJNayNqeYlAf2FFnr/erxBD77QOjNCNdpdM+xQ0CVRd5slJ6/3mvv5cThVhx4Q6N94h Xsn5lGjChyGlXK8w2bGF5ExIfGJUGmfLgsJubAZ4edabZ4pQjAIqC04WZGaT/azOT+GC FQSw== X-Gm-Message-State: AGi0Pub6XGFA5pKM9BLjweEXgGO2jRucZIDoXqXVCj1dX0snLXnfC3JW igjJs81hqp963WYYBCvHMJZ7nBgVjto= X-Google-Smtp-Source: APiQypLM+qPjyGq3+0x+QjP1ZPxZgoTBJBBQm1X60QjHByiwE0TGh2m54v64KXkoJiNwjy40J4+t7g== X-Received: by 2002:a17:902:bd87:: with SMTP id q7mr2944156pls.92.1588951078580; Fri, 08 May 2020 08:17:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 08/19] tcg: Use tcg_constant_{i32,i64} with tcg plugins Date: Fri, 8 May 2020 08:17:36 -0700 Message-Id: <20200508151747.6166-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::1043; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1043.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org 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 Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.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=1588951692; cv=none; d=zohomail.com; s=zohoarc; b=Bwcegl6CbgD3ld1IXlM6A3IM+XXTDwqDsGi5fgU70wDJs7C/fhVL2i/A/FD7uhKqh4gp4jEgCQKUmrjQrnNI2eG/mBpeQYawwxdNM5NU5XLC6qFI2vt0nzl6oAmZUOR+5S33wUwgclpLfW4J/BucNdBziTdfUUuiTwQRy+k5lpg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951692; h=Content-Type:Content-Transfer-Encoding:Cc: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=s8VXXHi1iDtHYGhbceKG3FGqG6XMQ3ZwJ4s4y4ornzs=; b=Hhtsfn/1k7S39op13r8IkPdiApHGnkJDCNpgNyDiLZl/5+NVWAOL0WEXS853akvSmDEd7dPYAUaghPHOvRUUjOdCA0H3ZFq696WKF4uHLX2nRiyV0jhmtZVCpZyGyz/diOSge992d7HYVbZOGqbWHpdRHaf6Kwk84bw/6KbAP98= 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 1588951692372369.2629022956165; Fri, 8 May 2020 08:28:12 -0700 (PDT) Received: from localhost ([::1]:36974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4v5-0005LL-0O for importer@patchew.org; Fri, 08 May 2020 11:28:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lG-0005xr-R0 for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:02 -0400 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]:51445) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4lF-00030H-KB for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:02 -0400 Received: by mail-pj1-x1044.google.com with SMTP id mq3so4401792pjb.1 for ; Fri, 08 May 2020 08:18:01 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.17.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s8VXXHi1iDtHYGhbceKG3FGqG6XMQ3ZwJ4s4y4ornzs=; b=O5WlKMK+lw2xqLMfEROonr49PfT0cYPUmoGIrRn4GqMGdOt4PnMTilb2/XRfQBlSjR TjNFlKdTvCJGSVqhdU904I7GgnK0O6SECzZPGFHssQxODM7sBrBSqetArlX9qz9ZqVtn Exe/UjC7KT3Z5h5K9pW6HF9q6vdD8O7GUTVN/5ackxHTBhZU6ie4RpMX7tWcjjUGu6iW CqZEYiYX6QduyPjUojrco5/r+Q9/e6v6VTgRN4d/g3z9YE5vuYzYPK2/WtxPCggRkIsT NSGKdX7FfYf6G5CglXn6Sy+NlS0SHkumzO7VOz1moXJMFQYTuz3YX6MPbopY7FZnduMA UN/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s8VXXHi1iDtHYGhbceKG3FGqG6XMQ3ZwJ4s4y4ornzs=; b=bqcfkEY4uku8nBoqapPp9EsphlzO8EiDsAT4wriuPlrylGlVCMb/O+S6aqNy5mcBkS LzH7uaL4Wah03W93q5hIEp4dhW9gdFJ+xDWfx8Eygv/gClEwi9If3syZftoVwb9E2mDJ 1M/Y06MI4xoqiBqKY30TPhIBj2/cEFgwup0TjbrKySIazw7qsFQe27JGqfF77yes5C6S Wl3qUJIrkeGrHTfzdQlFgpkC+5MSk+uKX4Am+tBAqxgJRWA9e58VePu/EpsfoIMA2OzX PWnlc+R9X2x7YJUlN7ttj+bhBBX52fLg8NHoD6GS/jeouTxzFPJJ1Olh662OUvzGEjkF mTsw== X-Gm-Message-State: AGi0PuYhHOoiJdzQTcfA7dh+aRpjoOFlhnOOFlMaEmaHbOZ00oNMT/1c DzB9tSrCYQhgzAPlKtjELRZjSqmxzKw= X-Google-Smtp-Source: APiQypKfrkchL+nNHy6BayCNs8DXrYZnvq4A41dU+1VKNnpE5LOVnfAZjEELnYtQ1qa46ApF+mvIuA== X-Received: by 2002:a17:90a:8c8e:: with SMTP id b14mr2356897pjo.222.1588951079874; Fri, 08 May 2020 08:17:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 09/19] tcg: Rename struct tcg_temp_info to TempOptInfo Date: Fri, 8 May 2020 08:17:37 -0700 Message-Id: <20200508151747.6166-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::1044; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1044.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Fix this name vs our coding style. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/optimize.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 8f3bd99ff4..c0fc5e3da6 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)); @@ -180,7 +180,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) { @@ -211,8 +211,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 @@ -245,7 +245,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; @@ -608,7 +608,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. @@ -619,7 +619,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 Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.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=1588951586; cv=none; d=zohomail.com; s=zohoarc; b=CBT+8Tr1ohb1wy1BhtbH5PfwWetQWyth7skqhWTmKTGuzx4w7qVSqmiCyAhR36vkTv1+xFjekyqJoW1vJy2y4mSaruUFH6mYmwCsjeAJeoUjmWgAjppj0QANP2fej/13mrZydLTaS80cShXhjX5SgXtwmlESZyOrWtggJteYFAw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951586; h=Content-Transfer-Encoding:Cc: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=hO8uxZGqqMIyQAAAtWPOJL9YxJXzGDQrOpnZTatzOw0=; b=L433LwqkXU8R9j8+xgoAuhqXUEDbEyt6Di2SWBmSTW4vjedipdnaGVmoN1ZfhmcQj7MWjkf7xE/SbisOy/eTEXeRcAGrkWOQj8DyZT7IGN2LIZ6A0JX/CDCWrW48JV/iodGw0ajs/BLs42blxHxXQgCPimGDNFVsG886g+Qx4Yc= 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 1588951586728722.7358577487668; Fri, 8 May 2020 08:26:26 -0700 (PDT) Received: from localhost ([::1]:60994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4tN-0003Ms-E3 for importer@patchew.org; Fri, 08 May 2020 11:26:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lH-000606-ME for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:03 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:34385) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4lG-00030k-SI for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:03 -0400 Received: by mail-pl1-x641.google.com with SMTP id s10so856381plr.1 for ; Fri, 08 May 2020 08:18:02 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.17.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:18:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hO8uxZGqqMIyQAAAtWPOJL9YxJXzGDQrOpnZTatzOw0=; b=NS7bJjktqhtzL1PkdRflvGXj5byWneMK4Ci4yARbZqfpjAPo74JVSS5ohOsga9MzHc t+YZw/BbQ3Vv0vi+mit349W0AgRuY/ZlQ7pgnzK2waUoXIkogl2H7VW6JC6yaNkf7vIy csacwc5sAeggkfjyiwPSWV4MIIfA3TUq8JhBurHdEZ+b0GKVKBkSA7LheBeCT/cUzbu4 ebblC92Dm9/U6Od7gofN3+6We1zfcOfrS/ouR+9EcXNYd48rGS7Z6aa9jKeyIFa9FTQ4 i4jxdCgZoScSXGYuiJEytwko3ImAoiNa8RUGHX8Qwo/weERHbtLVYpFTxqal4xv63Zpm hOog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hO8uxZGqqMIyQAAAtWPOJL9YxJXzGDQrOpnZTatzOw0=; b=CPVES5gctxA9LQ3HlF2cVP13LujZlSChYDE6G/5JCto4jFGo2n/18/67zIbReTZ8jZ S8TmZflQU4LCQ+gAuzVY85ctPEFQ5yETm9rBJStS87IARz3CQqg5dZcEXssr9S0Eod/q JfYM+4hMeDEcyNibBZoSiWXZjI+KbjzFaiESSOVqHvMbqiV42q9bSgO0irlPg+MuWg1h vr67+wMef2HHinDAiS1EztNIt5yc1VJX0wj1m8IAtQX61z/INUdIoHS55aMFgq1GdyUr vqhUMigTgkuzjt+Ii7ZeQlOGjVaXs4pmVPX5nYsnKxt116Y/z/fq1OMVIxROfKopNKtH 52Vw== X-Gm-Message-State: AGi0PuZ/nwR0UeMe8DTfdeTaGl6B6vEoFTlhRKSPl6NUnn7Wdz5nIyPg 0+GO/d9LuG3OnwDB5oW3WDpJPwYcMmM= X-Google-Smtp-Source: APiQypJ3IqolJeSvS5zSAwSI0e/5fZSYmMC0s7sxIpDmrqez5KP3OLYp3ErE/f19ro4Yxqu3t2NN3Q== X-Received: by 2002:a17:902:bd89:: with SMTP id q9mr2853923pls.161.1588951081004; Fri, 08 May 2020 08:18:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 10/19] tcg/optimize: Improve find_better_copy Date: Fri, 8 May 2020 08:17:38 -0700 Message-Id: <20200508151747.6166-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::641; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x641.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org 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" Prefer TEMP_CONST over anything else. Signed-off-by: Richard Henderson --- tcg/optimize.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index c0fc5e3da6..b86bf3d707 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -122,31 +122,28 @@ static void init_arg_info(TempOptInfo *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) --=20 2.20.1 From nobody Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.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=1588951870; cv=none; d=zohomail.com; s=zohoarc; b=GQ7C8xl7OYr+27PnRWTyd8bHxwGnlIcb52T99yw7CdL+rYrg9syfkf2r3M/ke87Da73vnEzLyTEwcxsPOzWcSsg6X9Rryy3sD9zd47RTRzgeEExIAMb3OJpk5y2779SkOM4QKI7fvxeKlkDQ4NflUXvik9skh8jBf2xRlwRCIgQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951870; h=Content-Transfer-Encoding:Cc: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=PGD1fCr8bwj/Q/j1fYvGYsHYGUWqSqai/2Ei2TPU6EOT11FAIb++/TBat9HO+yB8tGwUkGCLMyFoLFf8MyV6yHhHgCr3Xz03+Lje2V1J0Qht+UneZ/+P30KDV8EbGwIE1KLg0KmnN/I6b8/uz1eElQscg5lBx783bXqMqlBc2W8= 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 1588951870538178.00033020338492; Fri, 8 May 2020 08:31:10 -0700 (PDT) Received: from localhost ([::1]:45564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4xx-0001Vy-2A for importer@patchew.org; Fri, 08 May 2020 11:31:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lM-00062s-1U for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:08 -0400 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:37075) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4lI-00030z-5M for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:07 -0400 Received: by mail-pj1-x1043.google.com with SMTP id a7so4381236pju.2 for ; Fri, 08 May 2020 08:18:03 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:18:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DuJkDhPEOnaROoc/1JyNu5wUbGL/01Lw8KOKVY4KSao=; b=IUlSt1FfdZcSAndamJS81XM69YeXeb/BPXTdslQOIuDedGyEk0OI9TtE+OWSb8rWzK ZzH9u5ERnNahi+ArltdSubfwaOCgNDBBixEDXfclldVGhgb4YCDpL+Vk6kO6Y3KrVxOD JSsi30xa4VMgO8CE2lRwH3hSIP0uBmYKWoPLVm7CEZ93ZJFxVdMuGw6287xoucHfnjrv pHL9hPIMSb45AsjMHLFefxcWFRi7pa/iH6u79MPTsAHUtdSrl9OPtRLDgmWf6XVoDPoW 2eGtuxh/ktanz2yfaeAZwc/9ZcVw0O5S4U3IeJAHTrtQ+GHbBtr1MQkXMAwFK8TcdD7I xkBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DuJkDhPEOnaROoc/1JyNu5wUbGL/01Lw8KOKVY4KSao=; b=rZEVGEFie+oiM3FZCztHXFKPdBU6WKQFrwD4B+figaxEmaeFl8CiV9Po0cFhLbwOfC sxCUyztGETphUJKrx3JKznZ4nR2XBUDwgFwR5ifo5JGY0/SmYhIT+EWvtt5i6ZLcY6Or 4O7XaSrfe2oWy75VyNR2ORyu3OEN9I+NOstMKOleJ+qQemTHNP57zOOtKBOZagr6rQtZ ZEulayz18QZLJpJ0I+MKuZkfWdmCrIbwhy+oZnAy9BQn9dcuLugzGUQ9+NFulENJS/pw 7qrxWwxSmcrzKRnBgJ9e3IlD4l5y9Ol9E9NZDgde90qjrekZ9fUBArHJ9AhoaHAw/Dwj Z1Bw== X-Gm-Message-State: AGi0PuZR8GXTlUxGPxTQEqw+XJzuVJsL5W6+LiwR3me/UQJCyKYHBBm+ 2UNziBwjItl+x09mh6aCoPHSiOUZZUM= X-Google-Smtp-Source: APiQypL1crxt18Hp5sZZxO0ErZL/eqWuCmfwvNJTzJ3o1YIJaSpny7a/5qCy1P5FvX6uhQj21k2bhg== X-Received: by 2002:a17:90b:93:: with SMTP id bb19mr6074946pjb.134.1588951082448; Fri, 08 May 2020 08:18:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 11/19] tcg/optimize: Adjust TempOptInfo allocation Date: Fri, 8 May 2020 08:17:39 -0700 Message-Id: <20200508151747.6166-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::1043; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1043.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org 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 Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.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=1588951717; cv=none; d=zohomail.com; s=zohoarc; b=emv2stCdqTymUD7srdPHPNjCF7Qt45aXQwjvXi+M9a6DIsrmt/NXxxGNqewAm2BXZXZ2i8oRSeZ8bp91JaoAZdpKAfBjLX8Fyy+AAdgjOSCzXWJlX4yhRQLvneUt8CeYEcl3UKZe0/xRXIJrY3rNlPQ5WLYxc9grzu8QZJHPLhM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951717; h=Content-Transfer-Encoding:Cc: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=IOO4XIM6PdxMK6XzDaHVNls8fG6OP65HuBtCWQIcFk+xrWMnz9v/84xSpogEPE0QAh9/zqBDVQK+swZvPyDzVoaiFJ+71Ieo3Mv5w/+GbZ/xUE6QTN+tUkozrq4BhgLC2zGba+RTtBr8vcjtP24J/kihiFXuot1xxMwfeZ+CUO8= 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 158895171704051.487052301870676; Fri, 8 May 2020 08:28:37 -0700 (PDT) Received: from localhost ([::1]:38190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4vT-0005rl-HV for importer@patchew.org; Fri, 08 May 2020 11:28:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lO-00067B-PM for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:10 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:44207) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4lL-00031K-Nd for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:10 -0400 Received: by mail-pl1-x641.google.com with SMTP id b8so836856plm.11 for ; Fri, 08 May 2020 08:18:05 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.18.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:18:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8se14kJpotzBe1gBeAfalsCzpFa61zbk2HVh3S7WLCI=; b=mVFlRF9y7AodxJyh9q6F+CtEemS6rE12TjAD5hy1b+RDbrBcyVxtME0Hh8zfQecVIj sHRZdu4L2+QYkYzOVax9rtHbq5/VqPRPhI/xpiUjaH4T4kEBiNxzhdsVw0zxL9nFlkAq OMxiqi61HHX3PMq5zPmOo9GCzTcaZtYaLaBb2H6FxVyo73JsxVFdHDBu/80vcv/XV5L5 Jz9GAm0Ct8/FzHtkYVB4AgVjYsVuMKuGRojD0E0KfsJOceKq+ShJM56JdBvbF5EFSpHH BeZzMsOWpZi2fG1YboMvihmMFDITE2XTW6NluB6OCpZRw39jxuPCNgamMS2ztrIe/6N+ HGsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8se14kJpotzBe1gBeAfalsCzpFa61zbk2HVh3S7WLCI=; b=sgRJ5yknrUdfzXx6RvXkO0GPK+CSmCHAAFqZBZMO7VFq5EyNjm5wftIUFgOY6XhDW9 dNSmvE2Y1lJY4lsgWyEHqGdJtjIIxsVUcoy5Ax0ALMGCtPaEN0WUc20cfc/QiuBSSwHI u3kAXCjss85JUtZ1OAli1WR78hmSjt9jwNzxJqqSSRoTtmrOoEtSWzZDpFdk3p1O9Lrt 9silI2u/I4+4AL4vHBBONs6bvMQcywZ5JjOvCxg+SxvesMpdAxKPHYNZC8ktVtbt2XOl Bey3RTz8/tgCnM3ah6gKbjo1kHFng6JlIArv3KHEStI4fBEzGM5Jot82EMkKrJPR1zlK dXwg== X-Gm-Message-State: AGi0PuZ9UNrSxfZmAAKTLJ74cU0FRUcgXAd/+zg4s0v8hHEnnK1mlhNT 6VHWNq+IIPNoZMUSVphyBlqUj3nlPOw= X-Google-Smtp-Source: APiQypJd4g1qFwZEKa3k8f5Pp5x4fOUt20LRkCLq5vck/cAv6IprnJBsAoLUB9JBuleARLjrdrLA9w== X-Received: by 2002:a17:90a:2323:: with SMTP id f32mr6540659pje.139.1588951083583; Fri, 08 May 2020 08:18:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 12/19] tcg/optimize: Use tcg_constant_internal with constant folding Date: Fri, 8 May 2020 08:17:40 -0700 Message-Id: <20200508151747.6166-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::641; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x641.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org 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 Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.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=1588951535; cv=none; d=zohomail.com; s=zohoarc; b=jtAlQeoFz8mrPvlnWnSaLmvoS2IIngFQV8orvIA7MCRKEZ2JSsewqy6DUdsqd0b4SOAqCOUGlSw3S9E0vfUwoqP/yIgRaUY7oZYl6oOKnRXLzoT2QBKdw/Yvj6lBzsXkVsQqwhmIhJIPPmC2bkfYsPqRbvXGyB0CX7FkFkfOtV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951535; h=Content-Transfer-Encoding:Cc: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=HGZf0tXbQcHFuKfgvmWZ0tWTe9fLxbdPJyws4KGoMOc=; b=EjyY0MNjBZFvvebuVarZQ0CN3D4zLoN0em/6yGg3lwaxFpR4PoOFv9w9w4xtW6SaS0cOePjFhiQgcJZPPS0gs6otmsnMsK1xjTTI6LuvbIEfqrEvuyWQGl1Adfw3rAqzcFi6IYmXysCCRyHnAUkzXJK+uwAxzRAB5JwE1g3iFe8= 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 1588951535568541.7483350802821; Fri, 8 May 2020 08:25:35 -0700 (PDT) Received: from localhost ([::1]:57806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4sY-0001dK-5Z for importer@patchew.org; Fri, 08 May 2020 11:25:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lO-00065A-7b for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:10 -0400 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]:40017) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4lL-00031O-US for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:09 -0400 Received: by mail-pj1-x1044.google.com with SMTP id fu13so4373403pjb.5 for ; Fri, 08 May 2020 08:18:06 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:18:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HGZf0tXbQcHFuKfgvmWZ0tWTe9fLxbdPJyws4KGoMOc=; b=n7f+XXn2kHvntCSApadSf+qDX+3TOPv8Q4jiycazYfBf2CxvbveYstPCYwpbnFiYEL IoZlVlB/438HS7Ok1pcMTZcvXqi7XeUfQM1hETPuXpfSHBcuWzxh0ESCiQxH73sx29Ze rO1SWx3HIs3P5GNvEIKCAdJ6PmBlH1XYEJylwUtdhJCmr2Twc/OiVIV0WtxExpjZB++V G0rlKoWlqdZvR3eW5auy3Zal3BEJxQm9+SX3ZzgyiLCNNcWNAezwgWOZc+K7XOMmMr9L QC2RYzsQdRnEvJxi+0B+tx1SqRaC9sW5eiuvVL/7mAi/UpYcQqV6CFn4QPUHkqZ9GVy+ DJbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HGZf0tXbQcHFuKfgvmWZ0tWTe9fLxbdPJyws4KGoMOc=; b=XspheDCFPqDeDzC9sn5ckPRdiepk7cT6tvy1eqdEIY/jlfByZMgc1vDdtlNSgTiGos staZKPx3T6MgjKTny9mF5YoZwxk+48vHYJ+o5Ds7iKwmnEQvxdbuucAIYcAT1zOjyYZ0 Q042pdg3E+y1nUVBfonqIAuFYDPyEY/NVvhlEbGnp2pvP/NYX1vj488xIbH7mKe1DD04 aCbtsVJQDFw1b2Xcwpux7lU7S4Bo/mtRHA0kDW74xYup2iUzQJ4YpnG7+fUKWVvxHO97 Sy2NYb7UP4ndbYSB61WWDg2XCBF0NoDWRoED8HnO0Ob2UPDyMWSolJQMdpPX7ASOJS4o lzXw== X-Gm-Message-State: AGi0PubB1lacvmrJKFUN7YEfWuWQT2Q8o1FIgnUTBWNB6E/FDwoi7a9L 221Q/BhdUAuPkJyfRa8TDEqV+LMeAk4= X-Google-Smtp-Source: APiQypIHXeusDLkNjA271/GUMTtnoqmPIPnPt74ype/3TmD3DpEHHk3XJRCIILoTYuzCUpkRblUscw== X-Received: by 2002:a17:90a:fe94:: with SMTP id co20mr6636639pjb.213.1588951085008; Fri, 08 May 2020 08:18:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 13/19] tcg/tci: Add special tci_movi_{i32,i64} opcodes Date: Fri, 8 May 2020 08:17:41 -0700 Message-Id: <20200508151747.6166-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::1044; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1044.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org 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 e3929b80d2..5a941eaa07 100644 --- a/include/tcg/tcg-opc.h +++ b/include/tcg/tcg-opc.h @@ -272,6 +272,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 Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.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=1588951825; cv=none; d=zohomail.com; s=zohoarc; b=TF1oL71/2Yffe0WnL2FrIUKhEuyKyxQKNCt+Clnen5Kz4qnjWcb8STEtdjvGYADJ9q6p2wbP6a7ELIJCuuj7mzkVNUvmY8msM9v6ZTXCXcBoKuoE01KhnxHZkQlAIGmxUADocoXNffnlqvxT4cuYOfwSvtNK8fan2q6022z5eAA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951825; h=Content-Transfer-Encoding:Cc: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=4sAorkUkIPV8aMP4L4OrLvn2nsQGAPk9jrtYSWUqYLI=; b=bXEbZInlrtWp5AOLihwhsWqgcD7fFg1LGXJ2pUgeOtmMk1UY6WLCJuAJFEE8ZVstw0OxmOXMtLpMTiw2kHe3wsiiSGpAbfkh5h5MtUADdGP1d1sjMtJ8UfpyzIZt5D3zHJ+jWPtmVQPop/RV65dBe2EQPxvp936hYhSl40mUzV0= 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 158895182590716.461398416971747; Fri, 8 May 2020 08:30:25 -0700 (PDT) Received: from localhost ([::1]:43300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4xD-0000Fq-Ru for importer@patchew.org; Fri, 08 May 2020 11:30:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lR-0006Bh-HC for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:14 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:34386) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4lL-00031U-UZ for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:13 -0400 Received: by mail-pl1-x641.google.com with SMTP id s10so856563plr.1 for ; Fri, 08 May 2020 08:18:07 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.18.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:18:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4sAorkUkIPV8aMP4L4OrLvn2nsQGAPk9jrtYSWUqYLI=; b=zrlzAy2oDknXRel68oh5VzK5K5leCnKxUil+OHxqnHNEI3ZAnWot1FyU3KHwDRm8I6 8Fecv230+YVpzYmC5dUg/9l9dptJOJVZ0sj/NlCr3rNbwNdm2wVnHWr2FSpGBEMx4MhT U+U5j3vgyQO1Gn54lwTETwpVi1NHKOSR0pbFifNhaV9O66VXhNW/dHxovizZScS6KRpG TP6tnttAjyL5cGBkDddGdP/dpkXz6P7Jt3hHiAFGXOqjRCFd19eaiNzaziTzaFknw87t d0s5fMb4VkIso3X0dLExbghxki9Zq8bZG4a7nwldBeCuP2lnriDAZA/ESpAYUDkFlp7/ cTCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4sAorkUkIPV8aMP4L4OrLvn2nsQGAPk9jrtYSWUqYLI=; b=fCPaanymoMEO9SmQNiG6p4fEDAyLigo6x1WUQV8QL8Y0ktrpOXsbJQniHEUKmsce0K WjtUhVCUjLC3ivTPC17Es1cRsOLCc6XEpOd6G7hiCriMs2aU6S5/F6VgjaEZ1kNRigfw q3TZaI7DFyY37wkqfdK1XaK7fRS9c3/UNRu2s2EDsXT2n41hNfoXGq2iZaoJ7AoSeHvZ QEyUMN9/SwkkuyxO8b/ocNB/7eYNTke3yqAf7qgtmrf50oL+aAKKCY/T7Ip28jFPppfc wDRbU7gy2IXVq+vqQOmXx9ysjR+rgsWGPf2pNyiBdYtdvaw0yDopfTW1GhSklIWVOczG JUZA== X-Gm-Message-State: AGi0Pua4i55WEfXLIDL/YHsQPTqyBTCd/vsaiug8w/6n1KWuFtHRz79r t8F5NPf0Mqm+by5rkQ2X/J4h+KGBFA8= X-Google-Smtp-Source: APiQypK4oyfVRCOInkjCCSX2FgSqZ4szeRHaB7/5HKMuLTcKYb+jJbZai6fu5Z3b+P5pWuBkh3suVQ== X-Received: by 2002:a17:90b:3444:: with SMTP id lj4mr6486227pjb.37.1588951086171; Fri, 08 May 2020 08:18:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 14/19] tcg: Remove movi and dupi opcodes Date: Fri, 8 May 2020 08:17:42 -0700 Message-Id: <20200508151747.6166-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::641; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x641.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org 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 5a941eaa07..d63c6bcb3d 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 760b0e742d..d065fd600b 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -2262,8 +2262,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(); @@ -2471,7 +2469,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 ae0228238b..bc957e7bed 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 7da67086c6..c525439b62 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(); @@ -3314,7 +3312,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 0e3e80a612..4681d26973 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 94f7898317..7a23ccb017 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: @@ -3488,7 +3485,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, @@ -3511,14 +3508,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_*. */ @@ -4301,11 +4290,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 Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.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=1588951911; cv=none; d=zohomail.com; s=zohoarc; b=OJ356ALpc7jB1xKsDWgO7yTDYD9yRckLYINKCUt9wOx5DjKLD4d3peVge1v2D5s5slG6rzrpIprsfjjaa+k5ijzPxIn3Ft8ARaL7RhcHDcoc97xIlMdYLm6uNm55BMIPMlexmBeqNqqNZuXzkfa5f3amlca9FT8z+eb+7VmOxBY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951911; h=Content-Transfer-Encoding:Cc: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=dTuL5S6jrin2+ysLj262uH3ZxCyTSd1WxaHvCqnz6aM=; b=KoZdRtUgeouU4SxIAP4JuEiCzEZZab7llA2OfPvvrZ4/BwtR+/wCF888XdRWCpAejaUD8eHPFZtLFLeBFFZpNu3cskgfFORyiClj/s/Ksu8o1IBTqMQm3IXYfrNOggV275FS6QBtFyuEZQ51/3B7uplM11nnzlFF7VRHDYsVOkI= 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 158895191140195.45120609056426; Fri, 8 May 2020 08:31:51 -0700 (PDT) Received: from localhost ([::1]:46902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4yc-0002HX-3l for importer@patchew.org; Fri, 08 May 2020 11:31:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33948) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lP-000689-3W for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:11 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:40559) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4lN-00034s-P3 for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:10 -0400 Received: by mail-pl1-x644.google.com with SMTP id t16so844724plo.7 for ; Fri, 08 May 2020 08:18:08 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:18:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dTuL5S6jrin2+ysLj262uH3ZxCyTSd1WxaHvCqnz6aM=; b=x7TfdgZ2+UWmNvM7v4XvuK0wV5TYbDWyFenPvkv3Jgnd01hZC8/sbZxsyuYDSfKWO/ oArdX5E4OOHbk/lmNKjZv3qeA/TzmH8lXftIhU/vCsd4I0Srkxfko3Dfo1mRGA3FPSzc XDAHV84MMBzRCsKuakTvGimlVePaeNvn2EX4vh8F+RT2+XGxHDKtfSbGSKMxsRLZoRnz VmrGPnkXbGN/X+WhtbyF1QgXad7yiJQLuK2UE07QzBAx1xcjRie4+XUI4f7JXI0fzOta dK77aRTVW6nMVJwfIWPyhoeFRshDyFiAwLJiY6upkwsu8HhOHbv5NF7tSfT6AZWhv8GG lmcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dTuL5S6jrin2+ysLj262uH3ZxCyTSd1WxaHvCqnz6aM=; b=JdzBrrSQ3KKOYTQqqsLwOcNgCBltQFAQ70vet7DC8MBJ+kccfvpVVF8YbutHMS13zV oOaHuQeTlMvx1cCygZgmTdWS0Ejy4/ek2KvkUK+siC9+7BJai0TZaRBXmM7m5AA3YfR1 f/aB7hRbzUSZD/jQw2d7gWyxuR4tpzGBu6d71RGnd6zs+yTakUCEYjLj+WJBOAeT0Ec/ SEjtA7sdZH0yFc50svaw0vrwD0dOxmygXgIMzaDWDidvNa9Oo4WqaGb9jPJq0h/apAsc MBmYnLK3qoFxTHHSJDM/Jt3ilkMZ+RjUJOZATXjoQ80ik2FgMrOGBt7uf2hoJ/Ff8Nd4 kc/A== X-Gm-Message-State: AGi0Pua9LCYLGJWgxqROvozn211W0MVQUYxFjcO2dqrvrToOB3oQAICv qI95l2qJ+hM+iKBco7vixA5VsRblev0= X-Google-Smtp-Source: APiQypI0Eua5D76zvcQFKpgZYY7TSK6kHB3ozruj6Ntb6WOKtyd1KBxxWiZ9V3kj6AiGY31NivITMA== X-Received: by 2002:a17:90a:f40f:: with SMTP id ch15mr2368961pjb.178.1588951087480; Fri, 08 May 2020 08:18:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 15/19] tcg: Use tcg_out_dupi_vec from temp_load Date: Fri, 8 May 2020 08:17:43 -0700 Message-Id: <20200508151747.6166-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::644; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x644.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org 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 d065fd600b..a7b1d36494 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -1010,13 +1010,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 bc957e7bed..4118071dd9 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 c525439b62..7111da34dd 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 7a23ccb017..a84a9d3d63 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3400,7 +3400,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 Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.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=1588951775; cv=none; d=zohomail.com; s=zohoarc; b=EavANLy3eSYGdAD42TfdRedGRAKES8x4yO2o6mYyBMiR6H00rB4vV8rfM7phObJ7uhkX24AcU50u+Z0+lPnXRZhXqU8AipZvA6guNT8dmGPGVRxOC8NSkHgmsJRHga8BQ/skLjSI77z1l4knBsmOmfoz/aSiKFUMDfh4G763pEI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951775; h=Content-Transfer-Encoding:Cc: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=2tXAuw+O0nKjEkY6i1LmjeSafeFA055NiORJ15tNu8k=; b=fEjcVSO8uB7uTc6Q/TLQEc0vK3WoSE4S9T5anK3ezLlIy/YKNQZg/gcMBba1wF8AnvSTTFYFyXoOoFpjqwJV6/w3eBqcW9HB6NaJe+y8Qpieq7FWQa3NhRkxzGAasVv5Xn7BHPD+5E1g6s+I3pKcPqsqd+BqEa5f8n1O4YUhe50= 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 1588951775742595.1483028993595; Fri, 8 May 2020 08:29:35 -0700 (PDT) Received: from localhost ([::1]:41242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4wQ-0007Ty-B1 for importer@patchew.org; Fri, 08 May 2020 11:29:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33962) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lR-0006Bd-Cp for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:14 -0400 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:35615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4lO-0003Am-Rf for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:12 -0400 Received: by mail-pj1-x1041.google.com with SMTP id ms17so4381282pjb.0 for ; Fri, 08 May 2020 08:18:10 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2tXAuw+O0nKjEkY6i1LmjeSafeFA055NiORJ15tNu8k=; b=iH1nWt5nRge8qPK3A0Oyp7iz2IF+VDqyFZlnapdftB2yTfJ19LuCH3++N/wOzcP10T LC7+AfG7AVUsndtS49T14e7Z3fp4RZ6yaFuzxzAbnM4gcjQ3ZVPcwAzNkGYrNVZZd4Dc K5FAkIOmdkmkhkvUiHCerGKIEhTbQUes9+Nz8Mb+7fex8ihoOKPHvLAiIwFWdQWpGv0K EW3g6iRdJPGEzbkxY9svTF3G1K2Lqc8hyUNoOdtjRNZtdPYwe+KQGg2v1iXrnH5Nzrh8 W1qqRGZR7XlRtk9VZEMtDFaeIUEj/JPoCgXbCxXuVddeVHpIluo+nyvc+7AJpxUJG9yD DGsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2tXAuw+O0nKjEkY6i1LmjeSafeFA055NiORJ15tNu8k=; b=HxEEzqCnK6lqBIZlHNNsfoHa0UDgNPaQHQ4KdO+LG3J0a5tDtldmb8V5x+nTxoKTD0 WYaCUtIMplNms0HXSxy0p4OYY9/7peBUVZ1kNKs+GhSNxqFLKDlkOo5OElwaycUOYtJ5 Oguk9ESCPmkABIHqM5934N2N+8os9ThoETz8YBWdu0qr3kmqZqcE3zYTTlmyZpmdE3AM UM+OyQ6+3N/q98A+eYw4cBkyixcswfEYcajUTeiCVvaTv4wHx3EYb8wYQBV1A/5SnX9R 2X2KZ//WkPh7Q2ufZe/Rd9RgA83++X3lDNKDeg+TapCFp252QMzqJ/HhqGW+CEEdHy2S wLAw== X-Gm-Message-State: AGi0PubsD8kdODQ7Ts/oI9zJ1ImYtkVcK9G/DH66KIVmjNQE26X4gc5g wh8oZMw6ILK87/Y3EcypNTmaabB5pDo= X-Google-Smtp-Source: APiQypLdJcnh+v1ttR28t5NhRWO0GP6cOPSuaiublJJcPECqYpORMOOSKolroETX7B8yuk79UiqWPQ== X-Received: by 2002:a17:902:9a83:: with SMTP id w3mr2795444plp.53.1588951089022; Fri, 08 May 2020 08:18:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 16/19] tcg: Increase tcg_out_dupi_vec immediate to int64_t Date: Fri, 8 May 2020 08:17:44 -0700 Message-Id: <20200508151747.6166-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::1041; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1041.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org 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 a7b1d36494..82b409ca7d 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -857,7 +857,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 4118071dd9..5e73e5d02b 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 7111da34dd..3f9690418f 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 a84a9d3d63..18ebcc98f6 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 Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.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=1588951958; cv=none; d=zohomail.com; s=zohoarc; b=n0TyEP3+n+XMjGPJrKlz6hvFSNJjovQOGzWH6aeDIf2CmdV2bMhoQqjXp8Bg7gsYly/qH+KXDuYOyTY9l1blCA6pWLE0WkDEgFi9S4wT5Y818MrorjD7C4bZf6/6LFHDKiXRtf511F0Yt3pOIPniMNS0yUUpdFqCvsBPK5q7Zd0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588951958; h=Content-Transfer-Encoding:Cc: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=Kyd75dQ6HSF4Bc6As5SxJ/ajmbJCQUS6r+6XFxFF4i4=; b=fsfCmrS6nf3Z/4pE9OuzF65UWlz3JjtzHCmeXczITrhbzPkqZw/ouAS+759hqXexVnuzkZyQuow+vwJkH8wjbN8Ceb3RX6sJ1KIzQkEBCPZ/wr9YhqinG5gSQgND+elhAPNE4OOkVhtJsoQGtZ/u2K7TqMEl4gbr4YKzpd8wNCY= 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 1588951958307331.6238269531266; Fri, 8 May 2020 08:32:38 -0700 (PDT) Received: from localhost ([::1]:49874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX4zN-0003Z6-0v for importer@patchew.org; Fri, 08 May 2020 11:32:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lU-0006Cj-M7 for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:16 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:34388) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4lQ-0003F2-Lj for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:16 -0400 Received: by mail-pl1-x642.google.com with SMTP id s10so856698plr.1 for ; Fri, 08 May 2020 08:18:11 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.18.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:18:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Kyd75dQ6HSF4Bc6As5SxJ/ajmbJCQUS6r+6XFxFF4i4=; b=L2JtC1OHJja/JFbC8t/jwZOoHqQXOpAkJhI9MUtaF/romDh/Qb4I2eZA0KqKUY3GQ0 WZxHSlmgJWd4TSZVAQPVACGHU35+rpcXbouvanT+AnZNiDL1BI895cGZoJSc+ytKtRaN 1XR+7NguW2tlZ9mK0YsHVQ9ABRCL3oVPtlM0YQY8o6C9d4clPykot5lWH1fUAEMfVhPK b9NbHYfY7Ygo5Mf2HYtw4lA1pvEXIygfdaT6UfCOAHY2jgzuBidSdHpedTnohXLJCF8y gOuBaxDnjcmeFYvbt5ZTM/fk/TK0vHCGDywDVETJyzw6koecs7gdKTPJ/Ld9Sdz3mqlB h0Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Kyd75dQ6HSF4Bc6As5SxJ/ajmbJCQUS6r+6XFxFF4i4=; b=Q6lnU97+zPechQLezyAoySmtvSrUk6XkHO7cff/2tVPSV+D4RbbQC+7u+U042fr7m9 /crzK7aIRZdG7RIY7GdLWny1awa4qntSjea3s7MMilCFUULRwNRzc/oVJOgCoV+EgbKr 2ZqzC513EOo7oquN2v7CeyEkbCXKwEL9p9WHiCGVH0s4/wxqyCr70qSsVGHZDX5W29BB jnbfB4NXHIWdZfUK9X9Sk7alBwYNxkDnfk1mvfwPPmFcCAVuR3dS2KxhJEYGl3ZsW08a xRxMq+QFUhzAJ5mJRqXVsZf7JhE7cDVs/LM2/xEeQs6eG3fFKXOIgRBGw3lduwKfff/E szXQ== X-Gm-Message-State: AGi0PuZN8/zpA7iFMdZKsVXEX6V118Ne1TvseKrKQ8nozv+8+2wJ15ZN M3z1FYXwlJbL8FsuDYGbgS59RlINIUc= X-Google-Smtp-Source: APiQypLfNouruWAeFRVCv5y4tmWDtC6ZpeQHwkSOT1Hjmwb8DlnUy8xyVlN0lok3jRlSw+PwmHxKvg== X-Received: by 2002:a17:902:40a:: with SMTP id 10mr2901923ple.183.1588951090222; Fri, 08 May 2020 08:18:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 17/19] tcg: Add tcg_reg_alloc_dup2 Date: Fri, 8 May 2020 08:17:45 -0700 Message-Id: <20200508151747.6166-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::642; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x642.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org 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 18ebcc98f6..e8fe2d580b 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3908,6 +3908,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 @@ -4299,6 +4384,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 Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.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=1588952227; cv=none; d=zohomail.com; s=zohoarc; b=FTBvrjoofDtYsJWLKOA66/SwZ9Fe0VeoNipzISiznl73lytexNWVVVZf22Q55CI2u4SYo1JE6ggl8QGCK5DXwqOXMt33Tlk3VwqdkcU1QZsmYFm0Cw94vEIRX3Cn1QLt3GmNAl36HozbWPml9vHpIQBGxVyJL0sKTfbNuEghChc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588952227; h=Content-Transfer-Encoding:Cc: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=qeDuC9uLOMGYvdYUwqaO7ersqvyJVI4m0BQ+UjrHL80=; b=e9thPAFK9hLzuySkRI7C5L+BLV3pOhpwIVHjFAK3m6YMXaBMYSwUxELIpC0UKq699UhWbFriXeODHfP9WTjjONkz7CbgtuwfKw5B0lVWbMscFz2O31+qAhwudceCNDNRmhRn7kxwhco0DdL+c71SjqKKl9qsKu55GqGmsUYKapM= 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 1588952227615997.0688272367549; Fri, 8 May 2020 08:37:07 -0700 (PDT) Received: from localhost ([::1]:40804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX53i-0002fm-7z for importer@patchew.org; Fri, 08 May 2020 11:37:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33978) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lX-0006GU-AM for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:19 -0400 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]:52944) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4lR-0003Hx-8K for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:18 -0400 Received: by mail-pj1-x1042.google.com with SMTP id a5so4399350pjh.2 for ; Fri, 08 May 2020 08:18:12 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qeDuC9uLOMGYvdYUwqaO7ersqvyJVI4m0BQ+UjrHL80=; b=PChqeIqrjkb2WtvffE4tcQOi9+O1oP8rTnl1raOhG2WLl90et+MRsBi9U8s3vCifTn ksGQDSVz7qENpCng3GFb0WsfnamFBasx/jaOd4ClkBi53pzlLwFCLL7/56ugJOqPfFvZ WLhcxxcreJu0rsFd58gbdz3ybGMgz2x+cnrtt/XRCRRG98HJn7T/gQKhU8T9NqyDsNn2 1ORm1cRZyXNO7jsPBVENmoVHhNpAMtUckXXQ2aULzR5Q6/HbXQYmGagXbIy4WjmmtpSc yUFO22QTNBFgdRKgUReyRIoz2WABEpNcsm7b/A9PByF0kmOTwypIiPxuXXLZFRBeNi8s jeWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qeDuC9uLOMGYvdYUwqaO7ersqvyJVI4m0BQ+UjrHL80=; b=A7g6ky8AWU2DTRIBYDjpezyv/gakLmgkfL0Ob4XUekNFX1SG6JV76PC8WrflLGFDZe AL5MNVaAfYL1MqeCvGQeRrWFpGlgtn2jiqDnZrPAuvpHNXVENIK9Sl5VKsIfNQ8muiEn /PFt2Ne4nNh2Djn5QdF0QwwqqvUzJlaryw0eAxc6Cug7wR/kmcqla8hZ9Nvwzh3yeNH0 Z64FiuUkW76gTVEvut2XfHqd85RAIUopNwXRyugpa6xoGa8K02tjAMWg53mraC3VilE2 CXCTtixGm+35X+ItFAqsJbdKBfdpG0XYMDbzJfq13jPKya/XeVA2b/ygYfjvPJSfN5hk oLNQ== X-Gm-Message-State: AGi0PuYJNKrXd/334jrBdFwcvoBuZb6KuLo4qDzYIwOiE+T8R4BBsW8r jdpOfxZkNa55CeQYSd4xqLoGcEQOU6I= X-Google-Smtp-Source: APiQypLGC8TekqDYpCymdfrCmqcHqQkc9iKEQMEYDTWT5BjMfrk7QDEsMhSk1QYhFnpHkwJXsyr7Fw== X-Received: by 2002:a17:902:5a47:: with SMTP id f7mr2978648plm.288.1588951091497; Fri, 08 May 2020 08:18:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 18/19] tcg/i386: Use tcg_constant_vec with tcg vec expanders Date: Fri, 8 May 2020 08:17:46 -0700 Message-Id: <20200508151747.6166-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::1042; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1042.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org 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 5e73e5d02b..cce28c81d7 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -3519,7 +3519,7 @@ static void expand_vec_rotv(TCGType type, unsigned ve= ce, TCGv_vec v0, 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 @@ -3537,11 +3537,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, @@ -3556,15 +3556,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); @@ -3592,7 +3592,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) { @@ -3663,9 +3663,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 Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.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=1588952087; cv=none; d=zohomail.com; s=zohoarc; b=n04Bj+1lXkn10ivalVSWRPgLGGLv0pCWMhTGO5/GT3WqAe0iTKIKqnW3Csoc7kRB/Ph69KaHcjDSuw3VRHQOVQglp4OiD8nieGwomHULJuuOkvEBCbPsBhefHLYYTyvNq+Wlc9Q0XvtcJKFEui6JeybRwSFcvv3SBxxQ8AYk2kY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588952087; h=Content-Transfer-Encoding:Cc: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=pb4mNTdVoF7AlivNCkuavLGrYz8n9Jd0hKihdmkcszE=; b=gLoB7ad+TbrMaXVxUTewgcHmn5wwjGf+RRv5DjEXtKXUck0ccjWzGzEf+ZJzZIL3BmZfsv04s67WorkWxI6ownah0KM8HoDGDdxOrHoNx1bGmclV+kogxDX81BgO9xVdeT0KeMgnETexCVE97zAVYHou889TB4T+9njpoCBwLHc= 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 1588952087411543.8928466311863; Fri, 8 May 2020 08:34:47 -0700 (PDT) Received: from localhost ([::1]:60520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX51S-0007PO-5j for importer@patchew.org; Fri, 08 May 2020 11:34:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33976) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4lW-0006EC-DW for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:18 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:47098) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4lS-0003Nf-UH for qemu-devel@nongnu.org; Fri, 08 May 2020 11:18:18 -0400 Received: by mail-pf1-x433.google.com with SMTP id 145so1058619pfw.13 for ; Fri, 08 May 2020 08:18:13 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id b5sm2125933pfb.190.2020.05.08.08.18.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:18:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pb4mNTdVoF7AlivNCkuavLGrYz8n9Jd0hKihdmkcszE=; b=zoWNiEknRvdrdtUSzoYAZ4W0OskQOL8BNCfL2cnaDFPiinngBl5XGaoO28DBXVhWZO CZKkXaOV70acYwUWGVi+uAfhnRJnRH7WME12CK4TYOgfWKBApF6g1ON8K1F49TEwUHFn XM9Kp+wvoAj7sLbTl5uS/kyZIZYkGoPIoltHQ4rreIW3n43425bw3mUcp0VJDr0/fTub rrnEut/IgFETJFbcnkEHPGGsdUqcANV2naS2djhfpIRM/Lleh7BeCxF4doYtuVc3DTJN WodV0mYyNNMyVVrTp5JNJ5TgiFDJdc0K6SjZ1UXlaBOAs5LTEh9nMllyShqimcLJkWes H+fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pb4mNTdVoF7AlivNCkuavLGrYz8n9Jd0hKihdmkcszE=; b=DMbl8ecTIm55AMxtITL/jmN7BSCMd3Ppukppn8PNwwSZnDRJLO2rZJlZZI7ZHRvny8 VM3D8EU30buushLX24IkxiK/BEqx/EchPUIfvOvnJ9DNvQMtKQBvYbbgmuHOlFtEIBGL VqjLEonVTYy9atHieDIloBvJyQsFpHEcN10w6tjHVzN5JsHHMHc1J3loelf/okJitWKh 8iFY69Hk8NazlhakWb7HgiLyYSD25F81RCoyWjIaJUM2282ZW/m0F020xQi29zUEGiny sv25E3UOvQEGvUarAJjcAxoqxCzMBQR/Wfb8hJgQt9D8J29tsRpP43TxQhtU15XgVh23 kRGA== X-Gm-Message-State: AGi0PubQN+BPZ9JTx2Knq5EpgdTP2F12rd3c+q62kofyIK0V28D7p4en ppM1K79sZ6OF8RYFBHbVuJcVx9aFVRc= X-Google-Smtp-Source: APiQypLEWeobuhjuP7j1JznKl5W86NfhDBnjptm2aEeqx29ed16O5Gcc0F7hMj8qkIISwllwCPV9jA== X-Received: by 2002:a63:7801:: with SMTP id t1mr2443217pgc.192.1588951092681; Fri, 08 May 2020 08:18:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 19/19] tcg: Remove tcg_gen_dup{8,16,32,64}i_vec Date: Fri, 8 May 2020 08:17:47 -0700 Message-Id: <20200508151747.6166-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508151747.6166-1-richard.henderson@linaro.org> References: <20200508151747.6166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Cc: alex.bennee@linaro.org 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 b4fba35e87..d0319692ec 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 4681d26973..9c5deafd5f 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