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);