From patchwork Wed Apr 22 01:16:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185614 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp159942ilf; Tue, 21 Apr 2020 18:17:42 -0700 (PDT) X-Google-Smtp-Source: APiQypI3/huuFRvz+EpDibvIWomAAuldU5pTElUyhqN7UJ1oaveJTY6TOJI5pVnl4z5DqcFEQ8V5 X-Received: by 2002:a0c:b2d2:: with SMTP id d18mr5363139qvf.80.1587518262582; Tue, 21 Apr 2020 18:17:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518262; cv=none; d=google.com; s=arc-20160816; b=a46eThhx06TgmsQz12NEcC0LufwWWtmIZ33yeBnI+vbqojw4Wfqm6oGSpeIBjjg3fA txIxDbnzhpp4PmhxVgdKnR05cskB+GQTfcZ0Jhevq3rPGbduuiCZEbtilf5UfwcIJ47q fF8NLI2tbX3KOdon3TWlrNRxHzUWz01O+9H7TjLgnjQ6+tjVEMmTEcDb1pxLrfkTH0TW xeze/kclwhOzUZzVLgMDwFW/sJOI8LLNLnAd9/ehskAypqFR6It1kq8ONKG5Fth58ChO xl1/1LBx72wPrbDqCaZqsZd/50rKdSn7Rg2M84yNrrE6vfvhMMdyoS9tNpkt6AePX5zC fC5Q== 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=BLcD9N9MlInNi6OgkZr1QrgaUSOVwaTdYcH5SM4Yl98=; b=XZUxtxsfVMpMcuq00HzHTDqw8qjYxrK7qTKXa6lZ/fbkp1FH631h0RgqdwGi8tFOAj OiQAjS32e1dJUjZZF3CQXnZSI/d0HF9uCvv85xwxBaPJ3JDCBBntvybCo2FL20M4UhK/ DaFCy6RwLhk8OfF7Fz3TDzYAMYoy2rvgNdCAaI83WMYMi600iwNH0hc53ou41ZZVEU3J EJbR2dwQ223W8+PTkPpuK62F1Clj4PEz6nvovfe9FhOe0tZeCfbhyWBdDKBDTfFJ6FtV tL6tPP74BCipa+7nfNuRGeMWnhIjbTCeTtqFiRPAqDCDfYzGkEc912pBy/Zd6GxmfyVV f6yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WX3dDYzd; 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 t2si2510634qkb.118.2020.04.21.18.17.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:17:42 -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=WX3dDYzd; 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]:38428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41F-00015G-39 for patch@linaro.org; Tue, 21 Apr 2020 21:17:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33592) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR413-00013a-Lk for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR412-00014A-MN for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:29 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:40331) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR412-0000xH-8B for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:28 -0400 Received: by mail-pl1-x643.google.com with SMTP id t16so240427plo.7 for ; Tue, 21 Apr 2020 18:17: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=BLcD9N9MlInNi6OgkZr1QrgaUSOVwaTdYcH5SM4Yl98=; b=WX3dDYzdo+CTgu0rZU24tkXT5Gz4i+Jt1iOdRL/oyCI8Kw1ykTJxx+ArydS5wyzLc7 yp79SyPeiVThwhDrPBNvmPT/dCG+2382NVSrhLloRiT/tkNyMe3w3s3UpYDEY/j20AgD 010XEwSRpCLE2VNtG63dK1HNa6D8F43IX0aMXT6XvSntcKqKiq1GXMUa3tdF0wEQlmDX JBsnktthXnpTlgOI1a9ZmyyA7forEframJW5d+pWJy+OLPjcK+QdkM/bQfd/YVeie2Fp ovFzTIH7K4CQcTQFkyjXzVJmwkqkF0G4c2yQl+WWetzIjdrPsGw5ePc3AQT8sPyKurkt L9SA== 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=BLcD9N9MlInNi6OgkZr1QrgaUSOVwaTdYcH5SM4Yl98=; b=Rw9fCJ11QeUkWhbktDvUwP9p4kqAlfHz7evwKv02+JFvf0OqJj3om3FiYzfqHe1BlW 42vLnPb8BOFwJNhIyFnqQJXMGJxUyew5ICCmp3omuIEtRifChijpE4rNy17lcS1oSdXZ 3Rsq+u9qKz+Phs5XDNF6aj9QImfoReJ2ojfIBo2tZVvhsXes4ldIYL55t8F+Adu+cClj CgRaW/SZtczXwaQCQa4sHJNPGtCyYC1yfc/yXU8WwGh9bhcrNG+KyTFMDT8JGpM4IYqk 7NLiOvxjd6fcensrGPUX9Qeb01NH60/xSYm2sb5PLty2Aw7Gap733La1Xi1vagW5CcMZ KRqw== X-Gm-Message-State: AGi0PuZNjG3HPBPvprW78XenvsMKVgUYHs7ypDvr18PM154+MNs49OFm 7InFA+R03qwhjPsd27ijHIa+WkZwIG4= X-Received: by 2002:a17:902:a50d:: with SMTP id s13mr24780278plq.5.1587518246044; Tue, 21 Apr 2020 18:17: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 m4sm3673561pfm.26.2020.04.21.18.17.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 01/36] tcg: Add tcg_gen_gvec_dup_imm Date: Tue, 21 Apr 2020 18:16:47 -0700 Message-Id: <20200422011722.13287-2-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::643; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x643.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::643 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, LIU Zhiwei , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Add a version of tcg_gen_dup_* that takes both immediate and a vector element size operand. This will replace the set of tcg_gen_gvec_dup{8,16,32,64}i functions that encode the element size within the function name. Reviewed-by: LIU Zhiwei Reviewed-by: David Hildenbrand Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/tcg/tcg-op-gvec.h | 2 ++ tcg/tcg-op-gvec.c | 7 +++++++ 2 files changed, 9 insertions(+) -- 2.20.1 diff --git a/include/tcg/tcg-op-gvec.h b/include/tcg/tcg-op-gvec.h index 74534e2480..eb0d47a42b 100644 --- a/include/tcg/tcg-op-gvec.h +++ b/include/tcg/tcg-op-gvec.h @@ -313,6 +313,8 @@ void tcg_gen_gvec_ors(unsigned vece, uint32_t dofs, uint32_t aofs, void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dofs, uint32_t aofs, uint32_t s, uint32_t m); +void tcg_gen_gvec_dup_imm(unsigned vece, uint32_t dofs, uint32_t s, + uint32_t m, uint64_t imm); void tcg_gen_gvec_dup_i32(unsigned vece, uint32_t dofs, uint32_t s, uint32_t m, TCGv_i32); void tcg_gen_gvec_dup_i64(unsigned vece, uint32_t dofs, uint32_t s, diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 327d9588e0..593bb4542e 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -1569,6 +1569,13 @@ void tcg_gen_gvec_dup8i(uint32_t dofs, uint32_t oprsz, do_dup(MO_8, dofs, oprsz, maxsz, NULL, NULL, x); } +void tcg_gen_gvec_dup_imm(unsigned vece, uint32_t dofs, uint32_t oprsz, + uint32_t maxsz, uint64_t x) +{ + check_size_align(oprsz, maxsz, dofs); + do_dup(vece, dofs, oprsz, maxsz, NULL, NULL, x); +} + void tcg_gen_gvec_not(unsigned vece, uint32_t dofs, uint32_t aofs, uint32_t oprsz, uint32_t maxsz) { From patchwork Wed Apr 22 01:16:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185617 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp161543ilf; Tue, 21 Apr 2020 18:19:41 -0700 (PDT) X-Google-Smtp-Source: APiQypJW08j/QY0HgCO5mg7rlvrxNm2A0Bcbx7vxv0rkYHMqrtyb7rEQqt/yiUwcGL8Gt6ogr8dh X-Received: by 2002:a05:620a:796:: with SMTP id 22mr10002135qka.247.1587518381026; Tue, 21 Apr 2020 18:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518381; cv=none; d=google.com; s=arc-20160816; b=yjwbqTr/xsL9GBRLvya0ZoFJqAdhTLPX6sEueHH0bJQQZz/ycKS5M5gG7rrrnXmdGh ghdtuTaDgCHs4MSzNec5srAM0JDVFrVT5U1Pmnv2q6BDzT8ax9OLk/mFH6SNGhqnRURs 4dI/XsJCNPR5otyH3ZjPt037ZIIIFpWdthZM4zJj0l9gG26byJpU4fQdYD7YVbKiTGQl rUapZ91QRe2krdTonZ0/MDJN8WFxLmDaSwCLTBWSDAiaw928xpa/xuIW0YbD/aHiRYLz DAGT55/XWc4BduISG4ac/s+KS9ruoA6smX4jRh7TboClkVzQBtdKkPxjDJTNYfhcSnfW nScg== 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=dOnBBGhmkNTpQUIqTasvNhE2MTWW7gI0dB3WMtwwkiQ=; b=EuF7G8hRey2lxFsI4Bac0ov1BzY2N+klF0Tv2sSEhLFShhGMY+rYgBAfGpduEf1CwH Vp5jkb+P+JOq5UX+yKngdTKpV/yoAJ+fFGqB9sQM6cWI6lTSL2P/+DlTlKJ/7Gl8ynNY pMri5B3xgh5sRNE/JswAIar2uNXOjrwL09vn87jIPPGytqNZqMbgJpOGkFutfqLTrvsP reGUw0i/MymzbTV6uJWPNS5n5QXvpDrh9t2yGmFT5JHWAEgQ/d/hVx5W9/mVpFqZK3r0 lB19Fr4uUce8VvCqdgfg0w1UCAt4EIFpxe5qbwf+KinYXBnU3Um8ftUSFaKrdDx4CPdC S49g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dF+G9V1j; 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 j207si2526364qke.62.2020.04.21.18.19.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:19:41 -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=dF+G9V1j; 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]:38598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR43A-0004pC-H4 for patch@linaro.org; Tue, 21 Apr 2020 21:19:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33640) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR414-00013c-3s for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR413-00018G-Ge for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:29 -0400 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:40573) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR413-00012Q-23 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:29 -0400 Received: by mail-pj1-x1041.google.com with SMTP id a22so152442pjk.5 for ; Tue, 21 Apr 2020 18:17:28 -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=dOnBBGhmkNTpQUIqTasvNhE2MTWW7gI0dB3WMtwwkiQ=; b=dF+G9V1jvI1961CjsImzyiM4/+mpSq1Jo0LdN4EHEONWL9h7ryuY4v5BjOICv1C1ZF fbuDzsj02QPNAQEHhCaXhdJg4FuXrxp/Rf2fH+yHlM43Q5aBkdabtnNr7HE8ZXPr4eKR 6r06QCyFMKSSLNhzD8Omk2CzPJL1nEdT3nWCJNaxYwztpTWelf93qh+OzF4E5lkZ3nsX FclFMN5OWC6U6QuE9LnwxMQ02peErI81z5DgzaBhfjt9nMfOnjK4fL7dKsr/inDdOlGj wwzfMO03hIJE7ObY+cALNXhFFRGK/8/DHAVx4/IqbDpquPiKO//GdqlYmKvpqtL4Bq2X 34LA== 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=dOnBBGhmkNTpQUIqTasvNhE2MTWW7gI0dB3WMtwwkiQ=; b=YTp89ikorjTAObCtPjTIzgvs+Dvft2s8A/pCJeB2uh3gynDD32z1TFiGI7X6vIlYnx i0NbOPD9XouF45PGjvbHtI3SVUASXS8ZcuX5TSFbSL0tc7rRdo3wbtOZjBpbXEBhAFnt MIPZn23Rg+5ZfRtlloUlKubD52jpH8frHlGk8kMGWHAJ4SYYp+a62DrYBS6GMusRGGKv xvrREBYd1LifsrJ84FuvDxAqK/ONS7L50tLenOMJgkNo94Yuyco665JeHAGG7eLzeeQU yS0Ez9S3c8fFUD7yTEpZb5wfu/O4s97mN9w0SAExI52m5fJ3viVpJmwySKtmrjcBHJXf xNfQ== X-Gm-Message-State: AGi0PuZ1GRVsMKK4+bvc40X8viDan/k9/MXz1DXSRq/M0WqDvGoaRvNH pGMYShs9WqAECE35kN34AIx7dwhyoiM= X-Received: by 2002:a17:90a:f995:: with SMTP id cq21mr8699807pjb.56.1587518247266; Tue, 21 Apr 2020 18:17: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 m4sm3673561pfm.26.2020.04.21.18.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 02/36] target/s390x: Use tcg_gen_gvec_dup_imm Date: Tue, 21 Apr 2020 18:16:48 -0700 Message-Id: <20200422011722.13287-3-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::1041; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1041.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::1041 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, David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The gen_gvec_dupi switch is unnecessary with the new function. Replace it with a local gen_gvec_dup_imm that takes care of the register to offset conversion and length arguments. Drop zero_vec and use use gen_gvec_dup_imm with 0. Reviewed-by: David Hildenbrand Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- target/s390x/translate_vx.inc.c | 41 +++++++-------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) -- 2.20.1 diff --git a/target/s390x/translate_vx.inc.c b/target/s390x/translate_vx.inc.c index 24558cce80..12347f8a03 100644 --- a/target/s390x/translate_vx.inc.c +++ b/target/s390x/translate_vx.inc.c @@ -231,8 +231,8 @@ static void get_vec_element_ptr_i64(TCGv_ptr ptr, uint8_t reg, TCGv_i64 enr, #define gen_gvec_mov(v1, v2) \ tcg_gen_gvec_mov(0, vec_full_reg_offset(v1), vec_full_reg_offset(v2), 16, \ 16) -#define gen_gvec_dup64i(v1, c) \ - tcg_gen_gvec_dup64i(vec_full_reg_offset(v1), 16, 16, c) +#define gen_gvec_dup_imm(es, v1, c) \ + tcg_gen_gvec_dup_imm(es, vec_full_reg_offset(v1), 16, 16, c); #define gen_gvec_fn_2(fn, es, v1, v2) \ tcg_gen_gvec_##fn(es, vec_full_reg_offset(v1), vec_full_reg_offset(v2), \ 16, 16) @@ -316,31 +316,6 @@ static void gen_gvec128_4_i64(gen_gvec128_4_i64_fn fn, uint8_t d, uint8_t a, tcg_temp_free_i64(cl); } -static void gen_gvec_dupi(uint8_t es, uint8_t reg, uint64_t c) -{ - switch (es) { - case ES_8: - tcg_gen_gvec_dup8i(vec_full_reg_offset(reg), 16, 16, c); - break; - case ES_16: - tcg_gen_gvec_dup16i(vec_full_reg_offset(reg), 16, 16, c); - break; - case ES_32: - tcg_gen_gvec_dup32i(vec_full_reg_offset(reg), 16, 16, c); - break; - case ES_64: - gen_gvec_dup64i(reg, c); - break; - default: - g_assert_not_reached(); - } -} - -static void zero_vec(uint8_t reg) -{ - tcg_gen_gvec_dup8i(vec_full_reg_offset(reg), 16, 16, 0); -} - static void gen_addi2_i64(TCGv_i64 dl, TCGv_i64 dh, TCGv_i64 al, TCGv_i64 ah, uint64_t b) { @@ -396,8 +371,8 @@ static DisasJumpType op_vgbm(DisasContext *s, DisasOps *o) * Masks for both 64 bit elements of the vector are the same. * Trust tcg to produce a good constant loading. */ - gen_gvec_dup64i(get_field(s, v1), - generate_byte_mask(i2 & 0xff)); + gen_gvec_dup_imm(ES_64, get_field(s, v1), + generate_byte_mask(i2 & 0xff)); } else { TCGv_i64 t = tcg_temp_new_i64(); @@ -432,7 +407,7 @@ static DisasJumpType op_vgm(DisasContext *s, DisasOps *o) } } - gen_gvec_dupi(es, get_field(s, v1), mask); + gen_gvec_dup_imm(es, get_field(s, v1), mask); return DISAS_NEXT; } @@ -585,7 +560,7 @@ static DisasJumpType op_vllez(DisasContext *s, DisasOps *o) t = tcg_temp_new_i64(); tcg_gen_qemu_ld_i64(t, o->addr1, get_mem_index(s), MO_TE | es); - zero_vec(get_field(s, v1)); + gen_gvec_dup_imm(es, get_field(s, v1), 0); write_vec_element_i64(t, get_field(s, v1), enr, es); tcg_temp_free_i64(t); return DISAS_NEXT; @@ -892,7 +867,7 @@ static DisasJumpType op_vrepi(DisasContext *s, DisasOps *o) return DISAS_NORETURN; } - gen_gvec_dupi(es, get_field(s, v1), data); + gen_gvec_dup_imm(es, get_field(s, v1), data); return DISAS_NEXT; } @@ -1372,7 +1347,7 @@ static DisasJumpType op_vcksm(DisasContext *s, DisasOps *o) read_vec_element_i32(tmp, get_field(s, v2), i, ES_32); tcg_gen_add2_i32(tmp, sum, sum, sum, tmp, tmp); } - zero_vec(get_field(s, v1)); + gen_gvec_dup_imm(ES_32, get_field(s, v1), 0); write_vec_element_i32(sum, get_field(s, v1), 1, ES_32); tcg_temp_free_i32(tmp); From patchwork Wed Apr 22 01:16:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185618 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp161896ilf; Tue, 21 Apr 2020 18:20:09 -0700 (PDT) X-Google-Smtp-Source: APiQypJznWJ3wWxhcGWYcB5FEnU7VCY7A1lfh8V38u4jA5D5/xDOHKazKKeX2qT9l/SZ/t8nDdPj X-Received: by 2002:a0c:da87:: with SMTP id z7mr22735992qvj.141.1587518408954; Tue, 21 Apr 2020 18:20:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518408; cv=none; d=google.com; s=arc-20160816; b=GvAuHePldWoZ/fjat3/LVv7CnAZFCDSDE3MmJpFZS52NKKgRYAdbWYhQSb6+UXmbR8 RzfNcoArSPuEhI6oX5DxzhlDFwv3eRZe6o9xoz/+xExdE7Ct6IotnbR6LK44ftvAIfdt JSH9Q3xUPBqfPBz4aSuska7NWMqvnL1ylr1RPybFCPW7Q8EvOJZE4T+5iq1cCnL5X7Li 0sFj+FzRZ65NqnKhE77Lv3tUVoV9P7u5CebpYmrezzkOKxV5fpICHf2wj5f8reOxN3Hp HOMfSXVt/vnI5/4Xvj1/OVQeiwRPEZO19Fp4roAO6+Y2UnzFF44tIEaWCjLlkhv99qnm frng== 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=J8tKD8Dhorc/rZ7Pqa63r7FVSLYqB5ObHvXNIyPd1G0=; b=Y1wDbLVnvz3eMOXuy77w/+niX725+KfTn4qGiKvB8RYjPayQ6Jb4mX1yNGIN8Ci1JN vk2DAyAcWg9FikIzqI7pRrbX7y0ifk+gVLtK6r4ddf2xe2CfTLJ9hQCcPx++A+IZ5l+k FhIKC0/DaAn1mUaiOZDjUZiEeCaDJXmg+20qHmTuWLj7orgngUHbhRRcMzbDws+hOnrn T/fbRlAAQmM3trNGTaBHjmf2Ed5zMF/1XRffksldSapOQmG9wIaf0NlgD1pVrh6lzeAN qS+lCFh10XOlQqRcKXB5r/fo+qzP83zJ8pg9kA5vKj+KkrWWEfG7vdIo9JT46Xd1XQ+H +Xjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dtym6svX; 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 7si2435339qtt.80.2020.04.21.18.20.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:20:08 -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=dtym6svX; 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]:38606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR43b-0004u2-Eg for patch@linaro.org; Tue, 21 Apr 2020 21:20:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33750) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR415-00014Y-HR for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR414-0001DM-RP for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:31 -0400 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:51597) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR414-00018W-Ds for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:30 -0400 Received: by mail-pj1-x1043.google.com with SMTP id mq3so151098pjb.1 for ; Tue, 21 Apr 2020 18:17: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=J8tKD8Dhorc/rZ7Pqa63r7FVSLYqB5ObHvXNIyPd1G0=; b=dtym6svXNRG09FaGUE3ydgDPAHdq75PwjHlZmkv9dUpKnow+5xOQ6iVrmPRH/++edq BknPQcOJVlIbfmhzPIpKnUwU9EL/wglHYLXgV0IUzYV4E+jQgOxArKBEuRtWu6W4G/Jg NHhkrn1CYkkyIWFlXiu837rH8LLL9/ZfTulbnhtL8t5URgZvy4qlI1Qs3EJ7+1fYN+zr A/Age6F5/g97RPCdvrXm1PdAupRPNjHV2eVvsZ5qwO2eR70jkQzsYuuezWvCTN9fwSoH Bx1o70Y7/XayfEvlQhG0QdCcTR9e7aEXRUEh17jmJ7/YtnVTGkGjdX0959lY63X+fXhM iT+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J8tKD8Dhorc/rZ7Pqa63r7FVSLYqB5ObHvXNIyPd1G0=; b=a31qhfr4F6UlPsplkGoNp4vwdDPo4ango/9Y3WkbLVTofOfP+5SuS2osaw52T4rSEu VkEgL58qsDKvlEX/9vvi3b26pX4vWU5CkmtsLK1DnjeQ4e8B5SktN1jZYq3PsSxBmznT F5Lx8oC6zal4H70X4R0UCX6/EITBg+SJAWG3lKs6Sf/jxMy/LLDP6ab4nAmT155UiDZX Nv73cx2WdaW238VG+ZoQz/H10om3ZFJlUf2caamJ7yOzST3mvImJhIVXtp7lOe7vHFpJ Gd6yPtnnQFDOiVdXGcpDgAczNrTjC/UDSBSne/Gpb4FdtQmGHTy7kWCUgf3Xoe5Hnr5V Bsfw== X-Gm-Message-State: AGi0PubHn2k2WSRqsy7dSsVifdSMvXFpLcpf3PRuiO/9DeaBq4wPguWJ tLGD0k6HfqMHmVL4zZXvMq7ZI1hyy20= X-Received: by 2002:a17:90a:a484:: with SMTP id z4mr8656936pjp.40.1587518248653; Tue, 21 Apr 2020 18:17: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 m4sm3673561pfm.26.2020.04.21.18.17.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 03/36] target/ppc: Use tcg_gen_gvec_dup_imm Date: Tue, 21 Apr 2020 18:16:49 -0700 Message-Id: <20200422011722.13287-4-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::1043; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1043.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::1043 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, David Gibson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We can now unify the implementation of the 3 VSPLTI instructions. Acked-by: David Gibson Signed-off-by: Richard Henderson --- target/ppc/translate/vmx-impl.inc.c | 32 ++++++++++++++++------------- target/ppc/translate/vsx-impl.inc.c | 2 +- 2 files changed, 19 insertions(+), 15 deletions(-) -- 2.20.1 diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx-impl.inc.c index 81d5a7a341..403ed3a01c 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -1035,21 +1035,25 @@ GEN_VXRFORM_DUAL(vcmpbfp, PPC_ALTIVEC, PPC_NONE, \ GEN_VXRFORM_DUAL(vcmpgtfp, PPC_ALTIVEC, PPC_NONE, \ vcmpgtud, PPC_NONE, PPC2_ALTIVEC_207) -#define GEN_VXFORM_DUPI(name, tcg_op, opc2, opc3) \ -static void glue(gen_, name)(DisasContext *ctx) \ - { \ - int simm; \ - if (unlikely(!ctx->altivec_enabled)) { \ - gen_exception(ctx, POWERPC_EXCP_VPU); \ - return; \ - } \ - simm = SIMM5(ctx->opcode); \ - tcg_op(avr_full_offset(rD(ctx->opcode)), 16, 16, simm); \ +static void gen_vsplti(DisasContext *ctx, int vece) +{ + int simm; + + if (unlikely(!ctx->altivec_enabled)) { + gen_exception(ctx, POWERPC_EXCP_VPU); + return; } -GEN_VXFORM_DUPI(vspltisb, tcg_gen_gvec_dup8i, 6, 12); -GEN_VXFORM_DUPI(vspltish, tcg_gen_gvec_dup16i, 6, 13); -GEN_VXFORM_DUPI(vspltisw, tcg_gen_gvec_dup32i, 6, 14); + simm = SIMM5(ctx->opcode); + tcg_gen_gvec_dup_imm(vece, avr_full_offset(rD(ctx->opcode)), 16, 16, simm); +} + +#define GEN_VXFORM_VSPLTI(name, vece, opc2, opc3) \ +static void glue(gen_, name)(DisasContext *ctx) { gen_vsplti(ctx, vece); } + +GEN_VXFORM_VSPLTI(vspltisb, MO_8, 6, 12); +GEN_VXFORM_VSPLTI(vspltish, MO_16, 6, 13); +GEN_VXFORM_VSPLTI(vspltisw, MO_32, 6, 14); #define GEN_VXFORM_NOA(name, opc2, opc3) \ static void glue(gen_, name)(DisasContext *ctx) \ @@ -1559,7 +1563,7 @@ GEN_VXFORM_DUAL(vsldoi, PPC_ALTIVEC, PPC_NONE, #undef GEN_VXRFORM_DUAL #undef GEN_VXRFORM1 #undef GEN_VXRFORM -#undef GEN_VXFORM_DUPI +#undef GEN_VXFORM_VSPLTI #undef GEN_VXFORM_NOA #undef GEN_VXFORM_UIMM #undef GEN_VAFORM_PAIRED diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx-impl.inc.c index 8287e272f5..b518de46db 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1579,7 +1579,7 @@ static void gen_xxspltib(DisasContext *ctx) return; } } - tcg_gen_gvec_dup8i(vsr_full_offset(rt), 16, 16, uim8); + tcg_gen_gvec_dup_imm(MO_8, vsr_full_offset(rt), 16, 16, uim8); } static void gen_xxsldwi(DisasContext *ctx) From patchwork Wed Apr 22 01:16:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185621 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp163096ilf; Tue, 21 Apr 2020 18:21:48 -0700 (PDT) X-Google-Smtp-Source: APiQypIvtHoX1IJAYuT9ZA7rjizyi/KwVyYPe9w4xZB0yU86Mf/uUAWlcniBj0p9S2BnT20H+P1q X-Received: by 2002:ac8:31ac:: with SMTP id h41mr23986101qte.139.1587518508262; Tue, 21 Apr 2020 18:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518508; cv=none; d=google.com; s=arc-20160816; b=DR+ZuB0LPfl9p2tvwJxXlNGsHNLqPTsTkNKmkCOspG3qw5yFUR4pLEPU3U2fKamXed RQfeczrhve1ERzgAY20NBXLk1fooi2JX0xI1vmx31XEGt30rCB9Pgg+yeSaGUYjXHRD/ lIvbBpe9MjzoiqaBNF3isqCFPKp33zFuzMM/VMLWSUDEck7om2y0Y3GNY+DDgRXEesGB ZspfYQkQnqrL+eaG//N8a2o0gOZ/TIMKqhAKlSS7Ud0aIbhWArkSXFKnuaFRMJpScjHI B3ojUJ8YTxTasdpkU1z7+SxMdmyjGWX8JKWHdaR+f7mJR8kakyheo3bxHL0Blih/MYT5 uqfQ== 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=0V/ZRxEb6ePbby7wOatIf966jqiZTa7L3IUbLbPYLQI=; b=jmkGmpzIHL0ZCV/qJwjZyOXTdSbAHgWCXgmaSyAnTmNGGdW91HpnRqzx+8GY3s69PR vLTP9Dyym+8H59aVLfg0jqyB0Y7eaG0/ND8XH/POZ+oKh9kreumFqpv5Vm1YciPJ1R+W J7iaoU7Stnqc6I3qQx2m6YT2QouExi/SIy/ivuiAOnUX/dyXkR7rp4/RFvVDlXuL/jjd hLLkmjKXs8ZOx7pH21tD+PnR5JJbM1Iw201sFW87Ad+MhWYoi/N3upq7PyEfV1xgq4SG LvpruMH4jOwQU6IbgNQLbuR9grocPMjo16x7ckmpGigRG65YEdh8Q9/aOAFwlyMy78bW jwOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v8x2OyAj; 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 p45si2314898qtc.179.2020.04.21.18.21.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:21: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=v8x2OyAj; 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]:38660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR45D-0008NL-K5 for patch@linaro.org; Tue, 21 Apr 2020 21:21:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33854) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR416-00016s-Sr for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR416-0001Hv-3T for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:32 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:36419) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR415-0001Dn-MB for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:31 -0400 Received: by mail-pf1-x441.google.com with SMTP id g30so226307pfr.3 for ; Tue, 21 Apr 2020 18:17: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=0V/ZRxEb6ePbby7wOatIf966jqiZTa7L3IUbLbPYLQI=; b=v8x2OyAj2X+c7gtEEZpQUohma0vesyS9VL1HD4gx9DKmB7DRdD5MXUAKgHenD0kZZW M78XhjMUuE8RjRWKD+hVp4mmUBIFSFFLEAKSyJXEnpHHL0WbJBH2FyKSK14/IWuMahlg wPIT6q2RqTbsFU8pU+1eCD+Tk5gUfnenId/libB20Ca283NFHJ3ecMYuMqb4MRt5KSP/ y/bw0SAZHCTHKrlMZA5UaTbZyQnP7tAydxZDWfVR15SXvbB7oX1SECe5WEQSFrW1aSq/ gkkHbuGgdMliVUX2zY21tPr/BKbhKcJvS/j9oohqXUT0N4px8Zc7WVlQhj+yOq5DIbp0 Vo9g== 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=0V/ZRxEb6ePbby7wOatIf966jqiZTa7L3IUbLbPYLQI=; b=BDjBLiITUmoC7Y9WnNRH5/lRfRIYPaesBDGLqBp8qEiT4A+u7oYACJNutqLFYzrHSO bSuz9pA944IpDj+M/xo5l7osH4ZP6bwGdpTu9KGzPl8d7kFKBaHUvaXbFVzr4EQEGY8i ON4c9gZX4Yh+u7FOmPgMZb1YVCJYRkM/przs1KkyakCpV6Jnf6018GCHDP3svxIgRRNL zdKWpBiEVTXUZJz27DXGA/Sh4JuK1bHGVDvOkUOoyd+xtUgADVlkZh7fFLVeIzMqBuPb t+BvZmURJiKwTdCrNwuHKrtAqRUkdq1MnJXx/COcgUGqOj/v/Mk3BK/9HHik1q7QXt90 Oo8w== X-Gm-Message-State: AGi0PuacTcMLIqHRdx9IsAqSnqOhz3rY2JaEOBXMDW1Fcobfim1YxQN1 ywNGcRO2q/V15yIJfV8/rPu77K7Ori8= X-Received: by 2002:aa7:8e0a:: with SMTP id c10mr24588404pfr.114.1587518249892; Tue, 21 Apr 2020 18:17: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 m4sm3673561pfm.26.2020.04.21.18.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 04/36] target/arm: Use tcg_gen_gvec_dup_imm Date: Tue, 21 Apr 2020 18:16:50 -0700 Message-Id: <20200422011722.13287-5-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::441; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x441.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::441 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" In a few cases, we're able to remove some manual replication. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 10 +++++----- target/arm/translate-sve.c | 12 +++++------- target/arm/translate.c | 9 ++++++--- 3 files changed, 16 insertions(+), 15 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 7580e46367..095638e09a 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -519,7 +519,7 @@ static void clear_vec_high(DisasContext *s, bool is_q, int rd) tcg_temp_free_i64(tcg_zero); } if (vsz > 16) { - tcg_gen_gvec_dup8i(ofs + 16, vsz - 16, vsz - 16, 0); + tcg_gen_gvec_dup_imm(MO_64, ofs + 16, vsz - 16, vsz - 16, 0); } } @@ -7794,8 +7794,8 @@ static void disas_simd_mod_imm(DisasContext *s, uint32_t insn) if (!((cmode & 0x9) == 0x1 || (cmode & 0xd) == 0x9)) { /* MOVI or MVNI, with MVNI negation handled above. */ - tcg_gen_gvec_dup64i(vec_full_reg_offset(s, rd), is_q ? 16 : 8, - vec_full_reg_size(s), imm); + tcg_gen_gvec_dup_imm(MO_64, vec_full_reg_offset(s, rd), is_q ? 16 : 8, + vec_full_reg_size(s), imm); } else { /* ORR or BIC, with BIC negation to AND handled above. */ if (is_neg) { @@ -10223,8 +10223,8 @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u, if (is_u) { if (shift == 8 << size) { /* Shift count the same size as element size produces zero. */ - tcg_gen_gvec_dup8i(vec_full_reg_offset(s, rd), - is_q ? 16 : 8, vec_full_reg_size(s), 0); + tcg_gen_gvec_dup_imm(size, vec_full_reg_offset(s, rd), + is_q ? 16 : 8, vec_full_reg_size(s), 0); } else { gen_gvec_fn2i(s, is_q, rd, rn, shift, tcg_gen_gvec_shri, size); } diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index b35bad245e..6c8bda4e4c 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -177,7 +177,7 @@ static bool do_mov_z(DisasContext *s, int rd, int rn) static void do_dupi_z(DisasContext *s, int rd, uint64_t word) { unsigned vsz = vec_full_reg_size(s); - tcg_gen_gvec_dup64i(vec_full_reg_offset(s, rd), vsz, vsz, word); + tcg_gen_gvec_dup_imm(MO_64, vec_full_reg_offset(s, rd), vsz, vsz, word); } /* Invoke a vector expander on two Pregs. */ @@ -1453,7 +1453,7 @@ static bool do_predset(DisasContext *s, int esz, int rd, int pat, bool setflag) unsigned oprsz = size_for_gvec(setsz / 8); if (oprsz * 8 == setsz) { - tcg_gen_gvec_dup64i(ofs, oprsz, maxsz, word); + tcg_gen_gvec_dup_imm(MO_64, ofs, oprsz, maxsz, word); goto done; } } @@ -2044,7 +2044,7 @@ static bool trans_DUP_x(DisasContext *s, arg_DUP_x *a) unsigned nofs = vec_reg_offset(s, a->rn, index, esz); tcg_gen_gvec_dup_mem(esz, dofs, nofs, vsz, vsz); } else { - tcg_gen_gvec_dup64i(dofs, vsz, vsz, 0); + tcg_gen_gvec_dup_imm(esz, dofs, vsz, vsz, 0); } } return true; @@ -3260,9 +3260,7 @@ static bool trans_FDUP(DisasContext *s, arg_FDUP *a) /* Decode the VFP immediate. */ imm = vfp_expand_imm(a->esz, a->imm); - imm = dup_const(a->esz, imm); - - tcg_gen_gvec_dup64i(dofs, vsz, vsz, imm); + tcg_gen_gvec_dup_imm(a->esz, dofs, vsz, vsz, imm); } return true; } @@ -3276,7 +3274,7 @@ static bool trans_DUP_i(DisasContext *s, arg_DUP_i *a) unsigned vsz = vec_full_reg_size(s); int dofs = vec_full_reg_offset(s, a->rd); - tcg_gen_gvec_dup64i(dofs, vsz, vsz, dup_const(a->esz, a->imm)); + tcg_gen_gvec_dup_imm(a->esz, dofs, vsz, vsz, a->imm); } return true; } diff --git a/target/arm/translate.c b/target/arm/translate.c index 9f9f4e19e0..af4d3ff4c9 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -5386,7 +5386,8 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) MIN(shift, (8 << size) - 1), vec_size, vec_size); } else if (shift >= 8 << size) { - tcg_gen_gvec_dup8i(rd_ofs, vec_size, vec_size, 0); + tcg_gen_gvec_dup_imm(MO_8, rd_ofs, vec_size, + vec_size, 0); } else { tcg_gen_gvec_shri(size, rd_ofs, rm_ofs, shift, vec_size, vec_size); @@ -5437,7 +5438,8 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) * architecturally valid and results in zero. */ if (shift >= 8 << size) { - tcg_gen_gvec_dup8i(rd_ofs, vec_size, vec_size, 0); + tcg_gen_gvec_dup_imm(size, rd_ofs, + vec_size, vec_size, 0); } else { tcg_gen_gvec_shli(size, rd_ofs, rm_ofs, shift, vec_size, vec_size); @@ -5783,7 +5785,8 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) } tcg_temp_free_i64(t64); } else { - tcg_gen_gvec_dup32i(reg_ofs, vec_size, vec_size, imm); + tcg_gen_gvec_dup_imm(MO_32, reg_ofs, vec_size, + vec_size, imm); } } } From patchwork Wed Apr 22 01:16:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185628 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp165053ilf; Tue, 21 Apr 2020 18:24:33 -0700 (PDT) X-Google-Smtp-Source: APiQypL+tvkSo3qTDykFFFlUJbf9HezuAvTlFapT/rVI41bWcDGlRXGp0u4Desrci7XP1om/XQhb X-Received: by 2002:ac8:4247:: with SMTP id r7mr25087851qtm.52.1587518673818; Tue, 21 Apr 2020 18:24:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518673; cv=none; d=google.com; s=arc-20160816; b=kWaZm+4/HOKu4sOJA8d7zt+52QdjSGAqhM0U4R3DwjMPn3XFwRjxFJJE75vqOXeX/Y VGt7ippQrql9xWThHWQw4YblOKtvJZbwUdUFqRO9zb28tjp6ptz5A7szwM5QkeaoqV52 IxKVqDernQ27Q5pUEEI6cyoxcr+OtS9mX+WMIbJ4LRibUsKGFRn42PFlyhy5LOMZw5ui pap70fKMe41b+4xpnXIOy/clOO0BdpZmt2wMnC1HiUekT/DSCg7Q8PucpthZ7T8rECIJ 1bGlg7VgH/CwpLhBjMR19swlUwADnq7blFHxozvoHS/dsDhUuDtQnA9dLt6R3DCWwlEg Pksg== 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=glPDdkgy28ft6bPZXYEAIgcEtYEuVNy5yrxjCgISMLo=; b=d3cAw+w5l7Pbz4d4JZsevAdGevL2Oc+bgxDLmYJcSy4aiEEmb5DacqUFZC3X2m1SCp M0PvokFgj578deDhy/92RR7eLJ9V/3zZ/pjYPOPQ+MsJ+tkyoWV/lIKzX+ZK7I5Z6/Iq NvwNHE8D/2sCz5YBOQDcnTE87DmvvTu6I/ruHk9ZCAfgYO9hxQF1/kAjfYieIySydf+H oWKLf0Z6+3zD+aIkkA2eFfXwYpA3oOpKVzaHeh79/ovwnEXlMINKYVG5pwDwtzcjNh1p zqfsIZNuIfWsEqlTg7nfX0vJ858wYD9xMic8Oi9r+UynfyPYdXs/XSCjRSRCzICWCwIP stvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="xCQ6CuP/"; 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 j15si2371626qtq.91.2020.04.21.18.24.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:24:33 -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="xCQ6CuP/"; 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]:38748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR47t-00054u-AF for patch@linaro.org; Tue, 21 Apr 2020 21:24:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33928) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR417-00018q-S3 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR417-0001N1-9r for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:33 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:39735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR416-0001Hg-St for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:32 -0400 Received: by mail-pg1-x541.google.com with SMTP id o10so254408pgb.6 for ; Tue, 21 Apr 2020 18:17: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=glPDdkgy28ft6bPZXYEAIgcEtYEuVNy5yrxjCgISMLo=; b=xCQ6CuP/gKB2yOA3mvie6kntOunz4gv/LF/AMwEIiLevfe4eBjD5DMICvmJ1S/ktvL 3KiZm3F+8sjmH4G0VUgsy7xHbvKUeOKvLFAK4iVCrWoFBiFdzsd9C/OidpRAWVAb0t5N KafwFpMHjmrZomIWz518AGf3nUBaLBA2lmgblrvWFCfBTTwIl6Y5Ka4nryvj4VgvlvRb XRveLJNbm2kOo7C7HjSSZM+Ux0qs4+n6ETi0tOAOhEkkHNQiPDCtwntZGLQKR7YXv8C3 rDV+JtahpCFYxpiLK2MwYO+0L/PytH4F7SzsWGMxav30dHbtOrhayR1rJme1kDH96A3R egoA== 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=glPDdkgy28ft6bPZXYEAIgcEtYEuVNy5yrxjCgISMLo=; b=G1nXTofX/VtGINlc27uVCm4XTSF5zTLVJQLyv1RVzjzBa2ZKVK30PCfbClQLS2UL/N 2UuwMG37xQE2IcjeeYGSJhn4gqcZLroJrjQFRD2TNQ3jJP5VBfkjY7I0LBd8JOxEXtHj w20X3+GcpJqajyOE1Sp9nsRYDC0XmHUwAZAldE9Q24NAJwx4pORAczdgNO9WHfNxJqnc OjxVnDu/d/5aLTDYumRvJqbi4CHGi96jPEyz7Kimr8+YzBPhCCN0pi/04oBZWf7iukeC eo0Gp5WIeZi+TWMfRBWqOcLQSKJa9rtR36BJJ/SwGoX/HiPwn3tyLnQCVsANGs8BYYcz Iaqg== X-Gm-Message-State: AGi0PuYJBjW8CwfrnzRyQamCIB02zw1pitxU1jpoDUjzt11Y5V6ElYT1 aO8DTQFAWtIp1QRJ4tTnVGn8l+nOgkA= X-Received: by 2002:aa7:8a92:: with SMTP id a18mr5201366pfc.0.1587518251069; Tue, 21 Apr 2020 18:17: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 m4sm3673561pfm.26.2020.04.21.18.17.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 05/36] tcg: Use tcg_gen_gvec_dup_imm in logical simplifications Date: Tue, 21 Apr 2020 18:16:51 -0700 Message-Id: <20200422011722.13287-6-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, LIU Zhiwei Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Replace the outgoing interface. Reviewed-by: LIU Zhiwei Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tcg/tcg-op-gvec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 593bb4542e..de16c027b3 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -2326,7 +2326,7 @@ void tcg_gen_gvec_xor(unsigned vece, uint32_t dofs, uint32_t aofs, }; if (aofs == bofs) { - tcg_gen_gvec_dup8i(dofs, oprsz, maxsz, 0); + tcg_gen_gvec_dup_imm(MO_64, dofs, oprsz, maxsz, 0); } else { tcg_gen_gvec_3(dofs, aofs, bofs, oprsz, maxsz, &g); } @@ -2343,7 +2343,7 @@ void tcg_gen_gvec_andc(unsigned vece, uint32_t dofs, uint32_t aofs, }; if (aofs == bofs) { - tcg_gen_gvec_dup8i(dofs, oprsz, maxsz, 0); + tcg_gen_gvec_dup_imm(MO_64, dofs, oprsz, maxsz, 0); } else { tcg_gen_gvec_3(dofs, aofs, bofs, oprsz, maxsz, &g); } @@ -2360,7 +2360,7 @@ void tcg_gen_gvec_orc(unsigned vece, uint32_t dofs, uint32_t aofs, }; if (aofs == bofs) { - tcg_gen_gvec_dup8i(dofs, oprsz, maxsz, -1); + tcg_gen_gvec_dup_imm(MO_64, dofs, oprsz, maxsz, -1); } else { tcg_gen_gvec_3(dofs, aofs, bofs, oprsz, maxsz, &g); } @@ -2411,7 +2411,7 @@ void tcg_gen_gvec_eqv(unsigned vece, uint32_t dofs, uint32_t aofs, }; if (aofs == bofs) { - tcg_gen_gvec_dup8i(dofs, oprsz, maxsz, -1); + tcg_gen_gvec_dup_imm(MO_64, dofs, oprsz, maxsz, -1); } else { tcg_gen_gvec_3(dofs, aofs, bofs, oprsz, maxsz, &g); } From patchwork Wed Apr 22 01:16:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185615 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp160036ilf; Tue, 21 Apr 2020 18:17:48 -0700 (PDT) X-Google-Smtp-Source: APiQypLPTOMfDdTCeb1YXlZC345nHU+Qz0EehST183JfOO1/+kK8XVeNEmPzG8wUaCtMoIkW5W8u X-Received: by 2002:ac8:720f:: with SMTP id a15mr23243404qtp.207.1587518268695; Tue, 21 Apr 2020 18:17:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518268; cv=none; d=google.com; s=arc-20160816; b=a9lzSJAiLXGj/CQXT1JtuZn53gqHNvv5myxkKy636wCylsu8UxYJWuw8lGMxuWB94p 39JYp6v8siRdEyJl11hyI0SJbg4UZeYwtKpHKn4i5BEGxHPpRRv1CZYFFa0cJfDmWvrS Ubhfb1vqgjNLUMi2I8Rbq35iIAPxf0adLt6Pyd+xx3uSd/dHreW0zTpgwRipT7Fn73HF wAgfPgfEz+xwRcQlV35wKg04f4eUoIv030bBQpVxAx2sSvqYJhDlVOgBKtEFOw6cRfK6 96nCCJUKAcc++fTazHC9ZOjgvPsiE5tmJ0C/Hqbc/0SUV/Pj+D9u/YJR/8AbB2SI8jdW zmyA== 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=ZhM8WFsngVW12JNtP5Ld2uYK1gRgB1Q32WgIlT7XOUI=; b=Mly23Mw7pW/+eXwG1unoW6pwipeXZ6lAn1urBCEetUxaN4oveAVLg4mEuHMmbIJo0A hN6bWK7rOhklUvrP5W+0JPKU4k5bUNeygRE21VRHx9h2xDswiwe4iFZSLEg/obhNf83l xcG5EYsF0QvfmCH0fgtRWaKbZ63IdjrljiuLNjjRGJYr+h81VnN751xwZ4uL0oOZKwUT mt095qxnz9zf+AWEhzP422TJvot56CXvmRpqKOgsGiSrXGTRZFTUj/ilXlgj8mVgLMh5 re1PeS84tFkGMg8Vn8cG3YRBveIT4ZriasQhrrJM3540ZmyXKiox8I0IY3U5R3s5jjfa MFmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DprGUP+W; 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 p6si2474483qkg.20.2020.04.21.18.17.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:17: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=DprGUP+W; 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]:38448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41M-0001Fz-77 for patch@linaro.org; Tue, 21 Apr 2020 21:17:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34042) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR419-0001BW-9W for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR418-0001P4-LD for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:35 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:35805) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR418-0001NB-6Z for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:34 -0400 Received: by mail-pg1-x52c.google.com with SMTP id t11so264753pgg.2 for ; Tue, 21 Apr 2020 18:17:33 -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=ZhM8WFsngVW12JNtP5Ld2uYK1gRgB1Q32WgIlT7XOUI=; b=DprGUP+WVCW6pTdgkmrtT8wcIe4NKwZnaG9LfKnQ2rAE6hH8q77QZE4kmSC4cEHDxd slp8l490XgjNfgER5XXWfygWCvl21aZ3rd/x6KtJ1+G//Q8j5K7j81QPQFBwzWoH3Nme nvnZZEDIP8fRjWW5sYovk5POjSEK5pByboIWDVTcfGnv2YNldY/B/69G3HPCaUBKbfwa 7CTpQI7590UD3g6ogRhLeQrWmp7k5Oo7mSgrMd3/ZsQVVs7K7P7kmEThNYkKiMSQ+w7I UhAqSeJHR9nuDyitZMR32COqlCu4Ziv332ZXiP3kU/8n7V0DJgfZ1Mjpfb8Pnoe/qUYv EcFQ== 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=ZhM8WFsngVW12JNtP5Ld2uYK1gRgB1Q32WgIlT7XOUI=; b=YSAXqVagf/rjeKvHVJWHb22HUe1IXPwtSoF1tUtjAJrqp0VMnoIjgG/yhasXfyK53z uDqTd1p47O0nV8YfG5dQfBDbjrQ+sJ2cEAEsvcAyE03SwlUnBV0wobknvH/ENalWXhQq VbyeEa7vghPT+g8l2m54LI92Ch5oYRJ2aju2GdrgiaP0OtjmnoyKs1hLTkXfTBMqdNHO CCmoCL/bYEUofs7q6Z1K92FB76JlmX98dKikWsmmrJn2Evc7nnlbNeDfHT+1CYvW1DDA cqWraRwjWQlTiD5VUlMDPZb5nTNjy08G5VXSFqjkU9DUUjFZFSs4R4Cm77zMcZDlSNcI K0DQ== X-Gm-Message-State: AGi0PuYFLTPPgZ7FIGGuOY5iXU00eXWiAZy7NAlDGlbVCSMT5Lxsp1cN lzRlUecoAo7nu6gf6Ax1NNqK+oslP1c= X-Received: by 2002:a63:5c01:: with SMTP id q1mr22984996pgb.177.1587518252394; Tue, 21 Apr 2020 18:17:32 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.17.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 06/36] tcg: Remove tcg_gen_gvec_dup{8,16,32,64}i Date: Tue, 21 Apr 2020 18:16:52 -0700 Message-Id: <20200422011722.13287-7-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::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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::52c 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, LIU Zhiwei , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These interfaces are now unused. Reviewed-by: LIU Zhiwei Reviewed-by: David Hildenbrand Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/tcg/tcg-op-gvec.h | 5 ----- tcg/tcg-op-gvec.c | 28 ---------------------------- 2 files changed, 33 deletions(-) -- 2.20.1 diff --git a/include/tcg/tcg-op-gvec.h b/include/tcg/tcg-op-gvec.h index eb0d47a42b..fa8a0c8d03 100644 --- a/include/tcg/tcg-op-gvec.h +++ b/include/tcg/tcg-op-gvec.h @@ -320,11 +320,6 @@ void tcg_gen_gvec_dup_i32(unsigned vece, uint32_t dofs, uint32_t s, void tcg_gen_gvec_dup_i64(unsigned vece, uint32_t dofs, uint32_t s, uint32_t m, TCGv_i64); -void tcg_gen_gvec_dup8i(uint32_t dofs, uint32_t s, uint32_t m, uint8_t x); -void tcg_gen_gvec_dup16i(uint32_t dofs, uint32_t s, uint32_t m, uint16_t x); -void tcg_gen_gvec_dup32i(uint32_t dofs, uint32_t s, uint32_t m, uint32_t x); -void tcg_gen_gvec_dup64i(uint32_t dofs, uint32_t s, uint32_t m, uint64_t x); - void tcg_gen_gvec_shli(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t shift, uint32_t oprsz, uint32_t maxsz); void tcg_gen_gvec_shri(unsigned vece, uint32_t dofs, uint32_t aofs, diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index de16c027b3..5a6cc19812 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -1541,34 +1541,6 @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dofs, uint32_t aofs, } } -void tcg_gen_gvec_dup64i(uint32_t dofs, uint32_t oprsz, - uint32_t maxsz, uint64_t x) -{ - check_size_align(oprsz, maxsz, dofs); - do_dup(MO_64, dofs, oprsz, maxsz, NULL, NULL, x); -} - -void tcg_gen_gvec_dup32i(uint32_t dofs, uint32_t oprsz, - uint32_t maxsz, uint32_t x) -{ - check_size_align(oprsz, maxsz, dofs); - do_dup(MO_32, dofs, oprsz, maxsz, NULL, NULL, x); -} - -void tcg_gen_gvec_dup16i(uint32_t dofs, uint32_t oprsz, - uint32_t maxsz, uint16_t x) -{ - check_size_align(oprsz, maxsz, dofs); - do_dup(MO_16, dofs, oprsz, maxsz, NULL, NULL, x); -} - -void tcg_gen_gvec_dup8i(uint32_t dofs, uint32_t oprsz, - uint32_t maxsz, uint8_t x) -{ - check_size_align(oprsz, maxsz, dofs); - do_dup(MO_8, dofs, oprsz, maxsz, NULL, NULL, x); -} - void tcg_gen_gvec_dup_imm(unsigned vece, uint32_t dofs, uint32_t oprsz, uint32_t maxsz, uint64_t x) { From patchwork Wed Apr 22 01:16:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185619 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp161993ilf; Tue, 21 Apr 2020 18:20:15 -0700 (PDT) X-Google-Smtp-Source: APiQypInzlqGyNlLlFIZbZrZbjxZP+fxRTP+LqxaLNpvE84xlKNzNWLOwZk93eDqo9Yi0tItBd5G X-Received: by 2002:ac8:688c:: with SMTP id m12mr3434058qtq.278.1587518415729; Tue, 21 Apr 2020 18:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518415; cv=none; d=google.com; s=arc-20160816; b=QWax8iprJR8+Vuw6qk/O67fyhw5XwsSqXExk6xuUrbW0+oD7D/yjA0MCoGj2m7XHk8 Pvb6TZ3XEaAclLtqM+Ypn35JOcwmZLaN3fa1j4bfw/5et8SvoGyuHhHl/mhcCr1qOPln hvtLxDsd81nTRuIe1tgMV/5BRdVHo9bmedLV0kCWbW+l5j5NAsvDz9TX4NSkDc4O+lIT EyGYfVFq8WK+I5Rbefj8H7VAHpyJrZD6Rlhp83qhOw97AoIdzLEL+BK7w2j0UlhINYSy /kxON0LVRCVMTnY9E4g0yxg17Vgf6OAI9LGrvdSPnpu80PI9UemTQZJVbcgiWVA07rL+ CxPA== 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=NV6lL8g5TLJgWVXBQ3cW0c77O/M78yXELJw+3HhuoJg=; b=V33H/6aEWiQBYlzHlsJbvC3U7y/UDUk+uyZ/9NCOOA1q0EgWisANZE1ad3+u0KmhS4 55n5UgO2D0wFyc3Lza9StpziUjtHzkjppc8+HgbRGehWZ9x+CgOcZ8NIbfFvBTKIbJzV /E3RhK9W4+0lmw0J2V9ilAX5OjgKY/SeRYjYLE0IgHHt+C0gSldI8eHZu9NhWbIzfk/6 2aVUAEViUus/BIv+Kj01jRLasYDucj1ZozabozzrYk68nuSnf4P9VWlfrrxF7l0rtK2L 1EsmxE5hTgEOE6nZ874yirQ8pGIVwlEy2JGIwwiWqSWvgfOC1+LDM+KxmQ9uTAnTA1Hf g9fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nBy7+FcR; 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 h11si2306986qtu.335.2020.04.21.18.20.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:20:15 -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=nBy7+FcR; 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]:38610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR43j-00055r-5K for patch@linaro.org; Tue, 21 Apr 2020 21:20:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34150) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41A-0001EK-Pf for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41A-0001T0-6E for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:36 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:41537) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR419-0001QO-O0 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:35 -0400 Received: by mail-pg1-x529.google.com with SMTP id h69so248095pgc.8 for ; Tue, 21 Apr 2020 18:17:35 -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=NV6lL8g5TLJgWVXBQ3cW0c77O/M78yXELJw+3HhuoJg=; b=nBy7+FcRzgMRoTxKgdfaIZHCF1SI8fiXB7VxHNAuFh1eBlF5E1H5nmRBHqd/QiRP0m R+kDS5bkJa47cGt57QKpt2qkKDGGt1GPYjoC3+8jXswL8Xv5i3m+i/HBfcKY+Zdb45ZJ 8jGTai1iic5OSIm1c0HAgtOIXqIFR0TTzhHFYOdGyWbScRgcOwSpYTG2HtVXoGjfK8wc yhwOqIVkOGA8/os4p/DwWTEWOja0tYRbU6+i1OGnFbcpzWXe5SR0nDKSUDSES3QT8yuq W2xpzZUIMgHVkJ1t9b+ChPSMVG6+k8M11XGnarP1znAE/z1t/MorcWj8JEeH+PB9Ljzd eRsA== 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=NV6lL8g5TLJgWVXBQ3cW0c77O/M78yXELJw+3HhuoJg=; b=i+as9VmeiQZ+60gFgWV1+MrjCAWkCNzhqa2CweczsjIxYHY3px8vkaXmRi9pGE81mC zwNP0HSL/bGPv7DR9BmK40wVoL5M965AoWD7iIP5RhN3U7soy5xKmytww+6cVpoycWIL 5kEr59u6ayOx5AFpgtZBFCWLrq+ezVH54WaLm36VYH4NwzyiuUmaFZV7Yszc56dpRvbF xdsV0o/voRtFzdNJJk6NrB5ihG7XSTlcqtq3Hq+hhWl5ZW3sVTNSeQtDGacB9xpZTWXU ltWnImzPY87MEQft/slJsJ6hg6RpnQbGaKnv/w2cHlSiYBKW573W1+17IUfHVZ/U3O4e 5e8g== X-Gm-Message-State: AGi0PubuNffszlYOPQoug5fJrXUv34/oUG+3YeUxN4vj9XcA/dUCTQ21 mnMQpZcU/wonBEUV3nH4CwJ9LC8LATo= X-Received: by 2002:a63:2e03:: with SMTP id u3mr24561951pgu.121.1587518253576; Tue, 21 Apr 2020 18:17: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 m4sm3673561pfm.26.2020.04.21.18.17.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 07/36] tcg: Add tcg_gen_gvec_dup_tl Date: Tue, 21 Apr 2020 18:16:53 -0700 Message-Id: <20200422011722.13287-8-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::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.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::529 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, LIU Zhiwei , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For use when a target needs to pass a configure-specific target_ulong value to duplicate. Reviewed-by: LIU Zhiwei Reviewed-by: David Hildenbrand Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/tcg/tcg-op-gvec.h | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.20.1 diff --git a/include/tcg/tcg-op-gvec.h b/include/tcg/tcg-op-gvec.h index fa8a0c8d03..d89f91f40e 100644 --- a/include/tcg/tcg-op-gvec.h +++ b/include/tcg/tcg-op-gvec.h @@ -320,6 +320,12 @@ void tcg_gen_gvec_dup_i32(unsigned vece, uint32_t dofs, uint32_t s, void tcg_gen_gvec_dup_i64(unsigned vece, uint32_t dofs, uint32_t s, uint32_t m, TCGv_i64); +#if TARGET_LONG_BITS == 64 +# define tcg_gen_gvec_dup_tl tcg_gen_gvec_dup_i64 +#else +# define tcg_gen_gvec_dup_tl tcg_gen_gvec_dup_i32 +#endif + void tcg_gen_gvec_shli(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t shift, uint32_t oprsz, uint32_t maxsz); void tcg_gen_gvec_shri(unsigned vece, uint32_t dofs, uint32_t aofs, From patchwork Wed Apr 22 01:16:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185622 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp163170ilf; Tue, 21 Apr 2020 18:21:55 -0700 (PDT) X-Google-Smtp-Source: APiQypK9xjLtlr5QpJ3nQhQkdaz3XVqq3bJ0FSbg2WLAXCFBSeUAXAp2ZSttKao90KrrWqsmpf3N X-Received: by 2002:a37:61cf:: with SMTP id v198mr22672648qkb.485.1587518515713; Tue, 21 Apr 2020 18:21:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518515; cv=none; d=google.com; s=arc-20160816; b=fvcqoE493mRBnWvWkxzmypaaSxvp8ZEXNVJ3oGG2hXI6BDBGECaQ+0F/RBVSHIqhAY xJ+uFvnL2stgMy/N29EX6rpr50JM+usYgv/xnLwKtOABdJ4glnKFVMN6giEHziSIl+Ml DZ8GDiJrPFFY1YOji5dbc8K56KmN8at01Z+HXHI2mPSnsQPjAxckGcxQ5zm9b0BC9sbN Q6B07w/HsUkUmb4Mrnd2LmmR0DnIt5g1KgHLYGg9al07FQEO0HeEUI4O4+vNPXgnwoxb LjWb7S+r2gsOAWfgU1FdhBX3JzyjIKncySXhb9v+FrndkXdw4DnYVCADez0F1T8lBscC ojyQ== 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=5T7KJt0fc54mlBnT3n+g8HKCVqPFI5bG2HmAN7UzeMM=; b=JVttBLIRY/keECRLYkjBwcC4C4xpjTptBuuThCL2YMdW/IqlIo5E3KwGahTGC+id6x QalOQZ7PcPadxZzraLyKsJbrl2zdJoslyf/UhbYyt6ahjuQqdpBdBTcsLTYgvQLIEDJw hf2BbhP4wqpomrjNHY/fJJwK12USA/mAFna3zGYF3n0GyVy0TTHY1oydpGNOgnav0282 mtJEF0T/0wIgFk+V6awNyTzigzvejicKIEjAcRQIsLQPY8cgtbXxX+T1S6KFUkoiUiJV 99TMRXZvGbOLA/8ZstmWeoOkDk5i7pdZKTxHSVg+Ex40+3Fkg2MZ31L3RHOSHUcfRMl+ B+BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D4aQBiRe; 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 71si2353956qtf.126.2020.04.21.18.21.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:21:55 -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=D4aQBiRe; 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]:38674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR45L-0000Bv-6H for patch@linaro.org; Tue, 21 Apr 2020 21:21:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34274) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41C-0001Ha-Au for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41B-0001XV-LE for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:38 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:43440) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41B-0001Tk-7S for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:37 -0400 Received: by mail-pg1-x541.google.com with SMTP id x26so243884pgc.10 for ; Tue, 21 Apr 2020 18:17: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=5T7KJt0fc54mlBnT3n+g8HKCVqPFI5bG2HmAN7UzeMM=; b=D4aQBiReHKCm6EPUrCryo4Crtrgmkupl+usryWlE2/4M1ExkdNjFRRFZdBIj/elXw9 bTEHeWc0UmtHUlT3Evg6gOjX/q9jrgEaaZ/Fmn94DixVlEfrvmOhsaWWtqMKoA1yTtpS xiOnzrNlw3qCdQZX2oTEQcx6nY3cve9NiP54vz5PR7Eu6zBEHN8432xiCDPrc4txmusi ++UY4YEJLJk1e5WNAnBPTTSQWWJ2hXKx20pIXHfPZ3y3STUhOXmZikTglIv1x3PzB44f ecqlRjFIaYrv0ksXxnRdgR9PgnJPaXVTYAhj5cyWYaZaK2BAcoea+RCzfYfkwG5Uv23M LaWw== 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=5T7KJt0fc54mlBnT3n+g8HKCVqPFI5bG2HmAN7UzeMM=; b=dArKF/B+akgNDOsXeWYTkZMrvk1RGnZcnyK7su0cgBxzxSMm64PoImBkYLw83Xk/uY Rin9ilZnbJUkUsGM1bxZ01/5R9gpZWid6+Im8Wvb1QhFhVproCXq5UiY0/Zg4pmsyVAi IyetVbhOXOs+7Ag2vaq9ryoFkVKTHywsu+AhGZJqUqruj2c71yCkqKwGqV8+Ef9+VTGp PPFOHgJy2RYP+7qGgTA4XjO5JlPyI+4pQijfTLCkSaMmnrNYzecZuZZ6S8ywXn4zcm5+ TEal7ejCZldSyIS/+r8Wpx3gL/H5vjYtTfki8zLuljvQEvxlNU+Wn2khKBgrNJ8C5ddb QNSQ== X-Gm-Message-State: AGi0PubZ+6E8n9IV+eyxi1MfqsDtolqxAtjQa1ViwvPpzPT6ljqaYa7a RElbnIx84cnbWretwozkUOKxjiqIFIA= X-Received: by 2002:a63:230f:: with SMTP id j15mr24083965pgj.393.1587518255524; Tue, 21 Apr 2020 18:17: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 m4sm3673561pfm.26.2020.04.21.18.17.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 08/36] tcg: Improve vector tail clearing Date: Tue, 21 Apr 2020 18:16:54 -0700 Message-Id: <20200422011722.13287-9-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" Better handling of non-power-of-2 tails as seen with Arm 8-byte vector operations. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tcg/tcg-op-gvec.c | 82 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 63 insertions(+), 19 deletions(-) -- 2.20.1 diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 5a6cc19812..43cac1a0bf 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -326,11 +326,34 @@ void tcg_gen_gvec_5_ptr(uint32_t dofs, uint32_t aofs, uint32_t bofs, in units of LNSZ. This limits the expansion of inline code. */ static inline bool check_size_impl(uint32_t oprsz, uint32_t lnsz) { - if (oprsz % lnsz == 0) { - uint32_t lnct = oprsz / lnsz; - return lnct >= 1 && lnct <= MAX_UNROLL; + uint32_t q, r; + + if (oprsz < lnsz) { + return false; } - return false; + + q = oprsz / lnsz; + r = oprsz % lnsz; + tcg_debug_assert((r & 7) == 0); + + if (lnsz < 16) { + /* For sizes below 16, accept no remainder. */ + if (r != 0) { + return false; + } + } else { + /* + * Recall that ARM SVE allows vector sizes that are not a + * power of 2, but always a multiple of 16. The intent is + * that e.g. size == 80 would be expanded with 2x32 + 1x16. + * In addition, expand_clr needs to handle a multiple of 8. + * Thus we can handle the tail with one more operation per + * diminishing power of 2. + */ + q += ctpop32(r); + } + + return q <= MAX_UNROLL; } static void expand_clr(uint32_t dofs, uint32_t maxsz); @@ -402,22 +425,31 @@ static void gen_dup_i64(unsigned vece, TCGv_i64 out, TCGv_i64 in) static TCGType choose_vector_type(const TCGOpcode *list, unsigned vece, uint32_t size, bool prefer_i64) { - if (TCG_TARGET_HAS_v256 && check_size_impl(size, 32)) { - /* - * Recall that ARM SVE allows vector sizes that are not a - * power of 2, but always a multiple of 16. The intent is - * that e.g. size == 80 would be expanded with 2x32 + 1x16. - * It is hard to imagine a case in which v256 is supported - * but v128 is not, but check anyway. - */ - if (tcg_can_emit_vecop_list(list, TCG_TYPE_V256, vece) - && (size % 32 == 0 - || tcg_can_emit_vecop_list(list, TCG_TYPE_V128, vece))) { - return TCG_TYPE_V256; - } + /* + * Recall that ARM SVE allows vector sizes that are not a + * power of 2, but always a multiple of 16. The intent is + * that e.g. size == 80 would be expanded with 2x32 + 1x16. + * It is hard to imagine a case in which v256 is supported + * but v128 is not, but check anyway. + * In addition, expand_clr needs to handle a multiple of 8. + */ + if (TCG_TARGET_HAS_v256 && + check_size_impl(size, 32) && + tcg_can_emit_vecop_list(list, TCG_TYPE_V256, vece) && + (!(size & 16) || + (TCG_TARGET_HAS_v128 && + tcg_can_emit_vecop_list(list, TCG_TYPE_V128, vece))) && + (!(size & 8) || + (TCG_TARGET_HAS_v64 && + tcg_can_emit_vecop_list(list, TCG_TYPE_V64, vece)))) { + return TCG_TYPE_V256; } - if (TCG_TARGET_HAS_v128 && check_size_impl(size, 16) - && tcg_can_emit_vecop_list(list, TCG_TYPE_V128, vece)) { + if (TCG_TARGET_HAS_v128 && + check_size_impl(size, 16) && + tcg_can_emit_vecop_list(list, TCG_TYPE_V128, vece) && + (!(size & 8) || + (TCG_TARGET_HAS_v64 && + tcg_can_emit_vecop_list(list, TCG_TYPE_V64, vece)))) { return TCG_TYPE_V128; } if (TCG_TARGET_HAS_v64 && !prefer_i64 && check_size_impl(size, 8) @@ -432,6 +464,18 @@ static void do_dup_store(TCGType type, uint32_t dofs, uint32_t oprsz, { uint32_t i = 0; + tcg_debug_assert(oprsz >= 8); + + /* + * This may be expand_clr for the tail of an operation, e.g. + * oprsz == 8 && maxsz == 64. The first 8 bytes of this store + * are misaligned wrt the maximum vector size, so do that first. + */ + if (dofs & 8) { + tcg_gen_stl_vec(t_vec, cpu_env, dofs + i, TCG_TYPE_V64); + i += 8; + } + switch (type) { case TCG_TYPE_V256: /* From patchwork Wed Apr 22 01:16:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185631 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp166541ilf; Tue, 21 Apr 2020 18:26:42 -0700 (PDT) X-Google-Smtp-Source: APiQypLe4W97v2/pxD3ZNbN5Gb8b5gpdfjUZDRBtjYu0iuScO56LSmcmiwUrg/7087GTVabzunp9 X-Received: by 2002:ac8:1406:: with SMTP id k6mr23786095qtj.102.1587518802681; Tue, 21 Apr 2020 18:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518802; cv=none; d=google.com; s=arc-20160816; b=I7wIKZ7eIjemiEveiMsfvVf+ZgNRGRvAMtSHCIyWfgVxne8/jY1820GL0U9C0XjoqP jGVRpJM1PS+HGhc212i1iKLW102ERDHaLuquX7LNn0YUAbRtmjQLzuKkTOFCtLgwRDui IqRfc/ydeT7A7Th4Tx670kahPsEeSgWDiHq/FTKpU/B2HTaAsn2TPnjlTO5tJEC7xuMO 3qsuWTo3zO1wb4HElCqKWuHZbmdG7IS497gWttrB6wxtphEt+t3t/s5GlZPmjGCm/brz c9k4L7fTgM/LZWiseIcpaNrrYblRKrIITKiBCGNdrX9AwFXgFhJD1NqLEwzn8rCC6jn1 Zk7Q== 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=YQvYsNBEjo7yFlIFBRyh3+DHsJ1dC0K7YRDq4gXsYZE=; b=s1YN0fDc/4rMhaLyeFRVG7e1HvKy3R7r3sG3ga+3RCjBGfIBcyWvU+8FJ17/E2qyyw Hul63iM6JoN95OXH3Bkhferu4qAtEdOm2gyHHuA0EyAj3TdWox+v3j2RZtkJpLUF8FEC xslZbFAVE4eT0cqbdOXHF8IEZmem7SX8TGGQdkWeaDgvbVWQOyaQdPu+ZbmEgAkTtrjs vXj2Bbj35e7/euB0SPIk5+fhjbkZw9Z4J1QFC1f+XBcKjBXOz0IsNIGyySkjX8VpuGmh X+wkDs8ZZ84ihJo95PSeDol9c0p4XFPglCpVPmZq0qxBRN16d+73PKCW4tnE2qOVOLoJ PVrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EqoP1q5L; 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 b47si2408231qtk.399.2020.04.21.18.26.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:26:42 -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=EqoP1q5L; 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]:38812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR49x-0000Ix-5g for patch@linaro.org; Tue, 21 Apr 2020 21:26:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34418) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41E-0001MO-At for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41D-0001aK-3r for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:40 -0400 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:39781) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41C-0001Y7-L9 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:38 -0400 Received: by mail-pj1-x1043.google.com with SMTP id e6so154508pjt.4 for ; Tue, 21 Apr 2020 18:17: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=YQvYsNBEjo7yFlIFBRyh3+DHsJ1dC0K7YRDq4gXsYZE=; b=EqoP1q5LGf1S8XKYYIbQJ7jjpu6yTzaYd5eP8r+laZrMnIL3f00ZaUZysvqMLNJEll qN6oa+8RqTObk9WdisMECG5hvOOm9CP73Awy6pCymwdef7Ru3kppafckErXqENSvDGfQ z+tfTj3Tz98aAh70u0wfcBoyl8M19i/HEAYoDZ+SnCI2lenIToBt/vlnr0TslWzqGyAC fDw45jm6pQvIPHL8UF+hyKtAxCU14nvxGNLi4WNHLWFMZkKwqTCU57NtV47oM6VHIpDT CMd+ee4ENQdyfLc5RmCaFHItJ3YJN41Jj7CMo9RXqYZCGSSUjI3VPLfljE38KJCHBr6X CvdA== 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=YQvYsNBEjo7yFlIFBRyh3+DHsJ1dC0K7YRDq4gXsYZE=; b=hlGNsHPPyJR/jAJNMQKekivbv5P6+Gzror5Zagy8veGrbxGnaZfjrCsxdsMbnGJhWy dOnnH5iXI2pCuhOtqfqQ02TFL92qcMusVUhZOq0M6ZUc0jPrqbfJOOB3xVil8GcQ3Rc1 c4qzNK3cRma5kPQbo8eLbbpOMDVz415qasmQnVuQUCHlp5hJSe+5IUMRTmkAButT7Z6Y sZ3hxY8TAE1DovOYyRLem3TAHc3xTn/TEvS43EmvbKP2CyxHpHlzOUePiFqoJmqakNtk Bct84v3Tah5BxmgKeNKD4/xBPrCLiRbYOZ8i3OEOX4A6Ca6io5i7Qj18vLpJN5hwLKyY SmeQ== X-Gm-Message-State: AGi0PuaCY2BU1r6c0IfVLsPRkEbMgoq0BHQZgSIxnMtI0M+Q0jQg8OcS emYQiq+M11No3PtOK+MbQuObaYKDR8o= X-Received: by 2002:a17:902:7489:: with SMTP id h9mr21816262pll.212.1587518256648; Tue, 21 Apr 2020 18:17:36 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 09/36] tcg: Consolidate 3 bits into enum TCGTempKind Date: Tue, 21 Apr 2020 18:16:55 -0700 Message-Id: <20200422011722.13287-10-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::1043; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1043.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::1043 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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. 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: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index c48bd76b0a..3534dce77f 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -480,23 +480,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 dd4b3d7684..eaf81397a3 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); } @@ -1864,17 +1865,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)); @@ -1885,12 +1896,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; } @@ -2486,15 +2502,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); } } @@ -3069,7 +3094,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)); @@ -3106,15 +3132,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); } @@ -3131,7 +3156,7 @@ static inline void temp_dead(TCGContext *s, TCGTemp *ts) static void temp_sync(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs, TCGRegSet preferred_regs, int free_or_dead) { - if (ts->fixed_reg) { + if (ts->kind == TEMP_FIXED) { return; } if (!ts->mem_coherent) { @@ -3289,7 +3314,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 @@ -3314,7 +3340,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); } } @@ -3327,7 +3353,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. @@ -3347,7 +3373,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) { @@ -3387,7 +3413,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; @@ -3426,7 +3452,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; @@ -3448,7 +3474,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); } @@ -3485,7 +3511,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); @@ -3625,7 +3651,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]) { @@ -3716,7 +3742,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]) { @@ -3758,7 +3784,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)); @@ -3890,7 +3916,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 Wed Apr 22 01:16:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185636 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp169800ilf; Tue, 21 Apr 2020 18:31:12 -0700 (PDT) X-Google-Smtp-Source: APiQypIbbkGvvbej6U98LPnSlVBwCgsNHgo38NQLcg5h7eW40tW8gmAFEmKYHk8RK64VxAsFGimo X-Received: by 2002:a37:7906:: with SMTP id u6mr22846301qkc.489.1587519072241; Tue, 21 Apr 2020 18:31:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587519072; cv=none; d=google.com; s=arc-20160816; b=ajv/RVoXqN80h0LSm4M9nFhh3BIsLgxIdEasXzLYUmp64auCDN68TmcHhV/BZJsIDP V+eKQT6mJGAVCkNKEIewCEvk6HuzG0YVR+uANlobK74ybPvkC9zRiFFmwyiyWX9dViQo ZbMmMZp15XnDzsgygH6VL3+uCV6XFuaO9iB1x6O1CGy3SeIEOMn6JUAj3PD3YrIfZMHP RUuIn0YGsATPfP0tfsLkQArBw12YRQFd78/7618dhEtAbwmMv7Ur5PMNUnnY+BNiBmN4 zlFZodp2KXdiGTct30y3z9d5V8He6MGzBwRjsCzlEKmodoFFf1g2vGDxwbtQlnR1kJjb QS7w== 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=/FlEZqC+1flp7+XXS8i2pS5jBZSc3XV7jKgV0ZZ4cZs=; b=chL1oNw3u4EEZGM7YgEF6j3Ih+1LELW2pJt+U7rDbc3pXvZ+FQlehemZ4Y2mONcfxS vIGCGLRYyQY84JcOSslq8tiZP5izicI2Ri4gMwWoSqFfZWBMU4mTMCtaEgW0Dobls+wh JOfV6wAGG5+LhGCaCdx/5724BNfU3RaUAuXtNI0ADx8yE/aJxfA7wrZEdGSo8FBIEkqk S0+OMQ/fnGYvcBAojjx5+ClmtidnOuL6/7A/Qd1/X6mmYb7vd8gZxwJG5p6IqrAfD07b NnPtmhGlKEGOHuSrgKlgUX766Z8/7iyHc0e7Pwq8CLgT+VbrZC+HeXnnZba6jAWlEEiK zzew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NkW9SUgF; 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 u2si2308899qvy.210.2020.04.21.18.31.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:31: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=NkW9SUgF; 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]:38900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4EJ-0006i1-NQ for patch@linaro.org; Tue, 21 Apr 2020 21:31:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34468) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41F-0001Nw-0u for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41D-0001bw-Q3 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:40 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:35951) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41D-0001Zg-BL for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:39 -0400 Received: by mail-pg1-x541.google.com with SMTP id o185so262056pgo.3 for ; Tue, 21 Apr 2020 18:17: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=/FlEZqC+1flp7+XXS8i2pS5jBZSc3XV7jKgV0ZZ4cZs=; b=NkW9SUgFkVNkc8WAJS+HoA8OOVqnxrtr+8E/7I/ZMhwmFrYlGU0a+tganRSBIn5v7L D8Mbz/QNpM6x/ZO7GSEk1C12znlvUeHtyZjxMFVxz5dAxF0DnVWm5PUvllhzSaz2HLVU rX+MqauMLpumwW03VnpFCSUzW5nE4BitNZJAWG6rrgrjgqKbTuvMDUbFpKpeZaPw37Fv aJF880M64GdY48bBuEF2PHSUYOdlVQ+oP7DyOY3JIhq375PybEuqCYSQeBasRC/FM2pQ vUoab9yXKGGm7j7phfhFjMjeY84hqCSd9d+P8LtnxJS5aS5Khl4T3Z9ckd3m1Ewrsnqd aCaw== 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=/FlEZqC+1flp7+XXS8i2pS5jBZSc3XV7jKgV0ZZ4cZs=; b=Lj2zzoRtfRNrLF36hbie7n89bPVWejo2N1AgHQjAbSw+1GIGEUd1L2crq4D6vW+1T5 RJj+ncvus5BK0F8bv2Q4tVNxggmFao6BoDpjAF5bKISNXc66NFQC7ypifAxhxUy4Aj/m rnnZjW+DR3Az5z8Ud9nYn6oI89SGWOUGM1fPe1Q4GoSjtxK4yv6I+04U5wE1zuL8OipD 4K8gjpKjbit7+7HcchyAGoUHeinkfJNoSGqpu1gX4n8nRcqCEgQ+8GxoHLo1BDHd9EAC T+HD+k5UrS/aD4vf9arxsNnSfBfrJWSqcXdCOaGQlbREoSXfUheJFhvJaxNQpX4LWPf8 U0Bg== X-Gm-Message-State: AGi0PuZbvKCsZuHvdSENF1mYU27B/xJAx7vYCP0YtpaMuET4ireLCr5J S4MOtWA2B+KfcVbwZmNIOkSIJexvyTI= X-Received: by 2002:a63:1a16:: with SMTP id a22mr24742623pga.264.1587518257665; Tue, 21 Apr 2020 18:17: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 m4sm3673561pfm.26.2020.04.21.18.17.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 10/36] tcg: Add temp_readonly Date: Tue, 21 Apr 2020 18:16:56 -0700 Message-Id: <20200422011722.13287-11-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, =?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: 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 Reviewed-by: Alex Bennée diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 3534dce77f..27e1b509a6 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -678,6 +678,11 @@ struct TCGContext { target_ulong gen_insn_data[TCG_MAX_INSNS][TARGET_INSN_START_WORDS]; }; +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 eaf81397a3..92b3767097 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3132,7 +3132,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) { @@ -3156,7 +3156,7 @@ static inline void temp_dead(TCGContext *s, TCGTemp *ts) static void temp_sync(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs, TCGRegSet preferred_regs, int free_or_dead) { - if (ts->kind == TEMP_FIXED) { + if (temp_readonly(ts)) { return; } if (!ts->mem_coherent) { @@ -3314,8 +3314,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 @@ -3373,7 +3372,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) { @@ -3413,7 +3412,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; @@ -3474,7 +3473,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); } @@ -3511,7 +3510,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); @@ -3742,7 +3741,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]) { @@ -3784,7 +3783,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)); @@ -3916,7 +3915,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 Wed Apr 22 01:16:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185623 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp163201ilf; Tue, 21 Apr 2020 18:21:59 -0700 (PDT) X-Google-Smtp-Source: APiQypKoKpBSwu5hXrtSAdL7OQKEV/HBRz6s6Z7yOpVKMaNvZXjj8E2WfmqNYq6P5TWVawBnWGrh X-Received: by 2002:a37:7043:: with SMTP id l64mr22049174qkc.78.1587518519124; Tue, 21 Apr 2020 18:21:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518519; cv=none; d=google.com; s=arc-20160816; b=b1VBGiDpPp/lXSqJ5kkxg3p/QiuNKE22HdqNKH2Kpg7ft4GIspfo0adrqO3E7xLJNl bqFOBx00gyNEIz0rtaw5cMcyr4D3ncGzA8fVeZFKBPAUS4gf0Bbz50U6q12D4vU85nw9 c0RzfuFELWGlN0QOmZ8yMmx7WW0FJH209LAwUt990DZI6UbM+oxpyHPRO6w9L6Aa+UHu 9az8y/oMQCon4qyje5MsWGVze1vo34aKb2O0stj6FaGoxOridD3NLS5EKJgqU1Jiuvuj i69rYBXRsvM+PEley5325e13wM+PbHwG3uiJ0QWls43knrdDEgCo+zM+ZHglhKSlf/qG yQwg== 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=3qRzDIJe35AYacmzNyFLQ1yNiwezF16i9LevP5JOC1c=; b=SwTL+9yENFFhAzuzvW21UTxXfIPuRHngZL26LYMpoi7dS5XtMHH7BoFHHSAdSvQPqU BRjhbr2mwDYZwNlZMMaSwgC25AM3V6vAS5u1dtCYeSik7QUA9ZIDwScCxb0Xn9Z3G0uq 4wEahEFGxxAxpH2+gQSQkyK+IqLVejsST6TrUC9h/m3KMGcOEizPbPLKLcjvt16gOFK/ CytRaKD515JPhMGO7+K9zC3dBD/dKzEYAib1Lf4RN/6jyLzaptQvUFDmE69M00SrWqeH LDyuF9pPZxMT8Ftgse5V0qVJ7cXlm68pYD8kqmXBUbvIrPohLAc4z8FULx6rfEtJwhnJ 3dTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DTxIwE6d; 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 u6si2337961qkj.116.2020.04.21.18.21.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:21: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=DTxIwE6d; 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]:38678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR45O-0000Ix-JT for patch@linaro.org; Tue, 21 Apr 2020 21:21:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34684) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41H-0001SE-QS for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41G-0001j1-I5 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:43 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:44989) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41F-0001cy-2A for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:42 -0400 Received: by mail-pg1-x542.google.com with SMTP id q18so241763pgm.11 for ; Tue, 21 Apr 2020 18:17: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=3qRzDIJe35AYacmzNyFLQ1yNiwezF16i9LevP5JOC1c=; b=DTxIwE6doGwQD8ksteMLLaJ7ptQJp7zywH3BziSMYJg77LVHftsiHtqxVT6SctEtyr DN1AmlUYZ3beq9+0ICM9I3BLrgT7CUq4YuUX8I8eLIQMS9iyt+3ngro1RG5D7CBkuKal h+JxCMK/lM381ALLMV5L56yO1hssBsAnhQEXizPTTixSx0UXaYFnng3IVMuhzfENWeYL XgDHjW/XUeFxYHcJ0cCSRbhemG2AYYAL8HOlqXfW7rpvaQOJyPVu8S4zi2/vKqj784RJ ldH3h2GdFSZuJ96YXzKnxiovqDIZGXJBDJPz74IGehA8ELbJF/EwNoBthXndifpblm5/ cR6Q== 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=3qRzDIJe35AYacmzNyFLQ1yNiwezF16i9LevP5JOC1c=; b=MIZylJjCYijhilWTV76T+lD/wpexmI9efz6x8iY4FdpMLww+wz1QAZ1GynGZRC1L2S 3Qh4KiO2u02WGoL3QErK8zq+mMjiE4DUGOvi7Z+qo+s7Wyj68obiBlaL3sAw5ZArEyIl rHTG7db6gh0WNvvqAAIXo74s1DXeX5tuW1t2cBZHI6lTbe8Gu/yUZjdrEq2HsEq1nosX IePS2TWev8dobRO23QziRFNA/VIe7tyfhJfnT8wGr/ddto5uxV9fMHs542JEs7BkXiuM zSCegRaG5TGQoNq612FGuGDEAgPBGZbuK7jc/5sn/+QPyZ3INtHS2FUbScGJNZQHBRoa Ik1w== X-Gm-Message-State: AGi0PuZNQYBRNcNx1ydPBm7W2sF5TlzMSE37U6KcpenMHGfDuYKJJjK1 RK+aQ0ecx78LmWY1v6UXzOwUZgV5I3A= X-Received: by 2002:a63:6d87:: with SMTP id i129mr24204115pgc.54.1587518258812; Tue, 21 Apr 2020 18:17: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 m4sm3673561pfm.26.2020.04.21.18.17.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 11/36] tcg: Introduce TYPE_CONST temporaries Date: Tue, 21 Apr 2020 18:16:57 -0700 Message-Id: <20200422011722.13287-12-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::542; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x542.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::542 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 | 40 ++++++++++------- tcg/tcg-op-vec.c | 17 +++++++ tcg/tcg.c | 111 +++++++++++++++++++++++++++++++++++++++++----- 4 files changed, 166 insertions(+), 29 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 27e1b509a6..f72530dfda 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -489,6 +489,8 @@ typedef enum TCGTempKind { TEMP_GLOBAL, /* Temp is in a fixed register. */ TEMP_FIXED, + /* Temp is a fixed constant. */ + TEMP_CONST, } TCGTempKind; typedef struct TCGTemp { @@ -664,6 +666,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 */ @@ -680,7 +683,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; @@ -1038,6 +1041,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); @@ -1047,6 +1051,27 @@ TCGv_vec tcg_const_ones_vec(TCGType); TCGv_vec tcg_const_zeros_vec_matching(TCGv_vec); TCGv_vec tcg_const_ones_vec_matching(TCGv_vec); +/* + * 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..effb47eefd 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -99,8 +99,17 @@ static void init_ts_info(struct tcg_temp_info *infos, ts->state_ptr = 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); } } @@ -113,31 +122,28 @@ static void init_arg_info(struct tcg_temp_info *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) diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index b6937e8d64..f3927089a7 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -209,6 +209,23 @@ static void vec_gen_op3(TCGOpcode opc, unsigned vece, vec_gen_3(opc, type, vece, temp_arg(rt), temp_arg(at), temp_arg(bt)); } +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 92b3767097..59beb2bf29 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; @@ -1871,6 +1909,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; @@ -1907,6 +1948,26 @@ static char *tcg_get_arg_str_ptr(TCGContext *s, char *buf, int buf_size, case TEMP_NORMAL: snprintf(buf, buf_size, "tmp%d", idx - s->nb_globals); break; + case TEMP_CONST: + switch (ts->type) { + case TCG_TYPE_I32: + snprintf(buf, buf_size, "$0x%x", (int32_t)ts->val); + break; +#if TCG_TARGET_REG_BITS > 32 + case TCG_TYPE_I64: + snprintf(buf, buf_size, "$0x%" TCG_PRIlx, ts->val); + break; +#endif + case TCG_TYPE_V64: + case TCG_TYPE_V128: + case TCG_TYPE_V256: + snprintf(buf, buf_size, "v%d$0x%" TCG_PRIlx, + 64 << (ts->type - TCG_TYPE_V64), ts->val); + break; + default: + g_assert_not_reached(); + } + break; } return buf; } @@ -2513,6 +2574,7 @@ static void la_bb_end(TCGContext *s, int ng, int nt) state = TS_DEAD | TS_MEM; break; case TEMP_NORMAL: + case TEMP_CONST: state = TS_DEAD; break; default: @@ -3132,15 +3194,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. */ @@ -3156,10 +3231,7 @@ static inline void temp_dead(TCGContext *s, TCGTemp *ts) static void temp_sync(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs, TCGRegSet preferred_regs, int free_or_dead) { - if (temp_readonly(ts)) { - return; - } - if (!ts->mem_coherent) { + if (!temp_readonly(ts) && !ts->mem_coherent) { if (!ts->mem_allocated) { temp_allocate_frame(s, ts); } @@ -3352,12 +3424,22 @@ static void tcg_reg_alloc_bb_end(TCGContext *s, 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(); } } @@ -4148,6 +4230,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 Wed Apr 22 01:16: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: 185625 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp164605ilf; Tue, 21 Apr 2020 18:23:57 -0700 (PDT) X-Google-Smtp-Source: APiQypL9pRE64e1hPhAQIjmCTC/NeRY7xhXoWDHwAA3DPLmv+i269k3o4Qb3hbim+SaIz6ii6Yux X-Received: by 2002:a05:6214:17d0:: with SMTP id cu16mr3906678qvb.177.1587518636967; Tue, 21 Apr 2020 18:23:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518636; cv=none; d=google.com; s=arc-20160816; b=mql2v0I1zUMfuMtupRN1fTKFqBzET8XSwebFh/o03RSWwUl1AlytqyDt6Ut8hXTE+R qjBg9YdeR6owQ+sJLl+FVTW7IntzDQXHDJYbsVqCCDaLdEMSkbNTJYVdTP5JIMwhJWNF iTJ9N9dB7WXyUwrJT6Lb3bmI6mO1XSbXPMaZusNyBVH52Rt/2+aq97AdTKMkHZYaR2xV d6NWHgE8Flb1xK69SvDRVJwI92W1kxJtN/u3d7uiTB3cwHBz3P0+FXMyI5wPCgMgDwG1 b8xz2PXC8BG7+HmkqDofn3MHbDDXmNBcyXkEOe1hKTl5uRUfcy2WlIxHFlToez7BnJJA ktBw== 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=/fduq7+z5S6wjChMKi9oJb/vmTzyRgenbcyuQtF0AWE=; b=AFy2Z32oSogSvRKM/XPDRl76Oez0o29Yyin11S890FLCDYpBjJIplAVZxpGP+cLIGb CHekO4BdavyU0i9e8l6/6gtFnQzFEmo7yyObv0bJToN43JFKaex2e1qxV8codeRR9lEt szhoPLfcEW9CW9GRaYO19b607DBjW1n1HRpVOrXblaMVDPKElT/awR7iZiPl0LbFyq6w PFIdsj7BdJAzT5zysCI3ajLaxXVdd42Km4ET0qB2lTaTjtxnGPj3+6OxIdkuS03NNMUR ckGfcgFmNnXXQ+wtsKDtSWGBArh7jFSC9Ikus4x06Ixe1xLtnEdETieWhmK+9X/EBlzC yuqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eepeh7l3; 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 b2si1091759qvq.200.2020.04.21.18.23.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:23:56 -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=eepeh7l3; 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]:38730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR47I-00043U-Gj for patch@linaro.org; Tue, 21 Apr 2020 21:23:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34596) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41G-0001Pi-NG for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41G-0001hR-4x for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:42 -0400 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:36749) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41F-0001eN-Mx for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:41 -0400 Received: by mail-pj1-x1041.google.com with SMTP id np7so161265pjb.1 for ; Tue, 21 Apr 2020 18:17: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=/fduq7+z5S6wjChMKi9oJb/vmTzyRgenbcyuQtF0AWE=; b=eepeh7l3HyUvBzT1ZPXSW34WY1k+DFmtIsHfZZ7I5nvoOr7OnMFU3YjdPr6GYXYqoy c9tIrsdw8a3tkDgb3kTnwa0ITB14lWUGW1hssACq+ig5JGeUCFNPnLoA2zEpIrwbptk2 aPBQVmM7DozoBlRIAELDKzMp1O3i0Gj9XldEqa3+bFPTIQXd7RXDfvrMr8SSpKm767Pr z4afFFHInEQfP6ufaw9Tr6s9yk+6+gMgaxnnXmEehlsIHty5OUbbNsb/BDdC8sjRr8Ud G7Udl6z/ZNBCswye0rIy9KHJr10NyFCtpEwmZnhJ6qeA2KPfXBtx55JM6Pbebmr1KBTu qElw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/fduq7+z5S6wjChMKi9oJb/vmTzyRgenbcyuQtF0AWE=; b=eee5yeexsVuOlcSYDo0kfMdpuHQoJAvK2mPROtay138bN1qSN5KJR8EeRZ5jz9WrOX Ip2c3zFuRtwu72vwGPhYkxzIRwRWgCW7L0OR5Nb4d2cGHLRPRXUimJNj1e6CDmfyBhL6 yqvEvImil2RnUsDfVbX50OigLb8m8UYXaCaCVxAFO7/a2mfQYhcSsBL9MgPY2jdhjEvL VPbDBe7z/cTgCH5vpxhtR62X2VY9zDCgx/f8T/itfSP4ctaknQW6NF3UPkkxDkkML4m5 7ko3JOXnAN5iz6/esBH/lIu+liviqYijZLc/tdsXl0cMVqHJzijEdxC1U8TmwxfVL72N tvAw== X-Gm-Message-State: AGi0PubOTriFOAE19ZpAdoR2DH74T/SF2f33il+7ozmzMnh1qINBKn0V kKj3glvKrydk18THYbm8ZjW13iZ+z3U= X-Received: by 2002:a17:902:aa43:: with SMTP id c3mr12411135plr.7.1587518259985; Tue, 21 Apr 2020 18:17:39 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.17.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 12/36] tcg: Use tcg_constant_i32 with icount expander Date: Tue, 21 Apr 2020 18:16:58 -0700 Message-Id: <20200422011722.13287-13-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::1041; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1041.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::1041 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. Signed-off-by: Richard Henderson --- include/exec/gen-icount.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée 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 Wed Apr 22 01:16: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: 185630 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp166268ilf; Tue, 21 Apr 2020 18:26:19 -0700 (PDT) X-Google-Smtp-Source: APiQypKYKXQnfGBHA/vAMTS1vGfVtj3rOhtHeZsU2ly13ezx3VOc7VklFhO7fwj/41feuLeGvN2o X-Received: by 2002:a37:4d5:: with SMTP id 204mr24533291qke.176.1587518779431; Tue, 21 Apr 2020 18:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518779; cv=none; d=google.com; s=arc-20160816; b=CWUukDitlsCdVkRgCfwOUTUO6SeMp0TYYEoHnFi/diAiRNhcNUVdDapG7TssR2IkH9 +crbnKYnWpiBHSCk8td2WRPVKXilE4Jp5cp1d5FNUbztIo10JyVKz4VcOrPThyjZwKxs 2lziE9rLYjVd5lSObYvCNWFlONZRibuA5DRGlWVueo1aJTMnzuGkg9lMJreuJ16qYQxI Cxzgoq6+ma/5/mxeHeIgbXAOi3PYVBLPYkWcR8vzEW2qBGZwh4zapa2zjzxwg5rUKcJs /VUfzFTYxzWK6D+uLBqUKlHOslBZPdMCgJZpeGq5Gg69pHFtXqd7LDw2pb9iM6T/9rT/ +2/Q== 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=3L4RfFRSjz+k9D2woCHu0bThFj4aBhRBA4gE0EtRBC4=; b=l7G79+6kSm8DQWYvoGEsrHRPnCDlIWbrADIDPpOosbNaTtJhcER7nxrddetJBgm2pl dzsRTg0eCYPlGAMHJpBbHOplVFO3OIl83SgebSV5Tg4iOayl1U1OFFYdFstrGmgdawEx IMhHS4cNWtozSQHwDG6IK2Q2uD9BTT9pkJkP1RrRrxBagLICKPl+dKESD/fT6LcBSZNh SxdpeWa56TACXtJL89va6fxqbXz6/HUDirMWg/a8WUhlVtYjPaByVjgEjdhS1O89HDw/ ho24o060pUdUV4aS7fcPXVVJq4+f72HZMtU+swrTx++K8IhyDlcqrQUtr1lleQTxgvMF U+/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=i6JTVFGp; 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 bz7si2404827qvb.69.2020.04.21.18.26.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:26:19 -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=i6JTVFGp; 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]:38794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR49a-0007kY-RF for patch@linaro.org; Tue, 21 Apr 2020 21:26:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34796) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41J-0001W4-Dx for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41I-0001mt-00 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:45 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:40562) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41H-0001jQ-G7 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:43 -0400 Received: by mail-pf1-x431.google.com with SMTP id x3so217883pfp.7 for ; Tue, 21 Apr 2020 18:17:43 -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=3L4RfFRSjz+k9D2woCHu0bThFj4aBhRBA4gE0EtRBC4=; b=i6JTVFGpLlIW+pHdq1icjkn7UgAbRre6yQdGIYQEvMlhoDqe6XieT0Q1TUqEU75lrv TRrLLo1XpTqaD+scoIXbngg1pda+TlzpZXcFZmmczXVJsuLPaIsROQIPNtWQSRM32YJ+ g00GkGqvoamB8E+0XYbYHLGFpWXzJYOk8bhkYPyJZJ+w/AY5tC6KZS0vJQNFDPdJujWz 7dX2ufNkwvt1H3kFQAbdQLdDgSWsLaroGI1Y9ZA6fhfrBvYlWCFL6ch4ya4eZpAE33r7 uc3IXrf5/tuf5l2pXBeOy6jKj/cX1GIfECFOzrldPflwMMZFud/HIqTR/amcsj07VOjV +fUQ== 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=3L4RfFRSjz+k9D2woCHu0bThFj4aBhRBA4gE0EtRBC4=; b=R43hORvBRmHsm8pPkkH1+sYWHW7KdL3Ra/ycj6LAMLa0xpsiDm5zc4FQKO2lQFeUkU esorwcGzp9MuGzJbDoMtHvzz3Kzc3XFYrW17iNOCuZaQ1kCq1NYK+LECyS5+r2jcQJuy qjYsS1ic4c4irMGWpiUumLvvu/+r6KrStzdC2a2Tp3269HxCtuIQhaXWDi+Mi8I9toeq 0roj+NZBLgI1VfFlNNyQeqOWdsK5lYDf2U+gvdjZTOdPbTyYGM80bM8uiks4vyiKdr4B PQlquq4Hg+US2wFAZ8Rn96H50pyPtEIUIificYjWHEt0znZSCz5nLsvUiMSPcPnE4CoS IxTg== X-Gm-Message-State: AGi0PuZX5mu1cajd3ZkifJPPdJFz/GSIW9DkG3fAbRClgtiwWkLDUE80 ZeTFecz00O1wUXVU9MsF0jjXyS3qSMg= X-Received: by 2002:aa7:9709:: with SMTP id a9mr13506054pfg.166.1587518261225; Tue, 21 Apr 2020 18:17: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 m4sm3673561pfm.26.2020.04.21.18.17.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 13/36] tcg: Use tcg_constant_{i32, i64} with tcg int expanders Date: Tue, 21 Apr 2020 18:16:59 -0700 Message-Id: <20200422011722.13287-14-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::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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::431 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 --- include/tcg/tcg-op.h | 13 +-- tcg/tcg-op.c | 216 ++++++++++++++++++++----------------------- 2 files changed, 100 insertions(+), 129 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 230db6e022..11ed9192f7 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -271,6 +271,7 @@ void tcg_gen_mb(TCGBar); /* 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 e2e25ebf7d..07eb661a07 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, unsigned 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, unsigned 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 Wed Apr 22 01:17:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185626 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp164682ilf; Tue, 21 Apr 2020 18:24:05 -0700 (PDT) X-Google-Smtp-Source: APiQypLhtF/lzUlLPNNol/OfTLkzrND+cnEfqGtnCPdRebSizck+gKBqBFJCzgTqIOra1LIO4sG7 X-Received: by 2002:a37:6e46:: with SMTP id j67mr23155995qkc.155.1587518645421; Tue, 21 Apr 2020 18:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518645; cv=none; d=google.com; s=arc-20160816; b=EpX845Lrl4zUMZQLm8QB0UDmN0U3eYw72Q1p5C5rdhr7YNklTJ4MEq8IqkqIhaNUMC kPvIowPAsZeYIFJrxZB2TfAcE7KZS1ClrlmiPGeL7muVGVjCy8YNVLul/5csXRjbxKsH P+Ternc3dn0vRm3mZURyHaJjgvZ6nUIMSyQAx+NfAyZQcJiqwGo0x6qZcxWsszWKJv+x WdOvMpNuexnAr/I45r5W4/5mEQGvQkSnAnQxaI5+EPVS+7JASinqBpAduhh2W4a9acrR mh+djXelUyAzTRPS+wg9+U09LjoIB8zZ0ymyQ+H1OPeaNPtN40UPGOIalasRJ59m822e pG9A== 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=jnoGz1Jnxdfh+y+NorE/kRAs3qyr4Q4Rbpyv23cxSxY=; b=xhEL7RRGHZ7p+JcCSIwQwHkzRjRySubec5OJbAEU55TChoVm6mNdiRVu6Fd1KyjhiZ RbSLBUjuW7w9Qh9gOaBbYuaqu3xfgLA3AcvK9T2TbMIT/AyKO4g7Ugr+fs1NVjM6kyKF oDHOTfwQXZiZhnGDVhtU86nczNuyCowWYh02vD88pkwmS6kcJ5PeMzebmoY6LupZVqCj CD2n9M0HI0qTUYJgqqLYugjEULHxpnGA220XmGWEqDRrOv8iM4CDe+SmHZkII0FvbxUP HfWJPKzW/4NhXAFZl4FRBV04CZ3IndfYW/XKwXv/VLT2mceAXoeeaP3KHgqQSGybrik2 3k9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xzlDTfQH; 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 y12si2284718qky.159.2020.04.21.18.24.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:24:05 -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=xzlDTfQH; 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]:38734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR47Q-0004HI-UC for patch@linaro.org; Tue, 21 Apr 2020 21:24:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34912) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41K-0001ZV-Vi for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41I-0001ng-JL for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:46 -0400 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]:35014) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41I-0001lj-5p for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:44 -0400 Received: by mail-pj1-x1042.google.com with SMTP id ms17so163357pjb.0 for ; Tue, 21 Apr 2020 18:17:43 -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=jnoGz1Jnxdfh+y+NorE/kRAs3qyr4Q4Rbpyv23cxSxY=; b=xzlDTfQHDWl9Yl7ipMplJS61jujecIZge+sbAyrqCY41SxvC17wz6gQpEyk3ZERa6A n361T43vn6yQVjP1aRlea0iHn6h8wcScNj1xE+4c+u+wFZMP1b2AWvSZkCUfrwakcO4i YtR2zOUWt5j8Bd4oXVNGBEH+uXRbTbHds6Qq34daqnGcCxN1fuo6bLTgFJXBbOVe6j6p KcK9g+OzUi6pS9PNZe/GF/zDB/0YEljmtb9fKMDkf5KR4RYsVI2cCKJIbm0gM1V8G5XT R/ZEuILsuZmc7FA6FK8J/SAW5J8e3/o4xsEpzqF8cs96XWWZERgr3ZrKmofvxmiezRTH Gm3g== 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=jnoGz1Jnxdfh+y+NorE/kRAs3qyr4Q4Rbpyv23cxSxY=; b=YXC+D9SYlQPcYGI/L/74+SjJSjcvloQ0voZQA7MhIvtq0H416BUg3sUBbZGKdcyxw5 ZLunb3z+HacLPEQZuDEEeHIS0Gi2q8KxGZasZ2FKvxKQd3ggCsFsNolz9MkuUvi/u2H4 CzUJm1p20jXCfmp/S6oCQy8Iz6Hi3Nq85uuikocE1U9LSxz66eCf66eiale2mrrUe/mc I6PJWgntO3nIzQTrkEXjstDlmud4XWfrXjR8LujirZfIKtguNpzRrBjo+GWmIc2DhhCk RUTETKT+LSVBc4KcT01Kfd89Y/rLrovr8CR1Z+smakHyQRjdYG/jKc2MLWwoOgEhqxri A+Kg== X-Gm-Message-State: AGi0PuZ+RscMzztc/CqOo/VkphXfeB6SsV6JJP6TEMAIfJEJ5R/P59qx 1K6Iz9vgJsThex90SDh7Ciwyucd0u8I= X-Received: by 2002:a17:902:8e8b:: with SMTP id bg11mr22995354plb.139.1587518262405; Tue, 21 Apr 2020 18:17: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 m4sm3673561pfm.26.2020.04.21.18.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 14/36] tcg: Use tcg_constant_{i32, vec} with tcg vec expanders Date: Tue, 21 Apr 2020 18:17:00 -0700 Message-Id: <20200422011722.13287-15-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::1042; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1042.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::1042 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-vec.c | 63 ++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 29 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index f3927089a7..655b3ae32d 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -233,25 +233,17 @@ void tcg_gen_mov_vec(TCGv_vec r, TCGv_vec a) } } -#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 Wed Apr 22 01:17: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: 185629 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp166254ilf; Tue, 21 Apr 2020 18:26:18 -0700 (PDT) X-Google-Smtp-Source: APiQypLlhOYEd67JOSME+SzrPrPnoIHg8miP1XkbYYzXNiRAWHEmuJ16ST59OQe7iKrlwgzdioHQ X-Received: by 2002:a0c:f9c2:: with SMTP id j2mr12244938qvo.90.1587518778150; Tue, 21 Apr 2020 18:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518778; cv=none; d=google.com; s=arc-20160816; b=x1VpLGRE30ptBm4XHgHTBf8VFWJZwILNw8e9wmX/4ir4LTKvdAtxCYMq75m3Esi/wC g2TpPmozP1lSszXejO7MSJOhnrl1tYGX2VFPEAcEZElP++5Qx8cnV4DVONxsY/44JSYN /B48HOnZP6LNFQ4VofA1zD171/pQ4NGH0J8hHxuFd4oh+CVXv2A0Nt1ad7u573KnxmDP 5z8AnVCTFNKD3e90QKoEwqrBqD7AW/rhhgXZlm3v2+S+LiM9RXaW3kz4hlmqkV30/QNS L2a+YVO0gPhZa2kmO1M5DGCOoHjsTGK2U7W10DGtMFgYU+UzySGdyQS4qCpFWtm450G7 IaRA== 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=UBTvpXnQhX/NB3BncFrtFDo86VAuYzf/XHrJqnCZIJI=; b=0Zoh8dz85WRy8E9HFevqktYrkrxu2iiL8O5Z88xV3bGZj9igvXyK3RsAOoLgI0xov3 HL+jgH+7SWMO3EwWmXwycbAWvLFc8FPj04En1aZfgYvYNgFRDsp94VMYNWjgpqcgYGmZ WivTPNuRZhfCz/9ipMO+EHfqvjV628/EPLELnPsWgw70Q5YbqU4q2F0Qn1jyWPSmGHy2 veAE+ybLQ12bw1AEn/nwmV70OtaeYv/6/j2cVGYuhPZgotCQEuH9PUN3lIvqszY06OJQ CW5A9fVIrPFaMMX4G42Ikq4gZTE6luRQye5rSt6sjpYOYN2DM5OlDQPGaJvBvI2iO2il o0lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FhGuXJye; 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 r3si2407033qkd.153.2020.04.21.18.26.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:26:18 -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=FhGuXJye; 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]:38790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR49Z-0007j8-LA for patch@linaro.org; Tue, 21 Apr 2020 21:26:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35000) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41M-0001bv-4U for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41K-0001r2-9l for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:47 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:43158) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41J-0001oB-Qm for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:45 -0400 Received: by mail-pl1-x642.google.com with SMTP id z6so234432plk.10 for ; Tue, 21 Apr 2020 18:17: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=UBTvpXnQhX/NB3BncFrtFDo86VAuYzf/XHrJqnCZIJI=; b=FhGuXJye0m/BZIY4rGguPzeFQd9KrcWszqS5AkTA5QHbiddacWhI472vPqiFhMYTRt jgsjXSZODUDEheEs1TnJcEQbMM/bs+ZPaJPjYMxO3ry32p5XzgoslFX3MPU/aVuDx/if IQSab1PEV/PKocitl+GFh1JxWaeJC9KHQ44bBooDKGPvK6mG+qZH3UM6zGTek1mcV74x r/dt2RvNAB1m2fce913ZIG7Uzz7IWa6vV+C+3PTSB7cz7nkK8MDZYUPBZXflZtWNwnmo McpJREqx2XlK3CBuOvVpYvqKuJi+R/YK+apmSBaGkLj5ITCY92HgJzHE5QlO3ct6HT/I vgDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UBTvpXnQhX/NB3BncFrtFDo86VAuYzf/XHrJqnCZIJI=; b=Legbtxq0itrceqWaO64uu+PVgQMaAVDzZfB2wBU94YbBtYHiDE4OyeaQJpEDMETUAZ fTb1+x2lz7U2T4u4tAsaP0nrmjQ9G4j5vpDmkex1PC5NYsLjJicKF8DuxiYDAmA6IHvD Aucjy1LjlWOXYb6XR8NlV//F0xzWLCAGSlzuLP8Re4z2qPrVfOVCBmaAt8VJwYqmcioF 3S+CedT5r6S2gL/giAFmPFl0M4gMzzZspb98BwcmnxwM0YLmYRQRB2IQRmnyA0xMGGEN pyfFgrGuXbQ6vHUCUuurtw7FSP6h9zALO3nQaO4lnpFEiyGqoK/g9rhOA6DBbWzmCBi3 wajw== X-Gm-Message-State: AGi0PuZ3sMnEMs7VKuPtOyYXYrjbE+QFPTjF0MZa43Yjg95lg0tqt4M5 dtFVRY4ROMPoM+xJjG6L85FnX58dGmc= X-Received: by 2002:a17:902:ed13:: with SMTP id b19mr24802958pld.254.1587518263528; Tue, 21 Apr 2020 18:17: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 m4sm3673561pfm.26.2020.04.21.18.17.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 15/36] tcg: Use tcg_constant_{i32,i64} with tcg plugins Date: Tue, 21 Apr 2020 18:17:01 -0700 Message-Id: <20200422011722.13287-16-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::642; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x642.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::642 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 49 +++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 27 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée 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 Wed Apr 22 01:17: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: 185633 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp167840ilf; Tue, 21 Apr 2020 18:28:37 -0700 (PDT) X-Google-Smtp-Source: APiQypLlsyrYN3EwcjwIMQpfPL5B25OnWWkfKbwO8oe2gu3MJECzAvlSTgHGEqvJ987k4Xm8eJ8b X-Received: by 2002:a05:620a:5f1:: with SMTP id z17mr23289880qkg.21.1587518916683; 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=izSK40cvW2ULzvIyVoAOphrykvPXWXuRLRMIOxyVlYVWqMALiFUqNoY6GrnMK8dP1A 6hga6JkXxTSr0Vtzh7pKcHB9vL9+wPkzUGm7OMh2XEPIajp6Xm/uqs6XPUg1XqWGNgAA ZY4yfGUNM7/BtfVnvUllekvpO/RZ89zA2266E/eMkOPgNT8Y2kEwOCOHR+xM2M5whVfJ +d1AmaOq3QKUXElAbfunidHLWy23K8sQr+rZGik1ZRn5f7HhvPMJzrNF8GBRmOYqB4Cr oliC3w4e0nBNbfGu9mPe3C94jgBVkYRflmwSZKzIKDl1QUdnjhkgQQ23TdsQlka4BChD hxiQ== 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=WTwykg5WtqouwfqyNJXpZG28wcFWcjxQG9OeloSSTFs=; b=YVb2gwttxWxv7x+UEq10MCu94c/VfTP/XwsjQU0+acbsU3+DV7/ob4z/JsbReyC2Fy ajC9GbzZdYH+pMNsQ2uYf/HR5oHVQyP6pzBOHFPexLJ0Bf0hb2chrnC6JNzFzXZdIFBx YAIdiQ97nh31vyorptDU7544i5NSULgxD5lcVAmwFBAPpvmPmIABWu1FYvBDnmX/MuHh Y8GHeu4nNo6yJOyyGZU71Bu4uIi3USF8iNUfYZzZAQ0RviNLeoNpFW6/S8PAA5FSSmoJ V5SyWUbAFPQOyjd/i+F19q0az6PU/fyq1Hk/hEjzVBV75+c+AiFRfB23wFrxHUb/PIkF peRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="w/0R3Cz5"; 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 r26si2617808qvd.25.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="w/0R3Cz5"; 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]:38852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4Bo-00038d-7J for patch@linaro.org; Tue, 21 Apr 2020 21:28:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34958) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41L-0001b1-MU for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41K-0001sx-UF for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:47 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:36660) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41K-0001ps-Fh for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:46 -0400 Received: by mail-pl1-x643.google.com with SMTP id g2so249658plo.3 for ; Tue, 21 Apr 2020 18:17:46 -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=WTwykg5WtqouwfqyNJXpZG28wcFWcjxQG9OeloSSTFs=; b=w/0R3Cz50bvCfxaiyVV5fskbbRUvai/v6eQwT7FKiwjOFLlTxOsNfpOPUb4MRqIeKh u9QykJN5EIJkJOGChshtS/45/uM0FM9OWebfMDq1JGhUDVTtewmsicAwjHAn657uTz0G aZ8j1U3Y7LZDpI2jmivYb8FuaME2/4muxK2keWOcM5X8AceiK0EbCVTrFl/XbEGLxi24 uHosF/cHr8OzEWXGDOGsr/3K4dg6K4LJz4EKQO1cuswRGmDzOTX4Z2pik70dM0ycoUsI VjWE0xOwZxXMvboBaLKT/b5ED2gFytFjKx5iJCpXklXXeZaK3fBeup+LSWLDW2Ncv1NB emlA== 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=WTwykg5WtqouwfqyNJXpZG28wcFWcjxQG9OeloSSTFs=; b=Z/xZ/PYL4FnJoKWKQ0pk986WV9q8POsHjyJcfoAN0n6OpY8hrs3qIQmyHBWpo+KzIP RnLCsiOG+Th2glUFlevvQJdi0NsycWQvHC6avlr47FJgOPQHNtsB9vzxTS6aiA5Au5Y3 VoXhqQr5+2ThUJIkhi3Hytr56tDMb7kXpLTnQ2/7Zd5TbXA6r1fnJDFMFVPSV9OsQ4Qq u5uaxTw0KdTzbZ7ZCXwaNc46P5hHeSUxyglD4lvr2h74+iFri7XLUGwp95BUkr87Ysoz D+h5ggqcDHopN1+k2er3XwDwBmoD2ZufpS8A8eUYOgUtN603s3fPbyN7hWA55wUuSrg3 riRQ== X-Gm-Message-State: AGi0PuaVaT+TsiSSHUhz9lIXNCNKL5XnkGYZqZggO+7VZKk+vDB/j07L NoN1SPEcmxI5uctB1iItpYMPgTpx2L8= X-Received: by 2002:a17:902:ed42:: with SMTP id y2mr23935586plb.85.1587518264697; Tue, 21 Apr 2020 18:17:44 -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.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 16/36] tcg: Rename struct tcg_temp_info to TempOptInfo Date: Tue, 21 Apr 2020 18:17:02 -0700 Message-Id: <20200422011722.13287-17-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::643; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x643.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::643 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: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/optimize.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée diff --git a/tcg/optimize.c b/tcg/optimize.c index effb47eefd..b86bf3d707 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -35,20 +35,20 @@ glue(glue(case INDEX_op_, x), _i64): \ glue(glue(case INDEX_op_, x), _vec) -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)); @@ -177,7 +177,7 @@ static void tcg_opt_gen_movi(TCGContext *s, TCGOp *op, TCGArg dst, TCGArg val) const TCGOpDef *def; TCGOpcode new_op; tcg_target_ulong mask; - struct tcg_temp_info *di = arg_info(dst); + TempOptInfo *di = arg_info(dst); def = &tcg_op_defs[op->opc]; if (def->flags & TCG_OPF_VECTOR) { @@ -208,8 +208,8 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, 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; @@ -242,7 +242,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; @@ -605,7 +605,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. @@ -616,7 +616,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 Wed Apr 22 01:17: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: 185634 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp167877ilf; Tue, 21 Apr 2020 18:28:41 -0700 (PDT) X-Google-Smtp-Source: APiQypIzQV6EkkLimxdLuEM3VVULL+dittJ0C4hB/i4Yfx/i80eY2VicSglto9ZGxwsj/xI2o309 X-Received: by 2002:ac8:468d:: with SMTP id g13mr23519981qto.59.1587518921528; Tue, 21 Apr 2020 18:28:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518921; cv=none; d=google.com; s=arc-20160816; b=vQHdN3sKDWJ0NUwOpe4rlQuJJiVzirbybXsGB1FS2esN3Z1AyKAfqQlyhVuAMx4LlL M+Wt7nz1OMeDuC6zkhqVSoDj3zLlYYbVkGwWTezlNm8c1boCLlOl8tAM8YrcWUGYjk4z RNWluVSDtV1Vx5y1lCXr4wqJ+y6skI58Q3qKql8FLGjZaCCGtkyfGvDQHx1YVTbA89gw Fg7yyyWKHA6Rc+7aFPAy3r4FnNcCM1Vi2dYOjRaD588jmXCQuF8H7pmcz6y8yZ/PhzfS 7OZ10qrC9jbdf3+qS2tkJWuiULj6Vp2wQmD0jmP+t7RzrIUm5RgObMQy4wxR00E1KyQ/ TWzQ== 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=DuJkDhPEOnaROoc/1JyNu5wUbGL/01Lw8KOKVY4KSao=; b=E5Aefimg80TsTiQLCMKw4mKrcp4vESNaJ3pc0XyZW4JkqbTAakFR7tXPaUiksFqQor /2TiS+CSB/kaST9htj2E5NQlqOA5qMtkkEp1IctHZb3VCN7Dy94u69yPA78OOQ1alFkA 8tiHPMFhOm0OeJq/E6JYRucF6qVFfLv90gS90bE3K7tTRLUgFLlRdMTJ9DkVWubJkbvh +R8mHSiuHQ/lNMhIjtl/N79iHKEV0f8M0xpZZot+QGx9f8GlX4oo/+3GzxzCOPJXEWiE b20V88QxcgtCe29Ml4YyqKWrIwK0coCU7Ey7LV8qC0pJDlEff9OIS6+wMUekyTzPW4NS pQAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RcyL6Dwg; 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 w23si2460075qtn.98.2020.04.21.18.28.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:28:41 -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=RcyL6Dwg; 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]:38844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4Bt-0002Qo-1C for patch@linaro.org; Tue, 21 Apr 2020 21:28:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35158) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41O-0001gJ-2g for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41N-0001zK-9m for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:49 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:42611) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41M-0001vh-PI for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:48 -0400 Received: by mail-pf1-x434.google.com with SMTP id f7so212102pfa.9 for ; Tue, 21 Apr 2020 18:17:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DuJkDhPEOnaROoc/1JyNu5wUbGL/01Lw8KOKVY4KSao=; b=RcyL6DwgogtDh0tDQS1mF5ZYbfPbm7Z4xiv30qgO99gDnELvAxiqz9iC2CKMd6b9vn zHNjZPdT1mhcjKndU1B21AQb4WGx2KyooA9boeHd8VEuix5/LlFEp0vBZpBUro55FFug aN9PJF8GZGvurK+w9vgiL45JpmiITQ7pIp0oQT4qQ5cH59iZjzbFrmF1ZZKx+SSXir+1 j+U3mgaVXctEKYPPX9XO/yKvYwXXVDL6+2XiAOoBqjyG6u0g/XRw6dDhoACMazsm2qWg //Y5+HJfjSKnLgQzJFOscWsHdhYubuz9dSxzIYN16kZauROIg1/bYtovAJfYVbpD+c7V 3tZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DuJkDhPEOnaROoc/1JyNu5wUbGL/01Lw8KOKVY4KSao=; b=pyqQQFhjG1243t8KItS4xIq5rit+PUN6clTpmMTdG66rtE17PUQvjNZyllIhGNX2oN 2eUFFaQN2mYsW8gPmNZsx9nNMfQNljUJ8XSqytVw/tkHLqRIXRuBgEjUOibO+Wb+IG18 M8Zer3LgEvAN+fwByhypAItHXuVd4aGgIqQ0KsR90OsyqRuKBA5758N583CO3bfYcHTT gx0j7LRrRze7Xn6E9/BrL8R8try0VDU0avjtvcHXucQt5vu8m2QxS7fcLmyX0VOR0vPO gQzpcmqso8d+OuDJnxxVts6SkqBjY/HpV9vQvGk9wrLMZc0tFkZ0lV9A2cdCpPOmY3+b 8J7w== X-Gm-Message-State: AGi0PuZRZA/ZxbCilxUkGTl5JWSJfhjIi6E8XDr/DO8TzWSuSlAmgu3Z NrLrNMY8Fkd7qpFXeuH44+5Bcm0far0= X-Received: by 2002:aa7:9e07:: with SMTP id y7mr18435551pfq.257.1587518266036; Tue, 21 Apr 2020 18:17:46 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 17/36] tcg/optimize: Adjust TempOptInfo allocation Date: Tue, 21 Apr 2020 18:17:03 -0700 Message-Id: <20200422011722.13287-18-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::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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::434 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. Signed-off-by: Richard Henderson --- tcg/optimize.c | 60 ++++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 26 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée 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 Wed Apr 22 01:17:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185635 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp168913ilf; Tue, 21 Apr 2020 18:30:07 -0700 (PDT) X-Google-Smtp-Source: APiQypL+/HkDkiVK9X8b/igF51teoNU6rT+IFLC3j9vv7BNEtMRFdj5syySYnJcADmWCC4j/04N+ X-Received: by 2002:a37:a7cd:: with SMTP id q196mr21638610qke.160.1587519007587; Tue, 21 Apr 2020 18:30:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587519007; cv=none; d=google.com; s=arc-20160816; b=lohe2RhZSlGHF0GOv9giTIFUD0tla0AsP4a4nj69fMsqmFsWwTynoJCsbEWx8QVzKH PTe7xV4wkUyb9z3VUU0Yoo814zEhwiwW1D0PSCWrGnwsFUzuAtJvq1mhLuVIB6wJGhDo EvpLw/Z9vZMf1IfmH5rPjJSQvbmWWtdDO0aicgkuDYWtQtjvAkbuZGiVtlnTIUHzPyDZ Js3LjWcPb1zim5z/81UGMhXJnBM0mBCMkomvcsjtqitQd3gm9B3tosCkMryQcgGjotjM CTPllrKPeaUIPm/UHs4SyVRtOP4eAus7/qEJ1z/JnrgTDC67vpwL/yxBO5MkQTJUr5EW 0M/w== 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=8se14kJpotzBe1gBeAfalsCzpFa61zbk2HVh3S7WLCI=; b=EWV3v7wPXYNNiP361S6+oFKHXQ/jVokFhUWR+UZpJO7tG0g0YXDFz916pOAepueYoi 8Naaw0t3dzhMlrBg7Ob6BK7FeNgQtOpW6uehozBBhewxuDU84sViYfry0ShbOz8+l07b RTB4703Hhozu3qLDi3UoImTo2ESvqhqQGkHNjEqCGZSB8+QklIvklQ8mH9r+JJjkfjC0 Xws43j0wcBenM9ScHvCIRk0Ui3b4Qd/qIxFlEvU5hRpomaKnfckq3EPwhceoahAYr0hG GuIE33xQY5tOVKo3eAnn+28Ax9UrVZYOPIPuTPOJwM4FYGO5TBNoD0pf9qLAwGtkWVbS UJOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="bJQOnD/S"; 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 a15si2449724qkl.60.2020.04.21.18.30.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:30:07 -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="bJQOnD/S"; 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]:38887 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4DG-00060W-16 for patch@linaro.org; Tue, 21 Apr 2020 21:30:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35202) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41O-0001hc-MZ for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41N-00020J-Lw for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:50 -0400 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:54695) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41N-0001xQ-5V for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:49 -0400 Received: by mail-pj1-x1041.google.com with SMTP id y6so144381pjc.4 for ; Tue, 21 Apr 2020 18:17:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8se14kJpotzBe1gBeAfalsCzpFa61zbk2HVh3S7WLCI=; b=bJQOnD/SoTDPWit8H7kggPTQJE3ZwlZUWkOLkAIjCLZJt6WEwcOqtFjMk4LADP2/eg kdcXANpVukEy2GjnylDKZ7VpWtidxN/wO6MbCOarFm+AK6VjXiX6IxZwF+Gg+MbdxcUY GNfUdilabmEMutcu1GFzbRq+fuc04fmDa36EykIVk5zVJlkPMtzfTizov5IFDxSgDQW5 jlda/XUVR0yie6DyNZu85+oRiGWgbDnDip6/pqScmVNsFtM0NHeOHlQYMBwcP5wbyP2c bDQJ2nXiJsqx8sbvTc/mfY4RLcNr8VVG0yFYzI6AF/4CmHZBC3Rw2ILo/PC66Z4jpRBw URiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8se14kJpotzBe1gBeAfalsCzpFa61zbk2HVh3S7WLCI=; b=Tq4p+SoXh/7QfwM31N5lDY5u9Bjm6i3YuePzEa6gwgU0egmXWga7q5bvuJkIaziUTo XwbJQ9TG2AM4HmyI/e+ml5fHz3om8FtIWVQQdwjnFphrHk2MZjd/xcA02t6TUiaQL3ia L6OvhmPqFd6x/4s2O0g5zdeUOGU5/g9XrupanZbl+PKLc3INR9F5bPBVoiW/kzb9JaZO N7B36v03u1WBXzwzyAa0V2jciu3d0CIBRgNaRThyqjOmvDyHwHV+y3KrgKSDoXwNLMaQ pfeiRa7EJ9U3t443L4b1FpOwrusBnKTpYmCKaLBmEEBVAo5DZFSk3eoZGzF/HlpxNBoE nhXw== X-Gm-Message-State: AGi0PuYK5yr1eKjsQvzQjaED0lSDdJGBB2JGj6fPUUgBlag48fsC6rVk REqDr6oY9/mUs5LEY4uluD1J6yH+dXg= X-Received: by 2002:a17:902:b682:: with SMTP id c2mr24632319pls.144.1587518267277; Tue, 21 Apr 2020 18:17:47 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 18/36] tcg/optimize: Use tcg_constant_internal with constant folding Date: Tue, 21 Apr 2020 18:17:04 -0700 Message-Id: <20200422011722.13287-19-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::1041; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1041.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::1041 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/optimize.c | 106 ++++++++++++++++++++++--------------------------- 1 file changed, 48 insertions(+), 58 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée 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 Wed Apr 22 01:17: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: 185638 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp170497ilf; Tue, 21 Apr 2020 18:32:09 -0700 (PDT) X-Google-Smtp-Source: APiQypKF69vJW9sbIls5sUROVGXLqSGRyu/OggMQlTQAMVQIsqMZVy44+ABQlWLaSUv+2n9Zm6eQ X-Received: by 2002:a0c:8045:: with SMTP id 63mr12925411qva.68.1587519129072; Tue, 21 Apr 2020 18:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587519129; cv=none; d=google.com; s=arc-20160816; b=mNUDLOTgmxDqi7VMIEpg8szSfb9yLd/z4xo0jPbkptU8TBK6uuUhHNRA5cX5tfRvgl m9nkgUCQU0YtuzCDl1vnAMfxKrjjM0wYh84BAwDuoPzmwnpoR8c0vFZeURAjhjhYKESC rlKeXSkvrQFImOadR4XZAp0N5dyUvqo7ZmrrCbfBRVW+J5S9EKaM8GrQQvlfEfCYjBGM RZ/7Xt657xOOzf7MMazi/6bxr/FXeVRdSzWpvEJxE74BZ77IeOU1yKkwXx0MvTdNreT/ eHfYIFGjWqmRZzpb/yOU5AQb9gOZORY3URDhka4QZUGDGg4R0PWk+4hSQ28me1RLlT0c lNBg== 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=Zdjt8WpN4waxB25J3ykCncF8gpDtxEJVdnhsqarrM50=; b=07YDQz6/KPY8temvRs42oPyB1QJIiJ4jv2G0n+4l9GumVfBgCUgI7NDoq9pFJg8B/K eFvKq66DFm2oKjX5f2GbYPX3rlsmEFX0N3huxLLxnxf6P60Si+HBvIzBnUwWOhp0swWb ZTjDfQveUhH9wfGXd+be1tVxNcld89D2WQd3woSTvvaeKEETHcA+O6kduva6gHK5oGRN XGZk+3XxPrZzGdPIq0FWs2NNx0eP+0+WOtpN5O/L0ciKzanzvCy7Bggb+qo3newBNSqe 2Nm2mM0zfrODI3PLR3assOGhFVLNaYAMgSX7qAkhzspXyJM0ADw1rghciDtkSTK/TE06 blvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l2OnSAIN; 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 1si2486627qkr.85.2020.04.21.18.32.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:32: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=l2OnSAIN; 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]:38942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4FE-0000vI-GS for patch@linaro.org; Tue, 21 Apr 2020 21:32:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35276) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41P-0001jO-G3 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41O-00024n-TO for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:51 -0400 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]:38199) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41O-00020C-9Q for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:50 -0400 Received: by mail-pj1-x1042.google.com with SMTP id t40so156428pjb.3 for ; Tue, 21 Apr 2020 18:17:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Zdjt8WpN4waxB25J3ykCncF8gpDtxEJVdnhsqarrM50=; b=l2OnSAIN9pOZW3QTTeJHLAmMDjVXaAEqy5iGvIzdKy6Kk3WssrUciwF8eKy+p4Ux6R D0Y5T+tPVvPoWpsNe10lRgoaYhs7tY25QLePjuzT5/437kYPXv8iFs808khZ62moO+d/ E79IpJKsUUCSSb8h+jkljmO2/ckjpOmW9dQtqjfx2W/rMSATTGCoOPTc7y23Q/MP7MpT 0DgfhEXVPvTkobPtxu5jb5B8pRlP5YxU6g8oSP2lPGT2/teSFQnYL1JbYz1FMbnmLyvj ALx7VzwWLnXaQQZXKZWkE6apIGcbpGsZvgOivN54jxbX2QltzF1Zqe7yzDOLC1Myo5Lf AIvw== 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=Zdjt8WpN4waxB25J3ykCncF8gpDtxEJVdnhsqarrM50=; b=PPOmWp4ghmUt8sb8n1MxrWVbxq4M8F8xQSzsi0AfsLHEnrhAMaODoM9yROb7MzYEkW 2aTK7Fg1vHZ7S0HUp4VuDq9XHfh9LK8QnPhLimjbareI96UqaCU9UYqnIHZsGwMTNIva mSblsbz9dwtnmxAUJ6LcYBfCMkPKiGdeRhqD2Q/62aXmP8cUo+NEO0LW3coRCFeK0wuS gCw5cWuoLthQ3Bp90areOkwah+Ki9fR83EbFjzIWf//s35+rxf84WvuH6Q+5SHOt7Cno r3GAhgnP8xwQ6xHiqTCSQNh+unPUdjUFzGMNTKiSe9aAc4fF3ocX4hzUy1WUyOTUmUUE K/Lw== X-Gm-Message-State: AGi0PuYGIRCv1Y2psrsF79RTjr8F6RZhJk1gKID3Sk2BQlC1hNDa7tZr MWM7Nr6w1YtxF3KTWr2EbQG6evfPHDo= X-Received: by 2002:a17:902:7b96:: with SMTP id w22mr24706428pll.10.1587518268604; Tue, 21 Apr 2020 18:17:48 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 19/36] tcg/tci: Add special tci_movi_{i32,i64} opcodes Date: Tue, 21 Apr 2020 18:17:05 -0700 Message-Id: <20200422011722.13287-20-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::1042; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1042.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::1042 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. 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 Reviewed-by: Alex Bennée diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h index 9288a04946..7dee9b38f7 100644 --- a/include/tcg/tcg-opc.h +++ b/include/tcg/tcg-opc.h @@ -268,6 +268,14 @@ DEF(last_generic, 0, 0, 0, TCG_OPF_NOT_PRESENT) #include "tcg-target.opc.h" #endif +#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 Wed Apr 22 01:17: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: 185639 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp170851ilf; Tue, 21 Apr 2020 18:32:35 -0700 (PDT) X-Google-Smtp-Source: APiQypJ43oT0X8WLAJUhXq+VgcsfnMo4INi6zNXxL2/v58EXO9Wj7wgy1MCvM+2FMbzn9RXx7Aok X-Received: by 2002:ac8:2c78:: with SMTP id e53mr18824235qta.365.1587519155267; Tue, 21 Apr 2020 18:32:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587519155; cv=none; d=google.com; s=arc-20160816; b=GfvQ8XtcMD7XI7Z/aWG/9z6DyvqFMqNRtXwJaKOQzIHqIO5aZ09kHK5JMlRC3Av1KR skZ1UkiruCos/QUx9ca6BZ28WOd5O+rWdML3njs+RLcRsjQ1WvlgCpgQaD5MMoE1lRhf hqe+4hzRkcHwKAKMhwcoWyTC0groEMGhLZs81iLKOVH5ExV2C4i2+fwYiT/vE6orgMiP 3MpwqWZu9HBIUzdJP3ZNUXXJW8PSLvbJuFX4nveynrL4kEcZePQuVxUjMlb95JdMf/kO R7iuFhqA/WnSEA73ziVJ76CGVay5FdE+QcwjkxFQ8zpUL4dyRh1t7vp8he2NMTPSfdnS Lmjw== 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=rhrw9pekgEH5BB8vddUs+wUSUQ/QGWXX4jtEuHwbb9o=; b=vJuheo5IQj8oxrYYgSIdx8WHVSkk6RaJHD8Gk8Td/4+SlSLTO6jGFsiZqY463f1rJd 1Kr/i35L5V+EgC7wFBSq95VTRn2tT0kghMnee3Yzyxiu6BetJuZV2iSGd9GPsg+dKsn8 5YoB92TPv3VUeGfKDwSOo28y4Ne+Rlk80fe/eaIoLseTfhVPG/6WFl1KPIr/GiYDmuCz InUH8bBTmldBpGrcTdiEf3jS5ro+XACVgGq/ZgdrPvjSk/PXg89k/o7d99LMhPDmu59y s3uHnpHiORSGYXLHryxCXZxzGTyrzfBCiG3xfjZDJH/C+xYhE5463IMBnnoxhPyOTbXd qcaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qgNSE3v8; 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 71si2362715qtf.126.2020.04.21.18.32.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:32:35 -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=qgNSE3v8; 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]:38964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4Fe-0001cl-Mr for patch@linaro.org; Tue, 21 Apr 2020 21:32:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35396) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41R-0001n6-58 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41Q-00029U-6H for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:52 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:33232) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41P-00025S-Li for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:51 -0400 Received: by mail-pg1-x541.google.com with SMTP id d17so270949pgo.0 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=rhrw9pekgEH5BB8vddUs+wUSUQ/QGWXX4jtEuHwbb9o=; b=qgNSE3v822Zunw8tEpfJ2crl8v3uAVGjv06BumH4OR+jym+2AmYd5t0Mf1WHiqJ1A4 rtBcF2AL0iLxnKZ38YCE2ozWnAfcUfy6WiiPTOJ3tOjIEukH+3hiTckQSEBROBMOrOEC VGXCgh6jyvGGY5zYXtR5nJE4eoIaVCAT+TJqwSl0nkZhG5YTPHCuVBgnyrPWJKkEAcCz rFmoBLu9uEL9iRbnnG9GiMsVFPZAX6NeEDF23u94J3v/pe9RQO6E7tzQxXBQVYSzfv1O v8MqYXc1l1cX8lVRFl/tbQQ9bJJ/KF0/w9hb7udKZnsHVl4enP6+3VbvNRO/2QwQCLxG RLYA== 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=rhrw9pekgEH5BB8vddUs+wUSUQ/QGWXX4jtEuHwbb9o=; b=P1U0fYv5MXlndyv9WniPsCDwNZYy59kDi2kk0yQECBkm3m9MBlX0PDTjjhm1QhyVo9 WMQG9PvM156yL85NBGGEQzn28dJGYpzZGgnrb++UCJInYQkRg+PeQd7nk9rUyQJIX+s6 aYniGdhvnuUmYbtACOLqNVkddaHvPWwN5SS9zP8fLElKbPT7A+xCc7LUCj0SwT5v4mHD 1IbbCTpW9HZiGD45SiXd+j+N/9qacoQU3VjfZ6p6sePHbVJgnQpj6Xsq7hM5UJldJC/v EQOe6oBPgFaKTdkowh2aGre8+6VAgFy+zxLSGJIihVoCfSlkCt5bwfmBcexPHSDkJOXD r3rw== X-Gm-Message-State: AGi0PuY/cTyk6pY5dgDCypekTduusGZwsS8AymrEXpYr1E3L9JJfZ/Xv 1WEYcEeU1WQE10esQOTouzptMHmFnjU= X-Received: by 2002:a62:6443:: with SMTP id y64mr13418064pfb.100.1587518269713; Tue, 21 Apr 2020 18:17:49 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 20/36] tcg: Remove movi and dupi opcodes Date: Tue, 21 Apr 2020 18:17:06 -0700 Message-Id: <20200422011722.13287-21-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" These are now completely covered by mov from a TYPE_CONST temporary. Signed-off-by: Richard Henderson --- include/tcg/tcg-opc.h | 3 --- tcg/aarch64/tcg-target.inc.c | 3 --- tcg/arm/tcg-target.inc.c | 1 - tcg/i386/tcg-target.inc.c | 3 --- tcg/mips/tcg-target.inc.c | 2 -- tcg/optimize.c | 4 ---- tcg/ppc/tcg-target.inc.c | 3 --- tcg/riscv/tcg-target.inc.c | 2 -- tcg/s390/tcg-target.inc.c | 2 -- tcg/sparc/tcg-target.inc.c | 2 -- tcg/tcg-op-vec.c | 1 - tcg/tcg.c | 18 +----------------- tcg/tci/tcg-target.inc.c | 2 -- 13 files changed, 1 insertion(+), 45 deletions(-) -- 2.20.1 Reviewed-by: Aleksandar Markovic Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h index 7dee9b38f7..4a9cbf5426 100644 --- a/include/tcg/tcg-opc.h +++ b/include/tcg/tcg-opc.h @@ -45,7 +45,6 @@ DEF(br, 0, 0, 1, TCG_OPF_BB_END) DEF(mb, 0, 0, 1, 0) 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 843fd0ca69..7918aeb9d5 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -2261,8 +2261,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_mov_i64: - case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ - case INDEX_op_movi_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ default: g_assert_not_reached(); @@ -2467,7 +2465,6 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode 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 ec083bddcf..320a4bddd1 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -2678,8 +2678,6 @@ static inline void tcg_out_op(TCGContext *s, 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 ee1f9227c1..fb390ad978 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -2967,8 +2967,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_mov_i64: - case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ - case INDEX_op_movi_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ default: tcg_abort(); @@ -3310,7 +3308,6 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode 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 655b3ae32d..6343046e18 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -83,7 +83,6 @@ bool tcg_can_emit_vecop_list(const TCGOpcode *list, case INDEX_op_xor_vec: case INDEX_op_mov_vec: case INDEX_op_dup_vec: - case INDEX_op_dupi_vec: case INDEX_op_dup2_vec: case INDEX_op_ld_vec: case INDEX_op_st_vec: diff --git a/tcg/tcg.c b/tcg/tcg.c index 59beb2bf29..adb71f16ae 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1463,7 +1463,6 @@ bool tcg_op_supported(TCGOpcode op) return TCG_TARGET_HAS_goto_ptr; 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: @@ -3447,7 +3444,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, @@ -3470,14 +3467,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_*. */ @@ -4263,11 +4252,6 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) case INDEX_op_mov_vec: tcg_reg_alloc_mov(s, op); break; - case INDEX_op_movi_i32: - case INDEX_op_movi_i64: - case INDEX_op_dupi_vec: - tcg_reg_alloc_movi(s, op); - break; case INDEX_op_dup_vec: tcg_reg_alloc_dup(s, op); break; diff --git a/tcg/tci/tcg-target.inc.c b/tcg/tci/tcg-target.inc.c index 1f1639df0d..b796f4fc19 100644 --- a/tcg/tci/tcg-target.inc.c +++ b/tcg/tci/tcg-target.inc.c @@ -815,8 +815,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, 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 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: From patchwork Wed Apr 22 01:17: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: 185616 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp161077ilf; Tue, 21 Apr 2020 18:19:05 -0700 (PDT) X-Google-Smtp-Source: APiQypLj/OXBxRqiiT0IdGFyDo3pTJnjZrsTRQiGdf+7aIE6cwOypKkbAPp5v5NJOrZKnEwBrWFQ X-Received: by 2002:ac8:3466:: with SMTP id v35mr24174711qtb.308.1587518345512; Tue, 21 Apr 2020 18:19:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518345; cv=none; d=google.com; s=arc-20160816; b=CORJtAThZE+k6C8pI3FoQfUOVIV8+1F9MS/SnpQooejIpuzxYQVV2HhMTXUX/Vvuyx bVIIPH9teg4F2G5L8b+IilXNfPjjxtDhyRcuAO1M8SwctQAaRsHoHOmFAdO3lHP06ywE unhBR8yEKUWU7RgjLk+caPucMpVBhmz3hwT3h2jr0fr7OiKAHedvAliD1BbIC+WlXhC2 mrDKhrs35c1LWFFdV+frkKV4JprrJeAGxOMWdxKYOQldAdCTHMr2k2sanR/uPXxlD860 ih7PbcbVzA3X/KyKFkvYFbo0Iw11MdmcvpGaOgYIwP5ZTNqiBk0tIcXbxn9LEbTa8BQp eE1Q== 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=zkNLdD4lJapTD7P5RW5mO/2wUgiJHORElGCA3liJ3rI=; b=za1RmOMAgKwyg3/qj/Dbmbum/hD5Xd5FcBUsvWSQcJrXkpr3M5HXYZAuk8xDQ9ugco J1TegwznYKmDw1YnU1EfGutrV+tOItsCppBsnUh+394PvIZ6J26B2f5m1b84bvrWDPGT bVT9eR7vOSdZaaVZWSJJrmy9ZAbEltI+X4qVxjmtrYKvdtjOhA+z/Z9+BqDlYJ9hB+qo RgjL/yvKx9UqIEh96Ng4HkByqd/exCTeZs4cKY3kzX97wHcjH+sQcAsccIPCt0/9WEv8 cJuCfy0yyZO3ujlWIlxEMVXRWPXDhUr65BSv4dXyNq/IEZbBEZk4REX/vgDk3kGD7+P7 m0gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aHcIYtbC; 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 j32si2318713qtb.347.2020.04.21.18.19.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:19:05 -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=aHcIYtbC; 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]:38518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR42a-0001us-VD for patch@linaro.org; Tue, 21 Apr 2020 21:19:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35536) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41S-0001pz-Ut for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41S-0002Gq-2v for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:54 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:46719) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41R-0002BW-IR for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:53 -0400 Received: by mail-pg1-x543.google.com with SMTP id j7so237383pgj.13 for ; Tue, 21 Apr 2020 18:17:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zkNLdD4lJapTD7P5RW5mO/2wUgiJHORElGCA3liJ3rI=; b=aHcIYtbCvJoAiWpeMUYEnhwEUU14jrmGgRBo5HDXpieN7t622WBHAEkEaePZNPAzM9 BwqQ1BuzXS1qOwFEMB42A8+Lml2L6IOZwQibO4oNJnEx3osHEDI0hlL5FBpdlIvrxv+4 es9nMzNXJfqhEFI9XsrjI2j3OP8HDAzJ3dZkgdB6+F2CN4U2e+y/dJCqGeX2t9GrXQLh qfzw/K+2XHIXwbZJulkJef+Yn0IFKFLhI2fH7RcZEO2VK5w3zD6isooRUapJBoVVjtG1 CH5+Nn+bI4oQh6KhF2DpRB5PLnKqKn5HgxNEgo+H057ymSVcatfhY76iyj1LmjmVm1/z M7YQ== 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=zkNLdD4lJapTD7P5RW5mO/2wUgiJHORElGCA3liJ3rI=; b=EWDNBFsMNXa6dAX/mCrQcWTSqzmI7iRZs9O0ZUwylSDzawaEBaroXFofVyEpHEpW2E Mjtmorxq1KqCELdYasUZGyGtM6XkiLHBiqru/y2RkL4FufCucu9nLOAuy2rrnH9+buP9 ljHcN8nmwtidsjCBvmoP/qPtyGvQQdxBMbuodC1j8jKZTlsFoYuTENtGHw0lexvAwZkk xK8q0GtW5t/PeQ4frzZVokcUGB4q/AM/mpfkntuYbZGqJbbeEe0bgpKngUYeKrEXIbYw GmIhwQG8IJmjg4WOIZD2CWTLi2S3Ga3VN9NkpEYWpxId6W4kX2klYlFZw1v7Fb+G/ERm i4eg== X-Gm-Message-State: AGi0PuZm+vOTiRNxY2uul1PO5hTI+CWCiM2gU6Gk8mV0zB0pQuM2oKT7 UIA1ZnXqAduzujYF8k/sT6VxcAQ9bLA= X-Received: by 2002:aa7:85c2:: with SMTP id z2mr23606747pfn.25.1587518271811; Tue, 21 Apr 2020 18:17:51 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 22/36] tcg: Increase tcg_out_dupi_vec immediate to int64_t Date: Tue, 21 Apr 2020 18:17:08 -0700 Message-Id: <20200422011722.13287-23-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::543; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x543.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::543 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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. 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 Reviewed-by: Alex Bennée diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index e5c9ab70a9..3b5a5d78c7 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -856,7 +856,7 @@ static void tcg_out_logicali(TCGContext *s, AArch64Insn insn, TCGType ext, } 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 07424f7ef9..9cb627d6eb 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -945,7 +945,7 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType 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 7ab1e32064..3333b55766 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -913,7 +913,7 @@ static void tcg_out_movi_int(TCGContext *s, TCGType 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 4f1ed1d2fe..fc1c97d586 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -117,7 +117,7 @@ static bool tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece, static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, TCGReg dst, TCGReg base, intptr_t offset); static void tcg_out_dupi_vec(TCGContext *s, TCGType type, - TCGReg dst, tcg_target_long arg); + TCGReg dst, int64_t arg); static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, unsigned vecl, unsigned vece, const TCGArg *args, const int *const_args); @@ -133,7 +133,7 @@ static inline bool tcg_out_dupm_vec(TCGContext *s, 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 Wed Apr 22 01:17: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: 185637 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp169905ilf; Tue, 21 Apr 2020 18:31:22 -0700 (PDT) X-Google-Smtp-Source: APiQypLKckUGjxAqdme08RNOndUSft5RkkCiPqEGC7l6I98qvh/hrlSajkcSDbqz+m8Nhkg2DoWz X-Received: by 2002:ac8:582:: with SMTP id a2mr24766179qth.62.1587519081920; Tue, 21 Apr 2020 18:31:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587519081; cv=none; d=google.com; s=arc-20160816; b=rX9s7uAIt+iESJCUE5gt4ph+GEEsigkWtFohIl70ihLf6HeYq1z8gv7ZgVTVG2p9R5 EUkFgjJriyHYjI2rS+T3s5bztm4rvY4UJ21PaArIJEX5VippRRhOgLq/cvkVlv0AA7Df MRMUgsIQXSURNT4CWAwlTA3WdxN7f8X5v4xWb1TeUoDoltSMK7mX76R7IVYbg6TzmBoH GnzjTrrSxQCWpQFOCHueCSjGYHCJVhTELIT6jYDiDvxkhmI4KLb6cI19NbQ31iP25eSc G2mY2m2pHhuKAawEhLam9AwgkS5C0nqMcJib55ykw9636VdeDg1tN6o53Y8racMR+8EC +1GQ== 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=GuLBXp+DHzvjBbWtLt3J1mN+KRme5ZQDBMNQ1V2Bki4=; b=e8rTqdjul1iYH2rualuprBBOHZKaNNfbGhvzYtaKxerDuxQdELh1j+jknh8O6vgKCp 5d/Bp6TUzTyU/5bC+7L1mzAHwpqgLqW2BLThvBrhiObvBWu35jzVPRRCv/I2dPeFSZvK eVj1QSqlHqF3oV+rdJ4sUxsfXzSfOQmczD4N348FTxla1QpYZXmDt+r0n+AL6xNil+1b NbdutVCLiqlk2wcrk2Vfopx/3jMGxPJI1Ka8HM8xSP9QHadMzY0LvWS3T1ZQnzr1Pqy2 u5QeUWmeGLF+UqFDpDqZCg31XVcUunptz+A+icEvF2+Yzw3DPjdyKs7pGs1l6kuSR+LR 73yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C2ZsCRmt; 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 s40si2416023qts.310.2020.04.21.18.31.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:31:21 -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=C2ZsCRmt; 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]:38916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4ET-0007En-Cz for patch@linaro.org; Tue, 21 Apr 2020 21:31:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35624) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41U-0001sj-2L for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41T-0002Ma-DI for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:55 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:42581) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41S-0002ID-U0 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:55 -0400 Received: by mail-pl1-x642.google.com with SMTP id v2so236651plp.9 for ; Tue, 21 Apr 2020 18:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GuLBXp+DHzvjBbWtLt3J1mN+KRme5ZQDBMNQ1V2Bki4=; b=C2ZsCRmt/TWBZfNwnyA0zUmTHLZcf4dL+qjFn10y9qwIqhllrOVgOXtTXIloGrHqBR y2jM+Ckm16KvQLzCfml51OtTJUwDDHSoFo+NnK7ebv1s6HLiLHwf2HNAx9sY8FBq/IEx CLXFPpH414UQgWTbQ0HQSC1JrY0X6TPH6JPOL7o9Hrk9ykm5QT5O0IiDZTMQ14KJhCBj 4zoHQvRYtW5L8RDHmPwt1Jl9cFuQDvFEQNx9JT7x90BX0Uh81UOiAHS/oFTz3fLjJtCh 1JWLIsRK74utAWE4omuzK1ttD2wgnj67cqGxtctWj9TslF+o2tYdMEJUFmszy6yaxdNJ VeGQ== 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=GuLBXp+DHzvjBbWtLt3J1mN+KRme5ZQDBMNQ1V2Bki4=; b=W4sri6O4VqK0vwJQ1zBBHOYv1ygtGwI2FxuYtv4vjajktBFPABhhPM6y5R8VwvRBJG DfETlVcl+eejY6/0BJ7V/BDdBy9g+IyJgdITCtDcOALQ2lOGaUEchSlFD7pQUt7+99WZ FQkxMza5mEoDuJjtsaPfvKCZ4JeiTBn7ZRkJDXxAnA7t58zyDwEbeByCAnaYXLoQeP93 83I7sYDwr/Ldaa3vqqprkPYMqEj89JjkFvBuNaAHsqvQUzrtH/oTTfNjmC3flRKSgIWt UidErCBRod0eZb3fXTD6NVvJKvBRyWYGrKDu3DknAix0zlCc0ewxbi6RJ1D2nyqhCwx6 sUeg== X-Gm-Message-State: AGi0Puai43OjyY1yqsRe3xt4FDjkRIn9FqKsUROUHSdJmfHzchje2nI0 U+EshK35vTiIYLe17Q4fhC1C0ScCzos= X-Received: by 2002:a17:90a:5d96:: with SMTP id t22mr9032428pji.132.1587518273082; Tue, 21 Apr 2020 18:17:53 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.17.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 23/36] tcg: Add tcg_reg_alloc_dup2 Date: Tue, 21 Apr 2020 18:17:09 -0700 Message-Id: <20200422011722.13287-24-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::642; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x642.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::642 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Reviewed-by: Alex Bennée diff --git a/tcg/tcg.c b/tcg/tcg.c index fc1c97d586..d712d19842 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3870,6 +3870,91 @@ static void tcg_reg_alloc_op(TCGContext *s, const 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 @@ -4261,6 +4346,9 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) case INDEX_op_dup_vec: tcg_reg_alloc_dup(s, op); break; + case INDEX_op_dup2_vec: + tcg_reg_alloc_dup2(s, op); + break; case INDEX_op_insn_start: if (num_insns >= 0) { size_t off = tcg_current_code_size(s); From patchwork Wed Apr 22 01:17: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: 185641 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp171801ilf; Tue, 21 Apr 2020 18:33:50 -0700 (PDT) X-Google-Smtp-Source: APiQypI3VTMN7kOolQqqOeJLH6aRrXqnIAaZjLOdZVthdFRhH+zzMGT65ztYu0kO0kICBbRrb5pw X-Received: by 2002:a37:91c6:: with SMTP id t189mr23785805qkd.280.1587519230122; Tue, 21 Apr 2020 18:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587519230; cv=none; d=google.com; s=arc-20160816; b=zlFpzc+rkPIFhqQEEonq4da48NW2Q3l6j4rFBTFVzZ/+/5ccgkgr4XC6BGpuUsNhpA SvF1wjWtK1edXBMIT7Ewa6slinnQWMkuUtZFKNEq8tuZI2EfMAxQGqtPA5SexKm9b/Ka 00XEYcFzhAcU779vXn7qry/XTUY5K8sqj4D2H4T6BzchgHiqxGX/RkztzlqWH1EyWPlR 1z+3yl1UiXt9s6DBn7y9HU+UKMSQa8Ujv/8naSRq5+CEWjkEYjHOxH93ZD4mNIbYN2tb 4vguM+M+8nr5rXxYvjm5eODXljkCYF1uwmg9iVlHegMBhXzJVAwtd8G9afkNCBVKAGuo VPfw== 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=5EBqK+tM4Y7xOqKxuEa+KWDMy/xyFBtPmoMR4ACbhCI=; b=S1iVEQW4xbg4mBpgBLRpivDsZ5JS7n6VW6R06nRsfPCBnPbm7kHbCvVKhl7tDovGcG 2sStpeml0plY1o79pK6IIT0Og+F0TN05wZECh1yfLihCK8xm+mFfCOoXtHskCD+ALX72 P5vG1nwHmz6CC5qGEox225w6nhpa4uShIrnQuEnGXxIUfZUnqjwdRciqPnIWPIjcDYI3 sfKYDCHQsNTAT77XDM5p6hG2Gif+/+NE3qAymg7d1+mSBeBM29eBj5MmZH4EnHfcdG+P JT7qhUryhBDAa+WzTMvKLbNLJtxBM0+xZcG9uaRD6z6F1R51VS3qc/Rfm2cOouuUuWJP oZ8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vxHEjOz2; 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 p90si2340374qtd.308.2020.04.21.18.33.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:33:50 -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=vxHEjOz2; 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]:38992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4Gr-0003T2-JG for patch@linaro.org; Tue, 21 Apr 2020 21:33:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35702) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41V-0001ug-4Z for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41U-0002QF-G6 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:56 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:33233) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41U-0002MS-2H for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:56 -0400 Received: by mail-pg1-x541.google.com with SMTP id d17so271014pgo.0 for ; Tue, 21 Apr 2020 18:17:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5EBqK+tM4Y7xOqKxuEa+KWDMy/xyFBtPmoMR4ACbhCI=; b=vxHEjOz2VHNcE9YolzHgmb1xH8+6SS/2ofhzlSZfuM7MpSORAgQ7oDwBy28Q6ulOQb GTh5cVPjnKD4V2VfCSa9O6Ljau8b0M/ANKo+GVyTK2b1mTXSG5giynlknK7R+u7d7feI M+wHWt8TBrQ4B+Vc6PM5vetiUwPOeKxJyTf6VITYlcCkgJtKWXxmr6HB5DQC8+Z4X+IM eJHnmI1WX+vyiKyVDn0H7qvAJA/Q2Gft3i5MuYKTmgCx20Vj80Hnvlz6VF0GD/MHTAMh F/1rx0p15KZ94FUAWIbVzhlbCmWhzH7ekMWobazJz3urAu5uZCH7H0F6HDav1SBJXOKf SiZw== 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=5EBqK+tM4Y7xOqKxuEa+KWDMy/xyFBtPmoMR4ACbhCI=; b=PbBXlSmx4EAsvoKq2z8KmZjFt4mUkaPC7igyWZkJus55PEocoazosoduwahxiCedW6 L+wTjsz2yPOQ99/Uc4+QXm6peWOu6xwTeYfMSHHiS2f9RQVSLVqC5VQzQWDcSigFCSDD wMfwuX/6m5hbRdjCX1mgBwDwg9tQQlZT+qnSHEZfrvJ41eppni82ZJ+gmxH+Gt7EKxNy XHxCmkKRpblOYxJH1eZTtFdRwNKW+jlEBXWoqclHx/Yd8ey+MMiSbe7UTcGJ+/zSq/Lk s8bjnv6TtWbhIOGw3VA4vpbybFVR6P4xMBNqZbma+zre6289eotZouTiAWwWojqQkDi4 KLFg== X-Gm-Message-State: AGi0PuYLSy74T/kmWHrz4V3U6Ci9CoVesMvWIb2bbVoPppNuWUMs+32A cjh7E8+tC/sLoSMO51TkWytCgIjhSY0= X-Received: by 2002:a63:fc45:: with SMTP id r5mr22421412pgk.440.1587518274422; Tue, 21 Apr 2020 18:17:54 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.17.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 24/36] tcg/i386: Use tcg_constant_vec with tcg vec expanders Date: Tue, 21 Apr 2020 18:17:10 -0700 Message-Id: <20200422011722.13287-25-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" Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.inc.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 9cb627d6eb..deace219d2 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -3452,7 +3452,7 @@ static void expand_vec_sari(TCGType type, unsigned vece, 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); @@ -3470,11 +3470,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, @@ -3489,15 +3489,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); @@ -3525,7 +3525,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) { @@ -3596,9 +3596,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 Wed Apr 22 01:17: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: 185643 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp172584ilf; Tue, 21 Apr 2020 18:34:54 -0700 (PDT) X-Google-Smtp-Source: APiQypJilESB74M4QvlL94RmUQxvhGaStRtxhdRmQInF8n0ndBtJb0jU9PYXnxYO+6b49QBNaMA6 X-Received: by 2002:a37:6287:: with SMTP id w129mr23897298qkb.34.1587519294137; Tue, 21 Apr 2020 18:34:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587519294; cv=none; d=google.com; s=arc-20160816; b=Qm+SU1bHRn+014htP47IPQ91i3ux4LfJ/UmfiVKkBkkdi57B2nEseiG3tVmYm+RZCG cfHkZXSiKhR3s1eITy1KW9RxaeEaVyKRPz4K3WpY2klPuhkAb9uWtZKO42c71VAntOBi xNlrckrBDlmorFGiODi8fWEqyiSnoc/VAgfHDywJQ0EvIsOfgNECt17qOFBWf/PlJiZi V2f8HB+4kJ3qMwcJRx+LryA9zuYKpZBdfNHWTOsYnZtDXv5n7uy3CLvDalwryvb7MkKT /JkPpvURXKDUo3I9qY3AIL0uR5MzTrT/fnAC8fYP6LVQSEbaFTyxc992hBLMV9SB84kN sGkA== 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=2sdxv3dgmobchGTZXq4ItSud4I5lO54dfCluBdiq+N0=; b=zaw9aBvd/TbBD5mXEJJ23vlhXkkdwdGDRNvQYTJRpwsCqcqBJO1BvSSLj0cqiSYSqm kk9bnJRljC0wJjupq58R++q7v2+Ln3ljoGqNX0xRMFQNHUULFqPUrBxDYa5YBRRPhmH9 dvhWN6hqBoAWhZ/2YKKcKZJs3yjGZSuxROg+/CyTo3SHLfg+5xPVpfHca76j1qEL/RSN 4WkkTzi9hcVGaChwaRdLnKNGHEXMXz2YMxHACsO/ekhXvl0ipeuKi6Xf2xMx1z33Slcf pfBzYboR+FGeD03O76u9FX7U4lTt3jb7G+MR2HlcCXsMcO62vkH5InJeHOo2YxhOjo+P ce4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="s41d2B/a"; 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 z69si2460622qka.22.2020.04.21.18.34.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:34:54 -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="s41d2B/a"; 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]:39000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4Ht-0004CN-J7 for patch@linaro.org; Tue, 21 Apr 2020 21:34:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35810) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41W-0001yT-G9 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41V-0002UY-St for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:58 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:35572) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41V-0002QT-F1 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:57 -0400 Received: by mail-pf1-x42c.google.com with SMTP id r14so229923pfg.2 for ; Tue, 21 Apr 2020 18:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2sdxv3dgmobchGTZXq4ItSud4I5lO54dfCluBdiq+N0=; b=s41d2B/aqcjMxy5JWu9he0XufXmRzh6dKf5RTg3RSKL7JS/ohQtd+eZVIq4dhLZGyA 9JDw/wBQRg8dQj2GsQhh4U0VGLkXhY64Hv2LRqgVtDy5Fp9Arl5sJ1h5sLRn+Y37XQHl moCSyW/r+K5VahNIJktsXe64jppD7+oEuql1fcit6J13DG//+AIVMupIs91Z2lVv77Rd hT/kRr7C7230XsRV4KspeNGUqAE8Zakd0GQWnJYZMXysyWHMOLNzq1MFhWgisEt26he0 pq479WS3hqXIIxfaPmJOo+1bqZ6sMcMF9ncsjmHS6TI+Z/FC2AQfoi/bdY6OknKJgttb E1nw== 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=2sdxv3dgmobchGTZXq4ItSud4I5lO54dfCluBdiq+N0=; b=g/E6Jnz9KKFrLCG36Sc/7azOpO568B3QZ8SvxDiaaPBGIQ2a5QYLP4IIUaCQ6cWKj9 oFRG+TgfHq+yOD5xbdrbDpN08ApkFNnd48utON4mt4+0gVOEKuAcNkH/Br4sWaBvCswe Am0lUmMv1vsblnWI8cMCKWI6EYEBT4z/D+GyhOy+KUbV5bZHL6Cs7K+88RN6xQDIkhtw 7ITM0QdTbUI5z3rbNFlxHgWiEoPLWgECcBvGGPcOGoKoyKiDwR8AuWE8cg3J7beWoM0H fACNPB3ZpiOd7WIPNgvH0V+VjQavXv+rGqb4wZMcpit+XzBYvVD1rtEURB8hv8mHFfoV Seog== X-Gm-Message-State: AGi0PuaywP7n5aKjcjGftnx2xqK/F0bmwVsffH7FXePU1pZL9JZPyoAJ Z0CzuKulKW2IJtsvhKnLiLeMrpMKLP4= X-Received: by 2002:a63:296:: with SMTP id 144mr23831256pgc.110.1587518275718; Tue, 21 Apr 2020 18:17:55 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 25/36] tcg: Remove tcg_gen_dup{8,16,32,64}i_vec Date: Tue, 21 Apr 2020 18:17:11 -0700 Message-Id: <20200422011722.13287-26-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::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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::42c 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. 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 Reviewed-by: Alex Bennée diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 11ed9192f7..a39eb13ff0 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -959,10 +959,6 @@ void tcg_gen_mov_vec(TCGv_vec, TCGv_vec); void tcg_gen_dup_i32_vec(unsigned vece, TCGv_vec, TCGv_i32); void tcg_gen_dup_i64_vec(unsigned vece, TCGv_vec, TCGv_i64); void tcg_gen_dup_mem_vec(unsigned vece, TCGv_vec, TCGv_ptr, tcg_target_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 6343046e18..a9c16d85c5 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -284,26 +284,6 @@ void tcg_gen_dupi_vec(unsigned vece, TCGv_vec dest, 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); From patchwork Wed Apr 22 01:17: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: 185645 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp173781ilf; Tue, 21 Apr 2020 18:36:26 -0700 (PDT) X-Google-Smtp-Source: APiQypLYoIDrcs1EkbymqCGwB7ge7jB2yrdtJwlEEkRHDuiTb+QZRkZM68Yo1qJ9CQUZ785vvRq+ X-Received: by 2002:a0c:a986:: with SMTP id a6mr3923266qvb.79.1587519386448; Tue, 21 Apr 2020 18:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587519386; cv=none; d=google.com; s=arc-20160816; b=nEQqV+gBFuhwcMwXqxgOW+4323VSu8xrc4bnZJSSi3WGV1KqqDlHgvMnY7SM/8GFFv nT2DGpxyxHhPI/IrclOuhQ+Lp85U6foCerGMg4+bo64v8+Ai5s4Jl4Uxs0Cu0MkBJJ6N QvQOGA/oSfEVSqxMp3yU7VNfIWWuS3UDIBJhbtxML5y/BcG//iKpWhq/7M1gzXQsjWJ3 5oVTJTAIZy6TtXoCtVPYG9mxAbSZ285d+XP11MthKsP/EbksUUfiCo2UKmpBEEpdAURJ 5tFdjp/NmYyeq/lzSXrEVlwDAfD6bI08jxQxHYpoZ7cnzuZ6FhN2Y2qdgvRRUjTpJDEj IFpQ== 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=NursXVv/HRRUgUycsc5QQiTW037ba/6j60CDRbihF7Q=; b=Rs3ng/b5zHjqdAT96yDmg2KE3EIxlJACS0cMDJJmwCpinuYzqpltFz/oqMOrLiIEzQ Tt/HVElKh2eoi0lJ8krrLllEwKa/kQL2/OEO8/XUotgTlO9LRbgoAL6EkC/T12NpnyIF kz0j77Dwb4jXYnNtg86s+fUievDfmZSg8c5tWeXLj18WSWtYotI/W5Ig44FQnYd2ayRR WMt4MiToarc0g1eP1/TZvjWQXHS/Slp6aTBZP6Wm0QIvEG1jSGYNeG0PRX1pRlgetXO6 YxILtRLYVQyEGLLLNDSM/N7338+D323cf9tBDpE5S3kQwyj5QihKfdaOqNhNzMp3fwB7 IAww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gtgDWTWJ; 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 a4si2465469qkn.238.2020.04.21.18.36.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:36:26 -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=gtgDWTWJ; 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]:39052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4JN-0007TW-SY for patch@linaro.org; Tue, 21 Apr 2020 21:36:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36014) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41b-00025d-Ey for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41X-0002ai-Gv for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:03 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:38856) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41X-0002VM-1U for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:59 -0400 Received: by mail-pg1-x531.google.com with SMTP id p8so256976pgi.5 for ; Tue, 21 Apr 2020 18:17:58 -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=NursXVv/HRRUgUycsc5QQiTW037ba/6j60CDRbihF7Q=; b=gtgDWTWJlOgzElJupIxbf9un4Z+mXaj1ZGxWE5Sh1VwraFzKz+/kvncsm879RVoXh3 owJ+FqlQba97vwLcWQhMuBW8BeJAcYDlwzW2RBdSdzlfd9CmbC6MVsnMnTp4ZiAwsDVY oDGNlR2hhIECCEXh9/DycwPc5MvgNABSHTU8LSPfBacoF6Jfk6BS93C+9BHFAQJGNAVJ 8D8kPfnFnTKAvF3K+7457fookMjJalZ5zxc9PtCVvtdpzXCy94fICXkP/l/F9SmJ4E1H 9UFclPVoegLy8ipx00tRA/AznOHE1oXJBT4+WJz03iBUnFPNlBj32JiEdyvdtcNQeS8u yMXQ== 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=NursXVv/HRRUgUycsc5QQiTW037ba/6j60CDRbihF7Q=; b=rmfDfnjNDNCWkWZFk8868U4hZSOs7wF/jhs+YZKn8TQbU7L1G9oaeyfdJbvpRfLa1D 9SWJF3dDm1cpfO3dG2J+uFLOtGKcUSxr2WwLJdMHNdSXxUVfqQ8cwFdd+CBxzekfOGou bppBCxyDlUB7ohQzB2WipA7m+EzBeTGf2Y3MSGugDWG/B8LVy3ZwrXt0qPVoiHYUQOKH J1kZhg6uN/dUoQTT/cR97M2T4ih6rhTd1aEA8F6nS7Mr404ID8kxuHyDoD36GMSaRQA6 HIuOfchlaoIBRJwRrz/pah2+NIwilGq+yA9/YAFaVHfC6/p8NKoQKfZZIFtc50wJ8sfn Cd4Q== X-Gm-Message-State: AGi0PubgvHpxbcHnQPgEmE2T1h32diU3/VBItYgJqxLwQRn8cdPOldH7 SQKytUZifJAV4vWp+px+qJapCnjEdxU= X-Received: by 2002:a63:2b42:: with SMTP id r63mr13265329pgr.227.1587518276981; Tue, 21 Apr 2020 18:17:56 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 26/36] tcg: Add load_dest parameter to GVecGen2 Date: Tue, 21 Apr 2020 18:17:12 -0700 Message-Id: <20200422011722.13287-27-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::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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::531 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 have this same parameter for GVecGen2i, GVecGen3, and GVecGen3i. This will make some SVE2 insns easier to parameterize. Signed-off-by: Richard Henderson --- include/tcg/tcg-op-gvec.h | 2 ++ tcg/tcg-op-gvec.c | 45 ++++++++++++++++++++++++++++----------- 2 files changed, 34 insertions(+), 13 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée diff --git a/include/tcg/tcg-op-gvec.h b/include/tcg/tcg-op-gvec.h index d89f91f40e..cea6497341 100644 --- a/include/tcg/tcg-op-gvec.h +++ b/include/tcg/tcg-op-gvec.h @@ -109,6 +109,8 @@ typedef struct { uint8_t vece; /* Prefer i64 to v64. */ bool prefer_i64; + /* Load dest as a 2nd source operand. */ + bool load_dest; } GVecGen2; typedef struct { diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 43cac1a0bf..049a55e700 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -663,17 +663,22 @@ static void expand_clr(uint32_t dofs, uint32_t maxsz) /* Expand OPSZ bytes worth of two-operand operations using i32 elements. */ static void expand_2_i32(uint32_t dofs, uint32_t aofs, uint32_t oprsz, - void (*fni)(TCGv_i32, TCGv_i32)) + bool load_dest, void (*fni)(TCGv_i32, TCGv_i32)) { TCGv_i32 t0 = tcg_temp_new_i32(); + TCGv_i32 t1 = tcg_temp_new_i32(); uint32_t i; for (i = 0; i < oprsz; i += 4) { tcg_gen_ld_i32(t0, cpu_env, aofs + i); - fni(t0, t0); - tcg_gen_st_i32(t0, cpu_env, dofs + i); + if (load_dest) { + tcg_gen_ld_i32(t1, cpu_env, dofs + i); + } + fni(t1, t0); + tcg_gen_st_i32(t1, cpu_env, dofs + i); } tcg_temp_free_i32(t0); + tcg_temp_free_i32(t1); } static void expand_2i_i32(uint32_t dofs, uint32_t aofs, uint32_t oprsz, @@ -793,17 +798,22 @@ static void expand_4_i32(uint32_t dofs, uint32_t aofs, uint32_t bofs, /* Expand OPSZ bytes worth of two-operand operations using i64 elements. */ static void expand_2_i64(uint32_t dofs, uint32_t aofs, uint32_t oprsz, - void (*fni)(TCGv_i64, TCGv_i64)) + bool load_dest, void (*fni)(TCGv_i64, TCGv_i64)) { TCGv_i64 t0 = tcg_temp_new_i64(); + TCGv_i64 t1 = tcg_temp_new_i64(); uint32_t i; for (i = 0; i < oprsz; i += 8) { tcg_gen_ld_i64(t0, cpu_env, aofs + i); - fni(t0, t0); - tcg_gen_st_i64(t0, cpu_env, dofs + i); + if (load_dest) { + tcg_gen_ld_i64(t1, cpu_env, dofs + i); + } + fni(t1, t0); + tcg_gen_st_i64(t1, cpu_env, dofs + i); } tcg_temp_free_i64(t0); + tcg_temp_free_i64(t1); } static void expand_2i_i64(uint32_t dofs, uint32_t aofs, uint32_t oprsz, @@ -924,17 +934,23 @@ static void expand_4_i64(uint32_t dofs, uint32_t aofs, uint32_t bofs, /* Expand OPSZ bytes worth of two-operand operations using host vectors. */ static void expand_2_vec(unsigned vece, uint32_t dofs, uint32_t aofs, uint32_t oprsz, uint32_t tysz, TCGType type, + bool load_dest, void (*fni)(unsigned, TCGv_vec, TCGv_vec)) { TCGv_vec t0 = tcg_temp_new_vec(type); + TCGv_vec t1 = tcg_temp_new_vec(type); uint32_t i; for (i = 0; i < oprsz; i += tysz) { tcg_gen_ld_vec(t0, cpu_env, aofs + i); - fni(vece, t0, t0); - tcg_gen_st_vec(t0, cpu_env, dofs + i); + if (load_dest) { + tcg_gen_ld_vec(t1, cpu_env, dofs + i); + } + fni(vece, t1, t0); + tcg_gen_st_vec(t1, cpu_env, dofs + i); } tcg_temp_free_vec(t0); + tcg_temp_free_vec(t1); } /* Expand OPSZ bytes worth of two-vector operands and an immediate operand @@ -1088,7 +1104,8 @@ void tcg_gen_gvec_2(uint32_t dofs, uint32_t aofs, * that e.g. size == 80 would be expanded with 2x32 + 1x16. */ some = QEMU_ALIGN_DOWN(oprsz, 32); - expand_2_vec(g->vece, dofs, aofs, some, 32, TCG_TYPE_V256, g->fniv); + expand_2_vec(g->vece, dofs, aofs, some, 32, TCG_TYPE_V256, + g->load_dest, g->fniv); if (some == oprsz) { break; } @@ -1098,17 +1115,19 @@ void tcg_gen_gvec_2(uint32_t dofs, uint32_t aofs, maxsz -= some; /* fallthru */ case TCG_TYPE_V128: - expand_2_vec(g->vece, dofs, aofs, oprsz, 16, TCG_TYPE_V128, g->fniv); + expand_2_vec(g->vece, dofs, aofs, oprsz, 16, TCG_TYPE_V128, + g->load_dest, g->fniv); break; case TCG_TYPE_V64: - expand_2_vec(g->vece, dofs, aofs, oprsz, 8, TCG_TYPE_V64, g->fniv); + expand_2_vec(g->vece, dofs, aofs, oprsz, 8, TCG_TYPE_V64, + g->load_dest, g->fniv); break; case 0: if (g->fni8 && check_size_impl(oprsz, 8)) { - expand_2_i64(dofs, aofs, oprsz, g->fni8); + expand_2_i64(dofs, aofs, oprsz, g->load_dest, g->fni8); } else if (g->fni4 && check_size_impl(oprsz, 4)) { - expand_2_i32(dofs, aofs, oprsz, g->fni4); + expand_2_i32(dofs, aofs, oprsz, g->load_dest, g->fni4); } else { assert(g->fno != NULL); tcg_gen_gvec_2_ool(dofs, aofs, oprsz, maxsz, g->data, g->fno); From patchwork Wed Apr 22 01:17: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: 185620 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp162432ilf; Tue, 21 Apr 2020 18:20:49 -0700 (PDT) X-Google-Smtp-Source: APiQypJqPIVm2R+BKv/lsGUM0y6GUVBXFhT54q/6GgYzCR3zr/YA9LYOijrBkz3x8htozyE9ywjr X-Received: by 2002:ac8:1b6a:: with SMTP id p39mr23630627qtk.158.1587518449563; Tue, 21 Apr 2020 18:20:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518449; cv=none; d=google.com; s=arc-20160816; b=tn6xgk8vZr2BTeDyvkWkAg576PmKsQSKQE782tElLIzuKYleltQima3OtObY5MF8zc 2rP90wMX964NV/34phsoGQ+nWWIIk9zP+uBjbmxmljtvPvBnwD/1Q3X+I6oUnrDGZaa5 v8x3Kchm2Jvr2zCIdg9U7YER1VsFZ9+kismKKW9D9kvZf7CLTFqKqG8ym5wFLT1OKuhS I1Q8VWG3Y/tODcNRgC6izrK0zFmZt+8yNvw/x84EbINeHK4vx/fEjcEbzpWUxXk4Xxcq 2P7S87gHTRPJQmT7osoreJFHG2IigsMWAosEOmAN3B/72YjUH/N3RzMfySY49eRdKXbL T4fA== 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=RHqngWpoevmwnP7u6ymNEWWj37NtOSgwRX/BbJgjzrw=; b=h8OqMXaaTqVuIOO1qDXnN7FMwdz3DvRIe9gsAiXGpIqknR2IDQPEShwHVLy/ZXY0xo O7tFGHygYEnOcHhDaAZ/gHKIlU01ZJsVPPmVB6JMB15Pw2X9FhKLPgllolm5gVKDtgst 00OJnRVdZ3PEpj8swsBIiFkB1VTGMi2TI4D2rOk9AxqySxMpOeKJsAkB2yu17OnvfmRA 8yfnG2tP+kSrxBSHdTYqM9SX7jOjDUNrOAQwq2oZVT+lCNgGC52sLUPjCE3zyYrd1290 U5J8xDHKaFBg5eOzwu8iEtxFvPY6S/wSOS8uCEWeoQ3u78FiOk3+zYXaF1WwUW68UImD FFVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MrzYRDrB; 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 r63si2408534qkd.340.2020.04.21.18.20.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:20:49 -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=MrzYRDrB; 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]:38618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR44G-00065K-LX for patch@linaro.org; Tue, 21 Apr 2020 21:20:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36012) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41b-00025c-FY for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41Z-0002cZ-F3 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:03 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:34574) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41X-0002Y5-K8 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:59 -0400 Received: by mail-pf1-x444.google.com with SMTP id x15so234138pfa.1 for ; Tue, 21 Apr 2020 18:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RHqngWpoevmwnP7u6ymNEWWj37NtOSgwRX/BbJgjzrw=; b=MrzYRDrB3sP6Z7XgiVgqz0YwnbJGzLNcwL971wDPYGj1OXkID9Xtu4U9Mn55Wt7+Fc 2JfeeI/eZNWuXzqZPJNTy4075X7AGvUVfA1o5xKRY6665RUQij5u1uzuTaqWsVISs77N cu7/aWUY0eqT7xNtnP1YJo07+eim1/GBrWKtpLsJBtjCwdwGmEZp/I0M7DHihQ9f4/wR QDWC3cqhkeLMzP6aAd7liBWqpy+LrwI+wKyeuVGu36wUKSH1lGhK5x+dcXiIF2afuvwo QjmucEscYeYLTuN6JsLI3UX0BFmj5NT/GOtB4TaMvt4g8/GNn9TpWCs5qOemm/EY9Eml 6EOA== 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=RHqngWpoevmwnP7u6ymNEWWj37NtOSgwRX/BbJgjzrw=; b=uUt8EVFp0zcxRR2I3N5nk0+pZyWNRVWGgLSA4RMkk7XMDSFFybXsGU9xbDDHaPxUdD zSqk96V9TSlhlLwjHfnGYcfdFfnXc3Zxg18OEV0NgDOP5n6HXhNsDnVowKihk7lx2r9I hXwFb3klDW7st16hzwvTJC+C0bnYhVc9RX/sc7U3/0rZYw2WhQniKwCiZPkZGjNhimyc 8ncoA0frkQDF1eUMRjzvAKkmGRt2uVJvf/GrWKbGqpQVB+D6kMMDdZiZEI28ntLVDrqo +7HNsQp+YzM2NEnnp2i13CqE9odvZjw/YOr9MtBwO2N04gYnN5yaW9uonzbelfG2RQ/o 8A7A== X-Gm-Message-State: AGi0PuYFTQm7Swe3NMkd0V1/eGZsqy/vtZL7kxEyO3ybKqU40CdEncXq DD/7bK7qlZ5l4Mfjj1Y5Q43VqSaAysg= X-Received: by 2002:a63:d806:: with SMTP id b6mr8814688pgh.72.1587518277922; Tue, 21 Apr 2020 18:17:57 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.17.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 27/36] tcg: Fix integral argument type to tcg_gen_rot[rl]i_i{32, 64} Date: Tue, 21 Apr 2020 18:17:13 -0700 Message-Id: <20200422011722.13287-28-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::444; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x444.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::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For the benefit of compatibility of function pointer types, we have standardized on int32_t and int64_t as the integral argument to tcg expanders. We converted most of them in 474b2e8f0f7, but missed the rotates. Signed-off-by: Richard Henderson --- include/tcg/tcg-op.h | 8 ++++---- tcg/tcg-op.c | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index a39eb13ff0..b07bf7b524 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -298,9 +298,9 @@ void tcg_gen_ctzi_i32(TCGv_i32 ret, TCGv_i32 arg1, uint32_t arg2); void tcg_gen_clrsb_i32(TCGv_i32 ret, TCGv_i32 arg); void tcg_gen_ctpop_i32(TCGv_i32 a1, TCGv_i32 a2); void tcg_gen_rotl_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); -void tcg_gen_rotli_i32(TCGv_i32 ret, TCGv_i32 arg1, unsigned arg2); +void tcg_gen_rotli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); void tcg_gen_rotr_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); -void tcg_gen_rotri_i32(TCGv_i32 ret, TCGv_i32 arg1, unsigned arg2); +void tcg_gen_rotri_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); void tcg_gen_deposit_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2, unsigned int ofs, unsigned int len); void tcg_gen_deposit_z_i32(TCGv_i32 ret, TCGv_i32 arg, @@ -490,9 +490,9 @@ void tcg_gen_ctzi_i64(TCGv_i64 ret, TCGv_i64 arg1, uint64_t arg2); void tcg_gen_clrsb_i64(TCGv_i64 ret, TCGv_i64 arg); void tcg_gen_ctpop_i64(TCGv_i64 a1, TCGv_i64 a2); void tcg_gen_rotl_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); -void tcg_gen_rotli_i64(TCGv_i64 ret, TCGv_i64 arg1, unsigned arg2); +void tcg_gen_rotli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); void tcg_gen_rotr_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); -void tcg_gen_rotri_i64(TCGv_i64 ret, TCGv_i64 arg1, unsigned arg2); +void tcg_gen_rotri_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); void tcg_gen_deposit_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2, unsigned int ofs, unsigned int len); void tcg_gen_deposit_z_i64(TCGv_i64 ret, TCGv_i64 arg, diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 07eb661a07..202d8057c5 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -516,9 +516,9 @@ void tcg_gen_rotl_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) } } -void tcg_gen_rotli_i32(TCGv_i32 ret, TCGv_i32 arg1, unsigned arg2) +void tcg_gen_rotli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { - tcg_debug_assert(arg2 < 32); + tcg_debug_assert(arg2 >= 0 && arg2 < 32); /* some cases can be optimized here */ if (arg2 == 0) { tcg_gen_mov_i32(ret, arg1); @@ -554,9 +554,9 @@ void tcg_gen_rotr_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) } } -void tcg_gen_rotri_i32(TCGv_i32 ret, TCGv_i32 arg1, unsigned arg2) +void tcg_gen_rotri_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { - tcg_debug_assert(arg2 < 32); + tcg_debug_assert(arg2 >= 0 && arg2 < 32); /* some cases can be optimized here */ if (arg2 == 0) { tcg_gen_mov_i32(ret, arg1); @@ -1949,9 +1949,9 @@ void tcg_gen_rotl_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) } } -void tcg_gen_rotli_i64(TCGv_i64 ret, TCGv_i64 arg1, unsigned arg2) +void tcg_gen_rotli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) { - tcg_debug_assert(arg2 < 64); + tcg_debug_assert(arg2 >= 0 && arg2 < 64); /* some cases can be optimized here */ if (arg2 == 0) { tcg_gen_mov_i64(ret, arg1); @@ -1986,9 +1986,9 @@ void tcg_gen_rotr_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) } } -void tcg_gen_rotri_i64(TCGv_i64 ret, TCGv_i64 arg1, unsigned arg2) +void tcg_gen_rotri_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) { - tcg_debug_assert(arg2 < 64); + tcg_debug_assert(arg2 >= 0 && arg2 < 64); /* some cases can be optimized here */ if (arg2 == 0) { tcg_gen_mov_i64(ret, arg1); From patchwork Wed Apr 22 01:17:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185648 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp175106ilf; Tue, 21 Apr 2020 18:38:09 -0700 (PDT) X-Google-Smtp-Source: APiQypKXzeTRoUPK6zbl6lkiAttOBpsOhoLV6+uIshPwd0CmgzINYoWAJOtn8D+Gh5+uuroZGdxS X-Received: by 2002:aed:3e87:: with SMTP id n7mr24652646qtf.301.1587519489404; Tue, 21 Apr 2020 18:38:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587519489; cv=none; d=google.com; s=arc-20160816; b=vtfQ9rOOPt3oRIILaEg339+nONpFUfxnUxT0JNf7V4SeRP7A2Gk3HAqJ6rDeT2/IkH 6I+Sz1LkBp6ddkIm6uuhMEO3ojQaEXpfCJ95yM/53ndvrin9q50YC7+n0mcyo6LO2mLi gwFMzgt5t40t2dPZpl128oQdXKSftY49IYjnjK4LWxcXJdR2OwXqBObE+yYNeT8SzhmF OcUPgp7f42DxWjgG8Qi0oPBKoRO19kFGAisDn2Tjo9EauCmWK8I5FwBHB9QZqW+dRPNm vBxRFPWcb0QnZYA3nVfVs/RiKarmxXtBDdO4V9U6Z3bF0zKPaQuM55ENA1m81UNYnjtY B1ug== 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=nAoj3X5OTVqp+eKDn7XYP1jFDC+EKazjlRlIVTmBXzM=; b=elOtBUfwfhWcchvQnGBOak8Bmq0R8VoK8+thwGUZ/yNV51hhHjaqMGNYKlgClq3spY H+jBUAAp8hc03mBfpUQfj6YPVWB1HLJy32QfSSeOc9bOlwyowsQBDl5ZyAUasm/GeunK 3+xqCCQeSvQH1ZF+i4b4E6d1vhOZqAUXY02YIb3rqBpgQSO10goZ5YAcMat++kDhai2H PljN6Qh+KNfilMgYicdWNA0I+04HQuZjTLpA2gBnJ8Qf97ki4I24n1Fpj8J7yvn0nZoT w98vPdTZ4Vrpr2D3WSPloVoLlW4Z+bg4LEXaL1u5ouruSIKSoUglZGp9DcCLlm/viY2z Iqpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QyZqC1WU; 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 l7si2399796qtd.230.2020.04.21.18.38.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:38: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=QyZqC1WU; 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]:39084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4L2-0001jc-Rf for patch@linaro.org; Tue, 21 Apr 2020 21:38:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36080) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41d-00026S-BN for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41b-0002gN-In for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:05 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:33235) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41a-0002cQ-4v for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:03 -0400 Received: by mail-pg1-x543.google.com with SMTP id d17so271097pgo.0 for ; Tue, 21 Apr 2020 18:18:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nAoj3X5OTVqp+eKDn7XYP1jFDC+EKazjlRlIVTmBXzM=; b=QyZqC1WUWJCtbrWD8ZdJ/fjuzbQve27iE8lU933ip/XTZrHHY12Yt/eLevLHSD3nyk VJn2bAqcrm22jvPCjg516xDSSgIyyywn7ARYCIoOxH1sn8dt10Ds+4HBsJC26LLOONhe 5ZNshvBcjUJnou6xcWfhuvpexcxccphEKfrSzVs7QtojVLSA9FNYavgwUFwzUQc7nuWa AbzK0fIWdzbMeaOBnc8+amTS4cnUokrOZJTYhAUAQs6jza3oUA8PlS7Y6+dbjny/ctWC fZDnMJGrP1yJ6ti4P8oH3JhXn/xWiqZLb4cru+eyN5ytX8moZdgMo87AlDf9AghEH14r i9VQ== 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=nAoj3X5OTVqp+eKDn7XYP1jFDC+EKazjlRlIVTmBXzM=; b=m6mAE/bZK9uyEcvC1grCN+PuZyP1mH7EUX3YqcASVS/64Ll9OcZ8T7J0j2HeyZODzF jHu0USYgl29YjlvUBXkcVmwsWTFIXJRbCedFK3y1pGrHnxUURSOSfQDCscEUALe9NNs0 hkCZALCk/OB9NdL5aAknTbkG+3WB84a64iwc6yhHALfd0YSuJPqdiI3108I6A6g+u2eo SmRaUR7JAG/xRd6no8K9/qs57lAyGXSPLhgrAH+x5YvmVcItc5iypyI15TRsexHhmZDv QANT/y1EUOzT7HR8bRV6h/ftXa2p6auP8gAyExkoBQick+giYm2XbPU7XS2VFNWBIx0T hniw== X-Gm-Message-State: AGi0Pua4AYs5GMtssvVhe3gFH67JFJyx9daq/DupEwzMFnZ/4XAleGB2 OYl2uN0t7fznJEPiwbkyTV23ls9Rmys= X-Received: by 2002:aa7:843a:: with SMTP id q26mr17449862pfn.240.1587518279183; Tue, 21 Apr 2020 18:17:59 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.17.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 28/36] tcg: Implement gvec support for rotate by immediate Date: Tue, 21 Apr 2020 18:17:14 -0700 Message-Id: <20200422011722.13287-29-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::543; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x543.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::543 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" No host backend support yet, but the interfaces for rotli are in place. Canonicalize immediate rotate to the left, based on a survey of architectures, but provide both left and right shift interfaces to the translators. Signed-off-by: Richard Henderson --- accel/tcg/tcg-runtime.h | 5 +++ include/tcg/tcg-op-gvec.h | 6 ++++ include/tcg/tcg-op.h | 2 ++ include/tcg/tcg-opc.h | 1 + include/tcg/tcg.h | 1 + tcg/aarch64/tcg-target.h | 1 + tcg/i386/tcg-target.h | 1 + tcg/ppc/tcg-target.h | 1 + accel/tcg/tcg-runtime-gvec.c | 48 +++++++++++++++++++++++++ tcg/tcg-op-gvec.c | 68 ++++++++++++++++++++++++++++++++++++ tcg/tcg-op-vec.c | 12 +++++++ tcg/tcg.c | 2 ++ tcg/README | 3 +- 13 files changed, 150 insertions(+), 1 deletion(-) -- 2.20.1 Reviewed-by: Alex Bennée diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h index 4fa61b49b4..cf10c8361e 100644 --- a/accel/tcg/tcg-runtime.h +++ b/accel/tcg/tcg-runtime.h @@ -259,6 +259,11 @@ DEF_HELPER_FLAGS_3(gvec_sar16i, TCG_CALL_NO_RWG, void, ptr, ptr, i32) DEF_HELPER_FLAGS_3(gvec_sar32i, TCG_CALL_NO_RWG, void, ptr, ptr, i32) DEF_HELPER_FLAGS_3(gvec_sar64i, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_rotl8i, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_rotl16i, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_rotl32i, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_rotl64i, TCG_CALL_NO_RWG, void, ptr, ptr, i32) + DEF_HELPER_FLAGS_4(gvec_shl8v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_shl16v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_shl32v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) diff --git a/include/tcg/tcg-op-gvec.h b/include/tcg/tcg-op-gvec.h index cea6497341..1afc3ebf03 100644 --- a/include/tcg/tcg-op-gvec.h +++ b/include/tcg/tcg-op-gvec.h @@ -334,6 +334,10 @@ void tcg_gen_gvec_shri(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t shift, uint32_t oprsz, uint32_t maxsz); void tcg_gen_gvec_sari(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t shift, uint32_t oprsz, uint32_t maxsz); +void tcg_gen_gvec_rotli(unsigned vece, uint32_t dofs, uint32_t aofs, + int64_t shift, uint32_t oprsz, uint32_t maxsz); +void tcg_gen_gvec_rotri(unsigned vece, uint32_t dofs, uint32_t aofs, + int64_t shift, uint32_t oprsz, uint32_t maxsz); void tcg_gen_gvec_shls(unsigned vece, uint32_t dofs, uint32_t aofs, TCGv_i32 shift, uint32_t oprsz, uint32_t maxsz); @@ -388,5 +392,7 @@ void tcg_gen_vec_shr8i_i64(TCGv_i64 d, TCGv_i64 a, int64_t); void tcg_gen_vec_shr16i_i64(TCGv_i64 d, TCGv_i64 a, int64_t); void tcg_gen_vec_sar8i_i64(TCGv_i64 d, TCGv_i64 a, int64_t); void tcg_gen_vec_sar16i_i64(TCGv_i64 d, TCGv_i64 a, int64_t); +void tcg_gen_vec_rotl8i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c); +void tcg_gen_vec_rotl16i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c); #endif diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index b07bf7b524..c624e371d5 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -986,6 +986,8 @@ void tcg_gen_umax_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); void tcg_gen_shli_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i); void tcg_gen_shri_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i); void tcg_gen_sari_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i); +void tcg_gen_rotli_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i); +void tcg_gen_rotri_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i); void tcg_gen_shls_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s); void tcg_gen_shrs_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s); diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h index 4a9cbf5426..c46c096c3e 100644 --- a/include/tcg/tcg-opc.h +++ b/include/tcg/tcg-opc.h @@ -245,6 +245,7 @@ DEF(not_vec, 1, 1, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_not_vec)) DEF(shli_vec, 1, 1, 1, IMPLVEC | IMPL(TCG_TARGET_HAS_shi_vec)) DEF(shri_vec, 1, 1, 1, IMPLVEC | IMPL(TCG_TARGET_HAS_shi_vec)) DEF(sari_vec, 1, 1, 1, IMPLVEC | IMPL(TCG_TARGET_HAS_shi_vec)) +DEF(rotli_vec, 1, 1, 1, IMPLVEC | IMPL(TCG_TARGET_HAS_roti_vec)) DEF(shls_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shs_vec)) DEF(shrs_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shs_vec)) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index f72530dfda..d2034d9334 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -182,6 +182,7 @@ typedef uint64_t TCGRegSet; #define TCG_TARGET_HAS_not_vec 0 #define TCG_TARGET_HAS_andc_vec 0 #define TCG_TARGET_HAS_orc_vec 0 +#define TCG_TARGET_HAS_roti_vec 0 #define TCG_TARGET_HAS_shi_vec 0 #define TCG_TARGET_HAS_shs_vec 0 #define TCG_TARGET_HAS_shv_vec 0 diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index ca214f6909..225a597f84 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -133,6 +133,7 @@ typedef enum { #define TCG_TARGET_HAS_not_vec 1 #define TCG_TARGET_HAS_neg_vec 1 #define TCG_TARGET_HAS_abs_vec 1 +#define TCG_TARGET_HAS_roti_vec 0 #define TCG_TARGET_HAS_shi_vec 1 #define TCG_TARGET_HAS_shs_vec 0 #define TCG_TARGET_HAS_shv_vec 1 diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index bfb3f5f6e9..23aabde992 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -183,6 +183,7 @@ extern bool have_avx2; #define TCG_TARGET_HAS_not_vec 0 #define TCG_TARGET_HAS_neg_vec 0 #define TCG_TARGET_HAS_abs_vec 1 +#define TCG_TARGET_HAS_roti_vec 0 #define TCG_TARGET_HAS_shi_vec 1 #define TCG_TARGET_HAS_shs_vec 1 #define TCG_TARGET_HAS_shv_vec have_avx2 diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h index 4fa21f0e71..e57b891aa5 100644 --- a/tcg/ppc/tcg-target.h +++ b/tcg/ppc/tcg-target.h @@ -161,6 +161,7 @@ extern bool have_vsx; #define TCG_TARGET_HAS_not_vec 1 #define TCG_TARGET_HAS_neg_vec have_isa_3_00 #define TCG_TARGET_HAS_abs_vec 0 +#define TCG_TARGET_HAS_roti_vec 0 #define TCG_TARGET_HAS_shi_vec 0 #define TCG_TARGET_HAS_shs_vec 0 #define TCG_TARGET_HAS_shv_vec 1 diff --git a/accel/tcg/tcg-runtime-gvec.c b/accel/tcg/tcg-runtime-gvec.c index ca449702e6..34b1030365 100644 --- a/accel/tcg/tcg-runtime-gvec.c +++ b/accel/tcg/tcg-runtime-gvec.c @@ -716,6 +716,54 @@ void HELPER(gvec_sar64i)(void *d, void *a, uint32_t desc) clear_high(d, oprsz, desc); } +void HELPER(gvec_rotl8i)(void *d, void *a, uint32_t desc) +{ + intptr_t oprsz = simd_oprsz(desc); + int shift = simd_data(desc); + intptr_t i; + + for (i = 0; i < oprsz; i += sizeof(uint8_t)) { + *(uint8_t *)(d + i) = rol8(*(uint8_t *)(a + i), shift); + } + clear_high(d, oprsz, desc); +} + +void HELPER(gvec_rotl16i)(void *d, void *a, uint32_t desc) +{ + intptr_t oprsz = simd_oprsz(desc); + int shift = simd_data(desc); + intptr_t i; + + for (i = 0; i < oprsz; i += sizeof(uint16_t)) { + *(uint16_t *)(d + i) = rol16(*(uint16_t *)(a + i), shift); + } + clear_high(d, oprsz, desc); +} + +void HELPER(gvec_rotl32i)(void *d, void *a, uint32_t desc) +{ + intptr_t oprsz = simd_oprsz(desc); + int shift = simd_data(desc); + intptr_t i; + + for (i = 0; i < oprsz; i += sizeof(uint32_t)) { + *(uint32_t *)(d + i) = rol32(*(uint32_t *)(a + i), shift); + } + clear_high(d, oprsz, desc); +} + +void HELPER(gvec_rotl64i)(void *d, void *a, uint32_t desc) +{ + intptr_t oprsz = simd_oprsz(desc); + int shift = simd_data(desc); + intptr_t i; + + for (i = 0; i < oprsz; i += sizeof(uint64_t)) { + *(uint64_t *)(d + i) = rol64(*(uint64_t *)(a + i), shift); + } + clear_high(d, oprsz, desc); +} + void HELPER(gvec_shl8v)(void *d, void *a, void *b, uint32_t desc) { intptr_t oprsz = simd_oprsz(desc); diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 049a55e700..25300b1577 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -2694,6 +2694,74 @@ void tcg_gen_gvec_sari(unsigned vece, uint32_t dofs, uint32_t aofs, } } +void tcg_gen_vec_rotl8i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c) +{ + uint64_t mask = dup_const(MO_8, 0xff << c); + + tcg_gen_shli_i64(d, a, c); + tcg_gen_shri_i64(a, a, 8 - c); + tcg_gen_andi_i64(d, d, mask); + tcg_gen_andi_i64(a, a, ~mask); + tcg_gen_or_i64(d, d, a); +} + +void tcg_gen_vec_rotl16i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c) +{ + uint64_t mask = dup_const(MO_16, 0xffff << c); + + tcg_gen_shli_i64(d, a, c); + tcg_gen_shri_i64(a, a, 16 - c); + tcg_gen_andi_i64(d, d, mask); + tcg_gen_andi_i64(a, a, ~mask); + tcg_gen_or_i64(d, d, a); +} + +void tcg_gen_gvec_rotli(unsigned vece, uint32_t dofs, uint32_t aofs, + int64_t shift, uint32_t oprsz, uint32_t maxsz) +{ + static const TCGOpcode vecop_list[] = { INDEX_op_rotli_vec, 0 }; + static const GVecGen2i g[4] = { + { .fni8 = tcg_gen_vec_rotl8i_i64, + .fniv = tcg_gen_rotli_vec, + .fno = gen_helper_gvec_rotl8i, + .opt_opc = vecop_list, + .vece = MO_8 }, + { .fni8 = tcg_gen_vec_rotl16i_i64, + .fniv = tcg_gen_rotli_vec, + .fno = gen_helper_gvec_rotl16i, + .opt_opc = vecop_list, + .vece = MO_16 }, + { .fni4 = tcg_gen_rotli_i32, + .fniv = tcg_gen_rotli_vec, + .fno = gen_helper_gvec_rotl32i, + .opt_opc = vecop_list, + .vece = MO_32 }, + { .fni8 = tcg_gen_rotli_i64, + .fniv = tcg_gen_rotli_vec, + .fno = gen_helper_gvec_rotl64i, + .opt_opc = vecop_list, + .prefer_i64 = TCG_TARGET_REG_BITS == 64, + .vece = MO_64 }, + }; + + tcg_debug_assert(vece <= MO_64); + tcg_debug_assert(shift >= 0 && shift < (8 << vece)); + if (shift == 0) { + tcg_gen_gvec_mov(vece, dofs, aofs, oprsz, maxsz); + } else { + tcg_gen_gvec_2i(dofs, aofs, oprsz, maxsz, shift, &g[vece]); + } +} + +void tcg_gen_gvec_rotri(unsigned vece, uint32_t dofs, uint32_t aofs, + int64_t shift, uint32_t oprsz, uint32_t maxsz) +{ + tcg_debug_assert(vece <= MO_64); + tcg_debug_assert(shift >= 0 && shift < (8 << vece)); + tcg_gen_gvec_rotli(vece, dofs, aofs, -shift & ((8 << vece) - 1), + oprsz, maxsz); +} + /* * Specialized generation vector shifts by a non-constant scalar. */ diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index a9c16d85c5..845cb3de2e 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -546,6 +546,18 @@ void tcg_gen_sari_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i) do_shifti(INDEX_op_sari_vec, vece, r, a, i); } +void tcg_gen_rotli_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i) +{ + do_shifti(INDEX_op_rotli_vec, vece, r, a, i); +} + +void tcg_gen_rotri_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i) +{ + int bits = 8 << vece; + tcg_debug_assert(i >= 0 && i < bits); + do_shifti(INDEX_op_rotli_vec, vece, r, a, -i & (bits - 1)); +} + void tcg_gen_cmp_vec(TCGCond cond, unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { diff --git a/tcg/tcg.c b/tcg/tcg.c index d712d19842..71409073bb 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1697,6 +1697,8 @@ bool tcg_op_supported(TCGOpcode op) case INDEX_op_shrv_vec: case INDEX_op_sarv_vec: return have_vec && TCG_TARGET_HAS_shv_vec; + case INDEX_op_rotli_vec: + return have_vec && TCG_TARGET_HAS_roti_vec; case INDEX_op_ssadd_vec: case INDEX_op_usadd_vec: case INDEX_op_sssub_vec: diff --git a/tcg/README b/tcg/README index bfa2e4ed24..1e3e4654f4 100644 --- a/tcg/README +++ b/tcg/README @@ -605,10 +605,11 @@ E.g. VECL=1 -> 64 << 1 -> v128, and VECE=2 -> 1 << 2 -> i32. * shri_vec v0, v1, i2 * sari_vec v0, v1, i2 +* rotli_vec v0, v1, i2 * shrs_vec v0, v1, s2 * sars_vec v0, v1, s2 - Similarly for logical and arithmetic right shift. + Similarly for logical and arithmetic right shift, and left rotate. * shlv_vec v0, v1, v2 From patchwork Wed Apr 22 01:17: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: 185640 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp171255ilf; Tue, 21 Apr 2020 18:33:11 -0700 (PDT) X-Google-Smtp-Source: APiQypInMkOSIpp7n58sapORGKGxtoytFzbqCI9CrGBgMN7sZY4vdEr/nOAofeA463fM4625H08I X-Received: by 2002:a05:6214:6af:: with SMTP id s15mr22947418qvz.215.1587519191359; Tue, 21 Apr 2020 18:33:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587519191; cv=none; d=google.com; s=arc-20160816; b=HPziSzP4zn90Tp1gL7mOJ5eMyf+v1WEa2xEqgBNCj3If56ZFpXhn1ZfPBAK5bKT4LV Rh6HTn3b/SSV3SCz+5am6t5BW1ZytZjO1a+4rOv3qb/QSDMFKJ4pY8CjDQgY+5pz0UEV B1mxYID9bTyORUnKH3xahOLnVUnbb4eFCkYF3X0iu5CHlfSd500/OHEvxzBAkW8N6WLc 1Zn2Su78X7nIbV95eZSni0anouMIFCL7rYdEdDwSFt5SrJOwgE+qUcR3cDHo5VPuSZhe E6abrkvOkTLc8c9ebdfxsaAsCdv9S4EnIR0UlYfJJ8Q97PC24qjNeuHP1UJYyoBwY0PB FK8g== 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=I/8aNh0JgOwspHXHoCNpRtPerZWtWFokWr28SOX2pYY=; b=i0IgEUoxzPYeREHXMxMbQslSdnukg0SUUC9QPo5zoAYkYGiEyee/AEzox3xpYkUQX3 aBvQGbpAhRJ1meQWsuviREosMHVr4rtzCZykshznnXLRnIJd7C7WVt/69Og8r+lZqv03 xCUNsb0wGerVXYm0tVG8oWIjFu1qU/8PCkoHdx4+wRz8eqW8470k07B/wRrl8p/CLyoE YQhXh/Fh/9+mV3SqD+WhgwRN2vvjrUDxxFIIpYlH6TTWAuqh1/xUwHQxof/VJ3vU0b32 rNnw1i568p6iTJF3lBWq8MGpyKV+j2pfPS+R39m4ex9EGIP8ndCRSzc5bJjV/enpZujn ysrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ovRx8aRJ; 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 y14si2459325qth.54.2020.04.21.18.33.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:33: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=ovRx8aRJ; 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]:38972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4GE-0001pz-R4 for patch@linaro.org; Tue, 21 Apr 2020 21:33:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36310) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41i-0002DC-QM for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41d-0002hV-AS for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:10 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:42349) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41b-0002dB-5C for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:03 -0400 Received: by mail-pg1-x531.google.com with SMTP id g6so248313pgs.9 for ; Tue, 21 Apr 2020 18:18:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=I/8aNh0JgOwspHXHoCNpRtPerZWtWFokWr28SOX2pYY=; b=ovRx8aRJ1zpE+R+7vOF27VKLX6mBxZB+ifvnDNGFbo1SGa3UXyTedKNGTub1jdHfTa F8nVc8oK/NSSWZdQ/fAauoZ3a1JwSV78HH9BkWT9uvRd4RFDQWJtuVwcbj5T6ZGcsPbI sSG7aZ315YHZdSldGCvC4ZtVI55QMilCHMqISUbusobPoBdCAvCKr7+1ymvfCQXjzGIO HqX4+Xo/4Lm+tbaBISsBsiJbxQf5iwLCe2/CzieDGCcVuJ4t1VdGXMDfYrY9FCnzz/4U em/WEJ1OBJx0FMtkOKe0AoXpfvNmiH5VpENfHKeRmkuSMt9kPuKKzUH0mXA5UdT5rkpj gv5A== 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=I/8aNh0JgOwspHXHoCNpRtPerZWtWFokWr28SOX2pYY=; b=JI7jdYBA+5iic5mlHZLHhk50k41hbV/IO5RqDr9ScAAxvz9f04M0LF6nY/Pdljrddk GmPuMkXi3l6St7k6U9hKH7i01C7sz61zEFon3J+mKhM1zeHn96sj37xRegWF4FMB9/TC 2UFTSVNL84zOGkHBEWimUB/22m4Ybv/Vh4qn9L0WQoCw2xDWHggYfcZ/Q7VzLjGQ0krt xQQk+cqQhCr9W0MuLG2mJ5aQntwqlLuYar7XcV3y9hltY9T8P4+e5uuhSmBA0JNunl1+ nXDFCnZt+by+KJ134kqSWCcc3CtEfR9oEEhFXHKjd7ObQ2+lqvR/YGYJaaqQq5DaljGx ZPPw== X-Gm-Message-State: AGi0PuZWlNujy1AC+WvHYwnzP2fRMsIZdL6178+bBbWXnzoLzNc6QWgr rhWa4C7n/sQguDEDF4xRJIJLd38f5cg= X-Received: by 2002:a62:3285:: with SMTP id y127mr24596970pfy.234.1587518280416; Tue, 21 Apr 2020 18:18:00 -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.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 29/36] tcg: Implement gvec support for rotate by vector Date: Tue, 21 Apr 2020 18:17:15 -0700 Message-Id: <20200422011722.13287-30-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::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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::531 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" No host backend support yet, but the interfaces for rotlv and rotrv are in place. Signed-off-by: Richard Henderson --- accel/tcg/tcg-runtime.h | 10 +++ include/tcg/tcg-op-gvec.h | 4 ++ include/tcg/tcg-op.h | 2 + include/tcg/tcg-opc.h | 2 + include/tcg/tcg.h | 1 + tcg/aarch64/tcg-target.h | 1 + tcg/i386/tcg-target.h | 1 + tcg/ppc/tcg-target.h | 1 + accel/tcg/tcg-runtime-gvec.c | 96 +++++++++++++++++++++++++++ tcg/tcg-op-gvec.c | 122 +++++++++++++++++++++++++++++++++++ tcg/tcg-op-vec.c | 83 ++++++++++++++++++++++++ tcg/tcg.c | 3 + tcg/README | 4 +- 13 files changed, 329 insertions(+), 1 deletion(-) -- 2.20.1 Reviewed-by: Alex Bennée diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h index cf10c8361e..4eda24e63a 100644 --- a/accel/tcg/tcg-runtime.h +++ b/accel/tcg/tcg-runtime.h @@ -279,6 +279,16 @@ DEF_HELPER_FLAGS_4(gvec_sar16v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_sar32v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_sar64v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_rotl8v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_rotl16v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_rotl32v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_rotl64v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + +DEF_HELPER_FLAGS_4(gvec_rotr8v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_rotr16v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_rotr32v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_rotr64v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + DEF_HELPER_FLAGS_4(gvec_eq8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_eq16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_eq32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) diff --git a/include/tcg/tcg-op-gvec.h b/include/tcg/tcg-op-gvec.h index 1afc3ebf03..2d768f1160 100644 --- a/include/tcg/tcg-op-gvec.h +++ b/include/tcg/tcg-op-gvec.h @@ -356,6 +356,10 @@ void tcg_gen_gvec_shrv(unsigned vece, uint32_t dofs, uint32_t aofs, uint32_t bofs, uint32_t oprsz, uint32_t maxsz); void tcg_gen_gvec_sarv(unsigned vece, uint32_t dofs, uint32_t aofs, uint32_t bofs, uint32_t oprsz, uint32_t maxsz); +void tcg_gen_gvec_rotlv(unsigned vece, uint32_t dofs, uint32_t aofs, + uint32_t bofs, uint32_t oprsz, uint32_t maxsz); +void tcg_gen_gvec_rotrv(unsigned vece, uint32_t dofs, uint32_t aofs, + uint32_t bofs, uint32_t oprsz, uint32_t maxsz); void tcg_gen_gvec_cmp(TCGCond cond, unsigned vece, uint32_t dofs, uint32_t aofs, uint32_t bofs, diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index c624e371d5..0468009713 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -996,6 +996,8 @@ void tcg_gen_sars_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s); void tcg_gen_shlv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s); void tcg_gen_shrv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s); void tcg_gen_sarv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s); +void tcg_gen_rotlv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s); +void tcg_gen_rotrv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s); void tcg_gen_cmp_vec(TCGCond cond, unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h index c46c096c3e..d80335ba0d 100644 --- a/include/tcg/tcg-opc.h +++ b/include/tcg/tcg-opc.h @@ -254,6 +254,8 @@ DEF(sars_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shs_vec)) DEF(shlv_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shv_vec)) DEF(shrv_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shv_vec)) DEF(sarv_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shv_vec)) +DEF(rotlv_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_rotv_vec)) +DEF(rotrv_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_rotv_vec)) DEF(cmp_vec, 1, 2, 1, IMPLVEC) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index d2034d9334..6bb2e3fe3c 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -183,6 +183,7 @@ typedef uint64_t TCGRegSet; #define TCG_TARGET_HAS_andc_vec 0 #define TCG_TARGET_HAS_orc_vec 0 #define TCG_TARGET_HAS_roti_vec 0 +#define TCG_TARGET_HAS_rotv_vec 0 #define TCG_TARGET_HAS_shi_vec 0 #define TCG_TARGET_HAS_shs_vec 0 #define TCG_TARGET_HAS_shv_vec 0 diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index 225a597f84..a5477bbc07 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -134,6 +134,7 @@ typedef enum { #define TCG_TARGET_HAS_neg_vec 1 #define TCG_TARGET_HAS_abs_vec 1 #define TCG_TARGET_HAS_roti_vec 0 +#define TCG_TARGET_HAS_rotv_vec 0 #define TCG_TARGET_HAS_shi_vec 1 #define TCG_TARGET_HAS_shs_vec 0 #define TCG_TARGET_HAS_shv_vec 1 diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 23aabde992..4c806c97db 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -184,6 +184,7 @@ extern bool have_avx2; #define TCG_TARGET_HAS_neg_vec 0 #define TCG_TARGET_HAS_abs_vec 1 #define TCG_TARGET_HAS_roti_vec 0 +#define TCG_TARGET_HAS_rotv_vec 0 #define TCG_TARGET_HAS_shi_vec 1 #define TCG_TARGET_HAS_shs_vec 1 #define TCG_TARGET_HAS_shv_vec have_avx2 diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h index e57b891aa5..7993422526 100644 --- a/tcg/ppc/tcg-target.h +++ b/tcg/ppc/tcg-target.h @@ -162,6 +162,7 @@ extern bool have_vsx; #define TCG_TARGET_HAS_neg_vec have_isa_3_00 #define TCG_TARGET_HAS_abs_vec 0 #define TCG_TARGET_HAS_roti_vec 0 +#define TCG_TARGET_HAS_rotv_vec 0 #define TCG_TARGET_HAS_shi_vec 0 #define TCG_TARGET_HAS_shs_vec 0 #define TCG_TARGET_HAS_shv_vec 1 diff --git a/accel/tcg/tcg-runtime-gvec.c b/accel/tcg/tcg-runtime-gvec.c index 34b1030365..521da4a813 100644 --- a/accel/tcg/tcg-runtime-gvec.c +++ b/accel/tcg/tcg-runtime-gvec.c @@ -908,6 +908,102 @@ void HELPER(gvec_sar64v)(void *d, void *a, void *b, uint32_t desc) clear_high(d, oprsz, desc); } +void HELPER(gvec_rotl8v)(void *d, void *a, void *b, uint32_t desc) +{ + intptr_t oprsz = simd_oprsz(desc); + intptr_t i; + + for (i = 0; i < oprsz; i += sizeof(uint8_t)) { + uint8_t sh = *(uint8_t *)(b + i) & 7; + *(uint8_t *)(d + i) = rol8(*(uint8_t *)(a + i), sh); + } + clear_high(d, oprsz, desc); +} + +void HELPER(gvec_rotl16v)(void *d, void *a, void *b, uint32_t desc) +{ + intptr_t oprsz = simd_oprsz(desc); + intptr_t i; + + for (i = 0; i < oprsz; i += sizeof(uint16_t)) { + uint8_t sh = *(uint16_t *)(b + i) & 15; + *(uint16_t *)(d + i) = rol16(*(uint16_t *)(a + i), sh); + } + clear_high(d, oprsz, desc); +} + +void HELPER(gvec_rotl32v)(void *d, void *a, void *b, uint32_t desc) +{ + intptr_t oprsz = simd_oprsz(desc); + intptr_t i; + + for (i = 0; i < oprsz; i += sizeof(uint32_t)) { + uint8_t sh = *(uint32_t *)(b + i) & 31; + *(uint32_t *)(d + i) = rol32(*(uint32_t *)(a + i), sh); + } + clear_high(d, oprsz, desc); +} + +void HELPER(gvec_rotl64v)(void *d, void *a, void *b, uint32_t desc) +{ + intptr_t oprsz = simd_oprsz(desc); + intptr_t i; + + for (i = 0; i < oprsz; i += sizeof(uint64_t)) { + uint8_t sh = *(uint64_t *)(b + i) & 63; + *(uint64_t *)(d + i) = rol64(*(uint64_t *)(a + i), sh); + } + clear_high(d, oprsz, desc); +} + +void HELPER(gvec_rotr8v)(void *d, void *a, void *b, uint32_t desc) +{ + intptr_t oprsz = simd_oprsz(desc); + intptr_t i; + + for (i = 0; i < oprsz; i += sizeof(uint8_t)) { + uint8_t sh = *(uint8_t *)(b + i) & 7; + *(uint8_t *)(d + i) = ror8(*(uint8_t *)(a + i), sh); + } + clear_high(d, oprsz, desc); +} + +void HELPER(gvec_rotr16v)(void *d, void *a, void *b, uint32_t desc) +{ + intptr_t oprsz = simd_oprsz(desc); + intptr_t i; + + for (i = 0; i < oprsz; i += sizeof(uint16_t)) { + uint8_t sh = *(uint16_t *)(b + i) & 15; + *(uint16_t *)(d + i) = ror16(*(uint16_t *)(a + i), sh); + } + clear_high(d, oprsz, desc); +} + +void HELPER(gvec_rotr32v)(void *d, void *a, void *b, uint32_t desc) +{ + intptr_t oprsz = simd_oprsz(desc); + intptr_t i; + + for (i = 0; i < oprsz; i += sizeof(uint32_t)) { + uint8_t sh = *(uint32_t *)(b + i) & 31; + *(uint32_t *)(d + i) = ror32(*(uint32_t *)(a + i), sh); + } + clear_high(d, oprsz, desc); +} + +void HELPER(gvec_rotr64v)(void *d, void *a, void *b, uint32_t desc) +{ + intptr_t oprsz = simd_oprsz(desc); + intptr_t i; + + for (i = 0; i < oprsz; i += sizeof(uint64_t)) { + uint8_t sh = *(uint64_t *)(b + i) & 63; + *(uint64_t *)(d + i) = ror64(*(uint64_t *)(a + i), sh); + } + clear_high(d, oprsz, desc); +} + #define DO_CMP1(NAME, TYPE, OP) \ void HELPER(NAME)(void *d, void *a, void *b, uint32_t desc) \ { \ diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 25300b1577..2b71725883 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -3171,6 +3171,128 @@ void tcg_gen_gvec_sarv(unsigned vece, uint32_t dofs, uint32_t aofs, tcg_gen_gvec_3(dofs, aofs, bofs, oprsz, maxsz, &g[vece]); } +/* + * Similarly for rotates. + */ + +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); + + tcg_gen_dupi_vec(vece, t, (8 << vece) - 1); + tcg_gen_and_vec(vece, t, t, b); + tcg_gen_rotlv_vec(vece, d, a, t); + tcg_temp_free_vec(t); +} + +static void tcg_gen_rotl_mod_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) +{ + TCGv_i32 t = tcg_temp_new_i32(); + + tcg_gen_andi_i32(t, b, 31); + tcg_gen_rotl_i32(d, a, t); + tcg_temp_free_i32(t); +} + +static void tcg_gen_rotl_mod_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) +{ + TCGv_i64 t = tcg_temp_new_i64(); + + tcg_gen_andi_i64(t, b, 63); + tcg_gen_rotl_i64(d, a, t); + tcg_temp_free_i64(t); +} + +void tcg_gen_gvec_rotlv(unsigned vece, uint32_t dofs, uint32_t aofs, + uint32_t bofs, uint32_t oprsz, uint32_t maxsz) +{ + static const TCGOpcode vecop_list[] = { INDEX_op_rotlv_vec, 0 }; + static const GVecGen3 g[4] = { + { .fniv = tcg_gen_rotlv_mod_vec, + .fno = gen_helper_gvec_rotl8v, + .opt_opc = vecop_list, + .vece = MO_8 }, + { .fniv = tcg_gen_rotlv_mod_vec, + .fno = gen_helper_gvec_rotl16v, + .opt_opc = vecop_list, + .vece = MO_16 }, + { .fni4 = tcg_gen_rotl_mod_i32, + .fniv = tcg_gen_rotlv_mod_vec, + .fno = gen_helper_gvec_rotl32v, + .opt_opc = vecop_list, + .vece = MO_32 }, + { .fni8 = tcg_gen_rotl_mod_i64, + .fniv = tcg_gen_rotlv_mod_vec, + .fno = gen_helper_gvec_rotl64v, + .opt_opc = vecop_list, + .prefer_i64 = TCG_TARGET_REG_BITS == 64, + .vece = MO_64 }, + }; + + tcg_debug_assert(vece <= MO_64); + tcg_gen_gvec_3(dofs, aofs, bofs, oprsz, maxsz, &g[vece]); +} + +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); + + tcg_gen_dupi_vec(vece, t, (8 << vece) - 1); + tcg_gen_and_vec(vece, t, t, b); + tcg_gen_rotrv_vec(vece, d, a, t); + tcg_temp_free_vec(t); +} + +static void tcg_gen_rotr_mod_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) +{ + TCGv_i32 t = tcg_temp_new_i32(); + + tcg_gen_andi_i32(t, b, 31); + tcg_gen_rotr_i32(d, a, t); + tcg_temp_free_i32(t); +} + +static void tcg_gen_rotr_mod_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) +{ + TCGv_i64 t = tcg_temp_new_i64(); + + tcg_gen_andi_i64(t, b, 63); + tcg_gen_rotr_i64(d, a, t); + tcg_temp_free_i64(t); +} + +void tcg_gen_gvec_rotrv(unsigned vece, uint32_t dofs, uint32_t aofs, + uint32_t bofs, uint32_t oprsz, uint32_t maxsz) +{ + static const TCGOpcode vecop_list[] = { INDEX_op_rotrv_vec, 0 }; + static const GVecGen3 g[4] = { + { .fniv = tcg_gen_rotrv_mod_vec, + .fno = gen_helper_gvec_rotr8v, + .opt_opc = vecop_list, + .vece = MO_8 }, + { .fniv = tcg_gen_rotrv_mod_vec, + .fno = gen_helper_gvec_rotr16v, + .opt_opc = vecop_list, + .vece = MO_16 }, + { .fni4 = tcg_gen_rotr_mod_i32, + .fniv = tcg_gen_rotrv_mod_vec, + .fno = gen_helper_gvec_rotr32v, + .opt_opc = vecop_list, + .vece = MO_32 }, + { .fni8 = tcg_gen_rotr_mod_i64, + .fniv = tcg_gen_rotrv_mod_vec, + .fno = gen_helper_gvec_rotr64v, + .opt_opc = vecop_list, + .prefer_i64 = TCG_TARGET_REG_BITS == 64, + .vece = MO_64 }, + }; + + tcg_debug_assert(vece <= MO_64); + tcg_gen_gvec_3(dofs, aofs, bofs, oprsz, maxsz, &g[vece]); +} + /* Expand OPSZ bytes worth of three-operand operations using i32 elements. */ static void expand_cmp_i32(uint32_t dofs, uint32_t aofs, uint32_t bofs, uint32_t oprsz, TCGCond cond) diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index 845cb3de2e..4af92d6b0a 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -129,6 +129,17 @@ bool tcg_can_emit_vecop_list(const TCGOpcode *list, continue; } break; + case INDEX_op_rotlv_vec: + case INDEX_op_rotrv_vec: + if (tcg_can_emit_vec_op(opc == INDEX_op_rotlv_vec + ? INDEX_op_rotrv_vec + : INDEX_op_rotlv_vec, type, vece)) { + continue; + } + if (tcg_can_emit_vec_op(INDEX_op_shlv_vec, type, vece) && + tcg_can_emit_vec_op(INDEX_op_shrv_vec, type, vece)) { + continue; + } default: break; } @@ -697,6 +708,78 @@ void tcg_gen_sarv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) do_op3_nofail(vece, r, a, b, INDEX_op_sarv_vec); } +static void do_rotv(unsigned vece, TCGv_vec r, TCGv_vec a, + TCGv_vec b, bool right) +{ + TCGTemp *rt = tcgv_vec_temp(r); + TCGTemp *at = tcgv_vec_temp(a); + TCGTemp *bt = tcgv_vec_temp(b); + TCGArg ri = temp_arg(rt); + TCGArg ai = temp_arg(at); + TCGArg bi = temp_arg(bt); + TCGType type = rt->base_type; + TCGOpcode opc = right ? INDEX_op_rotrv_vec : INDEX_op_rotlv_vec; + const TCGOpcode *hold_list; + TCGv_vec t; + int can; + + tcg_debug_assert(at->base_type >= type); + tcg_debug_assert(bt->base_type >= type); + tcg_assert_listed_vecop(opc); + + /* Try the requested shift. */ + can = tcg_can_emit_vec_op(opc, type, vece); + if (can) { + if (can > 0) { + vec_gen_3(opc, type, vece, ri, ai, bi); + } else { + hold_list = tcg_swap_vecop_list(NULL); + tcg_expand_vec_op(opc, type, vece, ri, ai, bi); + tcg_swap_vecop_list(hold_list); + } + return; + } + + hold_list = tcg_swap_vecop_list(NULL); + t = tcg_temp_new_vec(type); + tcg_gen_neg_vec(vece, t, b); + tcg_gen_and_vec(vece, t, t, tcg_constant_vec(type, vece, (8 << vece) - 1)); + + /* Try the reverse shift. */ + opc = right ? INDEX_op_rotlv_vec : INDEX_op_rotrv_vec; + can = tcg_can_emit_vec_op(opc, type, vece); + if (can) { + if (can > 0) { + vec_gen_3(opc, type, vece, ri, ai, tcgv_vec_arg(t)); + } else { + tcg_expand_vec_op(opc, type, vece, ri, ai, tcgv_vec_arg(t)); + } + } else { + /* Fall back to shifts. */ + if (right) { + tcg_gen_shlv_vec(vece, t, a, t); + tcg_gen_shrv_vec(vece, r, a, b); + } else { + tcg_gen_shrv_vec(vece, t, a, t); + tcg_gen_shlv_vec(vece, r, a, b); + } + tcg_gen_or_vec(vece, r, r, t); + } + + tcg_temp_free_vec(t); + tcg_swap_vecop_list(hold_list); +} + +void tcg_gen_rotlv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) +{ + do_rotv(vece, r, a, b, false); +} + +void tcg_gen_rotrv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) +{ + do_rotv(vece, r, a, b, true); +} + static void do_shifts(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s, TCGOpcode opc_s, TCGOpcode opc_v) { diff --git a/tcg/tcg.c b/tcg/tcg.c index 71409073bb..5a82464610 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1699,6 +1699,9 @@ bool tcg_op_supported(TCGOpcode op) return have_vec && TCG_TARGET_HAS_shv_vec; case INDEX_op_rotli_vec: return have_vec && TCG_TARGET_HAS_roti_vec; + case INDEX_op_rotlv_vec: + case INDEX_op_rotrv_vec: + return have_vec && TCG_TARGET_HAS_rotv_vec; case INDEX_op_ssadd_vec: case INDEX_op_usadd_vec: case INDEX_op_sssub_vec: diff --git a/tcg/README b/tcg/README index 1e3e4654f4..a64f67809b 100644 --- a/tcg/README +++ b/tcg/README @@ -621,8 +621,10 @@ E.g. VECL=1 -> 64 << 1 -> v128, and VECE=2 -> 1 << 2 -> i32. * shrv_vec v0, v1, v2 * sarv_vec v0, v1, v2 +* rotlv_vec v0, v1, v2 +* rotrv_vec v0, v1, v2 - Similarly for logical and arithmetic right shift. + Similarly for logical and arithmetic right shift, and rotates. * cmp_vec v0, v1, v2, cond From patchwork Wed Apr 22 01:17:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185644 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp173180ilf; Tue, 21 Apr 2020 18:35:40 -0700 (PDT) X-Google-Smtp-Source: APiQypJ8IOzcTm0nWubezSXFs99QzLWkvQbq4AiqswIIYVNGg/V+I0tZNH1607srJDVxySigCwxJ X-Received: by 2002:ae9:f30f:: with SMTP id p15mr23886826qkg.178.1587519339904; Tue, 21 Apr 2020 18:35:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587519339; cv=none; d=google.com; s=arc-20160816; b=fl08G4NcmkS8L3/P6YinHdqKk6NPv2kH3KBew8j4mIIVp4Egt0PWnX8Jo6RP++6B+N W4XKibpayKD83iGw5GhRbByRqu98atcYKuuaGcsqcqvWlAJ41m13q1Ci5D5ZQubFPMUf iKIWBs7GcaLs2mU8hsPAFczdvAdCE0OJn0Q4svo/5QBwIeok5cTrmNSUu1DkjFhGj8NS Np8vqCz3AN5Qk7ZTdkokux7x0k4fiGHmpYpjX1JKRKAFTwbLXmU4DpIPiANACgT7GRjn F/dz6mE74c4Mot+V1BMWhR5o4LeW0CniJiEDCRebhbsEhmGgmDL4ZxpzfYbaEbar98bs GhZw== 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=m5JVm/hE+eWqh7YcSUCXJKnRiJGAH05U8LdEck/jm6k=; b=ubQnMuA4uNGI7miXCez0kc2U2v1aq6gGB508u2KcEIhsOsWc4kPTGHYlDQhjDMrX8a eIdVrNookVRDB5Yd2u2msKOLzrkY7VN0GgjG32pYJsZAAhTc98UfBSb9dMHrAgNAkz9o nxroLUIbxDYoXMWIzKvFlvuT5wBAe/OiDyVw/4mkCK+DODZ9SU1I0C0VNhjYYL/EpL38 k/f49l3FJw8Kf/7ZnT88qGcaiUSgsOd0DyxbQ6bPTIrMy/7MxceVXOpjx9T3a6VCm6HS LJqcGOgA7AhRbb6PEFicQJS0oICe8PPZUoQyqkDmOWbEuKYsHKS/HXoUMxLs86vqpLV7 Od8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bgbx5lFi; 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 r40si2383753qtb.286.2020.04.21.18.35.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:35:39 -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=bgbx5lFi; 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]:39038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4Id-0006N9-D4 for patch@linaro.org; Tue, 21 Apr 2020 21:35:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36150) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41f-00027Q-2P for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41d-0002hL-Ar for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:06 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:45575) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41b-0002dV-Ap for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:03 -0400 Received: by mail-pg1-x544.google.com with SMTP id f20so240982pgl.12 for ; Tue, 21 Apr 2020 18:18:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m5JVm/hE+eWqh7YcSUCXJKnRiJGAH05U8LdEck/jm6k=; b=bgbx5lFiP+6nO0u2d4Sd8AC2RBpviAKo3HBql/Rrpk5IKeX1y8ZJDhWwZ9xCcff881 o7nsDWZPQTP4DT+izGkxH6WsB6+/XP71ndSrSPGZjPt4Fiqjau26JD0cCmuNyq4YWnFV KRbq2rcLU65zJmWPglmCnTvNFHnqq+QI/76+TVsAVDIeYIQWyxrAEXFlCQX9SbLOuyjL JxJ44oEKfDyNx83U647vtCke+BmtFXfU4pHIZ7t34DbfkDYxTLB0AoDcRm40JpwNRqg2 X166eTLUOmuJEFWBkOFAwtElHUm/hGDrY/KU+mmJG0eQq0LtlRUvRsG6BQbo0rTAwdj/ KCvw== 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=m5JVm/hE+eWqh7YcSUCXJKnRiJGAH05U8LdEck/jm6k=; b=m7dVee7bqU1YVcgnaHpgaEiwUdEQGFFQ78EdVqE8pi5r9Tfudp0lj9RMMDwKO+AUF9 1zySSk0bfL+QHb+Ka89pr2aA1DU16suYcyaXAx65wP3bp+7Me8L+nP9X02eBAnJdmfN3 JCYSDdtjQ9Uezd6cmHj5ciSo4jpxf27oRFiDQ55Hs95jrFpBJMW1YDgzz1klONiXIXHP yXSZOFTWnOqY5k00Nr4J31Ln1/fgKs4HuWyZMS0qs432FP1QIjgdVB5lyb99cgjIz/X1 3A+oGAFa5hkBaRTmSmYfckB0mR4lIi4Q4rurT9DqpSsn2XcZZxQ59/gg/o55nXYAbrbX QI/g== X-Gm-Message-State: AGi0PuZWQ9Wd7PsleFpkfRmFFMqYeUOWaoZg3o42wOgHhTi9TNcrBlBp xIzM+slstDWDLY4Mtci2FKKaOsI6jSk= X-Received: by 2002:a62:528e:: with SMTP id g136mr10769621pfb.165.1587518281596; Tue, 21 Apr 2020 18:18:01 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.18.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:18:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 30/36] tcg: Remove expansion to shift by vector from do_shifts Date: Tue, 21 Apr 2020 18:17:16 -0700 Message-Id: <20200422011722.13287-31-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::544; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x544.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::544 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We do not reflect this expansion in tcg_can_emit_vecop_list, so it is unused and unusable. However, we actually perform the same expansion in do_gvec_shifts, so it is also unneeded. Signed-off-by: Richard Henderson --- tcg/tcg-op-vec.c | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) -- 2.20.1 diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index 4af92d6b0a..52c1b66283 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -781,7 +781,7 @@ void tcg_gen_rotrv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) } static void do_shifts(unsigned vece, TCGv_vec r, TCGv_vec a, - TCGv_i32 s, TCGOpcode opc_s, TCGOpcode opc_v) + TCGv_i32 s, TCGOpcode opc) { TCGTemp *rt = tcgv_vec_temp(r); TCGTemp *at = tcgv_vec_temp(a); @@ -790,48 +790,35 @@ static void do_shifts(unsigned vece, TCGv_vec r, TCGv_vec a, TCGArg ai = temp_arg(at); TCGArg si = temp_arg(st); TCGType type = rt->base_type; - const TCGOpcode *hold_list; int can; tcg_debug_assert(at->base_type >= type); - tcg_assert_listed_vecop(opc_s); - hold_list = tcg_swap_vecop_list(NULL); - - can = tcg_can_emit_vec_op(opc_s, type, vece); + tcg_assert_listed_vecop(opc); + can = tcg_can_emit_vec_op(opc, type, vece); if (can > 0) { - vec_gen_3(opc_s, type, vece, ri, ai, si); + vec_gen_3(opc, type, vece, ri, ai, si); } else if (can < 0) { - tcg_expand_vec_op(opc_s, type, vece, ri, ai, si); + const TCGOpcode *hold_list = tcg_swap_vecop_list(NULL); + tcg_expand_vec_op(opc, type, vece, ri, ai, si); + tcg_swap_vecop_list(hold_list); } else { - TCGv_vec vec_s = tcg_temp_new_vec(type); - - if (vece == MO_64) { - TCGv_i64 s64 = tcg_temp_new_i64(); - tcg_gen_extu_i32_i64(s64, s); - tcg_gen_dup_i64_vec(MO_64, vec_s, s64); - tcg_temp_free_i64(s64); - } else { - tcg_gen_dup_i32_vec(vece, vec_s, s); - } - do_op3_nofail(vece, r, a, vec_s, opc_v); - tcg_temp_free_vec(vec_s); + g_assert_not_reached(); } - tcg_swap_vecop_list(hold_list); } void tcg_gen_shls_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 b) { - do_shifts(vece, r, a, b, INDEX_op_shls_vec, INDEX_op_shlv_vec); + do_shifts(vece, r, a, b, INDEX_op_shls_vec); } void tcg_gen_shrs_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 b) { - do_shifts(vece, r, a, b, INDEX_op_shrs_vec, INDEX_op_shrv_vec); + do_shifts(vece, r, a, b, INDEX_op_shrs_vec); } void tcg_gen_sars_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 b) { - do_shifts(vece, r, a, b, INDEX_op_sars_vec, INDEX_op_sarv_vec); + do_shifts(vece, r, a, b, INDEX_op_sars_vec); } void tcg_gen_bitsel_vec(unsigned vece, TCGv_vec r, TCGv_vec a, From patchwork Wed Apr 22 01:17:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185624 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp163582ilf; Tue, 21 Apr 2020 18:22:31 -0700 (PDT) X-Google-Smtp-Source: APiQypLlQ5De9HgJwI0Aa3QRv3rCJFz/MYqj5CFLOpHziC6HorewWtGSaKmDis+l78+HFhFCQUJk X-Received: by 2002:a37:2e43:: with SMTP id u64mr23230226qkh.386.1587518550923; Tue, 21 Apr 2020 18:22:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518550; cv=none; d=google.com; s=arc-20160816; b=TiNuyqodUG0R83dEhbfgM4sIoHcYj4m5e8Ro5RTU6RuHjhS8LinS7sHIbco+2TnHXy Z6Z/5UzclKOwTH43c+G87nVPuZI8cAb2E7Cxl8TwRdwUzKTOLT0jfALII2mmWPu102TM qxIGGmzSd78soiE+Qjs/N8IRg4sUdqAU2B8b/WlFJS1PgySmMix44ncTZYFyoI9I6ZmW uz9SGx6z4xvqtOBc8XBlJoiCRgYsH2Lpm7pYA9nhpsa15MYrMweg4crt0ttku3xqkQcl XFhCSiFhk9iobTiyZbJEtzP4ZMpiF6ex39B4bjz1P8n0XQt6CaFKZkNNbcpOrvLyBiqr q6rQ== 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=D6SVv03MXxB2K+lEAZ0gVyytKOY11D/Z+5Ub09WGv3Q=; b=BA4s3KjJSPwnJQ4xdilyaNTFAOZi7/bWnMuKFsr4Vtnyfma8grDrFHSAJYaoxte8mM fi5sTIDOKvG7/+TN9/scvzK2BY/OS6E5lR6IDtkf3yNWGs+/2g5jIsWqYjlsoXiucj6z wDOf3SWbvYexzIlP4HeKBrdcaIeplyTruaaioCDiEAEjfc59oxuKnL8beVJNkSosqe0/ GbQFEKT/eWKh0DKeviHvHW4MhHbiYGX4wCYSFV51vCFhirrmd0MXYQrZorV7fwrT43WX 3+Ksqjl8zPFc2+tjSuoOiV9E34DjtwyzYVT3PjHo+5/l/BjCIGDTKE6GXLJo8riTDn/L EUQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NuufV4Gw; 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 d123si2538917qkg.370.2020.04.21.18.22.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:22:30 -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=NuufV4Gw; 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]:38686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR45t-0001CZ-Tl for patch@linaro.org; Tue, 21 Apr 2020 21:22:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36262) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41i-0002CR-DT for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41d-0002jb-I5 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:08 -0400 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]:35016) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41d-0002gr-2Y for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:05 -0400 Received: by mail-pj1-x1044.google.com with SMTP id ms17so163616pjb.0 for ; Tue, 21 Apr 2020 18:18:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D6SVv03MXxB2K+lEAZ0gVyytKOY11D/Z+5Ub09WGv3Q=; b=NuufV4GwkF7z7Dos43Rm7DNpQm9e5cVUBIwc/0zrb3gF/8Qoe4mTByw9HYeN/fmnNC +HN0o2HpEQHPYU3ExjQ8zJLW2VSZOuUBxmPaEhcdzzIbHvOdH7thmRhK1J2+5X3/Dcsa lPIn+I5T6LDwDzSSsEHV1LJbmNgVXPRydZWSE+pyaHvjf4eUsUp0U3b4RmWzZH3tAHgX urPWfSD/WX7LKOQNIavbnvt34RHKUMMMDo4GlzGhvf4fcfBYzUdDrq7wSZBSVqcp/BIH d5mnlUJPiMVwKk/K1gKIWWD715ZH5YQhFDdo/y8ryevgbK3ejKsQZnt01l9J4QIATule 22hQ== 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=D6SVv03MXxB2K+lEAZ0gVyytKOY11D/Z+5Ub09WGv3Q=; b=FgWyrw8JhdG+KW432qUqiPp3rV+am8p2iLDaddj9L6gt/2gk3/jiJRabSdObIo1UQx hIhmXrVlLvaaJAev3h+RndeIXgiGlv09hQM85L1o8Gj/kt4bgjngtABiP6d39ogxlPUa v0rjKuI6HjkCc8LikYdVnuSrg6ozxGAFjTcdZPLKTvAkzrVLU6EpN8+q/Fcr1DNwdWPb zGYZmz2D/LClabhG7Bt739r3umlmeK6vRSBZ0F4KLJ1jf1t3Uese+f+WBg72u56tDcqg 8Qe3IFnaOwCJupaoKCB+zRyvUvymaPPPjLGqT4jIrbidlWKDscTbmNqlISYUfknUBwE3 H2yQ== X-Gm-Message-State: AGi0PuYbVkH1MwnF0pbOX0MqTGEsDyozRgm53ohUx/nBIWUlxz98OWxL K3DkrS/z0D3ciZj6i/3KFpa5SogdXmc= X-Received: by 2002:a17:90a:25c3:: with SMTP id k61mr8981558pje.28.1587518282655; Tue, 21 Apr 2020 18:18:02 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:18:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 31/36] tcg: Implement gvec support for rotate by scalar Date: Tue, 21 Apr 2020 18:17:17 -0700 Message-Id: <20200422011722.13287-32-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::1044; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1044.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::1044 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" No host backend support yet, but the interfaces for rotls are in place. Only implement left-rotate for now, as the only known use of vector rotate by scalar is s390x, so any right-rotate would be unused and untestable. Signed-off-by: Richard Henderson --- include/tcg/tcg-op-gvec.h | 2 ++ include/tcg/tcg-op.h | 1 + include/tcg/tcg-opc.h | 1 + include/tcg/tcg.h | 1 + tcg/aarch64/tcg-target.h | 1 + tcg/i386/tcg-target.h | 1 + tcg/ppc/tcg-target.h | 1 + tcg/tcg-op-gvec.c | 22 ++++++++++++++++++++++ tcg/tcg-op-vec.c | 5 +++++ tcg/tcg.c | 2 ++ 10 files changed, 37 insertions(+) -- 2.20.1 Reviewed-by: Alex Bennée diff --git a/include/tcg/tcg-op-gvec.h b/include/tcg/tcg-op-gvec.h index 2d768f1160..c69a7de984 100644 --- a/include/tcg/tcg-op-gvec.h +++ b/include/tcg/tcg-op-gvec.h @@ -345,6 +345,8 @@ void tcg_gen_gvec_shrs(unsigned vece, uint32_t dofs, uint32_t aofs, TCGv_i32 shift, uint32_t oprsz, uint32_t maxsz); void tcg_gen_gvec_sars(unsigned vece, uint32_t dofs, uint32_t aofs, TCGv_i32 shift, uint32_t oprsz, uint32_t maxsz); +void tcg_gen_gvec_rotls(unsigned vece, uint32_t dofs, uint32_t aofs, + TCGv_i32 shift, uint32_t oprsz, uint32_t maxsz); /* * Perform vector shift by vector element, modulo the element size. diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 0468009713..d0319692ec 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -992,6 +992,7 @@ void tcg_gen_rotri_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i); void tcg_gen_shls_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s); void tcg_gen_shrs_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s); void tcg_gen_sars_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s); +void tcg_gen_rotls_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s); void tcg_gen_shlv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s); void tcg_gen_shrv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s); diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h index d80335ba0d..d63c6bcb3d 100644 --- a/include/tcg/tcg-opc.h +++ b/include/tcg/tcg-opc.h @@ -250,6 +250,7 @@ DEF(rotli_vec, 1, 1, 1, IMPLVEC | IMPL(TCG_TARGET_HAS_roti_vec)) DEF(shls_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shs_vec)) DEF(shrs_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shs_vec)) DEF(sars_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shs_vec)) +DEF(rotls_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_rots_vec)) DEF(shlv_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shv_vec)) DEF(shrv_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shv_vec)) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 6bb2e3fe3c..57d6b0216c 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -183,6 +183,7 @@ typedef uint64_t TCGRegSet; #define TCG_TARGET_HAS_andc_vec 0 #define TCG_TARGET_HAS_orc_vec 0 #define TCG_TARGET_HAS_roti_vec 0 +#define TCG_TARGET_HAS_rots_vec 0 #define TCG_TARGET_HAS_rotv_vec 0 #define TCG_TARGET_HAS_shi_vec 0 #define TCG_TARGET_HAS_shs_vec 0 diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index a5477bbc07..9bc2a5ecbe 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -134,6 +134,7 @@ typedef enum { #define TCG_TARGET_HAS_neg_vec 1 #define TCG_TARGET_HAS_abs_vec 1 #define TCG_TARGET_HAS_roti_vec 0 +#define TCG_TARGET_HAS_rots_vec 0 #define TCG_TARGET_HAS_rotv_vec 0 #define TCG_TARGET_HAS_shi_vec 1 #define TCG_TARGET_HAS_shs_vec 0 diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 4c806c97db..99ac1e3958 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -184,6 +184,7 @@ extern bool have_avx2; #define TCG_TARGET_HAS_neg_vec 0 #define TCG_TARGET_HAS_abs_vec 1 #define TCG_TARGET_HAS_roti_vec 0 +#define TCG_TARGET_HAS_rots_vec 0 #define TCG_TARGET_HAS_rotv_vec 0 #define TCG_TARGET_HAS_shi_vec 1 #define TCG_TARGET_HAS_shs_vec 1 diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h index 7993422526..4a17aebc5a 100644 --- a/tcg/ppc/tcg-target.h +++ b/tcg/ppc/tcg-target.h @@ -162,6 +162,7 @@ extern bool have_vsx; #define TCG_TARGET_HAS_neg_vec have_isa_3_00 #define TCG_TARGET_HAS_abs_vec 0 #define TCG_TARGET_HAS_roti_vec 0 +#define TCG_TARGET_HAS_rots_vec 0 #define TCG_TARGET_HAS_rotv_vec 0 #define TCG_TARGET_HAS_shi_vec 0 #define TCG_TARGET_HAS_shs_vec 0 diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 2b71725883..3707c0effb 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -2976,6 +2976,28 @@ void tcg_gen_gvec_sars(unsigned vece, uint32_t dofs, uint32_t aofs, do_gvec_shifts(vece, dofs, aofs, shift, oprsz, maxsz, &g); } +void tcg_gen_gvec_rotls(unsigned vece, uint32_t dofs, uint32_t aofs, + TCGv_i32 shift, uint32_t oprsz, uint32_t maxsz) +{ + static const GVecGen2sh g = { + .fni4 = tcg_gen_rotl_i32, + .fni8 = tcg_gen_rotl_i64, + .fniv_s = tcg_gen_rotls_vec, + .fniv_v = tcg_gen_rotlv_vec, + .fno = { + gen_helper_gvec_rotl8i, + gen_helper_gvec_rotl16i, + gen_helper_gvec_rotl32i, + gen_helper_gvec_rotl64i, + }, + .s_list = { INDEX_op_rotls_vec, 0 }, + .v_list = { INDEX_op_rotlv_vec, 0 }, + }; + + tcg_debug_assert(vece <= MO_64); + do_gvec_shifts(vece, dofs, aofs, shift, oprsz, maxsz, &g); +} + /* * Expand D = A << (B % element bits) * diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index 52c1b66283..1c12e31fbb 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -821,6 +821,11 @@ void tcg_gen_sars_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 b) do_shifts(vece, r, a, b, INDEX_op_sars_vec); } +void tcg_gen_rotls_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s) +{ + do_shifts(vece, r, a, s, INDEX_op_rotls_vec); +} + void tcg_gen_bitsel_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b, TCGv_vec c) { diff --git a/tcg/tcg.c b/tcg/tcg.c index 5a82464610..e8d06fe813 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1699,6 +1699,8 @@ bool tcg_op_supported(TCGOpcode op) return have_vec && TCG_TARGET_HAS_shv_vec; case INDEX_op_rotli_vec: return have_vec && TCG_TARGET_HAS_roti_vec; + case INDEX_op_rotls_vec: + return have_vec && TCG_TARGET_HAS_rots_vec; case INDEX_op_rotlv_vec: case INDEX_op_rotrv_vec: return have_vec && TCG_TARGET_HAS_rotv_vec; From patchwork Wed Apr 22 01:17:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185642 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp172306ilf; Tue, 21 Apr 2020 18:34:29 -0700 (PDT) X-Google-Smtp-Source: APiQypJhKI6V36APWXnfzRoWQgRQGQ2gLK15gWNUXsoreMUqvPIMaBQimg1KaIja2Icc4MXLsMup X-Received: by 2002:a37:a38b:: with SMTP id m133mr24249038qke.434.1587519269841; Tue, 21 Apr 2020 18:34:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587519269; cv=none; d=google.com; s=arc-20160816; b=Tf4yzxjL+Z6tbAbFesUmElgZPgw8LU7nrWfntMsoi7HhTuxWsDDQ2MFSgvxIEPfeZu PcfAxbiLDl7gjMqxElTFjBZ2kvh1dSQcSRooOOQBLX1oZSJJveFvxaq99AbFGXYsVXy6 MIpgvAixos9AZDfFnloWdtqW1mBwJssHwZ45XvTVEgmHiLJkG6Ja6eNgW0DOUO2q+sun q+01bFSyTb8R/xTo1ktPoQDiB1HtbqY9xvRrdyvUzlkE6TtiNq3kxwq2ke3KXz1lKsxq by19KTFkav0htAlTDkoVK/1DuCvhP0IuI0ZD+lo9HMWmJEGrh9OHlRmy0n8QH56zTHaK Qa0A== 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=L2VIIPBcFhefaaeb1Q87he02SCE4/igfBVPGh/qdnUE=; b=rtdoyykZUo8djH6LqMV573w5Lm4Hj0jgLdrITT1k8Y3VQju92unWfUUY779XPv7siJ RaRNPGrXaQfXv4uf8zEIyNaJ7XYMSU2KHQaXI4FNJZfuru2m+fv5dKVvDY0GLpWwC0b1 3s7VRm5VIUrxrScWmv5o6JHXS1igD+6QVRWi1bOSR3bTzzr0fooGe/f3Hl18OB75Dbwu eH9MWZ+rOGvxoLDpuM+3DstYkfpp6T1MEwLXDQ6CHnIMTK164fDkeylZUzow3CBHMAxc qpUb9fJbAGgttRxI7UQlWaEAQpaUUBCXsStQYC/lRNfBKrYcLnQC2GjzwXbNwnjwyVdY dlKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r86d0Dmp; 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 ew11si2283888qvb.136.2020.04.21.18.34.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:34: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=pass header.i=@linaro.org header.s=google header.b=r86d0Dmp; 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]:39008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4HV-0004Se-8u for patch@linaro.org; Tue, 21 Apr 2020 21:34:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36416) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41n-0002I8-06 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41f-0002oI-C2 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:14 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:44035) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41e-0002h5-Qi for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:06 -0400 Received: by mail-pf1-x443.google.com with SMTP id p25so207375pfn.11 for ; Tue, 21 Apr 2020 18:18:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L2VIIPBcFhefaaeb1Q87he02SCE4/igfBVPGh/qdnUE=; b=r86d0DmpfGkrDFRAwkPOEeSsmzFzzYLyfwmIflpiBomt1FmWv0Pbl14B7GxULytcVe qmb+B24AHKP/poi5IqABhSB5XLHSYaMBv4mfa4+0gE71iqZoRCLvpBfiDS9HyC7Nv7Pi cKFNDIIuumA1DeBM5OzXhk90fYPjRruchgq0WFSWCVQtY3PuRgC/us717HvSchifX0tj XiZ4SzX8gc55rOFyKw7Od3Rv35/WzWFW7VNspkPjoyj2TSXqKtzup/6XCuVShZNBZllO 6JaewWMP/DeWu5MFFCsYpQzyONskDpdiKBBpdhDJ7XghCCQYv1Z9jSmZN9FsISpDdRdt rrhg== 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=L2VIIPBcFhefaaeb1Q87he02SCE4/igfBVPGh/qdnUE=; b=pcZUzTKY2ArmwacYrrU+hJxojgkf/IFQRGU/ZXNN85JAbvDrGywKOr3mdwxk+wQDNi kLTEoNoLrAXTY7b/ESSm3JWqkzcWf0WDi2ww6mgk44vhCYfe3W8uDgjHnjrcAogUg45e 9K9KTt4HCUJnMlq752I3h/9F+zLjfsOz6g8omcCgGSDHSUTA8yuIPdp2o0K+KDe24JXa aSrWBKEirP7wywxQlT5+4x5LEhdVzjFlumHHnFT6YXNEqmmJaDfPZHPNa9dtx6xjMNUr GjN5WvJE2xjcoJkCV4Xrpt8fD/MgLypRzogqfRQgM7sDdxRkyiYR0itfopxVhQu9kPnB V2zQ== X-Gm-Message-State: AGi0PubE/PrjIn7afeympBH1h0dAMjziKXBUqUuFEayl3hy/UAcpLJj8 Yz/OjkARTCe23lU7F4L/I8cEcwt76CQ= X-Received: by 2002:a65:6250:: with SMTP id q16mr24880006pgv.9.1587518283899; Tue, 21 Apr 2020 18:18:03 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.18.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:18:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 32/36] tcg/i386: Implement INDEX_op_rotl[is]_vec Date: Tue, 21 Apr 2020 18:17:18 -0700 Message-Id: <20200422011722.13287-33-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::443; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x443.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::443 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 continue the special casing of 8-bit elements and the other element sizes are trivially implemented with shifts. Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.inc.c | 85 +++++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 16 deletions(-) -- 2.20.1 diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index deace219d2..6039ae4fc6 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -3255,6 +3255,7 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) case INDEX_op_shls_vec: case INDEX_op_shrs_vec: case INDEX_op_sars_vec: + case INDEX_op_rotls_vec: case INDEX_op_cmp_vec: case INDEX_op_x86_shufps_vec: case INDEX_op_x86_blend_vec: @@ -3293,6 +3294,7 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_xor_vec: case INDEX_op_andc_vec: return 1; + case INDEX_op_rotli_vec: case INDEX_op_cmp_vec: case INDEX_op_cmpsel_vec: return -1; @@ -3316,6 +3318,7 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_shls_vec: case INDEX_op_shrs_vec: + case INDEX_op_rotls_vec: return vece >= MO_16; case INDEX_op_sars_vec: return vece >= MO_16 && vece <= MO_32; @@ -3353,7 +3356,7 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) } } -static void expand_vec_shi(TCGType type, unsigned vece, bool shr, +static void expand_vec_shi(TCGType type, unsigned vece, TCGOpcode opc, TCGv_vec v0, TCGv_vec v1, TCGArg imm) { TCGv_vec t1, t2; @@ -3363,26 +3366,31 @@ static void expand_vec_shi(TCGType type, unsigned vece, bool shr, t1 = tcg_temp_new_vec(type); t2 = tcg_temp_new_vec(type); - /* Unpack to W, shift, and repack. Tricky bits: - (1) Use punpck*bw x,x to produce DDCCBBAA, - i.e. duplicate in other half of the 16-bit lane. - (2) For right-shift, add 8 so that the high half of - the lane becomes zero. For left-shift, we must - shift up and down again. - (3) Step 2 leaves high half zero such that PACKUSWB - (pack with unsigned saturation) does not modify - the quantity. */ + /* + * Unpack to W, shift, and repack. Tricky bits: + * (1) Use punpck*bw x,x to produce DDCCBBAA, + * i.e. duplicate in other half of the 16-bit lane. + * (2) For right-shift, add 8 so that the high half of the lane + * becomes zero. For left-shift, and left-rotate, we must + * shift up and down again. + * (3) Step 2 leaves high half zero such that PACKUSWB + * (pack with unsigned saturation) does not modify + * the quantity. + */ vec_gen_3(INDEX_op_x86_punpckl_vec, type, MO_8, tcgv_vec_arg(t1), tcgv_vec_arg(v1), tcgv_vec_arg(v1)); vec_gen_3(INDEX_op_x86_punpckh_vec, type, MO_8, tcgv_vec_arg(t2), tcgv_vec_arg(v1), tcgv_vec_arg(v1)); - if (shr) { - tcg_gen_shri_vec(MO_16, t1, t1, imm + 8); - tcg_gen_shri_vec(MO_16, t2, t2, imm + 8); + if (opc != INDEX_op_rotli_vec) { + imm += 8; + } + if (opc == INDEX_op_shri_vec) { + tcg_gen_shri_vec(MO_16, t1, t1, imm); + tcg_gen_shri_vec(MO_16, t2, t2, imm); } else { - tcg_gen_shli_vec(MO_16, t1, t1, imm + 8); - tcg_gen_shli_vec(MO_16, t2, t2, imm + 8); + tcg_gen_shli_vec(MO_16, t1, t1, imm); + tcg_gen_shli_vec(MO_16, t2, t2, imm); tcg_gen_shri_vec(MO_16, t1, t1, 8); tcg_gen_shri_vec(MO_16, t2, t2, 8); } @@ -3449,6 +3457,43 @@ static void expand_vec_sari(TCGType type, unsigned vece, } } +static void expand_vec_rotli(TCGType type, unsigned vece, + TCGv_vec v0, TCGv_vec v1, TCGArg imm) +{ + TCGv_vec t; + + if (vece == MO_8) { + expand_vec_shi(type, vece, INDEX_op_rotli_vec, v0, v1, imm); + return; + } + + t = tcg_temp_new_vec(type); + tcg_gen_shli_vec(vece, t, v1, imm); + tcg_gen_shri_vec(vece, v0, v1, (8 << vece) - imm); + tcg_gen_or_vec(vece, v0, v0, t); + tcg_temp_free_vec(t); +} + +static void expand_vec_rotls(TCGType type, unsigned vece, + TCGv_vec v0, TCGv_vec v1, TCGv_i32 lsh) +{ + TCGv_i32 rsh; + TCGv_vec t; + + tcg_debug_assert(vece != MO_8); + + t = tcg_temp_new_vec(type); + rsh = tcg_temp_new_i32(); + + tcg_gen_neg_i32(rsh, lsh); + tcg_gen_andi_i32(rsh, rsh, (8 << vece) - 1); + tcg_gen_shls_vec(vece, t, v1, lsh); + tcg_gen_shrs_vec(vece, v0, v1, rsh); + tcg_gen_or_vec(vece, v0, v0, t); + tcg_temp_free_vec(t); + tcg_temp_free_i32(rsh); +} + static void expand_vec_mul(TCGType type, unsigned vece, TCGv_vec v0, TCGv_vec v1, TCGv_vec v2) { @@ -3658,13 +3703,21 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, switch (opc) { case INDEX_op_shli_vec: case INDEX_op_shri_vec: - expand_vec_shi(type, vece, opc == INDEX_op_shri_vec, v0, v1, a2); + expand_vec_shi(type, vece, opc, v0, v1, a2); break; case INDEX_op_sari_vec: expand_vec_sari(type, vece, v0, v1, a2); break; + case INDEX_op_rotli_vec: + expand_vec_rotli(type, vece, v0, v1, a2); + break; + + case INDEX_op_rotls_vec: + expand_vec_rotls(type, vece, v0, v1, temp_tcgv_i32(arg_temp(a2))); + break; + case INDEX_op_mul_vec: v2 = temp_tcgv_vec(arg_temp(a2)); expand_vec_mul(type, vece, v0, v1, v2); From patchwork Wed Apr 22 01:17:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185647 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp175001ilf; Tue, 21 Apr 2020 18:38:01 -0700 (PDT) X-Google-Smtp-Source: APiQypK7wo28xaeWVugM+TPKx72FPoBxNOoO47oiqu4Jl1N338mecAECF3YqI8riIS0lFxT3EiH7 X-Received: by 2002:a37:6496:: with SMTP id y144mr25614663qkb.206.1587519481023; Tue, 21 Apr 2020 18:38:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587519481; cv=none; d=google.com; s=arc-20160816; b=atH7mSASO+vRQMHEFJIdGSFlcT7VCR9Ummd6cTf20lQ1tL2GNeVFJ0DXKYL3hVVG4X Ub2XZ9DlM14nCEb+Buk8Vu56oEu5WQry18XX1RKIMJfajEjh57qEmw6BLyLo1FTDfJW5 1nzwrAVkIP4Mzyzjt6vKR9hKbBtI6FwuzbNm03AoFHCD2tzNAIQNVGGgv4nZQdipXEwA mL4RZovxuiNFRd+dkzC9qoI3TjkyMBYTnPX7ly8Yt9wBGq4qP025vDLG7g1yIHUevp1Z Qq1uzqff7YVyw/ZXLkqE/ZkSz/iyxe5Bbio6nD32Lf8QcMh1UdM0cJsTi8krC5v5N2lX adng== 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=QfWAHFHlg6tn3+AwefIzGfld6vj/4nB9ZCqh/vx2MbY=; b=M4+eCQfq+Pc+5HKky7/ZzLtakY+HvhYmJntPe1d+qoCfH/URPIn9KM4uEqks72VMty Q2ROAHhNUHvaHs+p/CN5xH2TjkB/JdK/eFWsWEQq0ReolXvn4VHz7XYMNdvxnDrYi+S7 UMLecxv2XQOwstu83eeUrNM/lgM5xORcm/yEXLfyDd3haNtcB3Sdh1ytbktc18+vw+7Y efbU8dnpzlRNOlfyPTveXaYqtvj7gJ3BAy8rD68gcea2tX4QO8tTt6dbOTYTgDEIh8K/ AjV4lNHIP8vtAx1NIQDZrjseE7jcj3R274iIeDrotVvi3zskivsCzxGmFX4/T6MD5rYa DLQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mo7m2kRt; 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 p13si2897231qtn.149.2020.04.21.18.38.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:38:01 -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=Mo7m2kRt; 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]:39076 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4Ku-0000lZ-Hq for patch@linaro.org; Tue, 21 Apr 2020 21:38:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36366) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41m-0002Ge-CP for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41f-0002oY-Eu for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:12 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:38861) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41e-0002lx-VM for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:07 -0400 Received: by mail-pg1-x536.google.com with SMTP id p8so257148pgi.5 for ; Tue, 21 Apr 2020 18:18:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QfWAHFHlg6tn3+AwefIzGfld6vj/4nB9ZCqh/vx2MbY=; b=Mo7m2kRtMkhCAkad0lAxsMuokBvbCHMssHlfLzO8pq54bC1xHTfpJBknQRJOfLUtoW rOuiTJqoiWB7+i+YT0jTe/gkeSWCIlegKmO7e6nAhVSEv/fiO/+bIPe+MhyU9hGpwaHW GR6X0351nOXTtfSLyGVPQ6U5hTjj+EkR7ZqxlQxtz/UXpGXaQOnXaMwiaLdIEnFdqNQx JsCrXW2kNVGHDSFN5xznUk5frz0K0lHQOktzPwktMbHaQPmPDcXcL6E9P+gao/KwOLVZ 5mudqOoY53EBJz4BcvT9r2oQxkkh4L6GSB6ETxnK0mnUfewCNM8inv8AnMwqLHgAiDxV 9yzw== 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=QfWAHFHlg6tn3+AwefIzGfld6vj/4nB9ZCqh/vx2MbY=; b=OG/wcy3pbCJZX/hMOFOpvs1iHbtW1lEsAiNjo5nOhN9WH9W2S2tBwYh0MzCsvvXrup XI7lnxkpOsYVSWwIzBpY0xBqM0Fm3jV5kROO5I0D7sWvaNfthmfESJjpCU6qUW73QHrD k0VcZ5mdPiuuUwNiyT04+m8kVDYRZQOOzYcLCoHjvtcc2QenRuu52NtDndoBFAPmJ9P0 EQqNS7SZjrq/rP51VgUR/S4S2h5/4IF8lfrP7EKnbsvBFTA591FD3SccxUgEOkYAJ15y x5xvg1DrjAm0KS3g8Z1LBT3ss6lEN6SaPGQTpGnnuE39ges4cWZ9qIPgFJIQdaXPBbr1 tigg== X-Gm-Message-State: AGi0PuYgFR86L09/yDbKTXuQ0eBygPLhxW5k9NYHKD5s/ZJiX1c+DGhd v/2BGOllnReKscZGmgx/vhpX5CIA+Ag= X-Received: by 2002:a63:1210:: with SMTP id h16mr23575196pgl.328.1587518285197; Tue, 21 Apr 2020 18:18:05 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.18.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:18:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 33/36] tcg/aarch64: Implement INDEX_op_rotli_vec Date: Tue, 21 Apr 2020 18:17:19 -0700 Message-Id: <20200422011722.13287-34-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::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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::536 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 can implement this in two instructions, using SLI. Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.opc.h | 1 + tcg/aarch64/tcg-target.inc.c | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/tcg/aarch64/tcg-target.opc.h b/tcg/aarch64/tcg-target.opc.h index 26bfd9c460..bce30accd9 100644 --- a/tcg/aarch64/tcg-target.opc.h +++ b/tcg/aarch64/tcg-target.opc.h @@ -12,3 +12,4 @@ */ DEF(aa64_sshl_vec, 1, 2, 0, IMPLVEC) +DEF(aa64_sli_vec, 1, 2, 1, IMPLVEC) diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index 3b5a5d78c7..4bc9b30254 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -557,6 +557,7 @@ typedef enum { I3614_SSHR = 0x0f000400, I3614_SSRA = 0x0f001400, I3614_SHL = 0x0f005400, + I3614_SLI = 0x2f005400, I3614_USHR = 0x2f000400, I3614_USRA = 0x2f001400, @@ -2402,6 +2403,9 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, case INDEX_op_sari_vec: tcg_out_insn(s, 3614, SSHR, is_q, a0, a1, (16 << vece) - a2); break; + case INDEX_op_aa64_sli_vec: + tcg_out_insn(s, 3614, SLI, is_q, a0, a2, args[3] + (8 << vece)); + break; case INDEX_op_shlv_vec: tcg_out_insn(s, 3616, USHL, is_q, vece, a0, a1, a2); break; @@ -2488,6 +2492,7 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_shlv_vec: case INDEX_op_bitsel_vec: return 1; + case INDEX_op_rotli_vec: case INDEX_op_shrv_vec: case INDEX_op_sarv_vec: return -1; @@ -2508,13 +2513,23 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, { va_list va; TCGv_vec v0, v1, v2, t1; + TCGArg a2; va_start(va, a0); v0 = temp_tcgv_vec(arg_temp(a0)); v1 = temp_tcgv_vec(arg_temp(va_arg(va, TCGArg))); - v2 = temp_tcgv_vec(arg_temp(va_arg(va, TCGArg))); + a2 = va_arg(va, TCGArg); + v2 = temp_tcgv_vec(arg_temp(a2)); switch (opc) { + case INDEX_op_rotli_vec: + t1 = tcg_temp_new_vec(type); + tcg_gen_shri_vec(vece, t1, v1, -a2 & ((8 << vece) - 1)); + vec_gen_4(INDEX_op_aa64_sli_vec, type, vece, + tcgv_vec_arg(v0), tcgv_vec_arg(t1), tcgv_vec_arg(v1), a2); + tcg_temp_free_vec(t1); + break; + case INDEX_op_shrv_vec: case INDEX_op_sarv_vec: /* Right shifts are negative left shifts for AArch64. */ @@ -2547,6 +2562,7 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) static const TCGTargetOpDef lZ_l = { .args_ct_str = { "lZ", "l" } }; static const TCGTargetOpDef r_r_r = { .args_ct_str = { "r", "r", "r" } }; static const TCGTargetOpDef w_w_w = { .args_ct_str = { "w", "w", "w" } }; + static const TCGTargetOpDef w_0_w = { .args_ct_str = { "w", "0", "w" } }; static const TCGTargetOpDef w_w_wO = { .args_ct_str = { "w", "w", "wO" } }; static const TCGTargetOpDef w_w_wN = { .args_ct_str = { "w", "w", "wN" } }; static const TCGTargetOpDef w_w_wZ = { .args_ct_str = { "w", "w", "wZ" } }; @@ -2741,6 +2757,8 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) return &w_w_wZ; case INDEX_op_bitsel_vec: return &w_w_w_w; + case INDEX_op_aa64_sli_vec: + return &w_0_w; default: return NULL; From patchwork Wed Apr 22 01:17:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185627 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp165049ilf; Tue, 21 Apr 2020 18:24:33 -0700 (PDT) X-Google-Smtp-Source: APiQypK0diG5lkteKQUa1wywzihmgN7uH9w2mbf6RNzVJ/Nnm4B6LkR22FZIzkMbecKmaxyd2zvw X-Received: by 2002:a0c:fc0c:: with SMTP id z12mr21873045qvo.41.1587518673621; Tue, 21 Apr 2020 18:24:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518673; cv=none; d=google.com; s=arc-20160816; b=g0kOsQfhp2bU856gFvFrWli34I6linwx75IvVJ65lq2oK1oJrDpsmWw04htrg2emPp kK4JKN1Az+DMiivAFFjDKsPNK0xTN059UelTUOkqBG73u/SNv0bsXxf/RN0YMyC0/a9k kQ4S2JpK+pchBaYg8j4HE6rKMXtyta9gNbSf/8pzvqskqD1PXvFBbmG9NkkshS9BWene 4OLUw1nId+/p5AP58DAIV2aymo7wE2ZJgitmYxDKRx6hTXviBdikQKYBI4+53N0n9B6M NwLuqxjVjy8oeBCeMmXV1pXGOmEjcb42OHvaMwIt/AXubQP3RUKgesGxfBry9qCBm5J0 9tVA== 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=r3EFMKVRtS/SD5amlAn44uoEdKbs7LUTfz55GuERBtY=; b=L0h7WwxkbYFBVxAe8lcmK7hZAspHhu0WTSZBC51o7Ey7g06E5WuLo7p9YKeh4d1vXD SGiDupqi0ECccj/WKZYVBmcL+7o596tUrjZMaS9qJPASj1w78kezZHYT98E/ZpDS3ui7 +M7+MzGG/3uqKMYJuH+fzNWgWjtBJj0tvBzz3JIdcFWlHiwt1O65r2QuFz7ZovpnRhmQ eTBz7tIlKthDnlFKPBWnZCmPPhZhEnvX00299pInE3vhmf1AwHUlgclesYt9c40CtK8d ocVAa/yx2nFkU9N7lcT7ImpW6Q0LjNCvG2460WhieaRU3nchhLtRCP0R1nlrwbPakXhL DaKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yACwE71F; 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 u207si2406518qka.203.2020.04.21.18.24.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:24:33 -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=yACwE71F; 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]:38744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR47t-00053U-4I for patch@linaro.org; Tue, 21 Apr 2020 21:24:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36364) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41m-0002Gb-Bn for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41i-0002r1-IT for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:14 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:45576) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41g-0002oX-Jv for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:08 -0400 Received: by mail-pg1-x544.google.com with SMTP id f20so241070pgl.12 for ; Tue, 21 Apr 2020 18:18:07 -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=r3EFMKVRtS/SD5amlAn44uoEdKbs7LUTfz55GuERBtY=; b=yACwE71FyqjCj0CIXsduUWq/DVP3GUFy9k+4bG3HjOeaUJgNxjloSbHtl2mb4PfZd5 T54Ktz5yens6qJOG+PZxdSj1vhQoLeV+8vhg7uOkVoSvN04E5eHp/MXmp+yApSSENDo8 4onOSMHIBGim5qtZyhTAVnSqmg1HmaPo+Arq64RvLmExbQkZDJ87MpZKJRzzB6lSBwMT 2Bf3JUJlwHmgxjEbgK5jT395aLhNnInDJLW0kE0fE8R1lxzfPu2mNQPJwNKvseF6SgRI hzVnzJl9/CkDoHsDqynfckby96OVW53IznRGhP90E9sjlnIDwqcGRfRSlr/UY9cKA+Gh XuWA== 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=r3EFMKVRtS/SD5amlAn44uoEdKbs7LUTfz55GuERBtY=; b=gsRkciAs9Hzf7i5oPaunL7YeFNqD9OSTZC+48e2dnK2oJksimy5A8r35pQNsPtMQaC MS+yzgjB3i0bhNjPmaywafqeRfhyDUsEmSQkg6XHKihP6H8mOd0ORCQx+54fc/Hx5JlZ btLHO9bAdPJAxjl1fhKQSrfxzBTLWT0cMl2TS2w/QhYM5LLStM3dEnKAodYM4vUPKvNs HRI8STwyKgbHJjQJo0sEJUa4h7mIsWcIXMYzxCK85+Dd2zPF2utKsU1AtjjZfKjgV0Bm Gi7IURryAC/iN3b5VbSDUN2kjMLHheIu1DpRkqxBJDw1KB+L6raBqFz09Pw9GagwS/lL IJSg== X-Gm-Message-State: AGi0PuabyMNzS/lNsNygIrgy3CphlAWDuI7NYcO4/Yoc58R7xG1Gi/3p scn5hH1DuuHwz5RWKpRfYL+oQigvHYQ= X-Received: by 2002:a63:77c4:: with SMTP id s187mr17879919pgc.169.1587518286386; Tue, 21 Apr 2020 18:18:06 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.18.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:18:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 34/36] tcg/ppc: Implement INDEX_op_rot[lr]v_vec Date: Tue, 21 Apr 2020 18:17:20 -0700 Message-Id: <20200422011722.13287-35-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::544; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x544.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::544 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We already had support for rotlv, using a target-specific opcode; convert to use the generic opcode. Handle rotrv via simple negation. Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.h | 2 +- tcg/ppc/tcg-target.opc.h | 1 - tcg/ppc/tcg-target.inc.c | 23 +++++++++++++++++++---- 3 files changed, 20 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h index 4a17aebc5a..be5b2901c3 100644 --- a/tcg/ppc/tcg-target.h +++ b/tcg/ppc/tcg-target.h @@ -163,7 +163,7 @@ extern bool have_vsx; #define TCG_TARGET_HAS_abs_vec 0 #define TCG_TARGET_HAS_roti_vec 0 #define TCG_TARGET_HAS_rots_vec 0 -#define TCG_TARGET_HAS_rotv_vec 0 +#define TCG_TARGET_HAS_rotv_vec 1 #define TCG_TARGET_HAS_shi_vec 0 #define TCG_TARGET_HAS_shs_vec 0 #define TCG_TARGET_HAS_shv_vec 1 diff --git a/tcg/ppc/tcg-target.opc.h b/tcg/ppc/tcg-target.opc.h index 1373f77e82..db514403c3 100644 --- a/tcg/ppc/tcg-target.opc.h +++ b/tcg/ppc/tcg-target.opc.h @@ -30,4 +30,3 @@ DEF(ppc_msum_vec, 1, 3, 0, IMPLVEC) DEF(ppc_muleu_vec, 1, 2, 0, IMPLVEC) DEF(ppc_mulou_vec, 1, 2, 0, IMPLVEC) DEF(ppc_pkum_vec, 1, 2, 0, IMPLVEC) -DEF(ppc_rotl_vec, 1, 2, 0, IMPLVEC) diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index 3333b55766..3f9690418f 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -2988,6 +2988,7 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_shlv_vec: case INDEX_op_shrv_vec: case INDEX_op_sarv_vec: + case INDEX_op_rotlv_vec: return vece <= MO_32 || have_isa_2_07; case INDEX_op_ssadd_vec: case INDEX_op_sssub_vec: @@ -2998,6 +2999,7 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_shli_vec: case INDEX_op_shri_vec: case INDEX_op_sari_vec: + case INDEX_op_rotli_vec: return vece <= MO_32 || have_isa_2_07 ? -1 : 0; case INDEX_op_neg_vec: return vece >= MO_32 && have_isa_3_00; @@ -3012,6 +3014,8 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) return 0; case INDEX_op_bitsel_vec: return have_vsx; + case INDEX_op_rotrv_vec: + return -1; default: return 0; } @@ -3294,7 +3298,7 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, case INDEX_op_ppc_pkum_vec: insn = pkum_op[vece]; break; - case INDEX_op_ppc_rotl_vec: + case INDEX_op_rotlv_vec: insn = rotl_op[vece]; break; case INDEX_op_ppc_msum_vec: @@ -3401,7 +3405,7 @@ static void expand_vec_mul(TCGType type, unsigned vece, TCGv_vec v0, t3 = tcg_temp_new_vec(type); t4 = tcg_temp_new_vec(type); tcg_gen_dupi_vec(MO_8, t4, -16); - vec_gen_3(INDEX_op_ppc_rotl_vec, type, MO_32, tcgv_vec_arg(t1), + vec_gen_3(INDEX_op_rotlv_vec, type, MO_32, tcgv_vec_arg(t1), tcgv_vec_arg(v2), tcgv_vec_arg(t4)); vec_gen_3(INDEX_op_ppc_mulou_vec, type, MO_16, tcgv_vec_arg(t2), tcgv_vec_arg(v1), tcgv_vec_arg(v2)); @@ -3426,7 +3430,7 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, TCGArg a0, ...) { va_list va; - TCGv_vec v0, v1, v2; + TCGv_vec v0, v1, v2, t0; TCGArg a2; va_start(va, a0); @@ -3444,6 +3448,9 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, case INDEX_op_sari_vec: expand_vec_shi(type, vece, v0, v1, a2, INDEX_op_sarv_vec); break; + case INDEX_op_rotli_vec: + expand_vec_shi(type, vece, v0, v1, a2, INDEX_op_rotlv_vec); + break; case INDEX_op_cmp_vec: v2 = temp_tcgv_vec(arg_temp(a2)); expand_vec_cmp(type, vece, v0, v1, v2, va_arg(va, TCGArg)); @@ -3452,6 +3459,13 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, v2 = temp_tcgv_vec(arg_temp(a2)); expand_vec_mul(type, vece, v0, v1, v2); break; + case INDEX_op_rotlv_vec: + v2 = temp_tcgv_vec(arg_temp(a2)); + t0 = tcg_temp_new_vec(type); + tcg_gen_neg_vec(vece, t0, v2); + tcg_gen_rotlv_vec(vece, v0, v1, t0); + tcg_temp_free_vec(t0); + break; default: g_assert_not_reached(); } @@ -3656,12 +3670,13 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) case INDEX_op_shlv_vec: case INDEX_op_shrv_vec: case INDEX_op_sarv_vec: + case INDEX_op_rotlv_vec: + case INDEX_op_rotrv_vec: case INDEX_op_ppc_mrgh_vec: case INDEX_op_ppc_mrgl_vec: case INDEX_op_ppc_muleu_vec: case INDEX_op_ppc_mulou_vec: case INDEX_op_ppc_pkum_vec: - case INDEX_op_ppc_rotl_vec: case INDEX_op_dup2_vec: return &v_v_v; case INDEX_op_not_vec: From patchwork Wed Apr 22 01:17:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185649 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp176262ilf; Tue, 21 Apr 2020 18:39:47 -0700 (PDT) X-Google-Smtp-Source: APiQypJ8a9F7WjuJrT2S3ycU25Ayj0xtqwMdymWi54YMsaHBp4O1Lwk6im1YC/Tlf+1H2ArtcTDU X-Received: by 2002:a05:620a:1405:: with SMTP id d5mr25555001qkj.329.1587519587255; Tue, 21 Apr 2020 18:39:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587519587; cv=none; d=google.com; s=arc-20160816; b=W8lHDd37p486n0Sbq6qZ1rw2i/LZIyx9EtfVM6MruimBd4+YNAjZthuQ329loJ8Uqd vo8TYcl9gTTzJXLfUhqvQB525bwGO7L3dw4u0AwCmqC+Q1zCcNyzRcN9PkLiERaM1EvB /463RTa5VRaBv7F2ofNMBDsDP0RnbxK/3fGUxg6qcdLGlNYn0as8Ok2eaUGwuz45kDDr HJ0HKcSQglyb8dLyNH2Ev4uxIR8Ssy0nZdKB8cqg2NhFNcb1100FJTDZL5CHrFh5WwsJ NS8lW4r8rpP0m/EnSFwRqZMEJgjthBFIsgVknkXgLZHVvOj5c9j+qNvaoWegQUSHbNbZ f4IQ== 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=usEU+0THdbgtBj9wJbgNK97HinYANEa/S4b+EK/lCNc=; b=QQZOKEwG1bv0ck6kzMK0LBFQX9MLT8AX6ZZn6veV7Puq9LIPntEANkOLXOM21edfde jfH53qTN4vxXSSGpqTIgXkKv8w9j5j7PZbDjtxWW92OQOVNa1gwNKfNnwtsPJG++wGAN JUQncTXN1QQUJLe8+I5VHJBBN1Fr2wcaiPmDm+9AWoO9YSIthSfp2Kk1ss0xe1fy5uYG VTstaoxfh3xdyRhxxVe7FJSQ3PN8F4T5EwXZaTp+VtmendOKW2Y3Gz3qC9FudBfvPz+t qNEIx+mwZ6HQ8gcvRGBK3sL2Q0x81HnU4gPsCXDRXVUe9JNvxP/f4GCBA+BiGKmpwcL0 ef/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lUHLYzN6; 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 v41si2424977qtj.374.2020.04.21.18.39.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:39:47 -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=lUHLYzN6; 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]:39123 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4Mc-0004mT-PA for patch@linaro.org; Tue, 21 Apr 2020 21:39:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37192) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41w-0002cV-0Y for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41i-0002sI-UZ for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:23 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:43782) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41h-0002pO-Sw for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:10 -0400 Received: by mail-pl1-x635.google.com with SMTP id z6so234743plk.10 for ; Tue, 21 Apr 2020 18:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=usEU+0THdbgtBj9wJbgNK97HinYANEa/S4b+EK/lCNc=; b=lUHLYzN667EZT0Nj6H7WyPDr0EqytdYFh7d/UuzMtCvJNu30a/fXT/kwkD3atcC6sE khzt3PFpiFmhiMOddcsaGkVVIaKBRAxG9E8H38NxQ5S/J0LmSy2oaTt/18hMOeENN/5N IIq0ANOj9SsL4lgpO9h7XJPtV/aRW6gX7ZPwUG0fINNyGhAXQV4ld14uS24rSTK8Rrl0 PPb5wm7FaLoZZI3LgBcp4+llB/p5EztuKYUKGQ9fIR1lGQNcQ0jlf8lVrEy8aVpJHJzk TjI/S7NYUJbCYctmMI1Tq7C7iuO/zTsQseg2jm9rqBhwxYpcBdpbG2GVonlJYs8nvH7J PWmQ== 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=usEU+0THdbgtBj9wJbgNK97HinYANEa/S4b+EK/lCNc=; b=ZT53BQQkoirejsNDCU7kfJSI2Ukps9xB0Wyp4QcspKKjx5n8yycx6EMSi0/R/RspAW /Ln2TqwD8y6fEquiVRM7cahTEtTFu4eBdY/ZZmhQ+3l+aaFvwb2XskGZQWJ9/DtpRHrm caA1mr3m37IoBI88yCRZCkCqQwaYRYONEaGEdjv4FJd/qCKBz04v2y9EJDUQKU2VsgyL uTa64qu7cEsWUIcPL9tR+jPaT7CgP0BlVFHettL6XVitoDPN7FMcb2XnjEwkv3RsWBkY 3E8yKl6N8ogu/v0YRO0qUBTnywrKpcpfvuobtrRwyv0ac7GO8EhtgLRtWa269DQUee2h W06Q== X-Gm-Message-State: AGi0PuZL+Re3XJuxd9G2gLASvJIbRJMgAiCZBGCWGke3eRf0qfJKTxtC 9fmmSbBN1cmYYxQjjMBnY8yVcnXDbK8= X-Received: by 2002:a17:902:d203:: with SMTP id t3mr10526531ply.136.1587518287611; Tue, 21 Apr 2020 18:18:07 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:18:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 35/36] target/ppc: Use tcg_gen_gvec_rotlv Date: Tue, 21 Apr 2020 18:17:21 -0700 Message-Id: <20200422011722.13287-36-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::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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::635 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, David Gibson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Cc: David Gibson Signed-off-by: Richard Henderson --- target/ppc/helper.h | 4 ---- target/ppc/int_helper.c | 17 ----------------- target/ppc/translate/vmx-impl.inc.c | 8 ++++---- 3 files changed, 4 insertions(+), 25 deletions(-) -- 2.20.1 diff --git a/target/ppc/helper.h b/target/ppc/helper.h index a95c010391..b0114fc915 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -213,10 +213,6 @@ DEF_HELPER_3(vsubuqm, void, avr, avr, avr) DEF_HELPER_4(vsubecuq, void, avr, avr, avr, avr) DEF_HELPER_4(vsubeuqm, void, avr, avr, avr, avr) DEF_HELPER_3(vsubcuq, void, avr, avr, avr) -DEF_HELPER_3(vrlb, void, avr, avr, avr) -DEF_HELPER_3(vrlh, void, avr, avr, avr) -DEF_HELPER_3(vrlw, void, avr, avr, avr) -DEF_HELPER_3(vrld, void, avr, avr, avr) DEF_HELPER_4(vsldoi, void, avr, avr, avr, i32) DEF_HELPER_3(vextractub, void, avr, avr, i32) DEF_HELPER_3(vextractuh, void, avr, avr, i32) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 6d238b989d..ee308da2ca 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -1347,23 +1347,6 @@ VRFI(p, float_round_up) VRFI(z, float_round_to_zero) #undef VRFI -#define VROTATE(suffix, element, mask) \ - void helper_vrl##suffix(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ - { \ - int i; \ - \ - for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ - unsigned int shift = b->element[i] & mask; \ - r->element[i] = (a->element[i] << shift) | \ - (a->element[i] >> (sizeof(a->element[0]) * 8 - shift)); \ - } \ - } -VROTATE(b, u8, 0x7) -VROTATE(h, u16, 0xF) -VROTATE(w, u32, 0x1F) -VROTATE(d, u64, 0x3F) -#undef VROTATE - void helper_vrsqrtefp(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *b) { int i; diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx-impl.inc.c index 403ed3a01c..de2fd136ff 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -900,13 +900,13 @@ GEN_VXFORM3(vsubeuqm, 31, 0); GEN_VXFORM3(vsubecuq, 31, 0); GEN_VXFORM_DUAL(vsubeuqm, PPC_NONE, PPC2_ALTIVEC_207, \ vsubecuq, PPC_NONE, PPC2_ALTIVEC_207) -GEN_VXFORM(vrlb, 2, 0); -GEN_VXFORM(vrlh, 2, 1); -GEN_VXFORM(vrlw, 2, 2); +GEN_VXFORM_V(vrlb, MO_8, tcg_gen_gvec_rotlv, 2, 0); +GEN_VXFORM_V(vrlh, MO_16, tcg_gen_gvec_rotlv, 2, 1); +GEN_VXFORM_V(vrlw, MO_32, tcg_gen_gvec_rotlv, 2, 2); GEN_VXFORM(vrlwmi, 2, 2); GEN_VXFORM_DUAL(vrlw, PPC_ALTIVEC, PPC_NONE, \ vrlwmi, PPC_NONE, PPC2_ISA300) -GEN_VXFORM(vrld, 2, 3); +GEN_VXFORM_V(vrld, MO_64, tcg_gen_gvec_rotlv, 2, 3); GEN_VXFORM(vrldmi, 2, 3); GEN_VXFORM_DUAL(vrld, PPC_NONE, PPC2_ALTIVEC_207, \ vrldmi, PPC_NONE, PPC2_ISA300) From patchwork Wed Apr 22 01:17:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185646 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp174274ilf; Tue, 21 Apr 2020 18:37:08 -0700 (PDT) X-Google-Smtp-Source: APiQypKkduUqH0XigVu1PUP+BopqWK4XnB9WBT3FqJOi1d3lyV0puiWyLVe1sycKJDb4GZogOpE0 X-Received: by 2002:aed:3907:: with SMTP id l7mr24505663qte.136.1587519428307; Tue, 21 Apr 2020 18:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587519428; cv=none; d=google.com; s=arc-20160816; b=sFQGp/pcXSuDKzA3WkfwOLALtN3HBw1oGOwtmF4ZkyBmXs0JaX+CNXk6GVcA/WZ8fS 3vL9DUMTPyxrf53+LM/JP733xXwK+PaW+y6go6yPso9zDGX0oiGL2jGQhvaF8FgJoNwg tO8dtBIko5zQZKhFUbJAF3/Il798Kapni6yKZqtuViUBwCb5RvKggm2bH3ADPjtVcAAc BCdXGzTFw7IOgbFHN35a4V1gn21S8vrHbGFHEC5lpXgOINuG1Q3jmI4RwuQPQLJBikHz QHVEZRiZop4t7T6UgDYrXRMXLrk9I2JO+BmvqJKQ5L8m1piEBjAZSOLD3XCI2Dd6EJNT AQRg== 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=CAaXlaeCbYzCudlBaA6sfoD14Yf3D0yL19dplfxIkw0=; b=Uo/vtOumvo6IGnUQOMUcgk6fG2PSecwbPlGEm8XiAHXQoD/P6zFJwQMw0ZS9quTpjX NWNlGF3jgcZmME9U5XrVgDYj5bylP7T+CI14Yy9Tbv2tx9OfJVrzPmTaxIZZDj2Soi7K oQS6DSCYc9Ecbdo0oNglh5htiDjDJY8/dWvwT/4OosLgz63GP+UR31C2CzJM+BXE650I QE+HrXfGnoQ6s3hhmcV2TnKIMnYYvRqU4jISX/CwFV/gnEF3U1n069F4gcBqqz0NQLX/ GkbR/3JzMxzt9phFQ+0jC2yeNfENGELzy19wWPrkgk1ZJdmq2vutdwNZbgst0/hQLTSx LzUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oW2ZX0qa; 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 q20si2572081qtl.338.2020.04.21.18.37.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:37:08 -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=oW2ZX0qa; 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]:39056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4K3-0007g8-Qf for patch@linaro.org; Tue, 21 Apr 2020 21:37:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36586) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41o-0002Mi-Oz for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41m-0002tl-8i for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:16 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:46721) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41i-0002qj-OA for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:10 -0400 Received: by mail-pg1-x543.google.com with SMTP id j7so237694pgj.13 for ; Tue, 21 Apr 2020 18:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CAaXlaeCbYzCudlBaA6sfoD14Yf3D0yL19dplfxIkw0=; b=oW2ZX0qaOHUft7B2x7GxjHuHRAwnpPJeIS8znuZuVkB5nzygOVmk9SJuham3j95+vH sW+cgydiUesKd9dbXGxJ9/NU8cp5KGTXjV/YspGYwh08eTzYUC1hx16Ot2JhaRtOIT3l Lnk8JZvl6JeHKCC4uBlWsnGuAW7nmX6EuHFC/wddaYY359OQtkoxC/KFDqWHHUi2iY+g Q+swQQedd1KpuJ1Tg/h3X7nPS4NXJunxbQklXw3KnuVQxxgbCXyEHEDz/HMREcaw7tK7 PgMUUja0vn4wZCPx4BJ5VlP/BTLd97UjTmjRvRhLn1tIcyYTE4SYWz+45xpoEVfXjDm/ WKLA== 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=CAaXlaeCbYzCudlBaA6sfoD14Yf3D0yL19dplfxIkw0=; b=aoWIBhX1y98y0jn7Ypr9IdKeiFY46ioGIGameZ5Ak30j1vrXQgCU2Jtm1+sSd+e2ZJ lMrz8wccHTGshbtk4pM3QFvZZiu6lllALA94jiXZSgAX5n9mbs3qtT8yhjeNqRadbme8 hKvYEn4OeplHgQMx6swi0ghnlN8BskSWIswydbBWrX1pswjBqXxT8zO/2HwaI9XB0zWc haSfrWmpaXBwrwtxRXR3bl6T0O96WMUsCmrC51mo2VnpSDR8bN+7DEszRVlFW/XXdYH0 QTQZZaGeu7YwFvwlD0diyvBMlg+UIpIYd8EqP8sSsv9cAKZ8I/KBErcNOQsMVewQkR7I dseA== X-Gm-Message-State: AGi0Pua5LIhoUw8D1sYu1jcFrX5DnS6KZE3z3xmbdcKfNEOh1BBcehGA 6jRZQR4QLfak6Z14wpIrEbu84hbLqnY= X-Received: by 2002:aa7:8ecd:: with SMTP id b13mr13567353pfr.191.1587518288974; Tue, 21 Apr 2020 18:18:08 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:18:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 36/36] target/s390x: Use tcg_gen_gvec_rotl{i,s,v} Date: Tue, 21 Apr 2020 18:17:22 -0700 Message-Id: <20200422011722.13287-37-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::543; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x543.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::543 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Merge VERLL and VERLLV into op_vesv and op_ves, alongside all of the other vector shift operations. Cc: David Hildenbrand Signed-off-by: Richard Henderson --- target/s390x/helper.h | 4 -- target/s390x/translate_vx.inc.c | 66 +++++---------------------------- target/s390x/vec_int_helper.c | 31 ---------------- target/s390x/insn-data.def | 4 +- 4 files changed, 11 insertions(+), 94 deletions(-) -- 2.20.1 diff --git a/target/s390x/helper.h b/target/s390x/helper.h index b5813c2ac2..b7887b552b 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -198,10 +198,6 @@ DEF_HELPER_FLAGS_4(gvec_vmlo16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) DEF_HELPER_FLAGS_4(gvec_vmlo32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) DEF_HELPER_FLAGS_3(gvec_vpopct8, TCG_CALL_NO_RWG, void, ptr, cptr, i32) DEF_HELPER_FLAGS_3(gvec_vpopct16, TCG_CALL_NO_RWG, void, ptr, cptr, i32) -DEF_HELPER_FLAGS_4(gvec_verllv8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) -DEF_HELPER_FLAGS_4(gvec_verllv16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) -DEF_HELPER_FLAGS_4(gvec_verll8, TCG_CALL_NO_RWG, void, ptr, cptr, i64, i32) -DEF_HELPER_FLAGS_4(gvec_verll16, TCG_CALL_NO_RWG, void, ptr, cptr, i64, i32) DEF_HELPER_FLAGS_4(gvec_verim8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) DEF_HELPER_FLAGS_4(gvec_verim16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) DEF_HELPER_FLAGS_4(gvec_vsl, TCG_CALL_NO_RWG, void, ptr, cptr, i64, i32) diff --git a/target/s390x/translate_vx.inc.c b/target/s390x/translate_vx.inc.c index 12347f8a03..eb767f5288 100644 --- a/target/s390x/translate_vx.inc.c +++ b/target/s390x/translate_vx.inc.c @@ -1825,63 +1825,6 @@ static DisasJumpType op_vpopct(DisasContext *s, DisasOps *o) return DISAS_NEXT; } -static void gen_rll_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) -{ - TCGv_i32 t0 = tcg_temp_new_i32(); - - tcg_gen_andi_i32(t0, b, 31); - tcg_gen_rotl_i32(d, a, t0); - tcg_temp_free_i32(t0); -} - -static void gen_rll_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) -{ - TCGv_i64 t0 = tcg_temp_new_i64(); - - tcg_gen_andi_i64(t0, b, 63); - tcg_gen_rotl_i64(d, a, t0); - tcg_temp_free_i64(t0); -} - -static DisasJumpType op_verllv(DisasContext *s, DisasOps *o) -{ - const uint8_t es = get_field(s, m4); - static const GVecGen3 g[4] = { - { .fno = gen_helper_gvec_verllv8, }, - { .fno = gen_helper_gvec_verllv16, }, - { .fni4 = gen_rll_i32, }, - { .fni8 = gen_rll_i64, }, - }; - - if (es > ES_64) { - gen_program_exception(s, PGM_SPECIFICATION); - return DISAS_NORETURN; - } - - gen_gvec_3(get_field(s, v1), get_field(s, v2), - get_field(s, v3), &g[es]); - return DISAS_NEXT; -} - -static DisasJumpType op_verll(DisasContext *s, DisasOps *o) -{ - const uint8_t es = get_field(s, m4); - static const GVecGen2s g[4] = { - { .fno = gen_helper_gvec_verll8, }, - { .fno = gen_helper_gvec_verll16, }, - { .fni4 = gen_rll_i32, }, - { .fni8 = gen_rll_i64, }, - }; - - if (es > ES_64) { - gen_program_exception(s, PGM_SPECIFICATION); - return DISAS_NORETURN; - } - gen_gvec_2s(get_field(s, v1), get_field(s, v3), o->addr1, - &g[es]); - return DISAS_NEXT; -} - static void gen_rim_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b, int32_t c) { TCGv_i32 t = tcg_temp_new_i32(); @@ -1946,6 +1889,9 @@ static DisasJumpType op_vesv(DisasContext *s, DisasOps *o) case 0x70: gen_gvec_fn_3(shlv, es, v1, v2, v3); break; + case 0x73: + gen_gvec_fn_3(rotlv, es, v1, v2, v3); + break; case 0x7a: gen_gvec_fn_3(sarv, es, v1, v2, v3); break; @@ -1977,6 +1923,9 @@ static DisasJumpType op_ves(DisasContext *s, DisasOps *o) case 0x30: gen_gvec_fn_2i(shli, es, v1, v3, d2); break; + case 0x33: + gen_gvec_fn_2i(rotli, es, v1, v3, d2); + break; case 0x3a: gen_gvec_fn_2i(sari, es, v1, v3, d2); break; @@ -1994,6 +1943,9 @@ static DisasJumpType op_ves(DisasContext *s, DisasOps *o) case 0x30: gen_gvec_fn_2s(shls, es, v1, v3, shift); break; + case 0x33: + gen_gvec_fn_2s(rotls, es, v1, v3, shift); + break; case 0x3a: gen_gvec_fn_2s(sars, es, v1, v3, shift); break; diff --git a/target/s390x/vec_int_helper.c b/target/s390x/vec_int_helper.c index 0d6bc13dd6..5561b3ed90 100644 --- a/target/s390x/vec_int_helper.c +++ b/target/s390x/vec_int_helper.c @@ -515,37 +515,6 @@ void HELPER(gvec_vpopct##BITS)(void *v1, const void *v2, uint32_t desc) \ DEF_VPOPCT(8) DEF_VPOPCT(16) -#define DEF_VERLLV(BITS) \ -void HELPER(gvec_verllv##BITS)(void *v1, const void *v2, const void *v3, \ - uint32_t desc) \ -{ \ - int i; \ - \ - for (i = 0; i < (128 / BITS); i++) { \ - const uint##BITS##_t a = s390_vec_read_element##BITS(v2, i); \ - const uint##BITS##_t b = s390_vec_read_element##BITS(v3, i); \ - \ - s390_vec_write_element##BITS(v1, i, rol##BITS(a, b)); \ - } \ -} -DEF_VERLLV(8) -DEF_VERLLV(16) - -#define DEF_VERLL(BITS) \ -void HELPER(gvec_verll##BITS)(void *v1, const void *v2, uint64_t count, \ - uint32_t desc) \ -{ \ - int i; \ - \ - for (i = 0; i < (128 / BITS); i++) { \ - const uint##BITS##_t a = s390_vec_read_element##BITS(v2, i); \ - \ - s390_vec_write_element##BITS(v1, i, rol##BITS(a, count)); \ - } \ -} -DEF_VERLL(8) -DEF_VERLL(16) - #define DEF_VERIM(BITS) \ void HELPER(gvec_verim##BITS)(void *v1, const void *v2, const void *v3, \ uint32_t desc) \ diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 2bc77f0871..91ddaedd84 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -1147,8 +1147,8 @@ /* VECTOR POPULATION COUNT */ F(0xe750, VPOPCT, VRR_a, V, 0, 0, 0, 0, vpopct, 0, IF_VEC) /* VECTOR ELEMENT ROTATE LEFT LOGICAL */ - F(0xe773, VERLLV, VRR_c, V, 0, 0, 0, 0, verllv, 0, IF_VEC) - F(0xe733, VERLL, VRS_a, V, la2, 0, 0, 0, verll, 0, IF_VEC) + F(0xe773, VERLLV, VRR_c, V, 0, 0, 0, 0, vesv, 0, IF_VEC) + F(0xe733, VERLL, VRS_a, V, la2, 0, 0, 0, ves, 0, IF_VEC) /* VECTOR ELEMENT ROTATE AND INSERT UNDER MASK */ F(0xe772, VERIM, VRI_d, V, 0, 0, 0, 0, verim, 0, IF_VEC) /* VECTOR ELEMENT SHIFT LEFT */