From patchwork Fri May 8 18:25:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186422 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp227063ill; Fri, 8 May 2020 11:28:22 -0700 (PDT) X-Google-Smtp-Source: APiQypKcKIMC02Q9dtollRvUb4u12GtAahEIvCMuXG7BrO0XYOPBTEv3G2v1czmc6Um8fRlTFuk8 X-Received: by 2002:a05:620a:2046:: with SMTP id d6mr4116391qka.25.1588962502064; Fri, 08 May 2020 11:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588962502; cv=none; d=google.com; s=arc-20160816; b=UM9N7muiP1VmgpEaYcUOS1ecWk6pgBs+oUjGPlrEdNLLTD35OPhTD6wK24xNm12zns zlQFpGKqV6y//VtKQFkZ73MQzRIp7OozQTIHZ5VbKguFRIFti4pQhA77QXTnrufFIOIq sXRpUU7dvWs0h2tEF3b21cK7ihcla5dihu8mCcnjsIjj8SlEml/il7uEAzTunRTsiMyd 22i8JNSooWNiyTbuwPhLahWn3LlqA/0+KzA45t7MzQHxoFMKNDcpcDXwOoZ3T6hrHWbF 04ImFQIIuyKKrZ5emp/BzdWeSP/DhlEwM0VOo5EOmMOyWX/tmVpV0DJARL1l5w2ALEDA vqaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=BRsVpU1z9zuL1lkxFwdPAnMCWCYTUg87AJTyrr2g3xk=; b=HJTIHpUkauW053oZs2e1vIgTkf6ndIqrSDN64MzAa4zWEJcEJ8dTtT+ACXsa8kcsDP IQruoNhUxK7EwXXgbO4cnfrw6d/YEIu9zNp8P6iEa8CqDZn4eqDeeQtkYXC4+r7abEzY La63cqS+68sZyJOUI+GZapUVj1uMI22ONPLVU+nxY4FeAaAWCC9UyTjQMxmEMipB+zFj P58XQx1JssX7UCzGp8R0S6OA5W9aFBV9c33nPA7/PIy6YluKHmxxhd2S/0L1yhPoQWpz CvI2YTm8accX8rKxd88Z4aO0N84Z1y9bsIxbJOZlzHpoa+mw5TWYict1I/pAUoDPnMCW PAWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c1zx+Ar7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d13si1346352qkb.272.2020.05.08.11.28.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:28:22 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c1zx+Ar7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7jR-0001WM-IW for patch@linaro.org; Fri, 08 May 2020 14:28:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7hY-0006c0-3i for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:24 -0400 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:34849) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hW-000591-I1 for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:23 -0400 Received: by mail-pj1-x1041.google.com with SMTP id ms17so4658468pjb.0 for ; Fri, 08 May 2020 11:26:22 -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=BRsVpU1z9zuL1lkxFwdPAnMCWCYTUg87AJTyrr2g3xk=; b=c1zx+Ar7QhT+kNsr0npCdiDLo5tWbgjiuAPSJBRjcwxeiLqjxoCrt3290Wbz5aZii5 t4Rt9wpLNiZ7OuRque0dfxuLo8YdVZ+K00R7OZTK0ha1AtMLWjP4FZIMU3+e57wiutkq ZuX7OxNhp9NKM+wD/wxUchYgXiVyPptMBJkZoi4OAF2faKPywjnN67kZsfYC5sB4tpr4 m+dEqIrPGG4/DKPTSMP0BfP9Mah75wr0Gsg1CWs9srso5MxJA7aann9pwBVe5KaylwWT 9HTlU5OxX5TAKQrO4LD7awAUdj9S52OAMQab3QlbRx/0R6CRsfI5krVojTw96MG0knh1 /b+w== 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=BRsVpU1z9zuL1lkxFwdPAnMCWCYTUg87AJTyrr2g3xk=; b=fP1asfZB6sJttUpCTlRH+r/qemoz4MyyXNVnOVXGRnNGm5wOP89lOskKX8laJl0+Ri A6Lwsodn/HLBsG4/bFCW1i1D+z/RwPZGtdNjMrte1+DJms4ZMp/GvmHtFMoSJIF+kFUs r9Bhx67IPSm2Onil/nQiLPfRkDnrSzv+Pj/aPpVZ1jrym6igHeWtgj2injqNVDtikV3u 4Ma/5Tm0BHDKlUsjmD5rgkzA0VcHs3cbIZlxnODvEXKt6mYSZvxfoTdm8vGEO4NB7E9y p/3iPrm/8+d68ay2rouraSKkOMA+XW/3QTCQSvGFTJn2hPuvnQKHo5D2BqmRw0GRYYMD LGmA== X-Gm-Message-State: AGi0PuZEIkmvV5NLDOPTNIFvSLKC3cNEqjETi1lOsB/LZRDeG7ZpSgzc Bz3D3YT97c1xtk1dgcyUhc9mKPxY2qk= X-Received: by 2002:a17:902:8ec5:: with SMTP id x5mr3680947plo.149.1588962379701; Fri, 08 May 2020 11:26:19 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 01/19] tcg: Consolidate 3 bits into enum TCGTempKind Date: Fri, 8 May 2020 11:25:58 -0700 Message-Id: <20200508182616.18318-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The temp_fixed, temp_global, temp_local bits are all related. Combine them into a single enumeration. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 20 +++++--- tcg/optimize.c | 8 +-- tcg/tcg.c | 122 ++++++++++++++++++++++++++++------------------ 3 files changed, 90 insertions(+), 60 deletions(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé 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; +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; 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, TCGTemp *ts) TCGTemp *i; /* If this is already a global, we can't do better. */ - if (ts->temp_global) { + if (ts->kind >= TEMP_GLOBAL) { return ts; } /* Search for a global first. */ for (i = ts_info(ts)->next_copy; i != ts; i = ts_info(i)->next_copy) { - if (i->temp_global) { + if (i->kind >= TEMP_GLOBAL) { return i; } } /* If it is a temp, search for a temp local. */ - if (!ts->temp_local) { + if (ts->kind == TEMP_NORMAL) { for (i = ts_info(ts)->next_copy; i != ts; i = ts_info(i)->next_copy) { - if (ts->temp_local) { + if (i->kind >= 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 == s->nb_temps); s->nb_globals++; ts = tcg_temp_alloc(s); - ts->temp_global = 1; + ts->kind = TEMP_GLOBAL; return ts; } @@ -1172,7 +1172,7 @@ static TCGTemp *tcg_global_reg_new_internal(TCGContext *s, TCGType type, ts = tcg_global_alloc(s); ts->base_type = type; ts->type = type; - ts->fixed_reg = 1; + ts->kind = TEMP_FIXED; ts->reg = reg; ts->name = name; tcg_regset_set_reg(s->reserved_regs, reg); @@ -1199,7 +1199,7 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TCGv_ptr base, bigendian = 1; #endif - if (!base_ts->fixed_reg) { + if (base_ts->kind != TEMP_FIXED) { /* We do not support double-indirect registers. */ tcg_debug_assert(!base_ts->indirect_reg); base_ts->indirect_base = 1; @@ -1247,6 +1247,7 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TCGv_ptr base, TCGTemp *tcg_temp_new_internal(TCGType type, bool temp_local) { TCGContext *s = tcg_ctx; + TCGTempKind kind = temp_local ? TEMP_LOCAL : TEMP_NORMAL; TCGTemp *ts; int idx, k; @@ -1259,7 +1260,7 @@ TCGTemp *tcg_temp_new_internal(TCGType type, bool temp_local) ts = &s->temps[idx]; ts->temp_allocated = 1; tcg_debug_assert(ts->base_type == type); - tcg_debug_assert(ts->temp_local == temp_local); + tcg_debug_assert(ts->kind == kind); } else { ts = tcg_temp_alloc(s); if (TCG_TARGET_REG_BITS == 32 && type == TCG_TYPE_I64) { @@ -1268,18 +1269,18 @@ TCGTemp *tcg_temp_new_internal(TCGType type, bool temp_local) ts->base_type = type; ts->type = TCG_TYPE_I32; ts->temp_allocated = 1; - ts->temp_local = temp_local; + ts->kind = kind; tcg_debug_assert(ts2 == ts + 1); ts2->base_type = TCG_TYPE_I64; ts2->type = TCG_TYPE_I32; ts2->temp_allocated = 1; - ts2->temp_local = temp_local; + ts2->kind = kind; } else { ts->base_type = type; ts->type = type; ts->temp_allocated = 1; - ts->temp_local = temp_local; + ts->kind = kind; } } @@ -1336,12 +1337,12 @@ void tcg_temp_free_internal(TCGTemp *ts) } #endif - tcg_debug_assert(ts->temp_global == 0); + tcg_debug_assert(ts->kind < TEMP_GLOBAL); tcg_debug_assert(ts->temp_allocated != 0); ts->temp_allocated = 0; idx = temp_idx(ts); - k = ts->base_type + (ts->temp_local ? TCG_TYPE_COUNT : 0); + k = ts->base_type + (ts->kind == TEMP_NORMAL ? 0 : TCG_TYPE_COUNT); set_bit(idx, s->free_temps[k].l); } @@ -1871,17 +1872,27 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int nargs, TCGTemp **args) static void tcg_reg_alloc_start(TCGContext *s) { int i, n; - TCGTemp *ts; - for (i = 0, n = s->nb_globals; i < n; i++) { - ts = &s->temps[i]; - ts->val_type = (ts->fixed_reg ? TEMP_VAL_REG : TEMP_VAL_MEM); - } - for (n = s->nb_temps; i < n; i++) { - ts = &s->temps[i]; - ts->val_type = (ts->temp_local ? TEMP_VAL_MEM : TEMP_VAL_DEAD); - ts->mem_allocated = 0; - ts->fixed_reg = 0; + for (i = 0, n = s->nb_temps; i < n; i++) { + TCGTemp *ts = &s->temps[i]; + TCGTempVal val = TEMP_VAL_MEM; + + switch (ts->kind) { + case TEMP_FIXED: + val = TEMP_VAL_REG; + break; + case TEMP_GLOBAL: + break; + case TEMP_NORMAL: + val = TEMP_VAL_DEAD; + /* fall through */ + case TEMP_LOCAL: + ts->mem_allocated = 0; + break; + default: + g_assert_not_reached(); + } + ts->val_type = val; } memset(s->reg_to_temp, 0, sizeof(s->reg_to_temp)); @@ -1892,12 +1903,17 @@ static char *tcg_get_arg_str_ptr(TCGContext *s, char *buf, int buf_size, { int idx = temp_idx(ts); - 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; - for (i = 0; i < ng; ++i) { - s->temps[i].state = TS_DEAD | TS_MEM; - la_reset_pref(&s->temps[i]); - } - for (i = ng; i < nt; ++i) { - s->temps[i].state = (s->temps[i].temp_local - ? TS_DEAD | TS_MEM - : TS_DEAD); - la_reset_pref(&s->temps[i]); + for (i = 0; i < nt; ++i) { + TCGTemp *ts = &s->temps[i]; + int state; + + switch (ts->kind) { + case TEMP_FIXED: + case TEMP_GLOBAL: + case TEMP_LOCAL: + state = TS_DEAD | TS_MEM; + break; + case TEMP_NORMAL: + state = TS_DEAD; + break; + default: + g_assert_not_reached(); + } + ts->state = state; + la_reset_pref(ts); } } @@ -3110,7 +3135,8 @@ static void check_regs(TCGContext *s) } for (k = 0; k < s->nb_temps; k++) { ts = &s->temps[k]; - if (ts->val_type == TEMP_VAL_REG && !ts->fixed_reg + if (ts->val_type == TEMP_VAL_REG + && ts->kind != TEMP_FIXED && s->reg_to_temp[ts->reg] != 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 *, TCGRegSet, 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 == TEMP_FIXED) { return; } if (ts->val_type == TEMP_VAL_REG) { s->reg_to_temp[ts->reg] = NULL; } ts->val_type = (free_or_dead < 0 - || ts->temp_local - || ts->temp_global + || ts->kind != TEMP_NORMAL ? TEMP_VAL_MEM : TEMP_VAL_DEAD); } @@ -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 == TEMP_FIXED) { return; } if (!ts->mem_coherent) { @@ -3330,7 +3355,8 @@ static void temp_save(TCGContext *s, TCGTemp *ts, TCGRegSet 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 == TEMP_VAL_MEM || ts->fixed_reg); + tcg_debug_assert(ts->val_type == TEMP_VAL_MEM + || ts->kind == TEMP_FIXED); } /* save globals to their canonical location and assume they can be @@ -3355,7 +3381,7 @@ static void sync_globals(TCGContext *s, TCGRegSet allocated_regs) for (i = 0, n = s->nb_globals; i < n; i++) { TCGTemp *ts = &s->temps[i]; tcg_debug_assert(ts->val_type != TEMP_VAL_REG - || ts->fixed_reg + || ts->kind == TEMP_FIXED || ts->mem_coherent); } } @@ -3368,7 +3394,7 @@ static void tcg_reg_alloc_bb_end(TCGContext *s, TCGRegSet allocated_regs) for (i = s->nb_globals; i < s->nb_temps; i++) { TCGTemp *ts = &s->temps[i]; - if (ts->temp_local) { + if (ts->kind == 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, TCGTemp *ots, TCGRegSet preferred_regs) { /* ENV should not be modified. */ - tcg_debug_assert(!ots->fixed_reg); + tcg_debug_assert(ots->kind != TEMP_FIXED); /* The movi is not explicitly generated here. */ if (ots->val_type == TEMP_VAL_REG) { @@ -3428,7 +3454,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *op) ts = arg_temp(op->args[1]); /* ENV should not be modified. */ - tcg_debug_assert(!ots->fixed_reg); + tcg_debug_assert(ots->kind != TEMP_FIXED); /* Note that otype != itype for no-op truncation. */ otype = ots->type; @@ -3467,7 +3493,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *op) } temp_dead(s, ots); } else { - if (IS_DEAD_ARG(1) && !ts->fixed_reg) { + if (IS_DEAD_ARG(1) && ts->kind != TEMP_FIXED) { /* the mov can be suppressed */ if (ots->val_type == TEMP_VAL_REG) { s->reg_to_temp[ots->reg] = NULL; @@ -3489,7 +3515,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *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 != TEMP_FIXED); if (!ts->mem_allocated) { temp_allocate_frame(s, ots); } @@ -3526,7 +3552,7 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TCGOp *op) its = arg_temp(op->args[1]); /* ENV should not be modified. */ - tcg_debug_assert(!ots->fixed_reg); + tcg_debug_assert(ots->kind != TEMP_FIXED); itype = its->type; vece = TCGOP_VECE(op); @@ -3666,7 +3692,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) i_preferred_regs = o_preferred_regs = 0; if (arg_ct->ct & TCG_CT_IALIAS) { o_preferred_regs = op->output_pref[arg_ct->alias_index]; - if (ts->fixed_reg) { + if (ts->kind == TEMP_FIXED) { /* if fixed register, we must allocate a new register if the alias is not the same register */ if (arg != op->args[arg_ct->alias_index]) { @@ -3757,7 +3783,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) ts = arg_temp(arg); /* ENV should not be modified. */ - tcg_debug_assert(!ts->fixed_reg); + tcg_debug_assert(ts->kind != TEMP_FIXED); 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 TCGOp *op) ts = arg_temp(op->args[i]); /* ENV should not be modified. */ - tcg_debug_assert(!ts->fixed_reg); + tcg_debug_assert(ts->kind != TEMP_FIXED); 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 = arg_temp(arg); /* ENV should not be modified. */ - tcg_debug_assert(!ts->fixed_reg); + tcg_debug_assert(ts->kind != TEMP_FIXED); reg = tcg_target_call_oarg_regs[i]; tcg_debug_assert(s->reg_to_temp[reg] == NULL); From patchwork Fri May 8 18:25:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186419 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp226244ill; Fri, 8 May 2020 11:27:11 -0700 (PDT) X-Google-Smtp-Source: APiQypII0RnM41bqFIi+Gz7WnHl21/semATYImfZKTLo9ddV01ulEA3mtkieGSd+Euy6V42qaag6 X-Received: by 2002:a37:7b83:: with SMTP id w125mr3935845qkc.420.1588962431484; Fri, 08 May 2020 11:27:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588962431; cv=none; d=google.com; s=arc-20160816; b=P6SzaBAXT0CJY7yW7a2nXNVgSE3SZ07lw+/NgAH/UTnXnXgdxTEDZsyBwZEWpsEb0F ojOQy7qL1UfE3c47dw09DFsfJW2Fky3gkYcut3NGQSSSe9d9zlJZ484Ns2RjL/T9eiyp L0uEG3ibdaRRaGyij5r7RZFrmGLvlcJIcesirVvV6nsP3FhI+Ijnz2k39FclV4pzx8uS A740kV+Fnv+3EjylM+jYwde+dMaGaiRAH0eLmhCB4ihzRkVa4AH9XK9S29FgwttFjWhn 70JcrJvggkNr2/k/rWMGfZHZ0RLRjv1j9K+8CUmlv+H2slGRxYEc/GEUmjH7JFgqkwLL XR+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=lWkulx8CoF0cSLWK7D7tlMYLSyKx6Hnk2sQWr9PjIsk=; b=muRlKqDeOigk0Oy2KpG4fTIA2YjBxaB6S9KutVq+0rrIrv7tNmk1KVZ6yhWZa/GthY j2SGjqM3+LtYvsEhgzRhrXRKRDt6oJsX8rVsRUc6mrDULafnECXmd/f2h9+xOpBGaxkq jpHxY9RYf4peSTreGjUlMWxUwt0I60vfZ5fww8fIlutfoQXA4kAamOBcGBMSChck9xw4 Wsm4ZyP9NujwKROZHDtJ538TCMBETUMje/6im/NkK5L864InFbj9Nz8cv496V5owD3pI goYdg+4PiD4t1NcL1FJXHDrxAa3J1PqMHhfd1pbRvrVryZbzwjsYwHw91KvBfv+ynTHr 0L1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gMH6bPWc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o24si1460169qtj.337.2020.05.08.11.27.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:27:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gMH6bPWc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7iI-0006f6-V3 for patch@linaro.org; Fri, 08 May 2020 14:27:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7hY-0006co-Ec for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:24 -0400 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:37278) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hW-0005GD-Pj for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:24 -0400 Received: by mail-pj1-x1043.google.com with SMTP id a7so4658725pju.2 for ; Fri, 08 May 2020 11:26:22 -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=lWkulx8CoF0cSLWK7D7tlMYLSyKx6Hnk2sQWr9PjIsk=; b=gMH6bPWcNjNkkIuild7UgMkMf1MBex+9M9HzjZAFCHrWL2r4gQqTqWfEVHLhJ61Xvz +Oj6ZQxxFby/njrxGlv5/4YcJY/SVBF/fQzTm/sXEFKfmkc8p29eFZ/ILuPZivvbhoe8 aNdx5uuSs6rBSETb3oAraMueCyZRKtx2+mzsuj2NBYCaUs9xaYYEgeMLoBLG8ncHS4c2 sFIRrVlfnYPHIG+w5QNA9jl81IUJPHmgPO3GYEsrqB9+WJS0POfbV8SlpM92YUUzfAnC T/Yi1V7nIuBSvuE+rtGemERpGe0ZwXakbAo0thAZmKDx2OfFagmXq8HCbIusw0qxU56g drkA== 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=lWkulx8CoF0cSLWK7D7tlMYLSyKx6Hnk2sQWr9PjIsk=; b=izrb8EhaRdd2HN0RsztF1juhDhs2rWu+/kGurNQ1FfHkLwJMtQ4PwMeFH6VYi3j56B l3TOqKtZIAYsFAMbqOeVmHd2YG9UqdsQKgJkXNIwmtgCFzSSbyixyGwltfLaFNm6xvEI q+kFh+5E1OZlXUFlH8yhjh4qzJcnQQTaZ9f9a+kK4tzoCcpxunH9qy30in8hooax6Zrc ItHDPEG6gzWdvSiZxtsLPuXvPHXgz5wV+SqiDcFb6opV/oQwiJQNBYRt0uquaOm3QA0N qHqiwH3XFaexdhs2RWIU77ibchPKvZHb6l3ItEksx3d8Lciv4C/GCvtwv+hY8HrfvgcI 4Y7g== X-Gm-Message-State: AGi0PubjUeZWP0eNgAIauNen7syDQI/Qctu8LZ4IIWzh+vLMPPBUNLE7 3BFW9+eZrDGhGTchiVp6kaOynpVB48o= X-Received: by 2002:a17:902:b417:: with SMTP id x23mr3462293plr.51.1588962380810; Fri, 08 May 2020 11:26:20 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 02/19] tcg: Add temp_readonly Date: Fri, 8 May 2020 11:25:59 -0700 Message-Id: <20200508182616.18318-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 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, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 5 +++++ tcg/tcg.c | 21 ++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) -- 2.20.1 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]; }; +static inline bool temp_readonly(TCGTemp *ts) +{ + return ts->kind == 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 *, TCGRegSet, 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 == TEMP_FIXED) { + if (temp_readonly(ts)) { return; } if (ts->val_type == 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 == TEMP_FIXED) { + if (temp_readonly(ts)) { return; } if (!ts->mem_coherent) { @@ -3355,8 +3355,7 @@ static void temp_save(TCGContext *s, TCGTemp *ts, TCGRegSet 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 == TEMP_VAL_MEM - || ts->kind == TEMP_FIXED); + tcg_debug_assert(ts->val_type == TEMP_VAL_MEM || temp_readonly(ts)); } /* save globals to their canonical location and assume they can be @@ -3414,7 +3413,7 @@ static void tcg_reg_alloc_do_movi(TCGContext *s, TCGTemp *ots, TCGRegSet preferred_regs) { /* ENV should not be modified. */ - tcg_debug_assert(ots->kind != TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ots)); /* The movi is not explicitly generated here. */ if (ots->val_type == TEMP_VAL_REG) { @@ -3454,7 +3453,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *op) ts = arg_temp(op->args[1]); /* ENV should not be modified. */ - tcg_debug_assert(ots->kind != TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ots)); /* Note that otype != itype for no-op truncation. */ otype = ots->type; @@ -3515,7 +3514,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *op) * Store the source register into the destination slot * and leave the destination temp as TEMP_VAL_MEM. */ - assert(ots->kind != 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 TCGOp *op) its = arg_temp(op->args[1]); /* ENV should not be modified. */ - tcg_debug_assert(ots->kind != TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ots)); itype = its->type; vece = TCGOP_VECE(op); @@ -3783,7 +3782,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) ts = arg_temp(arg); /* ENV should not be modified. */ - tcg_debug_assert(ts->kind != TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ts)); 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 TCGOp *op) ts = arg_temp(op->args[i]); /* ENV should not be modified. */ - tcg_debug_assert(ts->kind != TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ts)); 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 = arg_temp(arg); /* ENV should not be modified. */ - tcg_debug_assert(ts->kind != TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ts)); reg = tcg_target_call_oarg_regs[i]; tcg_debug_assert(s->reg_to_temp[reg] == NULL); From patchwork Fri May 8 18:26:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186423 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp227117ill; Fri, 8 May 2020 11:28:25 -0700 (PDT) X-Google-Smtp-Source: APiQypJ1Wxi8oQYyeJV26k7oXuk8KOO2j0R7TbXglRuVSvQ+ealUlg9aKHUjF0Ed4CGHJalw0V64 X-Received: by 2002:a0c:b216:: with SMTP id x22mr4164593qvd.110.1588962505751; Fri, 08 May 2020 11:28:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588962505; cv=none; d=google.com; s=arc-20160816; b=itmGou+bdjwq/Ix4AgvOfq82r4vuuegmsJp5IdiO4GgtjCf7EXUCgkcZUsIrgq4B3/ cLa/O4k90b3i4MYuMpDHG8hoVQ9fAzrX7jlhYxVNJTjp3Uzx+RS49oA4ojbaDAqscmPD SByb5a2F94rtnb+RZRGd3lsrRy5tuFo9LFJ4SSvkh+mUN+Hctq60ubvEHOSOIHHoakxk je22ZREJR6g6EX6kU3IWKn0/NO52uYkeX5Epj3iX/1m2CBJaJPdqpydhrRkhcRCM6HH5 HQzjwSi+IK49wQ0tzgpVqHCOpt6aBuPK2Qv9/B2geScNCeEtHoX+cGo10M+/9uaj8X6E Penw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=q2Hu6R+yXoo2zdjGVfH6/b6E3wPdHyA+Gme+a50XUmw=; b=NeIY/SSuYgT1zX7U+Iy0n0cG7+68BqXVq+0Z3Pt7PQByI2iMSxZNu/7qxWYIXX7iXG LGwTMVyejU5cPP6kqdgOWfeBCmjvjjR3fzRC/4rGL4eRPoLFklhKdcJNmHwuDaw5T9yN JDCAXb8HitadcvtuqPCUx2LSbTB6qvsRIlKdzaV1rebKQ0HY5ql5s60FG3k3LBKCrUMF ZsvPGvJaavLC4iB5FCtmiUO4DI08vZ7b8uIOFG+zMzeOw85Sg1xtjt4YrGn6ZwtBrq6J EOyoOsuonzFebccixbBdOW9/0FrOFZvpcbrsejosCMWT/8scJALwpo9uSAO4v3o6u/C7 dVqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dLfh4JrU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n1si1559570qtl.163.2020.05.08.11.28.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:28:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dLfh4JrU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7jV-0001fU-7p for patch@linaro.org; Fri, 08 May 2020 14:28:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7ha-0006fR-47 for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:26 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:37133) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hY-0005a8-Fm for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:25 -0400 Received: by mail-pf1-x441.google.com with SMTP id d184so1376410pfd.4 for ; Fri, 08 May 2020 11:26:24 -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=dLfh4JrU1vNM5F1ZA0M0ePM2PrpVnnoltJlYgc7f3tJTT3wb1NnGEU9LRZKelHp/yz 24jDdByGMttr77W6cvFcTiv5dys01zmdVE7v1B7adbS3nSclrltShN2hahWVLkRukpjL 8/9SviyR1jdbMTD7WQJVjIJPaV/IhbEczPcN8LfyzZ+s+kY7PMobr+QLSFD2MvvSCh+P h/LOC7Dd15fQcoM3zh8gsm4UIJfxUE6wVs6yXUArjbYlC+Z27oCiJ3/mCxu7uframoJP eFNuiaTcKTbNf2HlD4oBw8tQI+OVQy4k3lqv/YZKEyG3cFdQbvAIpamoBw4ejbmDgxIw PNOQ== 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=CwQSkLDvpN18rTWVHeNg6kYyBzlUf4H0CaW4NRj7zOtv3bYInh5cp3BWrVuZX2vCAh /NsHnyScOXzEOPRMokIAR3rtF4D2nq45eX8TfhRG6E9q5xXPM89n/dr1xICivpw2HUe9 pKq+8v2YTyn1AXtypPcILYPhShEsoUmxgK6r34vKY3uI6dED57lNs2w92xh0dAzskq8K jyV2Bgc5q61ang+7gK+ZVp4cEVhYhzL07GoS8BaJ7tDaKi602bpwcBEFgtpaKcOKX3Jb ESWKzX42hos8bhya06j+nDI8qwdBvOQPX9S+5bmJgV/NVO04q3C17Gw+BkNae0nebx2Q RSZg== X-Gm-Message-State: AGi0PubD1IYcCBjjsxAGZg5AemuRmSPGce3NCehuehbD9wKVy1BNV7ed L43W+S+Scp0S96nY0NqFWCol9DJIoDQ= X-Received: by 2002:aa7:948f:: with SMTP id z15mr4051014pfk.129.1588962382258; Fri, 08 May 2020 11:26:22 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 03/19] tcg: Introduce TYPE_CONST temporaries Date: Fri, 8 May 2020 11:26:00 -0700 Message-Id: <20200508182616.18318-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.20.1 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; typedef struct TCGTemp { @@ -667,6 +669,7 @@ struct TCGContext { QSIMPLEQ_HEAD(, TCGOp) plugin_ops; #endif + GHashTable *const_table[TCG_TYPE_COUNT]; TCGTempSet free_temps[TCG_TYPE_COUNT * 2]; TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */ @@ -683,7 +686,7 @@ struct TCGContext { static inline bool temp_readonly(TCGTemp *ts) { - return ts->kind == TEMP_FIXED; + return ts->kind >= TEMP_FIXED; } extern TCGContext tcg_init_ctx; @@ -1041,6 +1044,7 @@ TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *op, TCGOpcode opc); void tcg_optimize(TCGContext *s); +/* 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); +/* + * 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 == 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 == 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 = ti; ti->next_copy = ts; ti->prev_copy = ts; - ti->is_const = false; - ti->mask = -1; + if (ts->kind == TEMP_CONST) { + ti->is_const = true; + ti->val = ti->mask = ts->val; + if (TCG_TARGET_REG_BITS > 32 && ts->type == TCG_TYPE_I32) { + /* High bits of a 32-bit quantity are garbage. */ + ti->mask |= ~0xffffffffull; + } + } else { + ti->is_const = false; + ti->mask = -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)); } +TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val) +{ + val = 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 == 32 && + val != deposit64(val, 32, 32, val) && + val != (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 != 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) /* 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)); s->nb_ops = 0; s->nb_labels = 0; @@ -1199,13 +1200,19 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TCGv_ptr base, bigendian = 1; #endif - if (base_ts->kind != 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 = 1; s->nb_indirects += (TCG_TARGET_REG_BITS == 32 && type == TCG_TYPE_I64 ? 2 : 1); indirect_reg = 1; + break; + default: + g_assert_not_reached(); } if (TCG_TARGET_REG_BITS == 32 && type == TCG_TYPE_I64) { @@ -1346,6 +1353,37 @@ void tcg_temp_free_internal(TCGTemp *ts) set_bit(idx, s->free_temps[k].l); } +TCGTemp *tcg_constant_internal(TCGType type, tcg_target_long val) +{ + TCGContext *s = tcg_ctx; + GHashTable *h = s->const_table[type]; + TCGTemp *ts; + + if (h == NULL) { + if (sizeof(tcg_target_long) == sizeof(gint64)) { + h = g_hash_table_new(g_int64_hash, g_int64_equal); + } else if (sizeof(tcg_target_long) == sizeof(gint)) { + h = g_hash_table_new(g_int_hash, g_int_equal); + } else { + qemu_build_not_reached(); + } + s->const_table[type] = h; + } + + ts = g_hash_table_lookup(h, &val); + if (ts == NULL) { + ts = tcg_temp_alloc(s); + ts->base_type = type; + ts->type = type; + ts->kind = TEMP_CONST; + ts->temp_allocated = 1; + ts->val = 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 = TEMP_VAL_MEM; switch (ts->kind) { + case TEMP_CONST: + val = TEMP_VAL_CONST; + break; case TEMP_FIXED: val = 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 = TS_DEAD | TS_MEM; break; case TEMP_NORMAL: + case TEMP_CONST: state = TS_DEAD; break; default: @@ -3173,15 +3235,28 @@ static void temp_load(TCGContext *, TCGTemp *, TCGRegSet, 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 = TEMP_VAL_MEM; + break; + case TEMP_NORMAL: + new_type = free_or_dead < 0 ? TEMP_VAL_MEM : TEMP_VAL_DEAD; + break; + case TEMP_CONST: + new_type = TEMP_VAL_CONST; + break; + default: + g_assert_not_reached(); } if (ts->val_type == TEMP_VAL_REG) { s->reg_to_temp[ts->reg] = NULL; } - ts->val_type = (free_or_dead < 0 - || ts->kind != TEMP_NORMAL - ? TEMP_VAL_MEM : TEMP_VAL_DEAD); + ts->val_type = new_type; } /* 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, TCGRegSet allocated_regs) for (i = s->nb_globals; i < s->nb_temps; i++) { TCGTemp *ts = &s->temps[i]; - if (ts->kind == 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 == TEMP_VAL_DEAD); + break; + case TEMP_CONST: + /* Similarly, we should have freed any allocated register. */ + tcg_debug_assert(ts->val_type == TEMP_VAL_CONST); + break; + default: + g_assert_not_reached(); } } @@ -3691,46 +3773,43 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) i_preferred_regs = o_preferred_regs = 0; if (arg_ct->ct & TCG_CT_IALIAS) { o_preferred_regs = op->output_pref[arg_ct->alias_index]; - if (ts->kind == TEMP_FIXED) { - /* if fixed register, we must allocate a new register - if the alias is not the same register */ - if (arg != 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; - } - /* check if the current register has already been allocated - for another input aliased to an output */ - if (ts->val_type == TEMP_VAL_REG) { - int k2, i2; - reg = ts->reg; - for (k2 = 0 ; k2 < k ; k2++) { - i2 = def->sorted_args[nb_oargs + k2]; - if ((def->args_ct[i2].ct & TCG_CT_IALIAS) && - reg == 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 == TEMP_VAL_REG) { + reg = ts->reg; + for (int k2 = 0; k2 < k; k2++) { + int i2 = def->sorted_args[nb_oargs + k2]; + if ((def->args_ct[i2].ct & TCG_CT_IALIAS) && + reg == new_args[i2]) { + goto allocate_in_reg; } } - i_preferred_regs = o_preferred_regs; } + i_preferred_regs = o_preferred_regs; } temp_load(s, ts, arg_ct->u.regs, i_allocated_regs, i_preferred_regs); reg = ts->reg; - 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 - 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 = tcg_reg_alloc(s, arg_ct->u.regs, i_allocated_regs, @@ -4189,6 +4268,13 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) } #endif + for (i = 0; i < TCG_TYPE_COUNT; ++i) { + if (s->const_table[i]) { + g_hash_table_destroy(s->const_table[i]); + s->const_table[i] = NULL; + } + } + tcg_reg_alloc_start(s); s->code_buf = tb->tc.ptr; From patchwork Fri May 8 18:26:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186420 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp226264ill; Fri, 8 May 2020 11:27:13 -0700 (PDT) X-Google-Smtp-Source: APiQypKSGn6xXbWu/kl1G69nV1Srf0qE+ywGQgvnNqGe+nPYE8aZt8+VyRLFhPey3ibXndhbevJt X-Received: by 2002:ac8:80d:: with SMTP id u13mr4558213qth.355.1588962433609; Fri, 08 May 2020 11:27:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588962433; cv=none; d=google.com; s=arc-20160816; b=kQTkzdqE8C8PsndBhgB48tuxUp6sXQAhzDlcWawh+k2LLCuEj53OIb/Gbp7naRWE5V dwjTHJPPbSyefkzeQ8hKPdxzMMvMrZa3tRYh/2ygNP0OZvkiNlbr9ox8ob/tb832EEL1 DohOyIG4x2liMf0ErNnoHPXaJKCAYB+RNyczWmvD1rYUBST+od8mQ00iuJmzLOq+PADM NtnHdBLmdTzlldNotdh1tARax36lgEhOaYX4OhFfgv+ZUDG6UEEwuLjmGXF5Udkib5q9 IaBy5jKYEDMIh5+t13DkVHACHACzYTHJ+7hXZWQztdIruUonUrw2Lbm9bGVVCP3nuw6a X3Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Wot8cVjNfhYdwjbPEb/DRxN+VrYjwXPiNxtZudeESRQ=; b=V0GBQGUGWiWRuJiAJvlNO1wLzZQ5O5TN5IiPQ2+UgZKRSOGg7MsL2pwYP75LiE3QCi pfisa02X4cPzClRIKzlvXlD96xv+0Rq+ewPC8unQ5Rs4wNiIAzkk7SPhSYIfpC+inyE6 FIALCHD8DEIbSHYhWaHFR6iVGeCorpZ5q77qKV5I4OPww5UvI7l5QvUXYRIsIrRxph1+ 9uyrh+g7fLu9Wao2VPiGiHECa1VhCCs7/fFBH/vDDrveMWIe5jHa4r9qHCHQ3sASpN5i YrKRigpGxqbpCNTq3PYnd+415rxbRymoL2uhY5JRNt9ZkuQJmMtL1znkE8+xgXpEVU/D gi4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a6SPl4BA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e19si1831316qtw.377.2020.05.08.11.27.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:27:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a6SPl4BA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7iL-0006jE-44 for patch@linaro.org; Fri, 08 May 2020 14:27:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7ha-0006gA-IO for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:26 -0400 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]:37278) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hZ-0005lv-Kb for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:26 -0400 Received: by mail-pj1-x1042.google.com with SMTP id a7so4658775pju.2 for ; Fri, 08 May 2020 11:26:25 -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=Wot8cVjNfhYdwjbPEb/DRxN+VrYjwXPiNxtZudeESRQ=; b=a6SPl4BAn/u6jCrm6XqJHdrAHjpVXFoAQcKB2decqWsbG3SmEhgTtoYyGLJVOUYglj Q06YUEOE9nOdaJaklkLVw+2iE1vzXyPI0EkKxbfgTneQMMWSQ8VIF1ERemA0jkuARDYg azypeJjQfCpAfTBvFE9SR3WREJORrNuzxTPwOGD0w1fijgDPhMX1KFbotw9kH3NlR+D1 qMEGZMjfCQKUa3G40TN2k951xRebs7jHvH3IsqDb3fQh3QVZjf5QZlpP+G3+vjcUmAi1 jiLsW+8FW3fvkSwgK6AyfgpLwsntr4PrhjjQqxPfJr1ww9A/RTfoiCc/VZm6eobztx3n XZgQ== 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=Wot8cVjNfhYdwjbPEb/DRxN+VrYjwXPiNxtZudeESRQ=; b=N2e/gU/TCMkZkK3ovRaCfHfOgqQMVNC93MWxG2Ynt2XZ1lqcL8KWLRnh/8PBtdB5wS jC+GuwnayQmGSTeOq1nPNhONbVQ5QYJ72NJsg8+VVMHKQh31ia8ybLI+Hrp0fJ8SoJju bWOOhXU7j54BroDiPTzDiXVbSj8CxX7ISuTki0XbNispCPaYx2vOvvA26SAshIr3wog6 MhrUMA2SBtF2Q2Wl/kDFi9jwI2jwpUekS3vQ7ujtMUEbgeFJpjeG0Eusd5BkXYvV7yad j+aZ0Sxds1mqXoWp0vig5dDtgtHfS7pTsrbCDv+20gNIpYodO5lj3Vo6H5+SWvvqZa6T qAlQ== X-Gm-Message-State: AGi0PuZa+vUeD2P09KFwymm2dTf2shyKRJZPLYVfuBS6DzFnkrgnYijI z4h3NC/lQ/Eq64wqskmvOmrldZAouW4= X-Received: by 2002:a17:90a:20e2:: with SMTP id f89mr6773438pjg.205.1588962383862; Fri, 08 May 2020 11:26:23 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 04/19] tcg: Use tcg_constant_i32 with icount expander Date: Fri, 8 May 2020 11:26:01 -0700 Message-Id: <20200508182616.18318-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We must do this before we adjust how tcg_out_movi_i32, lest the under-the-hood poking that we do be broken. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/exec/gen-icount.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) -- 2.20.1 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) static inline void gen_tb_start(TranslationBlock *tb) { - TCGv_i32 count, imm; + TCGv_i32 count; tcg_ctx->exitreq_label = 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)); if (tb_cflags(tb) & CF_USE_ICOUNT) { - imm = tcg_temp_new_i32(); - /* We emit a movi with a dummy immediate argument. Keep the insn index - * of the movi so that we later (when we know the actual insn count) - * 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 index + * 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 = tcg_last_op(); - - tcg_gen_sub_i32(count, count, imm); - tcg_temp_free_i32(imm); } 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))); } gen_set_label(tcg_ctx->exitreq_label); From patchwork Fri May 8 18:26:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186425 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp228121ill; Fri, 8 May 2020 11:30:04 -0700 (PDT) X-Google-Smtp-Source: APiQypIznCy7u4FMpiu/a7wjmO7zK8fdAtgYilmaUxKtmaoBRTh1pqLjgA+I2GhzYbMCOr4SPogn X-Received: by 2002:a37:b44:: with SMTP id 65mr4409395qkl.368.1588962604716; Fri, 08 May 2020 11:30:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588962604; cv=none; d=google.com; s=arc-20160816; b=Iz70AOSqw1UqddolBCpbCt6Oqa2l9Ty59k5YpJsXt4vTEWoUlcFG7ZzNYMbIG0hoKF EcjVYsR65oQg2kYKPgaINPehwCxw1PKgGesDE91JzW5xvGlEzTryM9Vcp9Y9umfAnOfR UUc5LS9amXTgtRGly8EfTTfLSC4u157n0HpvvItUrTtMzamznQkY1bXo8UrXS8ZYGE61 zONI/71rhgE+1bnC7L9oG4ci/x5sPx97gNf0fWN0vxWpvmLXwVhFIosLexMl9Ejh3bK9 6W5T3E693ebrhzp3N9w5YFoi/I6zYcRQDHOI1K00S+AvQK67jSG2cTX+IhnDVAXl7exq iJQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=NsnJVOaPLwH5XsOssCR1XTL/4FrFEQFISOVbUenMYyk=; b=vXXgBuY7Sdc3lWXtuBy5irriQnaFs0ADnch7rikHz8SDOTK8S1h908dNjK/+eei/ML TdclkNwimNxZ/YDZurmgNZFq2CaVpPT1AZCooCCKl+7f+RfJ14Ce2nIIq2VtgTa3EYv+ JF1ivNevSZGPOukvMtCBAy1bShQwJk6o26XpogymX1k7Y78m4/nvYihyHDIsNgNC7Vob kZsDxH7cup8bk5NHY2/2mPKHBfeLXp5w+aE+mZo/GoimGr9zn2/blwSdaRsBBP4Vul/O 9nAXNqcLGBru3X/tk+Yg4HHs5rzqMpGe3GschFA/HxRp1AtSbWmzOXxkK41i7165Mm6Q s4VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DvRDGDzp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b19si558208qvz.127.2020.05.08.11.30.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:30:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DvRDGDzp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7l6-00051q-3H for patch@linaro.org; Fri, 08 May 2020 14:30:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7hd-0006lX-Ie for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:29 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:35605) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hb-00061R-Km for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:29 -0400 Received: by mail-pj1-x102e.google.com with SMTP id ms17so4658553pjb.0 for ; Fri, 08 May 2020 11:26:27 -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=NsnJVOaPLwH5XsOssCR1XTL/4FrFEQFISOVbUenMYyk=; b=DvRDGDzpTAD4PPesue8Le9rXSDC0dfRdEUdfkQc7ITnRsXuK2QpbNd1g0vhChvI+yC pwcx3M3I84GVQFD6KaSGSOdHljZFGGcACMBWB5/01pzQJJGYMdxSaPcmNQGoCRTRraIE x5ZfLkucPrF7R9tX8Ex2K8ZWaWvSvtO3mytgXX2SmzqJpMh6J9T3St0qUsbCecmM5sF6 Fisxtica996Ru8v4uhIWzfc1WKtxVsLihpVwtX5eoprsVpI8nmgJWmfdKmkelPElZyQF ymcK73v7nKFJLFUZsq/jTOMo/X3gwv20zctCKfE3YOhxWRKVmE5HK7PmcXLtGexOoBtK KUgA== 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=NsnJVOaPLwH5XsOssCR1XTL/4FrFEQFISOVbUenMYyk=; b=MYy8GsBg4XIYgMvfH1bW5HYsGbyzNVHKqlzJpcxm6eZ4+1lMpYGqzYcXmsTaxzc+5V Lf+hEbyi32g411T29N7XEXXwem509/VOZHshE2jmTOF4mpxnea0RPHrN7OACH7BOh2Qc WWG2Xw6Un9hsrg5wLU6x67My9a8oSRXskFcdH7Of/cW9PJNsZpw8XUV1zroI/vsYS+Uq 4LdxtFRdiGBRTCKW3weSvpb4ovkG0fE518hxwfADysvRar/GID991/nZvVme/2WZVxVa 8oQMZvwybt04Gsn9FjKy3vudcxRsZvWpH5NmrIY7hj0QJt00Ib1+ahry3TqtR58wPcQE NhDQ== X-Gm-Message-State: AGi0Pub2LTDu85ohEfm/Nl02FyhL3HvFS8qNdnJi3a9MQk0BnQWH2dXr Zi5fWRP9rBERgN3tS0z9PnIjegDCa9I= X-Received: by 2002:a17:90a:a414:: with SMTP id y20mr6841155pjp.45.1588962385219; Fri, 08 May 2020 11:26:25 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 05/19] tcg: Use tcg_constant_{i32, i64} with tcg int expanders Date: Fri, 8 May 2020 11:26:02 -0700 Message-Id: <20200508182616.18318-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/tcg/tcg-op.h | 13 +-- tcg/tcg-op.c | 216 ++++++++++++++++++++----------------------- 2 files changed, 100 insertions(+), 129 deletions(-) -- 2.20.1 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); /* 32 bit ops */ +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) } } -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_i32 arg) /* 64 bit ops */ +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) } } -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_i64 arg1, TCGv_i64 arg2) 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) /* 32 bit ops */ +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 == 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 = 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)); } } @@ -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 = 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); } } @@ -134,15 +135,12 @@ void tcg_gen_subi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) if (arg2 == 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 = 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)); } } 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, int32_t arg2) } break; } - t0 = 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)); } 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 == 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 = 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)); } } @@ -193,9 +188,7 @@ void tcg_gen_xori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) /* Don't recurse with tcg_gen_not_i32. */ tcg_gen_op2_i32(INDEX_op_not_i32, ret, arg1); } else { - TCGv_i32 t0 = 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)); } } @@ -205,9 +198,7 @@ void tcg_gen_shli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) if (arg2 == 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 = 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)); } } @@ -217,9 +208,7 @@ void tcg_gen_shri_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) if (arg2 == 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 = 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)); } } @@ -229,9 +218,7 @@ void tcg_gen_sari_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) if (arg2 == 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 = 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)); } } @@ -250,9 +237,7 @@ void tcg_gen_brcondi_i32(TCGCond cond, TCGv_i32 arg1, int32_t arg2, TCGLabel *l) if (cond == TCG_COND_ALWAYS) { tcg_gen_br(l); } else if (cond != TCG_COND_NEVER) { - TCGv_i32 t0 = 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); } } @@ -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 = 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)); } 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, int32_t arg2) } else if (is_power_of_2(arg2)) { tcg_gen_shli_i32(ret, arg1, ctz32(arg2)); } else { - TCGv_i32 t0 = 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)); } } @@ -433,9 +414,7 @@ void tcg_gen_clz_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) void tcg_gen_clzi_i32(TCGv_i32 ret, TCGv_i32 arg1, uint32_t arg2) { - TCGv_i32 t = 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)); } 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 = tcg_const_i32(0); + z = 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, uint32_t arg2) tcg_gen_ctpop_i32(ret, t); tcg_temp_free_i32(t); } else { - TCGv_i32 t = 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)); } } @@ -547,9 +523,7 @@ void tcg_gen_rotli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) if (arg2 == 0) { tcg_gen_mov_i32(ret, arg1); } else if (TCG_TARGET_HAS_rot_i32) { - TCGv_i32 t0 = 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 = 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 = tcg_const_i32(0); + TCGv_i32 zero = 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 = tcg_temp_new_i32(); TCGv_i32 t1 = tcg_temp_new_i32(); - TCGv_i32 t2 = tcg_const_i32(0x00ff00ff); + TCGv_i32 t2 = tcg_constant_i32(0x00ff00ff); /* arg = abcd */ tcg_gen_shri_i32(t0, arg, 8); /* t0 = .abc */ @@ -1067,7 +1040,6 @@ void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg) tcg_temp_free_i32(t0); tcg_temp_free_i32(t1); - tcg_temp_free_i32(t2); } } @@ -1237,6 +1209,14 @@ void tcg_gen_mul_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_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 == 32 */ 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 == 0) { tcg_gen_mov_i64(ret, arg1); + } else if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_add_i64(ret, arg1, tcg_constant_i64(arg2)); } else { - TCGv_i64 t0 = 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)); } } @@ -1256,10 +1238,12 @@ void tcg_gen_subfi_i64(TCGv_i64 ret, int64_t arg1, TCGv_i64 arg2) if (arg1 == 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 == 64) { + tcg_gen_sub_i64(ret, tcg_constant_i64(arg1), arg2); } else { - TCGv_i64 t0 = 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)); } } @@ -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 == 0) { tcg_gen_mov_i64(ret, arg1); + } else if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_sub_i64(ret, arg1, tcg_constant_i64(arg2)); } else { - TCGv_i64 t0 = 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)); } } void tcg_gen_andi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) { - TCGv_i64 t0; - if (TCG_TARGET_REG_BITS == 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, int64_t arg2) } break; } - t0 = 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)); } 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, int64_t arg2) } else if (arg2 == 0) { tcg_gen_mov_i64(ret, arg1); } else { - TCGv_i64 t0 = 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)); } } @@ -1351,9 +1332,7 @@ void tcg_gen_xori_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) /* Don't recurse with tcg_gen_not_i64. */ tcg_gen_op2_i64(INDEX_op_not_i64, ret, arg1); } else { - TCGv_i64 t0 = 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)); } } @@ -1415,9 +1394,7 @@ void tcg_gen_shli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) } else if (arg2 == 0) { tcg_gen_mov_i64(ret, arg1); } else { - TCGv_i64 t0 = 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)); } } @@ -1429,9 +1406,7 @@ void tcg_gen_shri_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) } else if (arg2 == 0) { tcg_gen_mov_i64(ret, arg1); } else { - TCGv_i64 t0 = 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)); } } @@ -1443,9 +1418,7 @@ void tcg_gen_sari_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) } else if (arg2 == 0) { tcg_gen_mov_i64(ret, arg1); } else { - TCGv_i64 t0 = 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)); } } @@ -1468,12 +1441,17 @@ void tcg_gen_brcond_i64(TCGCond cond, TCGv_i64 arg1, TCGv_i64 arg2, TCGLabel *l) void tcg_gen_brcondi_i64(TCGCond cond, TCGv_i64 arg1, int64_t arg2, TCGLabel *l) { - if (cond == TCG_COND_ALWAYS) { + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_brcond_i64(cond, arg1, tcg_constant_i64(arg2), l); + } else if (cond == TCG_COND_ALWAYS) { tcg_gen_br(l); } else if (cond != TCG_COND_NEVER) { - TCGv_i64 t0 = 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)); } } @@ -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 = tcg_const_i64(arg2); - tcg_gen_setcond_i64(cond, ret, arg1, t0); - tcg_temp_free_i64(t0); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_setcond_i64(cond, ret, arg1, tcg_constant_i64(arg2)); + } else if (cond == TCG_COND_ALWAYS) { + tcg_gen_movi_i64(ret, 1); + } else if (cond == 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); + } } 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 = tcg_temp_new_i64(); TCGv_i64 t1 = tcg_temp_new_i64(); - TCGv_i64 t2 = tcg_const_i64(0x00ff00ff); + TCGv_i64 t2 = tcg_constant_i64(0x00ff00ff); /* arg = ....abcd */ tcg_gen_shri_i64(t0, arg, 8); /* t0 = .....abc */ @@ -1706,7 +1694,6 @@ void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg) tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); - tcg_temp_free_i64(t2); } } @@ -1850,16 +1837,16 @@ void tcg_gen_clzi_i64(TCGv_i64 ret, TCGv_i64 arg1, uint64_t arg2) if (TCG_TARGET_REG_BITS == 32 && TCG_TARGET_HAS_clz_i32 && arg2 <= 0xffffffffu) { - TCGv_i32 t = tcg_const_i32((uint32_t)arg2 - 32); - tcg_gen_clz_i32(t, TCGV_LOW(arg1), t); + TCGv_i32 t = 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 = tcg_const_i64(arg2); - tcg_gen_clz_i64(ret, arg1, t); - tcg_temp_free_i64(t); + TCGv_i64 t0 = tcg_const_i64(arg2); + tcg_gen_clz_i64(ret, arg1, t0); + tcg_temp_free_i64(t0); } } @@ -1881,7 +1868,7 @@ void tcg_gen_ctz_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) tcg_gen_clzi_i64(t, t, 64); tcg_gen_xori_i64(t, t, 63); } - z = tcg_const_i64(0); + z = 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, uint64_t arg2) if (TCG_TARGET_REG_BITS == 32 && TCG_TARGET_HAS_ctz_i32 && arg2 <= 0xffffffffu) { - TCGv_i32 t32 = tcg_const_i32((uint32_t)arg2 - 32); - tcg_gen_ctz_i32(t32, TCGV_HIGH(arg1), t32); + TCGv_i32 t32 = 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, uint64_t arg2) tcg_gen_ctpop_i64(ret, t); tcg_temp_free_i64(t); } else { - TCGv_i64 t64 = tcg_const_i64(arg2); - tcg_gen_ctz_i64(ret, arg1, t64); - tcg_temp_free_i64(t64); + TCGv_i64 t0 = tcg_const_i64(arg2); + tcg_gen_ctz_i64(ret, arg1, t0); + tcg_temp_free_i64(t0); } } @@ -1969,9 +1956,7 @@ void tcg_gen_rotli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) if (arg2 == 0) { tcg_gen_mov_i64(ret, arg1); } else if (TCG_TARGET_HAS_rot_i64) { - TCGv_i64 t0 = 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 = 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 = tcg_const_i64(0); + TCGv_i64 zero = 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 == 32) { if (ofs >= 32) { @@ -3102,9 +3086,8 @@ void tcg_gen_atomic_cmpxchg_i32(TCGv_i32 retv, TCGv addr, TCGv_i32 cmpv, #ifdef CONFIG_SOFTMMU { - TCGv_i32 oi = 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 = 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 addr, TCGv_i64 cmpv, #ifdef CONFIG_SOFTMMU { - TCGv_i32 oi = tcg_const_i32(make_memop_idx(memop, idx)); - gen(retv, cpu_env, addr, cmpv, newv, oi); - tcg_temp_free_i32(oi); + TCGMemOpIdx oi = 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, #ifdef CONFIG_SOFTMMU { - TCGv_i32 oi = tcg_const_i32(make_memop_idx(memop & ~MO_SIGN, idx)); - gen(ret, cpu_env, addr, val, oi); - tcg_temp_free_i32(oi); + TCGMemOpIdx oi = 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, #ifdef CONFIG_SOFTMMU { - TCGv_i32 oi = tcg_const_i32(make_memop_idx(memop & ~MO_SIGN, idx)); - gen(ret, cpu_env, addr, val, oi); - tcg_temp_free_i32(oi); + TCGMemOpIdx oi = make_memop_idx(memop & ~MO_SIGN, idx); + gen(ret, cpu_env, addr, val, tcg_constant_i32(oi)); } #else gen(ret, cpu_env, addr, val); From patchwork Fri May 8 18:26:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186426 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp228191ill; Fri, 8 May 2020 11:30:11 -0700 (PDT) X-Google-Smtp-Source: APiQypJSAN9Z7l7dVW4ouQaDICCnh+zp1QcAqwTjSzyh25A+sGtd5GQQdXqDFv+i4TdF9snLwGbT X-Received: by 2002:a37:a885:: with SMTP id r127mr2641694qke.93.1588962611769; Fri, 08 May 2020 11:30:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588962611; cv=none; d=google.com; s=arc-20160816; b=HTdtJavFsZYgKqXGYIG0rcbjZJbfx6FLZj7yLrv1owJLdYx6Y51dBnNEhE9p0PQDea 3/Bu9Er4U9SxE+kCrvB1QodtDjeyehsxOBN4fsf59Mykfmih85l+JgdO5TL21O3KcwJd oDpidvhm7EcjvtxTC4h18qM9yc4pAU4xhYGo7HkzQupn/WoohVBliHDdx7cJtaQfGWw1 xH7hTtZ76ZemZjXKwny1ZjRQIqlTIfv0RIlF+ENhU2D7qm3s7Pa3ZdxFR7MoYOXVVDM+ DeCo6KQ0qIdnQudhK0F4hhQYbmDsqud+tVgFIIWo3E1OzUmIduhcN3+ocDFT3+Bo4sbg ad+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=2L8f73fT7ql1FhEo7kgEnU/dvTfN8ScU6VGJ8RkN9ho=; b=PCHrv69ynirKJpkNh269Me8qq8Uu5saTBRylArhO8dtXEHzK+xF/RigIAdopEGr6VE l2gnZkuObeQ83I2hpROD9+XZQPTuKtdA9ZfPpuzAXKceQ1p6EuqCbDDKNgsVQkkBGBig NiQe9fwHhInaly9FQEia4jbFHnsOrwygegOgwuVynhnRn5xhqQelNlgR3WXXWnd+nvT/ VGJv0HYGrEc4Yex0b4vl685qexorxl1SbiAWw+BHVGSSretBSbJ//4k80Jmgs6dO92Jj JrLbetNsWy0iIDLRAxjOBSdlapVzONR5FQAd1wfu9avFVGAd6Xck3KmFsGJmS+fN6FMc FZlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=V+Bj7CVo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j5si1554733qvp.1.2020.05.08.11.30.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:30:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=V+Bj7CVo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56310 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7lB-0005D5-Fx for patch@linaro.org; Fri, 08 May 2020 14:30:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7hd-0006kP-3A for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:29 -0400 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:38460) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hc-00066D-4Q for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:28 -0400 Received: by mail-pj1-x1041.google.com with SMTP id t40so4650312pjb.3 for ; Fri, 08 May 2020 11:26:27 -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=2L8f73fT7ql1FhEo7kgEnU/dvTfN8ScU6VGJ8RkN9ho=; b=V+Bj7CVosq2eG4zS6Hqyf0AUi7ZUopilqVX+4udg0NrjcaDCVK1d3g3QMdNrzxeJr+ ensLSvxqLfoUMIKRXbVddQ8YpznWnpIX+qbFHUny/xC9qqpSKNNM37HfJzk6VS7IthX6 Uc/2Au38UKjfMqOOLmmtCjTYdfGgwslO6EMeIq5Y5w3qwmVxsKtERyubqxfNHiKTHcbX AT5vOwU/RkCg4rranM6KRP2ISqTxFswsnbzhEfgBbbcqSLjLDYRWTRns7X2Ldq25zYq+ ptfj9Sea1ALOrBnS1yLqyWJ8BX3F01G3G9y2jsVjUzpjXA5/NaunESpBtf/7wg0v8CQx L6NQ== 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=2L8f73fT7ql1FhEo7kgEnU/dvTfN8ScU6VGJ8RkN9ho=; b=Bh/N4z4scPVSFc4wkpGoTUDzr/drwKIAF5bkpDQDmaUulAiTCCozIQtKG8sdqTTccL d/qRH4KPJw9Z/Zu/GU4jzknMGFJpmRJa6QT978lQ7m67GEWZZpqsaQUNQOUsSXJDjN9Y WI4Ds/deiUQE3iU0V6xw5O23ljjXHGFMVNOuR/X9UPSaqLZugYjrpMVnjmZ4e9axSbhc sqiV29Mwl3uKoPeENN6GdsyJ3VUlpP5u6HxkQCR7kY5G9po782Qn6EMgcxtJE79hDNQs 8VHrDkeqBQUkQ5oQSJ5rvf4mdD5nszgXFED56g2ivQXmlbq+Lo2NzFyGgCrOuYaBwnAl imsQ== X-Gm-Message-State: AGi0PuZxAsaeoT1mCqpD2kyvAYc+tAmJ08sQAYKH1FYMED9T5ID4AGep iAKo/PS5UgHGEOvbndKhjMxvrbUibbI= X-Received: by 2002:a17:90a:362f:: with SMTP id s44mr8069851pjb.156.1588962386416; Fri, 08 May 2020 11:26:26 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 06/19] tcg: Use tcg_constant_{i32, vec} with tcg vec expanders Date: Fri, 8 May 2020 11:26:03 -0700 Message-Id: <20200508182616.18318-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tcg/tcg-op-vec.c | 63 ++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 29 deletions(-) -- 2.20.1 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) } } -#define MO_REG (TCG_TARGET_REG_BITS == 64 ? MO_64 : MO_32) - -static void do_dupi_vec(TCGv_vec r, unsigned vece, TCGArg a) -{ - TCGTemp *rt = 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 = 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; } TCGv_vec tcg_const_ones_vec(TCGType type) { TCGv_vec ret = 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; } @@ -267,37 +259,50 @@ TCGv_vec tcg_const_ones_vec_matching(TCGv_vec m) return tcg_const_ones_vec(t->base_type); } -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 == 32 && a == deposit64(a, 32, 32, a)) { - do_dupi_vec(r, MO_32, a); - } else if (TCG_TARGET_REG_BITS == 64 || a == (uint64_t)(int32_t)a) { - do_dupi_vec(r, MO_64, a); - } else { - TCGv_i64 c = tcg_const_i64(a); - tcg_gen_dup_i64_vec(MO_64, r, c); - tcg_temp_free_i64(c); + TCGType type = 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 == 32) { + val = dup_const(vece, val); + if (val != deposit64(val, 32, 32, val) && + val != (uint64_t)(int32_t)val) { + uint32_t vl = extract64(val, 0, 32); + uint32_t vh = extract64(val, 32, 32); + TCGArg al = tcgv_i32_arg(tcg_constant_i32(vl)); + TCGArg ah = tcgv_i32_arg(tcg_constant_i32(vh)); + TCGArg di = 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)); } -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); } -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); } -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); } -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); } 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_vec 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); From patchwork Fri May 8 18:26:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186424 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp227166ill; Fri, 8 May 2020 11:28:29 -0700 (PDT) X-Google-Smtp-Source: APiQypKIEI5NDSkiJ5KirDgxUxOiViptvzokrfLLWLIYDfcKu45tpdvsat8NVel8mAgRHN+Ttmee X-Received: by 2002:a05:620a:227:: with SMTP id u7mr4131359qkm.182.1588962509658; Fri, 08 May 2020 11:28:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588962509; cv=none; d=google.com; s=arc-20160816; b=oNGZve384A7YIl+I7PNKm0Eu4s2JTfUdms3f3QJmPmIZncr3LnKD3KWa8IywummvD5 aRCAXDjFrQ0fhN/WQx5NluFas+GL5V4BzidgcraYgcFuAgvUF/Qz6a+SrsARDrkdxUKx qrkquR1TW58fDLf0UiKEQcfH+QFoKNlhiyr2Ag1yaq7MWWiDbqPGs9Hns02v5QhFGljs IYrnl4CLG9x6GXYIur4ZW1KJYbemyM8Zk4vFY55ZWpb7A6E/fN20RYEVs9jYYOM5p0e0 BtV/oAIHQbhW/Tu8vjprKlNHYCmUXPqUqXtIPVv2YvkYl0vBkv1t77mbvlaoX6FK/BmS fljA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=xmadSpOQwsQc/jlcXZb4SKOmMYrqNW8ASv1JO/0wGNg=; b=Ov2iHT3DzJxlTvSBkWfpf+6Ns1roKZ2Xu1Ddq9BSQOmsTpnVlkQGqyWqKt42lss3CW Yld45lVZSghwkfr9FMH6C3X8f/9tGxlnxJb7PRKo12N9Tu16D/IHBX7K3xxwrjvVVdOd VYewcJszF9rma7/GBrYJnP8ET3NAMLiM6LMf8qqENS+urAwCZ42hLiIP9RIlm+EAU8aV 0g7R32zl4qciM188xVYPpml/BoOXR/MXzUjIz3NS15bIedYjdyjS5yIkajzJMrID9cdV cj7gLOhF0MgdnoQcEgEXFKS4kWCE+iDye+JnNl78U3Gs63TT8x6qb3clQ+Iz8es5IgEC ZxoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tYuUW3no; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y3si1414392qkl.285.2020.05.08.11.28.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:28:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tYuUW3no; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7jZ-0001pE-5P for patch@linaro.org; Fri, 08 May 2020 14:28:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7hf-0006py-Fb for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:31 -0400 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]:54673) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hd-0006Jt-O9 for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:31 -0400 Received: by mail-pj1-x1042.google.com with SMTP id y6so4678005pjc.4 for ; Fri, 08 May 2020 11:26:29 -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=tYuUW3noapmBsjf9Wk0HHaIHWWfTxMAUtFJqikZiu/8nqfOashyFzq8tJjElf55zsX MDMgsCLzgQlKST4xgfBdEX5HyY8udTR0likL1fcEOIBtomUnnU20gQLCCJ8gdCSrmhb1 WAH+G7jx0LwhqESjmjk5dUNYloME/m2UzAvjWCRjO7ZdgRFQWquJtG0VJnWsAfqEruW/ O/kstVkIPLFyLtlUfyUgZ4gC1kGtTO+OXPobnz3je9vUYs4MKCRyzQkmN2rtaGryLTho ed9Wceknh0aUIqi3TbRUg63sHqp7ykyzFlRMixacomoCDmCfjHs6Zz6J/klgux02mvPx wMTg== 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=YzdzjhtY1mLYIq/s6Bp6CfT9NUrgGwpGlzDrxkZiaLajj6WRFu+GPuqnifPbGKnMlk mmGrf2ZN6JmLJCom0VJhbxtLrvQ3uQfoCNhuRtI9PqSplDyO7f/UDQVm1K4xIU2UxGio QTuuBENwgeoLY/cwFyp9zvf9LdsuUI4caxg0eIh1EO4JqiAvnaX1+4Cbs4T4W6+7hmz3 e7PJ7rG2GQebLwoj1dHiTogddZYuFMZA4IpLuOdXbnLffCtlXn4vXbm0LfA0thbvnjtH uZ93deg1CXTQMQnoW6zgJBLaLZI4xrPQ29a005JXET2eXnpr/m6HM5KLCmaZUfX8224q Bcfg== X-Gm-Message-State: AGi0Pub+cvHcUR8rT8rHjtVumo80LKUL7RPMjDxzT9dWSLvCqDMdDMNT Bw6ZDQF5GiSmsdG66gLOM7fdtH1V9YA= X-Received: by 2002:a17:902:8b84:: with SMTP id ay4mr3692583plb.167.1588962387626; Fri, 08 May 2020 11:26:27 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 07/19] tcg: Use tcg_constant_{i32, i64, vec} with tcg gvec expanders Date: Fri, 8 May 2020 11:26:04 -0700 Message-Id: <20200508182616.18318-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- tcg/tcg-op-gvec.c | 125 +++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 75 deletions(-) -- 2.20.1 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 = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -108,7 +108,6 @@ void tcg_gen_gvec_2_ool(uint32_t dofs, uint32_t aofs, tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); - tcg_temp_free_i32(desc); } /* 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 = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -130,7 +129,6 @@ void tcg_gen_gvec_2i_ool(uint32_t dofs, uint32_t aofs, TCGv_i64 c, tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); - tcg_temp_free_i32(desc); } /* 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, uint32_t bofs, gen_helper_gvec_3 *fn) { TCGv_ptr a0, a1, a2; - TCGv_i32 desc = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -154,7 +152,6 @@ void tcg_gen_gvec_3_ool(uint32_t dofs, uint32_t aofs, uint32_t bofs, tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); tcg_temp_free_ptr(a2); - tcg_temp_free_i32(desc); } /* 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, uint32_t bofs, int32_t data, gen_helper_gvec_4 *fn) { TCGv_ptr a0, a1, a2, a3; - TCGv_i32 desc = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -181,7 +178,6 @@ void tcg_gen_gvec_4_ool(uint32_t dofs, uint32_t aofs, uint32_t bofs, tcg_temp_free_ptr(a1); tcg_temp_free_ptr(a2); tcg_temp_free_ptr(a3); - tcg_temp_free_i32(desc); } /* 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, uint32_t bofs, uint32_t maxsz, int32_t data, gen_helper_gvec_5 *fn) { TCGv_ptr a0, a1, a2, a3, a4; - TCGv_i32 desc = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -211,7 +207,6 @@ void tcg_gen_gvec_5_ool(uint32_t dofs, uint32_t aofs, uint32_t bofs, tcg_temp_free_ptr(a2); tcg_temp_free_ptr(a3); tcg_temp_free_ptr(a4); - tcg_temp_free_i32(desc); } /* 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 = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -233,7 +228,6 @@ void tcg_gen_gvec_2_ptr(uint32_t dofs, uint32_t aofs, tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); - tcg_temp_free_i32(desc); } /* 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, uint32_t bofs, int32_t data, gen_helper_gvec_3_ptr *fn) { TCGv_ptr a0, a1, a2; - TCGv_i32 desc = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -258,7 +252,6 @@ void tcg_gen_gvec_3_ptr(uint32_t dofs, uint32_t aofs, uint32_t bofs, tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); tcg_temp_free_ptr(a2); - tcg_temp_free_i32(desc); } /* 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, uint32_t bofs, gen_helper_gvec_4_ptr *fn) { TCGv_ptr a0, a1, a2, a3; - TCGv_i32 desc = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -287,7 +280,6 @@ void tcg_gen_gvec_4_ptr(uint32_t dofs, uint32_t aofs, uint32_t bofs, tcg_temp_free_ptr(a1); tcg_temp_free_ptr(a2); tcg_temp_free_ptr(a3); - tcg_temp_free_i32(desc); } /* 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, uint32_t bofs, gen_helper_gvec_5_ptr *fn) { TCGv_ptr a0, a1, a2, a3, a4; - TCGv_i32 desc = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -319,7 +311,6 @@ void tcg_gen_gvec_5_ptr(uint32_t dofs, uint32_t aofs, uint32_t bofs, tcg_temp_free_ptr(a2); tcg_temp_free_ptr(a3); tcg_temp_free_ptr(a4); - tcg_temp_free_i32(desc); } /* Return true if we want to implement something of OPRSZ bytes @@ -609,16 +600,13 @@ static void do_dup(unsigned vece, uint32_t dofs, uint32_t oprsz, /* Otherwise implement out of line. */ t_ptr = tcg_temp_new_ptr(); tcg_gen_addi_ptr(t_ptr, cpu_env, dofs); - t_desc = tcg_const_i32(simd_desc(oprsz, maxsz, 0)); + t_desc = tcg_constant_i32(simd_desc(oprsz, maxsz, 0)); if (vece == MO_64) { - if (in_64) { - gen_helper_gvec_dup64(t_ptr, t_desc, in_64); - } else { - t_64 = 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 = 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] = { @@ -646,7 +634,6 @@ static void do_dup(unsigned vece, uint32_t dofs, uint32_t oprsz, } tcg_temp_free_ptr(t_ptr); - tcg_temp_free_i32(t_desc); return; done: @@ -1196,10 +1183,8 @@ void tcg_gen_gvec_2i(uint32_t dofs, uint32_t aofs, uint32_t oprsz, if (g->fno) { tcg_gen_gvec_2_ool(dofs, aofs, oprsz, maxsz, c, g->fno); } else { - TCGv_i64 tcg_c = 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 = maxsz; } @@ -1647,16 +1632,14 @@ static void gen_addv_mask(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b, TCGv_i64 m) void tcg_gen_vec_add8_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 m = tcg_const_i64(dup_const(MO_8, 0x80)); + TCGv_i64 m = tcg_constant_i64(dup_const(MO_8, 0x80)); gen_addv_mask(d, a, b, m); - tcg_temp_free_i64(m); } void tcg_gen_vec_add16_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 m = tcg_const_i64(dup_const(MO_16, 0x8000)); + TCGv_i64 m = tcg_constant_i64(dup_const(MO_16, 0x8000)); gen_addv_mask(d, a, b, m); - tcg_temp_free_i64(m); } 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 = tcg_const_i64(c); + TCGv_i64 tmp = tcg_constant_i64(c); tcg_gen_gvec_adds(vece, dofs, aofs, tmp, oprsz, maxsz); - tcg_temp_free_i64(tmp); } static const TCGOpcode vecop_list_sub[] = { INDEX_op_sub_vec, 0 }; @@ -1800,16 +1782,14 @@ static void gen_subv_mask(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b, TCGv_i64 m) void tcg_gen_vec_sub8_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 m = tcg_const_i64(dup_const(MO_8, 0x80)); + TCGv_i64 m = tcg_constant_i64(dup_const(MO_8, 0x80)); gen_subv_mask(d, a, b, m); - tcg_temp_free_i64(m); } void tcg_gen_vec_sub16_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 m = tcg_const_i64(dup_const(MO_16, 0x8000)); + TCGv_i64 m = tcg_constant_i64(dup_const(MO_16, 0x8000)); gen_subv_mask(d, a, b, m); - tcg_temp_free_i64(m); } 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 = tcg_const_i64(c); + TCGv_i64 tmp = tcg_constant_i64(c); tcg_gen_gvec_muls(vece, dofs, aofs, tmp, oprsz, maxsz); - tcg_temp_free_i64(tmp); } 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 dofs, uint32_t aofs, static void tcg_gen_usadd_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) { - TCGv_i32 max = tcg_const_i32(-1); + TCGv_i32 max = 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); } static void tcg_gen_usadd_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 max = tcg_const_i64(-1); + TCGv_i64 max = 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); } 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 dofs, uint32_t aofs, static void tcg_gen_ussub_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) { - TCGv_i32 min = tcg_const_i32(0); + TCGv_i32 min = 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); } static void tcg_gen_ussub_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 min = tcg_const_i64(0); + TCGv_i64 min = 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); } 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, TCGv_i64 m) void tcg_gen_vec_neg8_i64(TCGv_i64 d, TCGv_i64 b) { - TCGv_i64 m = tcg_const_i64(dup_const(MO_8, 0x80)); + TCGv_i64 m = tcg_constant_i64(dup_const(MO_8, 0x80)); gen_negv_mask(d, b, m); - tcg_temp_free_i64(m); } void tcg_gen_vec_neg16_i64(TCGv_i64 d, TCGv_i64 b) { - TCGv_i64 m = tcg_const_i64(dup_const(MO_16, 0x8000)); + TCGv_i64 m = tcg_constant_i64(dup_const(MO_16, 0x8000)); gen_negv_mask(d, b, m); - tcg_temp_free_i64(m); } 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 = tcg_const_i64(dup_const(vece, c)); + TCGv_i64 tmp = tcg_constant_i64(dup_const(vece, c)); tcg_gen_gvec_2s(dofs, aofs, oprsz, maxsz, tmp, &gop_ands); - tcg_temp_free_i64(tmp); } static const GVecGen2s gop_xors = { @@ -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 = tcg_const_i64(dup_const(vece, c)); + TCGv_i64 tmp = tcg_constant_i64(dup_const(vece, c)); tcg_gen_gvec_2s(dofs, aofs, oprsz, maxsz, tmp, &gop_xors); - tcg_temp_free_i64(tmp); } static const GVecGen2s gop_ors = { @@ -2522,9 +2493,8 @@ void tcg_gen_gvec_ors(unsigned vece, uint32_t dofs, uint32_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 = tcg_const_i64(dup_const(vece, c)); + TCGv_i64 tmp = tcg_constant_i64(dup_const(vece, c)); tcg_gen_gvec_2s(dofs, aofs, oprsz, maxsz, tmp, &gop_ors); - tcg_temp_free_i64(tmp); } 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 dofs, uint32_t aofs, static void tcg_gen_shlv_mod_vec(unsigned vece, TCGv_vec d, TCGv_vec a, TCGv_vec b) { - TCGv_vec t = tcg_temp_new_vec_matching(d); + TCGType type = tcgv_vec_temp(d)->type; + TCGv_vec t = tcg_temp_new_vec(type); + TCGv_vec m = tcg_constant_vec(type, vece, (8 << vece) - 1); - 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 = tcg_temp_new_vec_matching(d); + TCGType type = tcgv_vec_temp(d)->type; + TCGv_vec t = tcg_temp_new_vec(type); + TCGv_vec m = tcg_constant_vec(type, vece, (8 << vece) - 1); - 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 = tcg_temp_new_vec_matching(d); + TCGType type = tcgv_vec_temp(d)->type; + TCGv_vec t = tcg_temp_new_vec(type); + TCGv_vec m = tcg_constant_vec(type, vece, (8 << vece) - 1); - 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 = tcg_temp_new_vec_matching(d); + TCGType type = tcgv_vec_temp(d)->type; + TCGv_vec t = tcg_temp_new_vec(type); + TCGv_vec m = tcg_constant_vec(type, vece, (8 << vece) - 1); - 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 dofs, uint32_t aofs, static void tcg_gen_rotrv_mod_vec(unsigned vece, TCGv_vec d, TCGv_vec a, TCGv_vec b) { - TCGv_vec t = tcg_temp_new_vec_matching(d); + TCGType type = tcgv_vec_temp(d)->type; + TCGv_vec t = tcg_temp_new_vec(type); + TCGv_vec m = tcg_constant_vec(type, vece, (8 << vece) - 1); - 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); } From patchwork Fri May 8 18:26:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186427 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp228776ill; Fri, 8 May 2020 11:31:00 -0700 (PDT) X-Google-Smtp-Source: APiQypLC9R8EGvGGPvr7z+joEKo50w4DSqGbz5o4igbvJFPDRdAlqwEOehtCnC8134bioaa0iSxA X-Received: by 2002:ac8:4d43:: with SMTP id x3mr4463356qtv.306.1588962659964; Fri, 08 May 2020 11:30:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588962659; cv=none; d=google.com; s=arc-20160816; b=l0PKcF8a1AnMwI2PG1FeYW+Ndo5coZH49LcTpoyy2NrYvz7YqHvBNTxoMr3zQJ69+W BnRYV/SBZjIsARY+YHQo6NEKSRxdsMcewMCaZ3+Do7I8H4YSYngPWm+A+2bFfF7vUowy NQ2Bst2cciv7G3MZpiHPigxki4rNRxWn4TgW1InTekbExivieRzJSPCMZjckpyJgQzfv oUDy+cB8WLUyz60sTuIRG3kHYeYQ8LhfRxGxlmuFMTlc0eypBk3lDWzS+NdwYlvKjUCr Gvse31sUl0lgcP0wRuV/xaskYZsbjyusnZqZ/zkFkvwLeV+CiX42i9HUjMYIK/3bdBpv n8gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=s991altgojrzqPsjuJ8OpBmqeSv4utq4bADW+fVvS7E=; b=nZuDvC0ks8AJJa7zXcvsO6RZIj0CJxSrL9XQeBxcyX4pFodfUv+QOLOxos8xP1P2zn LD9quXq+c6Ff/nhpGJ6xM5fDoJFTIdZYILu2+NeuNepB6KxBInbWceJ4fS1nRmqZ5ypI sYULpLMh7Rn8tHC/Jy+KBLgM7q8J4V3RpkbCmRuBdEnusuznRJp/BDP4uI+W214pTxR7 FTOUSTTgFsVhQE3Iq5yxvOXnIO9+CQB5MQTlqjWLq6VLeVLHGMb83I0JdiqoYuebsGhc Jem94u9S1IMBzcj/2NgJa4/dkU4H82ETaAVFYnnuyexEpwgae8e0VqjDSHxqMuurI9Fq N9zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YGgzIb4N; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s186si1445901qkh.370.2020.05.08.11.30.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:30:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YGgzIb4N; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7lz-0005LK-DV for patch@linaro.org; Fri, 08 May 2020 14:30:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7hf-0006qW-Lo for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:31 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:45256) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7he-0006PW-Et for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:31 -0400 Received: by mail-pl1-x641.google.com with SMTP id u22so1088220plq.12 for ; Fri, 08 May 2020 11:26:30 -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=s991altgojrzqPsjuJ8OpBmqeSv4utq4bADW+fVvS7E=; b=YGgzIb4NUxmGXZzDbwNHxj7TW+F0gbGH3gh7zDMUdwGxZGiSmt7pl6L8srLIZUFkaT 5MLWT69Hn3s4iCaIUB+C3wnzeU+ZHKgK8UpLOpMowAuMH/JwsbHpKFniJQm5b/kS/7Oq 33FDOOJcj4webqfMh+v7TKsXDTA5bB2jSz7k9EVR8bWOMXbH7hTkcA5wI3cJKVf6gdej s6mzSTr9f2IN82t5s3xBVQPVKR3NqXDAlVl9VOEuxZJUpjifdMhtDitaEi9Dyq/bHlhZ i/FOlfQcIANSCDa4Zuc9uTdnkmFbDdPrIST3uArMLV5cjNeaJ+O8RNf4UCH5Aur5iwOH pZJA== 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=s991altgojrzqPsjuJ8OpBmqeSv4utq4bADW+fVvS7E=; b=VFniOhdsJx0zZvIjg3j/Qp+8JCdImvAJN5qJdIwxa5xu3WWFiEaNv0BfyRImtdju8i jzZdF8i0InfgMtn2BcaA8cb44wPG4x5W153LVhlZHdSaC/LTr0z7zinEYfnqk/hkw2Fr C2SpEAa95ik5WZeAXTJ2kBSO/QnuCghgTx36dKGn4KKKozRtUzs1j8nzJ+/Z257C0EK2 rL2h/sGtaMGM2NpdaO5yhm3Flza/ghEfDbE/3oviIe4PrKeR7G4N6kQ/5p/esp4+ujqJ P+c9l72Y34lHHvq46Ey/2Hi2dBxNwJRFOXUAMe85m0dzoXCwMgdNRHZNZVE5/+E92nCo gPFg== X-Gm-Message-State: AGi0PuZul9jO+Wzlx04CrUUQrPexqys7CcMCiBVVtWFynTS2XmCKgXzi gGFrYp9Nz0xzREmB4WA5juxthn2tyYQ= X-Received: by 2002:a17:902:a604:: with SMTP id u4mr3656342plq.196.1588962388702; Fri, 08 May 2020 11:26:28 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 08/19] tcg: Use tcg_constant_{i32,i64} with tcg plugins Date: Fri, 8 May 2020 11:26:05 -0700 Message-Id: <20200508182616.18318-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 49 +++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 27 deletions(-) -- 2.20.1 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 == 32) { /* mov_i32 */ op = copy_op(begin_op, op, INDEX_op_mov_i32); - /* movi_i32 */ - op = copy_op(begin_op, op, INDEX_op_movi_i32); + /* mov_i32 w/ $0 */ + op = copy_op(begin_op, op, INDEX_op_mov_i32); } else { /* extu_i32_i64 */ op = copy_op(begin_op, op, INDEX_op_extu_i32_i64); @@ -306,39 +306,34 @@ static TCGOp *copy_mov_i64(TCGOp **begin_op, TCGOp *op) return op; } -static TCGOp *copy_movi_i64(TCGOp **begin_op, TCGOp *op, uint64_t v) -{ - if (TCG_TARGET_REG_BITS == 32) { - /* 2x movi_i32 */ - op = copy_op(begin_op, op, INDEX_op_movi_i32); - op->args[1] = v; - - op = copy_op(begin_op, op, INDEX_op_movi_i32); - op->args[1] = v >> 32; - } else { - /* movi_i64 */ - op = copy_op(begin_op, op, INDEX_op_movi_i64); - op->args[1] = v; - } - return op; -} - static TCGOp *copy_const_ptr(TCGOp **begin_op, TCGOp *op, void *ptr) { if (UINTPTR_MAX == UINT32_MAX) { - /* movi_i32 */ - op = copy_op(begin_op, op, INDEX_op_movi_i32); - op->args[1] = (uintptr_t)ptr; + /* mov_i32 */ + op = copy_op(begin_op, op, INDEX_op_mov_i32); + op->args[1] = tcgv_i32_arg(tcg_constant_i32((uintptr_t)ptr)); } else { - /* movi_i64 */ - op = copy_movi_i64(begin_op, op, (uint64_t)(uintptr_t)ptr); + /* mov_i64 */ + op = copy_op(begin_op, op, INDEX_op_mov_i64); + op->args[1] = tcgv_i64_arg(tcg_constant_i64((uintptr_t)ptr)); } return op; } 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 == 32) { + /* 2x mov_i32 */ + op = copy_op(begin_op, op, INDEX_op_mov_i32); + op->args[1] = tcgv_i32_arg(tcg_constant_i32(v)); + op = copy_op(begin_op, op, INDEX_op_mov_i32); + op->args[1] = tcgv_i32_arg(tcg_constant_i32(v >> 32)); + } else { + /* mov_i64 */ + op = copy_op(begin_op, op, INDEX_op_mov_i64); + op->args[1] = tcgv_i64_arg(tcg_constant_i64(v)); + } + return op; } static TCGOp *copy_extu_tl_i64(TCGOp **begin_op, TCGOp *op) @@ -486,8 +481,8 @@ static TCGOp *append_mem_cb(const struct qemu_plugin_dyn_cb *cb, tcg_debug_assert(type == PLUGIN_GEN_CB_MEM); - /* const_i32 == movi_i32 ("info", so it remains as is) */ - op = copy_op(&begin_op, op, INDEX_op_movi_i32); + /* const_i32 == mov_i32 ("info", so it remains as is) */ + op = copy_op(&begin_op, op, INDEX_op_mov_i32); /* const_ptr */ op = copy_const_ptr(&begin_op, op, cb->userp); From patchwork Fri May 8 18:26:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186428 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp230036ill; Fri, 8 May 2020 11:32:48 -0700 (PDT) X-Google-Smtp-Source: APiQypKVJ2dL7nEerG07B4jVqbRyipOSmTILtSdbdguStLDTMBqZkEoiEmYgXo7No3YslobvUtP1 X-Received: by 2002:a05:620a:110d:: with SMTP id o13mr4180472qkk.212.1588962768013; Fri, 08 May 2020 11:32:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588962768; cv=none; d=google.com; s=arc-20160816; b=Bn1tQ87YX9iQv4W9Mhe6Jc4Ju9kQlaWpHPOwd0AFQCP3rXNhQds6J0zev55OyiLTbg Veyl/7yj2H0hjV8pKtjjx5Obof3RjRq8oHuOD70lkojWMhsD+dKwXbI1ZXNO/k2ebKAe dOn8+CCIivF/FGcRKI4+d4wkv0p2SjRY8FM1QM1WMibfFi7ueDUmZy/QgiBVWbEt54Pj ok+CezNjfMe94wsLo8st/aP1IscxXLekNJhzShuegldxlUtTzMnH2u+s226apvIGDAo0 xtoKwfKbAub41evBUoBe0Ae5ix8x27Qc28MPo9+pcTpd55XtZdsfzG5bV+WWf+WUab17 Yebw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=MaLMndUgO42sLP84CXPM/Cp6vzOBQfg+XnMcWTaB1Gk=; b=NrJ19LKh0+Rai162LTS4x0mAIkWxaCUuZv1YVzTg8pps2IYJTjVRTYZu9CVlHuPmyF GO2+agtoNjtMauirX8J2KfRcEqqRjUx4xWBR/FMQNPvRkxcDX3dp3NLxyEEOJdR+AY7T Ds2kdx1MjXaaT52IK9e1tew6bOdy+WbINQSKwlkQ2Bb+6MG+yzSmg7QoXLax7fVHfL4/ j2qb5yz1XiHIOt7U0xcVtT1ntzoSHMA4ysKRBwREznTnze8oB0eVCGeWGDvre5xg7a/f wYxKx1srp/qF7li6qUmJQiuQgwk5P534abrOIHQNVP5DdNG5kEY1YfPyqDM8F0VshOLu FO0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mqqncLRP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x13si1363696qka.4.2020.05.08.11.32.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:32:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mqqncLRP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7nj-0000ih-Fw for patch@linaro.org; Fri, 08 May 2020 14:32:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7hg-0006t5-Op for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:34 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:37069) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hf-0006Zq-My for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:32 -0400 Received: by mail-pg1-x544.google.com with SMTP id f23so569266pgj.4 for ; Fri, 08 May 2020 11:26:31 -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=MaLMndUgO42sLP84CXPM/Cp6vzOBQfg+XnMcWTaB1Gk=; b=mqqncLRPYvyju8cLXYia9ld2LJtHJQ8AhmJaJ+stdhdYo2ZWNoMgP4hvoJx++gwrxv 4s0rsTbcs6d5j++vKkjT9VsnDmwQ7cUsL/lH2Cv8YY4mgtXjrPQjuu8Nmkbg2fcaZPtJ kCnWDhOngFVhRkDliKMYKM6heiiNPvg2roZMedqMQNAEH6jQtIu1NcWzokOlmiY5OY0Q IJcQQPC0Bs/Sa67qw+VGVdrOK+Y3/Rc1/8WVlxmNvhBOrAcQVI6oOFpGFTVMMCL950J4 PcIRg9gY86+n7rm0+IRCm8GlLadnnSaunJdXA6eV8oJrIC7amrD/5PWzzgQ7F5fxICWt lglQ== 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=MaLMndUgO42sLP84CXPM/Cp6vzOBQfg+XnMcWTaB1Gk=; b=Hpj8eRqsA7TTfZJ/ngOB0tNnj9LkTrllS9nNDVRHEqPs8npKG3FmbJ11oIfEcGB1Pt qXWtKmd6reX0hc9qiqbyl807oWL/UpWIxuQpdbz0AQi2NvsJb0FhmEoUTTYyecrMG4hS hthbEvdwHQLRjoakLgWrAEsaxrTgCK2t+If/emKa3t5FX7YZ6HVXqVVu/wM78ENXexD2 rhLEqkp0aEO+xYaHm+Yw9ahob7itJ6rwOBaNY/yuRFZ3Fa0eMqlX7EujEcSmfiM00OnG 0aktiXkqo3h6w6PdRq8a5hKhTr4OQU3/pmo93OAazByqSRM/NaPgt5+8o3apFm9VwuAA wnag== X-Gm-Message-State: AGi0PuaSdDswMRiwwwuWE2kv/6BHFnZz8cLm4oGSxuH2fn1QHI1S6O8C McY9pxbH4l+PQmT7z2ElBCrwOhKG27M= X-Received: by 2002:a62:68c1:: with SMTP id d184mr4228895pfc.138.1588962389918; Fri, 08 May 2020 11:26:29 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 09/19] tcg: Rename struct tcg_temp_info to TempOptInfo Date: Fri, 8 May 2020 11:26:06 -0700 Message-Id: <20200508182616.18318-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::544; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x544.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_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Fix this name vs our coding style. Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/optimize.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) -- 2.20.1 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) -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; -static inline struct tcg_temp_info *ts_info(TCGTemp *ts) +static inline TempOptInfo *ts_info(TCGTemp *ts) { return ts->state_ptr; } -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 = ts_info(ts); - struct tcg_temp_info *pi = ts_info(ti->prev_copy); - struct tcg_temp_info *ni = ts_info(ti->next_copy); + TempOptInfo *ti = ts_info(ts); + TempOptInfo *pi = ts_info(ti->prev_copy); + TempOptInfo *ni = ts_info(ti->next_copy); ni->prev_copy = ti->prev_copy; pi->next_copy = ti->next_copy; @@ -89,12 +89,12 @@ static void reset_temp(TCGArg arg) } /* 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 = temp_idx(ts); if (!test_bit(idx, temps_used->l)) { - struct tcg_temp_info *ti = &infos[idx]; + TempOptInfo *ti = &infos[idx]; ts->state_ptr = ti; ti->next_copy = ts; @@ -114,7 +114,7 @@ static void init_ts_info(struct tcg_temp_info *infos, } } -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 = arg_info(dst); + TempOptInfo *di = arg_info(dst); def = &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, TCGArg dst, TCGArg src) TCGTemp *dst_ts = arg_temp(dst); TCGTemp *src_ts = 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; @@ -245,7 +245,7 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, TCGArg dst, TCGArg src) di->mask = mask; if (src_ts->type == dst_ts->type) { - struct tcg_temp_info *ni = ts_info(si->next_copy); + TempOptInfo *ni = ts_info(si->next_copy); di->next_copy = si->next_copy; di->prev_copy = src_ts; @@ -608,7 +608,7 @@ void tcg_optimize(TCGContext *s) { int nb_temps, nb_globals; TCGOp *op, *op_next, *prev_mb = NULL; - struct tcg_temp_info *infos; + TempOptInfo *infos; TCGTempSet temps_used; /* Array VALS has an element for each temp. @@ -619,7 +619,7 @@ void tcg_optimize(TCGContext *s) nb_temps = s->nb_temps; nb_globals = s->nb_globals; bitmap_zero(temps_used.l, nb_temps); - infos = tcg_malloc(sizeof(struct tcg_temp_info) * nb_temps); + infos = tcg_malloc(sizeof(TempOptInfo) * nb_temps); QTAILQ_FOREACH_SAFE(op, &s->ops, link, op_next) { tcg_target_ulong mask, partmask, affected; From patchwork Fri May 8 18:26:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186430 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp232023ill; Fri, 8 May 2020 11:35:28 -0700 (PDT) X-Google-Smtp-Source: APiQypIr7buWaqaC5YDgbkyfgsj9MDPqpbmnSSYipkpPCirsChGtP4vxT+vmW1m7EGzB53gWKaAW X-Received: by 2002:a0c:ef05:: with SMTP id t5mr3912809qvr.113.1588962928080; Fri, 08 May 2020 11:35:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588962928; cv=none; d=google.com; s=arc-20160816; b=kv25wRlpVRH19xUXny9XFmyZ/zuxCLXzqgvz8Mflc/HMSQKcp54ffcRGDqvBs5IIKg N26oghzKqTQlhvvalnxvNe+Adro+BimEs0m4bh0Vat4AaZVDyOS2Wf1ZVYISpDTWKuoS 5DmRMY7rx5i2e4mzDj/llw9+/h6uhWRDqq9OFWWO0cWeVdZETHutuIynVsAHvYKh4x9z /rU2tIxtPXgBctbN2vumjAd87/JyawT8Oc68AQmvvcEgkfbCqw2NGXDUl9wuUfJfNnhs W+W3k0q5NCpm9MgvCNvqpjcKjfKNrBjOi/CsukdC/k+guktuwRaLWDGfoMm0FJT1gB81 Wm+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=hO8uxZGqqMIyQAAAtWPOJL9YxJXzGDQrOpnZTatzOw0=; b=U8VAwPBQPlMcUmrvlLU+TlbM3DJe2ycin8bUoNvcCrxUH2IRQ5OPF5/C348eSgMhFi zt3Kk21fko+tro+Nu8SzUIiCxrzNOzhT2130LAGhrhembUQ3iTnNcNNX3bzvRu5zAFGz xuDUsljv2PpokyEaekxRdC6hMM4QxtIAicGNFHDGNK0GiAOwAaxPVg0YCPsmnaF+xe/6 RsgXjirlAXlnhnkK4FVXe02Y01MDklykWuDYbVFfImzRO5ztSdrp63D2++2XSPleERqz E91GMleBu7fZyzluD6b3s1qfYEyk0I63QVwTeVnpGKS8yQxMEImMLUvpX7qfpZ9U63Hn R2rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=njmAAwuv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bb4si1549007qvb.106.2020.05.08.11.35.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:35:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=njmAAwuv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7qJ-0003b9-Jt for patch@linaro.org; Fri, 08 May 2020 14:35:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7hi-0006tr-JU for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:35 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:39979) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hg-0006eL-OG for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:34 -0400 Received: by mail-pg1-x544.google.com with SMTP id j21so1234019pgb.7 for ; Fri, 08 May 2020 11:26:32 -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=njmAAwuvw8oERfODYeN/lkVIgFf7zmJzhcAL+6bzIP18A4t42QD6vwiCptFh2fl6Ca uVql8v6VYihvB6O5cV5j19P5pI9kPgMKG6EdC7gLqTGnnpzJnxsymotrVI+AaePyDwBu 0ZagzMQbYEoBNgoGw9hWRXYg7RqWHvICmcKlDl3oSlGIJWvEbzw7lT7P0nmlzV++MkDr vzUmbqeVX2mcwUtb5qnDHsc5H2Za5yHOu+JRVWFbfPleGUg28GYWhvy/zToZjN2u7a58 2xInRZ6ZN6kHjBw7H6qo5Xiop0PNto2/KgPROr4U9jZPrHoNKIlFltsUOWtw/GodE2bl +LDA== 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=HKVQBapNPIWO5YjtKbPD2wEjmEtaMTMSYcvRQwFoWN+VW7HOJX5ckm+hHNP7qzXXF1 R+e1oX56KDm5clQIUvdt3TRJxYZ8WjIZdxADAyxMEOb8idM5c9AhZafXkAzee96ILdmw psvpHsZjHWLxVOwLJW9EGx5bCjDoUIlLbl1CF519KTrK/O9dCB+8u1WT72j5RFV+6rXH IVSIMZGNDbxf2IJ5AlVsQxn9TqkZe022TYfJcwLD4R0vChOvQGwtxjlGpTtyReByzs2l HRBz6MAA8nNyIyuZUDhIzMZ2GYcIZXUX9ZbFlBGkNCxfiNJVZdwtDQW/NdkMqJf04VP4 lqCQ== X-Gm-Message-State: AGi0PuZ9k1LZptK7ewU/Iz9brAy15VQLwCFLAQx6LVFMhxkmk3izFCWo iRsdidMGIkKGRUrQxCLGP5Nrpsp2Kzg= X-Received: by 2002:a63:e542:: with SMTP id z2mr3065701pgj.165.1588962391156; Fri, 08 May 2020 11:26:31 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 10/19] tcg/optimize: Improve find_better_copy Date: Fri, 8 May 2020 11:26:07 -0700 Message-Id: <20200508182616.18318-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::544; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x544.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Prefer TEMP_CONST over anything else. Signed-off-by: Richard Henderson --- tcg/optimize.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) -- 2.20.1 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, static TCGTemp *find_better_copy(TCGContext *s, TCGTemp *ts) { - TCGTemp *i; + TCGTemp *i, *g, *l; - /* If this is already a global, we can't do better. */ - if (ts->kind >= TEMP_GLOBAL) { + /* If this is already readonly, we can't do better. */ + if (temp_readonly(ts)) { return ts; } - /* Search for a global first. */ + g = l = NULL; for (i = ts_info(ts)->next_copy; i != ts; i = ts_info(i)->next_copy) { - if (i->kind >= TEMP_GLOBAL) { + if (temp_readonly(i)) { return i; - } - } - - /* If it is a temp, search for a temp local. */ - if (ts->kind == TEMP_NORMAL) { - for (i = ts_info(ts)->next_copy; i != ts; i = ts_info(i)->next_copy) { - if (i->kind >= TEMP_LOCAL) { - return i; + } else if (i->kind > ts->kind) { + if (i->kind == TEMP_GLOBAL) { + g = i; + } else if (i->kind == TEMP_LOCAL) { + l = i; } } } - /* 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; } static bool ts_are_copies(TCGTemp *ts1, TCGTemp *ts2) From patchwork Fri May 8 18:26:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186429 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp230288ill; Fri, 8 May 2020 11:33:09 -0700 (PDT) X-Google-Smtp-Source: APiQypI7P68CJSpfo3pMTJwEL46BQ2XojGN8/6+Ldt+39wedg/6UpqlXtRkufY+knuWifCaGrh/G X-Received: by 2002:a37:d85:: with SMTP id 127mr4309816qkn.205.1588962789429; Fri, 08 May 2020 11:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588962789; cv=none; d=google.com; s=arc-20160816; b=Q1ggs9tDMa/2SIAiaGmftzbKtzDC/VsQoXLNwHfZ3Fpr3ntfFi1JT/0Ya28OrnS92u QbzQhOySLgnJh5r6TW9+XHRUw9BfwN1L3hjo03546l1uz3pEzURF/cA5TODpsm1hATII SXEToewHveMrVZ01nihE30OG6/EW2YvEeib9IY9fg8/5tpsfc/rrzB1BuNCObMyY5pi9 +JP6mUIizc4qR4ZoZZsfqv8A1prJEit3pF6GoELlbVG3yJsEKNuQkfREgcvz/OdmJnWc 4CFdjBfUdNX8kLb6Rt0Oro68qMnl/RNdzVWLkF4+tqlyL/phqz9VM/vjQ9xEcszx/Aoj CVPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=OZxI+BJNGGc8i+fpWnheFUkcs37pG3uUWAB+Zp0TZ/I=; b=lbfPWbHu/mi3f7j1W86fbh5V6/bnaKIb8gW1b/6IuLV/I+e4o4l30iqg3DsHPGb1ru dTVu7+242tvOvrE/NWbDO5vcwIqLevPbx0fKgHJtzJhoHzycHnQiUrY15GJiD2w+Sd7K b/LHWgZOtT8amu9AIedzrlupsAfR2QWnrGV/A5P0r+tFXjOIlgilY8368pxIaL7y9tZA Ja7xdxqUGGxnrPcaRnQ6JY7Y9ZyA2CONgqbqbwazWZUgzHbeK7cJ4pjIEVHg5DoA1m9d vHpdzVinZZ1ycoo5IsWp+QnFYWAuuD5MnwA6c1U83a+IC/EXC8JOyrXLQoq+2AV7OKJn K8/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="G45/dllQ"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e19si1844899qtw.377.2020.05.08.11.33.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:33:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="G45/dllQ"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7o4-0000uo-Un for patch@linaro.org; Fri, 08 May 2020 14:33:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33752) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7hl-0006va-Ji for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:37 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:41947) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hj-0006q9-JH for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:37 -0400 Received: by mail-pl1-x635.google.com with SMTP id u10so1097085pls.8 for ; Fri, 08 May 2020 11:26:34 -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=OZxI+BJNGGc8i+fpWnheFUkcs37pG3uUWAB+Zp0TZ/I=; b=G45/dllQ96UvzA8IhBj8jgM5T1/gOepRHgHohzY3mZDKF5jpdeG7W9/CVxafspBUp1 7EuHobCWSl8K/RWt5d5glEOgFJngXLeSZQj8c9h8Vv3bMGxqekQTb0KjT4oqGI0qpCa2 L72hclxMgLtI1s+egV5ixFbtrfskYFRyMY6A0JBHq2P6VKYfpHnNrIDNYQEc99h9NQpQ uifE9MfzA15OGf2DCYNuEHU/BFqMgvwURBpmLlr/hfq1QYC0Nj2MFS4iMVdM7eHKMyHZ u0fGKyqUIEdESttwNN4mgdOIfCKZx/HPUVXc0cNr+xIxuU1f9cLdhQ1EjAr4jZrI8CmD Kq1w== 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=OZxI+BJNGGc8i+fpWnheFUkcs37pG3uUWAB+Zp0TZ/I=; b=KFNstkn7ATLwaQZRc/bYOGEL/XF2dQgAIJw5AJ2xdB1IUWgfxP1w5EhkIrIP+8u5co q8ndZ2Jyp0kI63daKuvDTNVXAnD7cdx0PyO1Ezb8X+CiR7acszNlMmKTSxz3Ok3iblT5 Eoe7hNJJV8EUk+o4uA0jisNs+3yBGDkqWvAXIon2Del+IOkUMzj1Oqh8Fg/duZCv7cI6 ykROjPii8IfstVyT0oR/vtu5HzKWKzpr8CV5fY5F4hQI5L0h5wSxx7Yi/OMktH5KkrOu SOmwuE1RVfN5Ghyt1KPgrQBuidj25ZZd4uwFc9ESvNIkS3jG1Ff1GedQO3+sHUED0Zey nbEg== X-Gm-Message-State: AGi0PubIQELC6zoGIX71+/SH4KPFZkI+bHsvgqXPzb0IgNREpcHPaexy 63W8M+B0XYfnRyc6odrBLAZGwV4FVgM= X-Received: by 2002:a17:90a:77c6:: with SMTP id e6mr7503123pjs.84.1588962393379; Fri, 08 May 2020 11:26:33 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 11/19] tcg/optimize: Adjust TempOptInfo allocation Date: Fri, 8 May 2020 11:26:08 -0700 Message-Id: <20200508182616.18318-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tcg/optimize.c | 60 ++++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 26 deletions(-) -- 2.20.1 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) } /* 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 = temp_idx(ts); - if (!test_bit(idx, temps_used->l)) { - TempOptInfo *ti = &infos[idx]; + TempOptInfo *ti; + if (test_bit(idx, temps_used->l)) { + return; + } + set_bit(idx, temps_used->l); + + ti = ts->state_ptr; + if (ti == NULL) { + ti = tcg_malloc(sizeof(TempOptInfo)); ts->state_ptr = ti; - ti->next_copy = ts; - ti->prev_copy = ts; - if (ts->kind == TEMP_CONST) { - ti->is_const = true; - ti->val = ti->mask = ts->val; - if (TCG_TARGET_REG_BITS > 32 && ts->type == TCG_TYPE_I32) { - /* High bits of a 32-bit quantity are garbage. */ - ti->mask |= ~0xffffffffull; - } - } else { - ti->is_const = false; - ti->mask = -1; + } + + ti->next_copy = ts; + ti->prev_copy = ts; + if (ts->kind == TEMP_CONST) { + ti->is_const = true; + ti->val = ts->val; + ti->mask = ts->val; + if (TCG_TARGET_REG_BITS > 32 && ts->type == TCG_TYPE_I32) { + /* High bits of a 32-bit quantity are garbage. */ + ti->mask |= ~0xffffffffull; } - set_bit(idx, temps_used->l); + } else { + ti->is_const = false; + ti->mask = -1; } } -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)); } 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 = NULL; - TempOptInfo *infos; TCGTempSet temps_used; /* Array VALS has an element for each temp. @@ -615,12 +620,15 @@ void tcg_optimize(TCGContext *s) nb_temps = s->nb_temps; nb_globals = s->nb_globals; + bitmap_zero(temps_used.l, nb_temps); - infos = tcg_malloc(sizeof(TempOptInfo) * nb_temps); + for (i = 0; i < nb_temps; ++i) { + s->temps[i].state_ptr = NULL; + } 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 = op->opc; const TCGOpDef *def = &tcg_op_defs[opc]; @@ -633,14 +641,14 @@ void tcg_optimize(TCGContext *s) for (i = 0; i < nb_oargs + nb_iargs; i++) { TCGTemp *ts = arg_temp(op->args[i]); if (ts) { - init_ts_info(infos, &temps_used, ts); + init_ts_info(&temps_used, ts); } } } else { nb_oargs = def->nb_oargs; nb_iargs = def->nb_iargs; for (i = 0; i < nb_oargs + nb_iargs; i++) { - init_arg_info(infos, &temps_used, op->args[i]); + init_arg_info(&temps_used, op->args[i]); } } From patchwork Fri May 8 18:26:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186431 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp232096ill; Fri, 8 May 2020 11:35:35 -0700 (PDT) X-Google-Smtp-Source: APiQypLPPB7/imZ0vwgpSOaS5hk39jv9S+6tbYd3M5hsbNepnPVUsk7Sy35poIDoxnjZkkZ/1ttc X-Received: by 2002:a0c:c506:: with SMTP id x6mr4130312qvi.188.1588962935007; Fri, 08 May 2020 11:35:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588962935; cv=none; d=google.com; s=arc-20160816; b=gnbRCMT8fpPJVKRPyo8cXQRQJlgeTkfZ7oqebCdblFsra5R5n5CDhRBhDAaKrvx12p ZjeqTtJ4k3bnRp+8DHfJQyxpZswO8xsPnHpolf15uBgeXmnCSTLGaTzvDUvmXaUwQ5s6 /ZpE7OWOW5YE5EOkQMGcymA6tXax7yCqn6tHyRIZWjxU5bMJVwX67csg5DrBdkTOYeTD r/9kFDgvf00dGR2aPjQkQWS6rJKcgcVvK01SGMdCw+m9JvDW2Z2MR5zkHk8elT4VIcCZ chb8H6OtZZ0UHeJDujsrMyh9hkqgKPrs9lu5dunC3QKyz3sfhum0ci2S3CtIvB+vZxkJ ukug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=g5L9isOBYf4t1bYKYYa8jot/bpntevMJTimjPXglsCc=; b=GM5ONkY6WnGOtmLFcjIGhOxil3BzgniioXsjZW8qVJLbFIOqUNSj2OdE1nYbHcpDAN X6pokz3NmD3tOcKvluX6Xz1PZh+nzbbMgj44meksujntLG0KhpxNFgFX5UamSQkq0y+l C57gxg7UqarHJXhn1h2O1ek9x3JdFMx/m4MLF8bYHsJ6GMVMV4oJGjJr2No6LBvFkDzn J0DGFbxGvrQATs0AcUPoMNZyCmKOpSuP7Npn4gNXAAx7t1pNQrqaxfNv9ftxB1dJWgNL HfJSQ6WBKuwrCcbrC0Jj+GtOrdIG5Ty5dtaRn42dk90XMacp3ITy4hM8JS+qcFdeSiKh FQ8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=z8N6GidX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i3si1408226qkl.0.2020.05.08.11.35.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:35:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=z8N6GidX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7qQ-0003jW-HQ for patch@linaro.org; Fri, 08 May 2020 14:35:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7ho-0006xR-4p for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:40 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:33154) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hl-0006ys-8y for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:39 -0400 Received: by mail-pg1-x542.google.com with SMTP id a4so1247707pgc.0 for ; Fri, 08 May 2020 11:26:36 -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=g5L9isOBYf4t1bYKYYa8jot/bpntevMJTimjPXglsCc=; b=z8N6GidXnDv4va+/x5sOC2f7/fT8uShaVhsQ8/yrbXO2btauZ0TyKYmY7uBOeTv9Iy teX3dYCe0B+f8gZ+E5gp7ABYTnJBhaCKQDnfbIxtPHAKV4QVEYAVYfdj5zrrTn37Xun+ AnLsO+3xh14v2jVKK1I4cCJJprXqu3mLoz2ZdSUMOr3W+5PVYY1Pe09eYHiiIMTgGzAy Uxw5y/VdP3w9R8yycB6uvwaoOMiCbbDOPZFo1h1puOw8OkHMiN+b1k/Hnw0Y1q2sXGn1 q0VX24+bB+HOwBuJPwoCYvpc2ym8eqy/VBv3WLOxgE+W5IMic3tJZ/KTIBEK7cZyBxEH 6z4w== 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=g5L9isOBYf4t1bYKYYa8jot/bpntevMJTimjPXglsCc=; b=WH10xLclPpmCh3fAhs1xqIXmznTupM+9IGL+De2u7mBizvSVGoPp1oYF6uhl/2n806 8FSzwAEne76Ds1PHIJ5WfNFOnjeocbAIrkhQI+vB9jJQGboF392r1HCAc3tFeHc1H1Kv BunPRXYwEGSyjdd/9jgOoQx1Zzj9m6bxyXE/TQVkw4jPH8ohanNWCzFYdLOse9wVY9e+ vTjSu1zgmo50R3rolsHhFsnuTIXcdQYR4sNB1evqHsm/bg/3CmVz8nS5I6RPYH/8107I E9nhTZAHGj2rrfwVy+B0n0KJoklNF6Mnit2SRAEDw0H3CG1LrODjrvNoYJH139UXN0Ak 0Z9w== X-Gm-Message-State: AGi0PuZcVSOi767Ge4CvGqqNHC+gsMlVFoGlidKo1qPVus6MkhAOgUif k9f3Xtbb3WjvAXwMzXxycZ977vOw3+A= X-Received: by 2002:a62:4ec8:: with SMTP id c191mr4372377pfb.30.1588962394566; Fri, 08 May 2020 11:26:34 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 12/19] tcg/optimize: Use tcg_constant_internal with constant folding Date: Fri, 8 May 2020 11:26:09 -0700 Message-Id: <20200508182616.18318-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tcg/optimize.c | 106 ++++++++++++++++++++++--------------------------- 1 file changed, 48 insertions(+), 58 deletions(-) -- 2.20.1 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)); } -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 = arg_info(dst); - - def = &tcg_op_defs[op->opc]; - if (def->flags & TCG_OPF_VECTOR) { - new_op = INDEX_op_dupi_vec; - } else if (def->flags & TCG_OPF_64BIT) { - new_op = INDEX_op_movi_i64; - } else { - new_op = INDEX_op_movi_i32; - } - op->opc = new_op; - /* TCGOP_VECL and TCGOP_VECE remain unchanged. */ - op->args[0] = dst; - op->args[1] = val; - - reset_temp(dst); - di->is_const = true; - di->val = val; - mask = val; - if (TCG_TARGET_REG_BITS > 32 && new_op == INDEX_op_movi_i32) { - /* High bits of the destination are now garbage. */ - mask |= ~0xffffffffull; - } - di->mask = mask; -} - static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, TCGArg dst, TCGArg src) { TCGTemp *dst_ts = arg_temp(dst); @@ -259,6 +228,27 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, TCGArg dst, TCGArg src) } } +static void tcg_opt_gen_movi(TCGContext *s, TCGTempSet *temps_used, + TCGOp *op, TCGArg dst, TCGArg val) +{ + const TCGOpDef *def = &tcg_op_defs[op->opc]; + TCGType type; + TCGTemp *tv; + + if (def->flags & TCG_OPF_VECTOR) { + type = TCGOP_VECL(op) + TCG_TYPE_V64; + } else if (def->flags & TCG_OPF_64BIT) { + type = TCG_TYPE_I64; + } else { + type = TCG_TYPE_I32; + } + + /* Convert movi to mov with constant temp. */ + tv = 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 = s->nb_temps; nb_globals = s->nb_globals; - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); for (i = 0; i < nb_temps; ++i) { s->temps[i].state_ptr = 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 == 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) if (partmask == 0) { tcg_debug_assert(nb_oargs == 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 == 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 == 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; case INDEX_op_dup_vec: if (arg_is_const(op->args[1])) { tmp = arg_info(op->args[1])->val; tmp = 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 = do_constant_folding(opc, arg_info(op->args[1])->val, 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 = do_constant_folding(opc, arg_info(op->args[1])->val, 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 = arg_info(op->args[1])->val; if (v != 0) { tmp = 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 = 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 = 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 = 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 = (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 = do_constant_folding_cond(opc, op->args[1], op->args[2], op->args[3]); if (tmp != 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 != 2) { if (tmp) { - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); op->opc = INDEX_op_br; op->args[0] = op->args[3]; } else { @@ -1293,7 +1283,7 @@ void tcg_optimize(TCGContext *s) uint64_t a = ((uint64_t)ah << 32) | al; uint64_t b = ((uint64_t)bh << 32) | bl; TCGArg rl, rh; - TCGOp *op2 = tcg_op_insert_before(s, op, INDEX_op_movi_i32); + TCGOp *op2 = tcg_op_insert_before(s, op, INDEX_op_mov_i32); if (opc == INDEX_op_add2_i32) { a += b; @@ -1303,8 +1293,8 @@ void tcg_optimize(TCGContext *s) rl = op->args[0]; rh = 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 >> 32)); break; } goto do_default; @@ -1315,12 +1305,12 @@ void tcg_optimize(TCGContext *s) uint32_t b = arg_info(op->args[3])->val; uint64_t r = (uint64_t)a * b; TCGArg rl, rh; - TCGOp *op2 = tcg_op_insert_before(s, op, INDEX_op_movi_i32); + TCGOp *op2 = tcg_op_insert_before(s, op, INDEX_op_mov_i32); rl = op->args[0]; rh = 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 >> 32)); break; } goto do_default; @@ -1331,7 +1321,7 @@ void tcg_optimize(TCGContext *s) if (tmp != 2) { if (tmp) { do_brcond_true: - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); op->opc = INDEX_op_br; op->args[0] = 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 = INDEX_op_brcond_i32; op->args[0] = op->args[1]; op->args[1] = 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 = INDEX_op_brcond_i32; op->args[1] = op->args[2]; op->args[2] = op->args[4]; @@ -1408,7 +1398,7 @@ void tcg_optimize(TCGContext *s) op->args[5]); if (tmp != 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] == TCG_COND_LT || op->args[5] == 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 = 0; i < nb_oargs; i++) { From patchwork Fri May 8 18:26:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186432 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp232842ill; Fri, 8 May 2020 11:36:37 -0700 (PDT) X-Google-Smtp-Source: APiQypL1hO0PO3AiYPthLdVzaHMAy2uDqhLbI3AgsjU/v/m+FAOj/iV0lOShb5eL98FwNOM+Y2pt X-Received: by 2002:a05:620a:13bc:: with SMTP id m28mr4017595qki.211.1588962997774; Fri, 08 May 2020 11:36:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588962997; cv=none; d=google.com; s=arc-20160816; b=dW6GtdiCoUD/UQeJBQ/KNu4nDMYFZla56e/prSS9e4vJ+zwVTxCypsKfqB9VwOpaVP zUmTIujX6iVJtdfqw4ipjK9yd0Ayj9lmP7Wgm+7uDwRr3Y6bpP2U9LYWKj4R7jvmM/mL n/AnT51tBGQvBKTUsVtX9f7hTAERyPR6MXfYxGCB4+HsxBRYBJ8Fx+lysv5Kp1p4vTo5 kmH++7zT0bfT09B6fEod8NN1Cpg2Cp7nnWgiCYvv3OecveKfVNDepFSjcYVqKkv038/n BnEluN2k++kzHmKKCqx7dMsE4NEiF9AGjGYyccox1c5TcdY0pztYzhIovF00k+PbDLi2 kU6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=n208OOL/5mz9BQVOgVsrwweVrr5EapOZuk9HWHgyuak=; b=Yo++wDY4OsKu+cxgZT58Ff8W6jZbY3yVEeGF2BOwJaqu/9tNZERA1nSDE6Qz5e3IDf ljLIz3eTCjpvScoXRVAskmUWoQ3aeCrO+sP5goPTY0m7ILzFM2P2IJKuPfN+flmzqLL5 DibS4D91xlX9cDVaTc022TGfszuJS64Ex75iDpm8K7d0d5ITPZS1JFOZMFHx/TkccD8j uamnLiRxOTAxUi9YW+xKdGfqacdoPk25tYKk8CKIP95klTyOULkkE/DsTTYEqKcANTGq D5eOso8TUybeIrapCcEJXEwRDzEGRGZ3MKv2qVPuO96VsIs2+mJXAsGAQeKPcg/hnRcW PBxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vAqTNPkN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bd20si1574336qvb.8.2020.05.08.11.36.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:36:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vAqTNPkN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7rR-0005P4-AV for patch@linaro.org; Fri, 08 May 2020 14:36:37 -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 1jX7ho-0006yp-KZ for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:40 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:45833) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hl-000788-O0 for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:40 -0400 Received: by mail-pg1-x543.google.com with SMTP id s18so1223426pgl.12 for ; Fri, 08 May 2020 11:26:37 -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=n208OOL/5mz9BQVOgVsrwweVrr5EapOZuk9HWHgyuak=; b=vAqTNPkN8xkxkY+8+YQPsFhC3R0dMR5VB3bStjJkzwXj2bUolwMUh/h/GwA+fDgL9A wDlQDJCg5VvBkOAxDxDYOXUurCMYPwsdKsQGAnb2CiSyOkmCY4DUjch872w6FQXwrQFt evttjGW5RZw3UXzJU+ognuo6n5wnx7oaD6pfCQwSzLeKa6BrQl2uKQxR5MLf2NB8OEAH ejzF/P4WPyQkL6R2lYy8u3eIGfBxekuwH4lpzqcyF9Yc3XOGCWcOqjHJ9/e37j3+jStV lcoKtrm8H2qjZLI+Eu537L+dcf5ocTgxwwogkjImJ7w1iNj1gdK3txB1ev249fuUnsX+ HN5A== 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=n208OOL/5mz9BQVOgVsrwweVrr5EapOZuk9HWHgyuak=; b=FtL2JI+hpoO3UptI9dKouSnJcnRg0ihMvvHUTk3Qs1ZixlTh5Ug2YZB4/3TKgnkGB2 /c5sk8oQdvacnTWJDtMNGfZQyXiZo6Le/sXsmmbzyxjOmSIeWJeucgeRKidPer1FAjHu JXYNSyAt4BTM+prSmSN2u4mKoYnW/y+Yfk9ksANkx7kwEzRLwmBYiH7yZwcI1ozvnlBO JG0+kTxTXMSO3WoeKqgc9OKjTVVvuQbmcxF9lkmTCuceJrNGekxQGT6oJfBNxvevFNoh Nr/33/4VprsXbNumnQnFZcqFidJJuE+7TtYHb0lMRpIxu67cytpKeUhWZzWidG0yskP+ YlBg== X-Gm-Message-State: AGi0PubpRWIi93M8srpuIfoB5B7C00jEM13wuMM2B1b9FPqipuQi8sg2 /qxkB+O52yuHvodvXNo7Ybju3VP1S/g= X-Received: by 2002:a63:4c1d:: with SMTP id z29mr3094707pga.243.1588962395946; Fri, 08 May 2020 11:26:35 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 13/19] tcg/tci: Add special tci_movi_{i32,i64} opcodes Date: Fri, 8 May 2020 11:26:10 -0700 Message-Id: <20200508182616.18318-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The normal movi opcodes are going away. We need something for TCI to use internally. Reviewed-by: Alex Bennée 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(-) -- 2.20.1 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 +#ifdef TCG_TARGET_INTERPRETER +/* These opcodes are only for use between the tci generator and interpreter. */ +DEF(tci_movi_i32, 1, 0, 1, TCG_OPF_NOT_PRESENT) +#if TCG_TARGET_REG_BITS == 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 = 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 = *tb_ptr++; t1 = 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 = 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 = *tb_ptr++; t1 = 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 = s->code_ptr; uint32_t arg32 = arg; if (type == TCG_TYPE_I32 || arg == 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 == TCG_TYPE_I64); #if TCG_TARGET_REG_BITS == 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 From patchwork Fri May 8 18:26:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186421 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp226845ill; Fri, 8 May 2020 11:28:01 -0700 (PDT) X-Google-Smtp-Source: APiQypKy5+Dt3QK9p7Pky5XE85xD9jZ19O4pGSCZlQFVsuknLVkGH41tCEiXnlFxdIGNvFZ5767D X-Received: by 2002:aed:312a:: with SMTP id 39mr4499338qtg.6.1588962480911; Fri, 08 May 2020 11:28:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588962480; cv=none; d=google.com; s=arc-20160816; b=XooN/YT1UFYQEnxyN2KS2ylF1IP52KJ5SDG/bfctMLvkeN11jM+WRQUBkE4EAf5Rgb V1/o9/bvQeI/0zsUsgFCPTQgfqVYsudaVPhJcLfjg0rvOyGFDSKsZbbwYlxtZxdFqt8D bEBG32a+26afWSbGVZNeznoOTCYIvZAbSF+8sYrtFDuid2n9sqlxu2kIHHFT5GXXsvlA Cpvs1lpIASI5kXWdzGVHMmtyXXRMZspi6E5U9RU+6Zu2KvPqBXNmBL8jFxw00/xV0Nqx uiSFjYzSmBc5PI3akImtFpdqr/P3pYw0q8uz+Jhs5sr6CZiG90p/c34qn3FeRd2Q8W6t XiCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=QceWq606b5fd+dz7ujV26VKv63SExBpTQSdHWzSFdho=; b=O2ZpXTh/4JbQy2LkqzUzTS2T1k3NMoSJU3r3MHVNXMXcDpUXlLmptSh4Kb4lsMiHg4 u8nQChiaKPBT1fCRdJo8L94yIw1Dv1mcGrd3NMXC/iwXPGeaFq9zvS6JrYnPOzN6tPYa mgmSER7vexi0Jz9Hu4IE5MSpyg4Il8lWu3wllkM0dpOLNR+DHLLTc8vZU/v8WZ9iw3WD NqgGP07Ql5AXBSW1PlOhNAi+InSABO2lwusDPnnYxu75D3FZvtq9BdpO8ABWVil65dAR zhXA7gppQldu4VNjRB2kUDW4z5HxCLOj3mroYa/+jpU14Rx+1ggnHuxolpUApEXm6GXZ 8tZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OntNbQ+K; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z4si1387905qtq.33.2020.05.08.11.28.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:28:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OntNbQ+K; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7j6-00083J-BU for patch@linaro.org; Fri, 08 May 2020 14:28:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7hp-00071L-Ix for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:41 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:34552) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hn-0007E1-Mw for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:41 -0400 Received: by mail-pf1-x443.google.com with SMTP id x15so783183pfa.1 for ; Fri, 08 May 2020 11:26:38 -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=QceWq606b5fd+dz7ujV26VKv63SExBpTQSdHWzSFdho=; b=OntNbQ+KMfV0CDQHCyFSmJrtB0R6jZ1PYRvyp2yFFJ6akLMs886MCSORYgOKKzjcV3 Kaf+UU5b9PABAt8v46bak5/tJVz9aHAo5Z3h7S8VtP8W/d25i6c2CAftNhxm7DR9qgOS Rg66XDJRWsfiG3dG60DlvCA1GANoVX9auCUOVkFXxJXn54f3qdujPkC2nRQYU0uWZrzq qCYaK9SPM6Evm7r7EKGqQx3mJvGb3OXeHIlBpfswl2BYHe7sYqmgrhflYeWCY9c9ktgh WicS5h5mGfkyXdS/uvAabih7YBWm1uHuto0x0VUrq3ELtbW7F0+4oijqFYP80lmZfqUs axqA== 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=QceWq606b5fd+dz7ujV26VKv63SExBpTQSdHWzSFdho=; b=UoPEIvX650KTqJoBVpl511WZDceUNx8w2L9bisljeMS5L2I4DWzyLVCWxcPi2GoJ3c DfHv+EzIhbTdRJwoLHz+rhBvPmmsAUvDgeKmNeoz9zgWGOVznvmshux1C5dT4mbu825Q 60T5yx+7hkTiy4uK4Xd1g2HiWi5bNgmkNXiMtIIUsXauSLSpJIeVM5IJ++FhT8zUGZxG DqqK7AoUtQGSMNBDFtGifiar1sKu9iQqm6AsFaWq8J8R8+DSUuC1OHr7hc2zfacjn332 4nenaXF4s2xiNeVInZIor0xY+ER+dAK/TAty6OlVanfT8lP5QKjsWR16S4OFhzBZqvur Ukhg== X-Gm-Message-State: AGi0PuaHTiQzkZNawGUfTtPgsHSG02DYVpuKwL3QoDVXZArjQ59NdwG7 Nrva57R922NvusyE1746qMQPSBkbXjU= X-Received: by 2002:a63:600c:: with SMTP id u12mr3153738pgb.318.1588962397273; Fri, 08 May 2020 11:26:37 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 14/19] tcg: Remove movi and dupi opcodes Date: Fri, 8 May 2020 11:26:11 -0700 Message-Id: <20200508182616.18318-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::443; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x443.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: Aleksandar Markovic , alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These are now completely covered by mov from a TYPE_CONST temporary. Reviewed-by: Alex Bennée Reviewed-by: Aleksandar Markovic 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(-) -- 2.20.1 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) 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)) 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) 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) DEF(dup_vec, 1, 1, 0, IMPLVEC) DEF(dup2_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_REG_BITS == 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, 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 opc, break; 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, TCGOpcode opc, break; 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, TCGOpcode 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 opc, break; 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, TCGOpcode 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; 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, 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 opc, return; 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, 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, TCGOpcode opc, 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, 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; 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 == 32; 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) 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, TCGRegSet allocated_regs) } /* - * 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_life, @@ -3511,14 +3508,6 @@ static void tcg_reg_alloc_do_movi(TCGContext *s, TCGTemp *ots, } } -static void tcg_reg_alloc_movi(TCGContext *s, const TCGOp *op) -{ - TCGTemp *ots = arg_temp(op->args[0]); - tcg_target_ulong val = 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, const 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(); From patchwork Fri May 8 18:26:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186433 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp233082ill; Fri, 8 May 2020 11:36:59 -0700 (PDT) X-Google-Smtp-Source: APiQypLIacPnwNV4tJ1KVFixpgfIowl+P+GGXGKyaKbwHkNItR4elB273X4UpAgu6BnPLPHZtKgO X-Received: by 2002:a05:620a:4fb:: with SMTP id b27mr3985222qkh.433.1588963019408; Fri, 08 May 2020 11:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588963019; cv=none; d=google.com; s=arc-20160816; b=L1cvL1/5cYrUwEJq1Kop/mbAv75F7+vSvb6PmrTRHxYTiocfoaTg3UrakewlfBJQBQ tejFBki2vhZfW0BgiVx5IMGnMpY1lTsjmbIVeFx2uauGYEP3fp5QZhrUZdnlS4BTKLEi jsg0DBh0qr1faUpSO5xdSb2kJ6Uoo75g+JAo2bUOqJszNZHVUfoTvqlEBkrnXz0gcZ4+ rHBP47Yh8RSJP2UyhR3hqyPUKYxNrvB6Gdp8CK727iCe2GB7tgt9LwhnqyyJhBnR8WJp DPSdWhNNNI6x43u/GP1wi0luekZ9bYMxj2RkBd4dUQpAhrRykuZmjdY4hlqTaSXsm+7n 9d2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=NvO2T1wYwGiRfWfqGrh6DB/67jrIMOZ5KtEk6dFeoQw=; b=RkiIL+0MxgxVN5FJdc+R8lbPdDEKrIFOl8OgPOXjEVyuELg4TOPcXuCNKvfW+rj2A/ kxgO2pC+CwEuYNQmmhq6r37FBpNDeIAJmUDhoZuYG4O7ktV0Pmx/sp+3aXg+koyfykPP BiTiEJK1I5vKxt2Z11hh28UBhN3ca7+RWzU2ZQZc7IG/KJE1jvH7Nrt6lWNS0P56xgdP H1bXBbMJ8Rkwy0bNj1276aBFMLPTMP4vVJIgDqePZfO1L6Ayq7QfYO2hutffbi0S5t6r rFSDpcOgyP8d8RSRwmDdO3BY+8XngCFGhgqR0hkBHMGO6ijJYqKZ/bak+os047bAQGNi n56w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Bpjuu1vi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j60si1427165qtd.320.2020.05.08.11.36.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:36:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Bpjuu1vi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7rm-0005aq-U7 for patch@linaro.org; Fri, 08 May 2020 14:36:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33796) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7hq-00072E-0t for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:42 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:41452) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7ho-0007Fk-R2 for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:41 -0400 Received: by mail-pg1-x541.google.com with SMTP id r10so745545pgv.8 for ; Fri, 08 May 2020 11:26:40 -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=NvO2T1wYwGiRfWfqGrh6DB/67jrIMOZ5KtEk6dFeoQw=; b=Bpjuu1vi1ISatmjpQP8glGwpYO1NhrMKF9eWP26MTCy2EcTF38nQHNw8nmrUokoMqZ AvgYyo/581M+LFj5Aorq+41OtojKTcIJ1h4DA3Y7NUcR+LaZSoN1p6HjGMaIu3EsctAQ xYK42aQqWDkBznJCzt6y5V1EaMKm4kRIWx/C2FJa0yJCU8DafIjk1Dvjx/n/amtCVg5A qqMnt3zew51Qh2tVDPoi1ft/V/sEC1l5itmJucqygNtDDGSK4Nn8PGd6zxPoryRKvoH/ ZfHNBfhf7cfttqILTY5P7DoM6qZeWFujInl+IRbufFC9Z1dcTy/kVCUnI1s557IIFxnS Fs7g== 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=NvO2T1wYwGiRfWfqGrh6DB/67jrIMOZ5KtEk6dFeoQw=; b=iJ0oaR8Pfvhwq+hnb2Xfl5doJ4W4vV7adpNJOSLCoN3uZTALClFOOEPiwf3JXTjRXs th57v8ErhVLGU5EGWHKBIISpOAkO7HmwPhj+2GEv1ZWzQFnYi7SzbyCuf55j2WsULmP6 aSMk4LtMscsQO2ngZ3sPqCLbjsUmzIKkarxumd8twKlarY7qJG7kHX2SGeSusJqa4pvz JMUJj71f4jUP2fe79mfNf0NPnirhEKqA2QD+gb7dv03Dc3XYf766CLYjdfBUnFB7Zp44 3XDxzqCAjGxVQnHlLVcI8UrkQqQeMtxZY7zEH7szPY2qHLWb2ZopoGEec+2XSCYNBjld De5g== X-Gm-Message-State: AGi0Pub6/8RDNxiBEav/3Tazhd7lzhMLHu8Zpu6gRbSFBvkwhcF1+eeW myrTw/mK4hWFPAIJpRodbag0fdHfdag= X-Received: by 2002:a62:3584:: with SMTP id c126mr4210621pfa.316.1588962398740; Fri, 08 May 2020 11:26:38 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 15/19] tcg: Use tcg_out_dupi_vec from temp_load Date: Fri, 8 May 2020 11:26:12 -0700 Message-Id: <20200508182616.18318-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::541; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x541.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Having dupi pass though movi is confusing and arguably wrong. Reviewed-by: Alex Bennée 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(-) -- 2.20.1 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 >= 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 type, } } -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 == 0) { + tcg_out_vex_modrm(s, OPC_PXOR, ret, ret, ret); + return; + } + if (arg == -1) { + tcg_out_vex_modrm(s, OPC_PCMPEQB, ret, ret, ret); + return; + } + + int rexw = (type == TCG_TYPE_I32 ? 0 : P_REXW); + tcg_out_vex_modrm_pool(s, OPC_MOVD_VyEy + rexw, ret); + if (TCG_TARGET_REG_BITS == 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; - switch (type) { - case TCG_TYPE_I32: -#if TCG_TARGET_REG_BITS == 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 >= 16); - tcg_out_dupi_vec(s, type, ret, arg); - return; - default: - g_assert_not_reached(); - } - if (arg == 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); } +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 == 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 == (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; - case TCG_TYPE_V64: - case TCG_TYPE_V128: - tcg_debug_assert(ret >= 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, TCGRegSet desired_regs, case TEMP_VAL_CONST: reg = 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 <= TCG_TYPE_I64) { + tcg_out_movi(s, ts->type, reg, ts->val); + } else if (TCG_TARGET_REG_BITS == 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 = 0; break; case TEMP_VAL_MEM: From patchwork Fri May 8 18:26:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186434 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp233981ill; Fri, 8 May 2020 11:38:13 -0700 (PDT) X-Google-Smtp-Source: APiQypJ8e2eOv5v6qwAYJlS65yJr+cpMKZHyjly5CRsY4jc/uT5ooHB3wlpOPLyWJKsO/0yLFKHE X-Received: by 2002:aed:2766:: with SMTP id n93mr4471258qtd.130.1588963092990; Fri, 08 May 2020 11:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588963092; cv=none; d=google.com; s=arc-20160816; b=LpQRP0Q5+WUTl0lPW5UuONbcVIrnCsQYzBfOF1ugljsNTvjW+8ms+JIzwK4ScTwPuH uHnCNFoH5k5pA3VURw9rdHoun4WKPUZcxkhwVzpMITo8LT2fPeIC3r1ztR022cP85T/T H2Ac3cp8OPP4IwCIjVDlXQs+zNXmrA1XuvVGwaoj8Hh84sPZas+VTsiTrCrI0hp0aG5T AYv2zjTpix7hqCBZJOcGii94Ae2d2MIM0xyPJzOfTQhBmyhASUXckNY1W1MQoYu5u2KD Xu8CIxzRihhJb8fqeU/aHWeVfiFmOYP4lZFjo2VMHyh9U5CeF5TRNzN1KWbAaIFViRmK QJpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=S9HEQQM80hO+EVGsjJ9OBeqQuwE6gwF9XnDO8sH6oUM=; b=HrlJQnhn9esvh2eKAktx7rUDLlOzj/SVlWKr6iVXdGWavFWdrK0qCj/CMSsOxP6Ys8 xzztYW5iuCAvyw8qXYd61doIqxdwJoNpXqBDmxwbnrle+infOVXA6etKI/rapCvwX0VJ usvuCEsctk0K5gnVh/C3BHoLKi1AlA8q63ZGCEY0mnVAeDu8R7eDIhtxGe+T0RU+i1/Q u6x7U11aoijmxYSKwBNQiB2WyXQm0VE2fB72rEhUroxv47+VOM8XeUkLtr8HmXOF06oP sKDGwnhOzyYpbaufhXEYF2OXfWLIAE4sj6EtPIWqB+FeNn2aRWrptNftMMDJfvcpOW2/ UrBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yT9P6ni7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k10si1616972qvq.24.2020.05.08.11.38.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:38:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yT9P6ni7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7sy-0007OP-Hc for patch@linaro.org; Fri, 08 May 2020 14:38:12 -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 1jX7hr-00075T-9p for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:43 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:45820) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hq-0007Ns-22 for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:42 -0400 Received: by mail-pf1-x444.google.com with SMTP id w65so1358296pfc.12 for ; Fri, 08 May 2020 11:26:41 -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=S9HEQQM80hO+EVGsjJ9OBeqQuwE6gwF9XnDO8sH6oUM=; b=yT9P6ni74P3IIwieb67fGOaBD0u0dLBSpPr/XJiQsXDki3FqrlDxV5uPoK+DXw9OfZ x0e8SQwUPIInV0cjOsWi001MNH2Im7UfZGnBXdmm+NcarvlSPsea5ddWyCJzZOZoAsIy Cj8p2JtkErm4fMacfNS1Gd1SRLJRDxqr5005rppexrciD2CfVoDtiUG8liq9AGqQbysv t8VTbLM3N/1ILAum1OGlgsBtp6XvMJwaRgcwy/yYfZC9K2wY2vrAQPF2xqYe/WUHlLBE KwOUU+iuOVKwb0iuxuAJfVTLZtL2y2jeAg+CdyK0/GHmHxDaxc0EWCRqMX8jJt+/reUp 02+w== 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=S9HEQQM80hO+EVGsjJ9OBeqQuwE6gwF9XnDO8sH6oUM=; b=JUe3pK5bQLFgBU2AgppXPvsKjLC67fDJLX/UYvAtfyQzkTj1KWaR9Pf9I/CUMyQysR VRP6ezkPmt2wk3rdv6Gy2OXHjX0TdeCKXX/cEW7ytov/wnTDUR2tPtiJxDR+8ws2r1xx JgGhC7Q4s8VRY/D4fD1Wqb16zVRNWk0vp7Z9rHLj26IL5be875jXpHt/mdpKk1YrlxwH UirtNeYn3sPJ0lzUGJ9hQoDZeOq4BFEgJtc5Ga5x2MnCQD/LNQhJ3I25AVeGXs5nxQNv Fw9TFMm6O9mmSuFK3pwCpEt0w2ZtQsenugOURGfoj+1+s0c9bSaMiyKKfgUoTSAeFZdH 74Xg== X-Gm-Message-State: AGi0Puak9EnstlRL9tQtIyk1iEJ0Rcg/h70XUX0qkyif+g79E51ONBNJ uG7kC5xrg8AjrhdHyI3dI03EjOL5r2Q= X-Received: by 2002:a62:1415:: with SMTP id 21mr4116155pfu.203.1588962400203; Fri, 08 May 2020 11:26:40 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 16/19] tcg: Increase tcg_out_dupi_vec immediate to int64_t Date: Fri, 8 May 2020 11:26:13 -0700 Message-Id: <20200508182616.18318-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::444; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x444.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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. Reviewed-by: Alex Bennée 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(-) -- 2.20.1 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, } static void tcg_out_dupi_vec(TCGContext *s, TCGType type, - TCGReg rd, tcg_target_long v64) + TCGReg rd, int64_t v64) { bool q = type == 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 type, unsigned vece, } static void tcg_out_dupi_vec(TCGContext *s, TCGType type, - TCGReg ret, tcg_target_long arg) + TCGReg ret, int64_t arg) { int vex_l = (type == TCG_TYPE_V256 ? P_VEXL : 0); @@ -958,7 +958,14 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, return; } - if (TCG_TARGET_REG_BITS == 64) { + if (TCG_TARGET_REG_BITS == 32 && arg == 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 == 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 type, } 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 == 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); } } 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 type, TCGReg ret, } 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 type, TCGReg ret, low = (int8_t)val; if (low >= -16 && low < 16) { - if (val == (tcg_target_long)dup_const(MO_8, low)) { + if (val == dup_const(MO_8, low)) { tcg_out32(s, VSPLTISB | VRT(ret) | ((val & 31) << 16)); return; } - if (val == (tcg_target_long)dup_const(MO_16, low)) { + if (val == dup_const(MO_16, low)) { tcg_out32(s, VSPLTISH | VRT(ret) | ((val & 31) << 16)); return; } - if (val == (tcg_target_long)dup_const(MO_32, low)) { + if (val == dup_const(MO_32, low)) { tcg_out32(s, VSPLTISW | VRT(ret) | ((val & 31) << 16)); return; } } - if (have_isa_3_00 && val == (tcg_target_long)dup_const(MO_8, val)) { + if (have_isa_3_00 && val == 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 type, TCGReg ret, if (TCG_TARGET_REG_BITS == 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 = LVX | VRT(ret) | RB(TCG_REG_TMP1); if (TCG_TARGET_REG_BITS == 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); } } 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, TCGType 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(); } From patchwork Fri May 8 18:26:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186435 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp234508ill; Fri, 8 May 2020 11:38:48 -0700 (PDT) X-Google-Smtp-Source: APiQypKJymNP+2lm5becQMmWUyT0ZMf7jVg5AEA/EjT1s4RA+ar+eeORZL/w9EcWxTFemtnX5nGN X-Received: by 2002:ac8:2c78:: with SMTP id e53mr4634227qta.365.1588963120439; Fri, 08 May 2020 11:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588963120; cv=none; d=google.com; s=arc-20160816; b=wfEnZz8PHfUxLbmx3hvQYCio0w1cGA+b1Pzl+5D/6wKZSjMVB0ew7BlwYHFEOW5Knx N/XdeaneS3UAi2oGF6DSY8By3PNlEjhD4iFP2+oQj8Nth8n4iC922FwrFEoNB3WkZYGS UIPmASviMttXsvkncDwblO3oL8TarZ9uFaVt/+rE27B72CkC2s9ez4UNLHGkoapFD2Wq pLHmxhlIw5JEAQPBpNZnDG6wPTmbzVEJwE5N9c59stI/9hEQ+nMarVohbd6bpGu/Qs9b Fy1xNEjxmRaF2ugByIceb8ltLhqfLKpMFHI+M0uNXmpnKiDLvZFQjrgmRxyCl2+Patk9 2GFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Kyd75dQ6HSF4Bc6As5SxJ/ajmbJCQUS6r+6XFxFF4i4=; b=FXZnPo3sBGyPMawmMHnR+V0P4x3aX6PfU7lRQmoEKDaQgQ1W5yxw6kFdO7fXLuLtw2 YDoqo+cd02eP3W3va2KZO7IHI/4O5ek4ZYo/z+lJKchYDkqjouqNZAuF8EZRBtE4xeGk lD0WRePmP0NosJbz8P8VHF5IkI+9IVjwjq1PspNi0i5mmQ3y1KPjcKMLdOL4iPl4R9xH XJClWQ5YL8IdeNO47l5aZCmGoH41ctM0kw1DkAIjtk098UaXkdxwrHPnJDFGgwvUxmk1 //OVLzwf1spLU+FHq4O+3E5bpytfa6Z9soTLpyE6VIfhXmEMJFcUf530Rd4R+Ix2GUXd zj3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Loojpcaw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d124si1497830qkf.326.2020.05.08.11.38.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:38:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Loojpcaw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7tP-0007aW-U2 for patch@linaro.org; Fri, 08 May 2020 14:38:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7hs-00077y-7d for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:44 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:35972) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hr-0007UX-At for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:43 -0400 Received: by mail-pf1-x441.google.com with SMTP id z1so1377723pfn.3 for ; Fri, 08 May 2020 11:26:42 -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=LoojpcawHiizoQXXDcp5uFA2/3TLmpEYVh/oz1cwEvg5d2LS9lCMt/MddB4bxu91p4 bMfxf0TTcbvOwwzpo/I7nybIc7kFtF9uXUAKfbXyAH/R9iHp6IZJU+bGmSvgZ0P+TMl/ L4wfbi6KRDxmz6mOQMvrpYeRmTHbSD3JuKKYnHczkIB0WHPKst4JbJcaXJyb5tkdjUm2 DEeJllBeiNGqHxBHimEsXjtrRnl+AP3xatPYRB/JC5v/vQ9hnbc0zZKZRqwQZU+ZlIYz 25iKOFeCaz3lyhJfB0vVA10tqHmqOn3MHpFzbhQh6ASmz13RJkJ6nEUtxEqVJtr/Cxc2 xKRg== 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=BXblqZu+CkdeTPBEJ6K2dKag3r/xoAFqJvB1qpODRgIfiDLzZBHB0hxOZSp35Htj1i X0XWE8PoQOz5xjasCqYo5lEhyLxPSBEjQPKmAw3uceusLWBi8U9tOBDduWam2mR7zFZr bbXLPxhK+FjMJvWz9tWyuNAn2ruOmqFqUT4HBB5IjfwXdoV09RNugr1UDJzQ25+ZUkYK yAVozmRFStrjpgi1M36tOKKSOHc9uWoAUR3IQwYACcBYkJRjIQfmotm2AIk80jU0xOyf zKxFk8Ef1S1j7xFUK2JCv2Uwbfiuo85QZOylCYp39kSnR99wVCEgkB1Sc78p6fDbsCIH tY+g== X-Gm-Message-State: AGi0Pubc+0+k4f+XEIR/dfY5a7VRVQzqkNITGWVeGqV59VIC+fEYAJpx Uu5SZux8FwAQNfUidzyFrvWGyO1mV9A= X-Received: by 2002:a62:6807:: with SMTP id d7mr4298728pfc.296.1588962401460; Fri, 08 May 2020 11:26:41 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 17/19] tcg: Add tcg_reg_alloc_dup2 Date: Fri, 8 May 2020 11:26:14 -0700 Message-Id: <20200508182616.18318-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(+) -- 2.20.1 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 TCGOp *op) } } +static void tcg_reg_alloc_dup2(TCGContext *s, const TCGOp *op) +{ + const TCGLifeData arg_life = op->life; + TCGTemp *ots, *itsl, *itsh; + TCGType vtype = 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 == 32); + tcg_debug_assert(TCGOP_VECE(op) == MO_64); + + ots = arg_temp(op->args[0]); + itsl = arg_temp(op->args[1]); + itsh = 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 != TEMP_VAL_REG) { + TCGRegSet allocated_regs = s->reserved_regs; + TCGRegSet dup_out_regs = + 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 == TEMP_VAL_REG) { + tcg_regset_set_reg(allocated_regs, itsl->reg); + } + if (!IS_DEAD_ARG(2) && itsh->val_type == TEMP_VAL_REG) { + tcg_regset_set_reg(allocated_regs, itsh->reg); + } + + ots->reg = tcg_reg_alloc(s, dup_out_regs, allocated_regs, + op->output_pref[0], ots->indirect_base); + ots->val_type = TEMP_VAL_REG; + ots->mem_coherent = 0; + s->reg_to_temp[ots->reg] = ots; + } + + /* Promote dup2 of immediates to dupi_vec. */ + if (itsl->val_type == TEMP_VAL_CONST && + itsh->val_type == 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 == itsh && + itsl->base_type == TCG_TYPE_I64 && + itsh->base_type == 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 = itsh; +#else + TCGTemp *its = 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 >= 0) { size_t off = tcg_current_code_size(s); From patchwork Fri May 8 18:26:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186436 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp235117ill; Fri, 8 May 2020 11:39:37 -0700 (PDT) X-Google-Smtp-Source: APiQypLAzUpWalQ/GAZfgEPjM2W2mcRinBTgPD3jA/Kx6z3sFaEYYUXBkc4Z2UJ5I0PzPbv9m6Sn X-Received: by 2002:ad4:44ab:: with SMTP id n11mr4005404qvt.147.1588963177193; Fri, 08 May 2020 11:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588963177; cv=none; d=google.com; s=arc-20160816; b=KAtJGD0yjTmvw97W4Z03Gibkd1QXXqc0hv+SeE7Tpi9Ymyh2FH/oOp3+SIXxx3hrCT 9YyzUxZ5qaLlPyIIMjWOQgwrdsp4lLlVvI+KVezd1luTF2VP8AKoDqreekcMEkbh+jkp A7rb2/F2MAmFp51zFIfLPhewpLDJQwb5Mrxe1eNT+lka/5I287KQdFIp10WyXM0TH8gu Hk5XjhpAl7DowrPy136E/w67DPVeNswE5cdB9s6/eudDBznZX/XPuMVpffzjyUoyye2j 6LwjwJgiQ55G+pqTtFeqS1x3Ry8g5myS7GRk8ph7CY25xH3nEYqy6eDTr23BkqdpSvFK JmwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=OLaptGH79qJSf/fUPP+jaZzrz3bBaRrtnif3pIsh4/Y=; b=OIXqeAiCyXA/5cDCOcaQD3vRefsH2IqRh80qzLitJxMncyge9ZOZKs+9ICuCD4CdYr owoBSiCC8TyfXu1JtORTzO3O3V0raegI3TB1vaCZe56iV2f3E75RnLibgiNa6UG1siXs JZZeM4gtowru1v8Qx3FnQGJ+o9UfRhptMpx3T4azBdo2KGpWbQfGKr8eoxaShr9C7gA5 eKKL0/Rfbm8NuguOIV+qUDXKpmiH76pMB7ISeSgZFDSpolzzwH8QCWOeALdvZjTk7ZPr VATUqXnoSaXj6wZbQTKAt8FXMbdg22YCo9ho7CQDbcZgTvcIwA9ZCbWwYtnSlCIUz85u VELA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jpShrlLG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r2si1604101qvp.138.2020.05.08.11.39.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:39:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jpShrlLG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7uK-00012p-LL for patch@linaro.org; Fri, 08 May 2020 14:39:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7ht-0007B0-GU for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:45 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:42666) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hs-0007X9-FT for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:45 -0400 Received: by mail-pl1-x641.google.com with SMTP id k19so1095132pll.9 for ; Fri, 08 May 2020 11:26:44 -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=OLaptGH79qJSf/fUPP+jaZzrz3bBaRrtnif3pIsh4/Y=; b=jpShrlLGwdQ2koVlsRdMZAlg60yIfDcP+35JWsKwP4mOYhgUzGofm3nsE9fncvV7et 5mYLHRpXN8HzwJOd/ofVWFcEOOcDdF2+EtzA2OWfff8fN43B577uLL3Ap+tfJBOJ8c9M ehdRcKoQbahyr01IN2RWIUBCfAiCe86O1NeuPd8CyfPLNQ3mZh1/qS4xygPtIdwzQdMy +ytxrbrEFQNGGQO4MUW/kaC+Fkhf+xdSm+yjEuu2ULA8gSF2tp+4xwKNZOV13GKaEB0T fuHGJ5oycRLFLLdRdE7aKq33VBmRkRuTX1hxGzsqkLUyVkQ2Mxt2iDFsBH4S9DKNxSxY gGpQ== 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=OLaptGH79qJSf/fUPP+jaZzrz3bBaRrtnif3pIsh4/Y=; b=i5qypjd7CtlwcexEjEKyMzmEawChYuwHScLT2MorSGXgxujRAr6+8CaNSGc1BVl4Pz NlXaczAn4yCDzluNUniv4w4DPzJ4ezDr1w34iJeD9pvndl6z7OvJoSoy6TSwhIqF2usN dKi8pzcpWpxEjixdV5eoMjRGuDo8yfFDIXHo79sleTmZRZViSGaYl/2H5hpL+RYxS2Tw c3IgkqdRaqS/lnAm9aH8tkPnAOX00XFG0QG8beVAf3aAefZaR68AWaUCuBIX7cOZW6YJ Lc47KOst+VO4KPma/Q60A55oktevXQjvjulB0WUC/55DPfI0F5TdS8uKRFHW7pJv2e3t /RTA== X-Gm-Message-State: AGi0PuaOV/R7h9FJkLCBHQbJRoeU5csFUXZSqR8WHgKWNjb9sjOBHalR PtMPl/otETZ/GMpikaKkeO9asCsMOvc= X-Received: by 2002:a17:90b:3547:: with SMTP id lt7mr2319145pjb.14.1588962402807; Fri, 08 May 2020 11:26:42 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 18/19] tcg/i386: Use tcg_constant_vec with tcg vec expanders Date: Fri, 8 May 2020 11:26:15 -0700 Message-Id: <20200508182616.18318-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.inc.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) -- 2.20.1 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 vece, 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; tcg_debug_assert(vece == MO_8); @@ -3537,11 +3537,11 @@ static void expand_vec_mul(TCGType type, unsigned vece, case TCG_TYPE_V64: t1 = tcg_temp_new_vec(TCG_TYPE_V128); t2 = tcg_temp_new_vec(TCG_TYPE_V128); - tcg_gen_dup16i_vec(t2, 0); + zero = 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 vece, t2 = tcg_temp_new_vec(type); t3 = tcg_temp_new_vec(type); t4 = tcg_temp_new_vec(type); - tcg_gen_dup16i_vec(t4, 0); + zero = 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, unsigned vece, TCGv_vec v0, NEED_UMIN = 8, NEED_UMAX = 16, }; - TCGv_vec t1, t2; + TCGv_vec t1, t2, t3; uint8_t fixup; switch (cond) { @@ -3663,9 +3663,9 @@ static bool expand_vec_cmp_noinv(TCGType type, unsigned vece, TCGv_vec v0, } else if (fixup & NEED_BIAS) { t1 = tcg_temp_new_vec(type); t2 = 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 = 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 = t1; v2 = t2; cond = tcg_signed_cond(cond); From patchwork Fri May 8 18:26:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186437 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp236016ill; Fri, 8 May 2020 11:40:38 -0700 (PDT) X-Google-Smtp-Source: APiQypJMHt0j6b/SZEa01Poq7oWvGfhU5bIGUy9Bm/CUpzyn+3xf3xNdM3TapECaoxUmYCVwurk+ X-Received: by 2002:a05:620a:568:: with SMTP id p8mr4174517qkp.311.1588963238018; Fri, 08 May 2020 11:40:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588963238; cv=none; d=google.com; s=arc-20160816; b=hwmaGbMrj9OlnaOiI8izz7eijxxGvpacjhESiir00NbKv8/oFk0Za1nkr37JLK7iYw 5mjj3y3u0VudtXKNa1KDo5MVV/oUYFTTQVSnK5Hd5eXscOPdh/qAxvYoKr4qcbxIcE4Y HqoRIADlNQaRMJ70v+XT+eUvwRoFZjfoCjon5j+UdPuJ7xsKZxiA8HMg0WgguhyfYoTp pOCi0Ghac39RGLEzlVzvtrZ1vUn9exYOvKCzZ8aZjCuqcfUomkpbj8OPLpI8BNAlXc7O Ns/kgMvU+oy08VW0Xc0TeTXsK+fkNFNdX5AsCijURsHClfUkycBBq8pDUSCdkjfwKYMX 2whA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=MsIsFqiezDMWfyTAinzx1qI+y1izKFiwu84PgQkXZ9I=; b=QOpd3T8mFowrrvb8G52ImrO8XYlz3DPCEY8Xy4QTcWq5JRXCAgcsSvDa4v9ujvd0sN ZwlW5e65qgGptXWf2W2RwbmXT4vn4k/RFECwftcXVT5sIqz45ZbGK+QFt1WYfdGgNiEH 36zCuOUK7oSMrpW1GGTs0d/pg9St8KGAifXBst4quUlKg2VBana1LJVI1onxv4RnFepu od0UawkiPCMt/yNE0SAqwQDZiNEw0RRr8a1TTX8SrWWjhZBraK6UwuGwXMW9p8PZCjm+ GndgRBI9wIpECA1zjCl4bOnu4aWxNklvIid2YIA4Q8BkeVGxNfxGy2iupJQhc8NGM3uN Zspg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a7crd209; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 22si1486019qkj.288.2020.05.08.11.40.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:40:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a7crd209; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7vJ-0001LZ-GB for patch@linaro.org; Fri, 08 May 2020 14:40:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7hu-0007Dl-Lq for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:46 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:35309) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7ht-0007dG-Nt for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:46 -0400 Received: by mail-pf1-x430.google.com with SMTP id r14so1382883pfg.2 for ; Fri, 08 May 2020 11:26:45 -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=MsIsFqiezDMWfyTAinzx1qI+y1izKFiwu84PgQkXZ9I=; b=a7crd209Oap8vp4zwc7T5zRHgpkvgjsBmtDgToenz29yDt/rfaVqzuSYiX80ekMNYb KOyI6PTF6jn0//NppcnsmpUndvMSXuQIdL36IvjuqxODkN8ZJlMCSE+zjcUA4C9erYFC BxdE5eBbvKGZkixTjuTEp7hwTqrXACQIr9jRu5iiV/yk30g/inTBkE4c/urZTIYdpIXu eWl/xJtRKR+POIGRbDUbIj8XqKl9RKa+valkF1j1EKEdkGMgScP25JbSKcjQK+2D9Tgx NMjSe4MY7u4mpg6QfIpPwuZNbolvz3S0RIJ3MdhjkSK8Q8dvquEsb/7AtpSeWWZtptU+ IZYw== 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=MsIsFqiezDMWfyTAinzx1qI+y1izKFiwu84PgQkXZ9I=; b=Fokt1pRIVBPplXbpMdJJXgN0F3dkw/diMFX+Wy73f2RJJEQ1ADeN2Ml2rXgel56sIG /+Q0z7Od1zdUDYo730Y2NER+2MxD7z4xCiQQAUhssq1Wt7v+cKLnDo2ihme90YeDLl9a kKIRhDjJ4qHsWX0vsqN337QzD+/tO1gFNtTb23b38GiDEkkXSBqyleERwyFFea6/hPFS lBEu2rjHAfjm+yFL01mmipuZSV3OGvf+KfZL7woUyp71biJv4fY1PeH57aG6OCwywIN5 zrlp/cRo2MNN7PnnUL0wTGMA82BWXaNPHdiPiKYvQf7KtWMN+mNbBtJ+A0qk8VJmR8S4 msVQ== X-Gm-Message-State: AGi0PuZE8DWVhlugunQ3/GB3R5qcRpvv+2V1s1RSwKqMQTnpFW9H8ap+ NXsE3mTAMdMKHOFVkXJ1NvrhA7lAqlc= X-Received: by 2002:aa7:8619:: with SMTP id p25mr4137439pfn.105.1588962403977; Fri, 08 May 2020 11:26:43 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 19/19] tcg: Remove tcg_gen_dup{8,16,32,64}i_vec Date: Fri, 8 May 2020 11:26:16 -0700 Message-Id: <20200508182616.18318-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These interfaces have been replaced by tcg_gen_dupi_vec and tcg_constant_vec. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/tcg/tcg-op.h | 4 ---- tcg/tcg-op-vec.c | 20 -------------------- 2 files changed, 24 deletions(-) -- 2.20.1 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_long); -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, uint64_t val) tcg_gen_mov_vec(dest, tcg_constant_vec(type, vece, val)); } -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 = tcgv_vec_arg(r);