From patchwork Wed Apr 22 01:17:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185632 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp167838ilf; Tue, 21 Apr 2020 18:28:37 -0700 (PDT) X-Google-Smtp-Source: APiQypJNK7h6yPNMFwNZC1K9Qkp5MTFhQksmk59d0lLzyM88pdoriHE16oJYCG9ZF1aVhQ+Z9dkG X-Received: by 2002:ac8:6f03:: with SMTP id g3mr23275454qtv.10.1587518916905; Tue, 21 Apr 2020 18:28:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518916; cv=none; d=google.com; s=arc-20160816; b=Z71WoXtwaZqloHxIT9e5T6GLckRuAjremMIQ+UaeedgZ+xFs17N6qsMhXOOxBjTxVo TGnr0AmJGz2n7isA7oKRSuvhuD0QVLJPGPBgsGuZZiOAsFMer100o1soxaKXxRl2umar LcDAckCu5T55oOlm0+TJb3HZoDXl2S0oAlgT/sMePcVLEe12T5KeT6pfE7kWG4Cnk6ja u8+8i/Omo0T1xQ3IFrI5QJfsedHjluHT67zEFP+hwp86BcpKKukgoLJ0u7EBGwwEbL2k RHDfZxLB2WPUjv25KYarZ7WKFfFPkTIpsFSF9M6pv69Tl+d83EOKh2kFmqAidaJ2nigm 4rKg== 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=kclyvX98JRyE2ZEPw+1FzvyDeiJrVyjendlYPY0jgDw=; b=pSOBwjdYtKh3N5/B8WBLxtA891D8rXYXPo9x18DPdPLEOGC7nkBIYxSn0/dvaJhOfr Frv4+RvyL7nRefGkEJb3bX061ObkBNKaEjNH1PQ9ZxetNhpA7tMPfLr9eWUI5nB1ykGF adLrHnVJxgLX5ZdDA9rf4/4qitKr4KdTjshVnsz6w73hYM0SryxFi6U5p+UPvURKhIa2 l7l5V2HPNznj49B96kwosCnJ9KpRYyn36Smk8jj8bMyE/+tT3akzDzXEc0nRQqTIJ5dj 2GCEeULecDm3ZQhmWjbRoITCdG0xOpgv2bR8diZCRWlCUrZ5L8sBlw+T8ZUI/u4mPAR2 rS8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tIBkB8i3; 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 p97si2350808qvp.168.2020.04.21.18.28.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:28:36 -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=tIBkB8i3; 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]:38840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4Bo-0002L9-DN for patch@linaro.org; Tue, 21 Apr 2020 21:28:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35434) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41R-0001na-IA for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41Q-0002C0-UU for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:53 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:39737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41Q-00027I-EU for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:52 -0400 Received: by mail-pg1-x541.google.com with SMTP id o10so254729pgb.6 for ; Tue, 21 Apr 2020 18:17:51 -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=kclyvX98JRyE2ZEPw+1FzvyDeiJrVyjendlYPY0jgDw=; b=tIBkB8i3Nc4MQDww2tkB9SGKSSP2tonPxtqB9x8SRJwSyYUSjiOugGZ/ySjN0y2gKx HGMP+4mxDLanFzaJicVjyDdlsLuvQ4qjc/0/oRE51fG0tV1RhxMjqnXdD46rBy0uUjit ePionFzYrBFKRdDe1Z0rNfBpxrHXxvjAucPzysjRF2EmzPteHoEsZ1rtGnvMnOuR1DRY VcpnlpC5UgkI1OGvCyfq5wQL9B0QCF62L+kqOOq1pzamsuadPZ8exVe/OcnrMI3zsgE8 O+rTgDjGIM3I5PP5cl9+K927mKvOQaeJ7k0NJCCy/h3YU+kLAjnRqLl5yHOo/E0MUkYE 1IjA== 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=kclyvX98JRyE2ZEPw+1FzvyDeiJrVyjendlYPY0jgDw=; b=Ww8bGZLO+NHHvmRYk6K3yi57j11kmSxpvr/igDePn3mBJvbMxSGsbyGF42FoTnLOF0 1hhDXdNsF3ZHcDB3usdoBJC8Q9AYi5UocQINYK/6vrXdFkgKSGJMOno+Xpa7gAfORxJO lwxcOzmYYrCbotLr1Qcdl4A61N/78pt0XhWkqMu5mmYmFmlmBV83yfCPUsM9yw0iEBvf 11vooTl3Q/RlRoIYj2XetysZ3/hhOO7jWj0BoGUAn9lflhpisvmSnz3hIBaM4euAFKsO 51WrkWoJtOqmclABrpVbkEX3D4aURyJTrzdmu5E16yMThwOWPm48EJVIQgNIWZxH+zRk SGIA== X-Gm-Message-State: AGi0PuYxcN9VpnZ1V+PclzRwblJsp4FCLzS8uew629DdvQP32e7wwDZL yVBa6VQ4mdX+ndRmqfjlGlTFSn6N+uU= X-Received: by 2002:a62:7e0f:: with SMTP id z15mr4040909pfc.149.1587518270688; Tue, 21 Apr 2020 18:17:50 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 21/36] tcg: Use tcg_out_dupi_vec from temp_load Date: Tue, 21 Apr 2020 18:17:07 -0700 Message-Id: <20200422011722.13287-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200422011722.13287-1-richard.henderson@linaro.org> References: <20200422011722.13287-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: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2607:f8b0:4864:20::541 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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. 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 Reviewed-by: Alex Bennée diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index 7918aeb9d5..e5c9ab70a9 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -1009,13 +1009,6 @@ static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg rd, case TCG_TYPE_I64: tcg_debug_assert(rd < 32); break; - - case TCG_TYPE_V64: - case TCG_TYPE_V128: - tcg_debug_assert(rd >= 32); - tcg_out_dupi_vec(s, type, rd, value); - return; - default: g_assert_not_reached(); } diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 320a4bddd1..07424f7ef9 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -977,30 +977,32 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType 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 fb390ad978..7ab1e32064 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -987,12 +987,6 @@ static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg ret, tcg_out_movi_int(s, type, ret, arg, false); break; - 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 adb71f16ae..4f1ed1d2fe 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3359,7 +3359,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: