From patchwork Tue Jun 29 18:53:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468325 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5249251jao; Tue, 29 Jun 2021 12:23:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLDAzGBKQuETLhsGNubJQvJaun914n0s8y1NRvPMkkUWi+/+RHj/E63RbsIEgQ7QuLK4d2 X-Received: by 2002:ab0:6145:: with SMTP id w5mr29295476uan.32.1624994581714; Tue, 29 Jun 2021 12:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994581; cv=none; d=google.com; s=arc-20160816; b=hEKWgWkWxvllWpZDw0lkCNGVDdAX8WUnJwe53JehkALM3BJXCZfaN6iLp/0fEX6Vr+ JdR+GuMbtCfO4e2iAEm5pIsXiLhu/pU4+i7srbUQcuvbIrp5F0XvzF1g48pc9qw5BMQ3 98hn1zBMwO0ATqc3IqjTk8C9OerpD9d9XZ8Lv2GTkWJ4PVtxXPebTijMkk/5OKLqDko9 Z7e5W1uPWoDRjdnWTrXji86tVO+usOLICqr3itJvGHfhDhr4UAJCkb2GzYxSVNwMzTTz jiMeDVfN3P42QJfBhouaUim6e4BGP+D95003yx074NK15FCNymjYJQBOKBjMSrQfchpg /3nw== 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=FBvB7U/HcEMO5AJVKY9MEDQbcWzedaB5pCNHh5Z+IcE=; b=XwyOmBczFzux1Zhlg2E+uoffNCj6XO0N0Q8RQZK5NVKbrsCFEv10mbvGh55GI4cItX 3+qvKVfyKHkXlwrEZx6szP3i3yjk14fuuO07kzBYA11CEJyisfaR20gAbe9d+wGpLcha 5wwoC4W4NFMSfLi26gxv7Z0xToDDrZtiGPH/9dRBzH2Jh+DOHhc/CQwrx+pzPK5xj0Gs evOoAdG/uEiiU5RDXMliBfBbTjueG/96gYMsim41IipTdM/vt9CLWUQ+5n0iax7fpJPf lddOYP4AC4Etn+ioEc1cSufj/DuiCaLQ2/qMtYLN4KNLHF9reZjK2cYB6yjHe3bC8i5A Nz/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zYlpJtTR; 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 w4si8074500vkg.77.2021.06.29.12.23.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:23: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=zYlpJtTR; 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]:53366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJK1-0000kE-38 for patch@linaro.org; Tue, 29 Jun 2021 15:23:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38196) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIsu-0007sS-FB for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:01 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:43858) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIss-0000q7-5T for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:54:59 -0400 Received: by mail-pl1-x630.google.com with SMTP id v12so25493plo.10 for ; Tue, 29 Jun 2021 11:54:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FBvB7U/HcEMO5AJVKY9MEDQbcWzedaB5pCNHh5Z+IcE=; b=zYlpJtTRdoBPO+R0OZUhw4uQAe2Qyyjq7aUAdMQOsKE74Yxoy5kplilLW+wDcBBeog KtjM4pSS6bPRzJAmNsVliFqrdB5FGK+4mEpolFmH/k5+DVjMVqL1tTYNuy/CyuTg0gPh 3Bj9JBBH3XoI0IHhDED4xfDTzr+MZYdIXZXpr4MTVGyXFFJ8JkhDt0MVdb4QAd5dm4A6 +KgBTo/i95IAGMzJUfdIS+YCQD0QwAZ8btcrMYd/fsf4K4jz0s8bauBJuXrWKC1fBnDw ICY++l/JHNj0aeBXrUl5zvLNZ2rUW3qgYoeH+2PlYN5B7+zAXwwOP+FOTZgmV88hLN76 Mm6A== 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=FBvB7U/HcEMO5AJVKY9MEDQbcWzedaB5pCNHh5Z+IcE=; b=MQtjQQj5nxVAOZfYW/rgdgJ0pjRBfpxTge/df+anM/dxnYOnQkrBpNa2HaYckPYtX5 gSoK4GkkNO7jIrBIPhzCnZFGQKwYC4FgWruR0nDd2agn4C6oz2hno3gVrV0JzHE00Thn tzauMznF/OL8CC69v4PFMmsJvm7R31rYBPm0GD79SIeWK2J4d2EZfIFFY6tZaL7elBmI SAhUpq1q2naJpR+zTQIJwU3x2spd+V/ecb/SL0tJf85/kK/ivFKoP85KNBB0TKWGfHq0 FN8jRUbhlRFdOcUFrN92TRjqP0W0+sBcyb/fZwIrNlB6duAxOklvxVUM/g6NI1eEmLiw xdnQ== X-Gm-Message-State: AOAM530A7Ah7yQ34I3D65VyO3a4Fbri/VWMGL4Uvoj1aJKcGZm7dBdVm xd8cOFpQ1CxEgdff5YMEhCZ1rCX8tLJO3w== X-Received: by 2002:a17:90a:8588:: with SMTP id m8mr315362pjn.160.1624992896720; Tue, 29 Jun 2021 11:54:56 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.54.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:54:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 01/63] target/nios2: Replace DISAS_TB_JUMP with DISAS_NORETURN Date: Tue, 29 Jun 2021 11:53:53 -0700 Message-Id: <20210629185455.3131172-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The only semantic of DISAS_TB_JUMP is that we've done goto_tb, which is the same as DISAS_NORETURN -- we've exited the tb. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) -- 2.25.1 diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 399f22d938..388fae93a2 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -37,7 +37,6 @@ /* is_jmp field values */ #define DISAS_JUMP DISAS_TARGET_0 /* only pc was modified dynamically */ #define DISAS_UPDATE DISAS_TARGET_1 /* cpu state was modified dynamically */ -#define DISAS_TB_JUMP DISAS_TARGET_2 /* only pc was modified statically */ #define INSTRUCTION_FLG(func, flags) { (func), (flags) } #define INSTRUCTION(func) \ @@ -209,7 +208,7 @@ static void jmpi(DisasContext *dc, uint32_t code, uint32_t flags) { J_TYPE(instr, code); gen_goto_tb(dc, 0, (dc->pc & 0xF0000000) | (instr.imm26 << 2)); - dc->is_jmp = DISAS_TB_JUMP; + dc->is_jmp = DISAS_NORETURN; } static void call(DisasContext *dc, uint32_t code, uint32_t flags) @@ -269,7 +268,7 @@ static void br(DisasContext *dc, uint32_t code, uint32_t flags) I_TYPE(instr, code); gen_goto_tb(dc, 0, dc->pc + 4 + (instr.imm16.s & -4)); - dc->is_jmp = DISAS_TB_JUMP; + dc->is_jmp = DISAS_NORETURN; } static void gen_bxx(DisasContext *dc, uint32_t code, uint32_t flags) @@ -281,7 +280,7 @@ static void gen_bxx(DisasContext *dc, uint32_t code, uint32_t flags) gen_goto_tb(dc, 0, dc->pc + 4); gen_set_label(l1); gen_goto_tb(dc, 1, dc->pc + 4 + (instr.imm16.s & -4)); - dc->is_jmp = DISAS_TB_JUMP; + dc->is_jmp = DISAS_NORETURN; } /* Comparison instructions */ @@ -883,7 +882,6 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) break; case DISAS_NORETURN: - case DISAS_TB_JUMP: /* nothing more to generate */ break; } From patchwork Tue Jun 29 18:53:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468331 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5251384jao; Tue, 29 Jun 2021 12:26:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3CoptBFPw0LPNT36Y9/n+zyL3Dn47pYnKe7vn4nujKC31nXddn0QebcBbs7CJrfSGZb+A X-Received: by 2002:a25:1f02:: with SMTP id f2mr39812423ybf.25.1624994807319; Tue, 29 Jun 2021 12:26:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994807; cv=none; d=google.com; s=arc-20160816; b=KJj6ZeeqYqxkarHsWNlUh7cg44vUJcEFEtkduDvMdJ6JpiNXcsrhQ5MYSHopoOCM0t e2G2NQAoZtf8U7dlJwCZChyfhdUAin8p8ZJoJCoOBD1oeV4/AqZrXTii63lukgJtEOvF CXM3jlG+55BOrewfFJEM90dfPtOBBrgaFqLyJBlKVMrgELYwp1H/i6agHDm3dXDLnHSG lMCa8NSAuTfVsGRXNTM0+LYdbvkWpinOYAx85o4w6NM02QLgHE9womJ2ZZ5kqYMegG3M HeVSXXdzVtdngrJ1C3DGAqb1RhcUAJNgIFBmkcwH4RWD3Bg8ELC/+YnXPiv4OfN4Bvek yPGA== 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=8bBekJoN92H0aYPF+hL0RhFsQgD+q2xSW84THBsT56U=; b=sUKI0UrvrpHxUqALN63zCSRM74ZcwvdIrRsdoh4t4yTLT8ZuSgyPof14m+ooC+OsAo Pqo5RgI0H2k2aT0NrzEvnshPb6QbxtS6B7CEY4A+AXjNalAeuew6/Qn+bLC4xQVBYZ25 tBroWw3XYS6jEF9YXfHtdm/23zWweoGFvQtphZtxqCOiC7mFWPKL5PSv3miXk9uqr5gt MZG7fdtKJZj7YPTmq/bGIDAMfLCg7TOH2WE77qaWW41XJCQgC2VCh+d4ML1x981AuV80 bzpNAAzCKlWTsoquwpNNi7ORErNkraWI9vqbGxJXpMKFOtcadJal/T9JUHSYRHpq6pS1 fOzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wMnJJn3V; 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 bt2si19687401ybb.479.2021.06.29.12.26.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:26: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=wMnJJn3V; 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]:39926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJNe-0002Ep-Pe for patch@linaro.org; Tue, 29 Jun 2021 15:26:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIsw-0007u4-0r for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:03 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:39678) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIst-0000qC-5R for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:01 -0400 Received: by mail-pj1-x1031.google.com with SMTP id in17-20020a17090b4391b0290170ba0ec7fcso2259633pjb.4 for ; Tue, 29 Jun 2021 11:54: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=8bBekJoN92H0aYPF+hL0RhFsQgD+q2xSW84THBsT56U=; b=wMnJJn3V0pObWksXLngzsyIuBEmxyvc6yIQhu+duDfnVclXnvbdouEqy51iLbgw0+w gTI5E3HBbDuaBymnxv8kX+UhUZ7SGuwA2ggImpLv7h+32YvGoVeSD7I5Jvk/fRVhBpnk PDDlQiSYrNj0mGogOcOIXQCj7ieB3mp9Q60cVhzZq4CD9E2xo1w0BuC+OtjolJLQYcNe A7aAg71Q3AOCjk1qpRXwQkfdctVP+dFN5sAk33rD9GlmliRJEWFhOcJ/LBEOo0l7S52Z C0fz40Kp4fBPXNv6nJh5h6SB+x4KNQix1AxudL6g9xONHAnbYtKOWj7X+G7NOdDIvSdD uDXA== 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=8bBekJoN92H0aYPF+hL0RhFsQgD+q2xSW84THBsT56U=; b=MCzkCSMWjMDSbly42nlssa7Gecm8v5oPqyRicr6GpNevB9QzqIjbaBi8sjXm8pS8X/ 9lbo54owc1QEtCqyS44++0CDrePZZrJ/LKQMtH4ZOPjaAMRVUBQgD1ObIQEIQ7z14ilA v1d1lAatbAzQ0fVx5wo8YbDea10gEee0exh11mb2jbDiLtEhUzbVhCgDNm4n3TM7gk21 s48qOeLAkzbMls0BYFOdUPMQhylwF0Rz+0Ll0Aaa6zjcHqpxg7V3uQ4OVityNJTeHzCm Ua1vbAYkUk4RuVzE/7SfoGtvP2YsuziwurXCObX/Jg8Nk9PidHyrR2vAzEILAPvAJs3b 4Jcg== X-Gm-Message-State: AOAM532BKfc7KG7Tarie08XRAf8hRfIxUPuh3yGgkTT0451TNxJoBH1m aHwqcKp4LS1nmYMAMx9qbjuHIZOyCweQPA== X-Received: by 2002:a17:902:6902:b029:106:50e3:b2db with SMTP id j2-20020a1709026902b029010650e3b2dbmr28832677plk.35.1624992897325; Tue, 29 Jun 2021 11:54:57 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.54.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:54:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 02/63] target/nios2: Use global cpu_env Date: Tue, 29 Jun 2021 11:53:54 -0700 Message-Id: <20210629185455.3131172-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We do not need to copy this into DisasContext. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 388fae93a2..39538e1870 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -97,7 +97,6 @@ } typedef struct DisasContext { - TCGv_ptr cpu_env; TCGv *cpu_R; TCGv_i32 zero; int is_jmp; @@ -147,7 +146,7 @@ static void t_gen_helper_raise_exception(DisasContext *dc, TCGv_i32 tmp = tcg_const_i32(index); tcg_gen_movi_tl(dc->cpu_R[R_PC], dc->pc); - gen_helper_raise_exception(dc->cpu_env, tmp); + gen_helper_raise_exception(cpu_env, tmp); tcg_temp_free_i32(tmp); dc->is_jmp = DISAS_NORETURN; } @@ -474,7 +473,7 @@ static void rdctl(DisasContext *dc, uint32_t code, uint32_t flags) tcg_gen_mov_tl(dc->cpu_R[instr.c], dc->cpu_R[instr.imm5 + CR_BASE]); #ifdef DEBUG_MMU TCGv_i32 tmp = tcg_const_i32(instr.imm5 + CR_BASE); - gen_helper_mmu_read_debug(dc->cpu_R[instr.c], dc->cpu_env, tmp); + gen_helper_mmu_read_debug(dc->cpu_R[instr.c], cpu_env, tmp); tcg_temp_free_i32(tmp); #endif } @@ -504,7 +503,7 @@ static void wrctl(DisasContext *dc, uint32_t code, uint32_t flags) { #if !defined(CONFIG_USER_ONLY) TCGv_i32 tmp = tcg_const_i32(instr.imm5 + CR_BASE); - gen_helper_mmu_write(dc->cpu_env, tmp, load_gpr(dc, instr.a)); + gen_helper_mmu_write(cpu_env, tmp, load_gpr(dc, instr.a)); tcg_temp_free_i32(tmp); #endif break; @@ -521,7 +520,7 @@ static void wrctl(DisasContext *dc, uint32_t code, uint32_t flags) if (tb_cflags(dc->tb) & CF_USE_ICOUNT) { gen_io_start(); } - gen_helper_check_interrupts(dc->cpu_env); + gen_helper_check_interrupts(cpu_env); dc->is_jmp = DISAS_UPDATE; } #endif @@ -817,7 +816,6 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) int num_insns; /* Initialize DC */ - dc->cpu_env = cpu_env; dc->cpu_R = cpu_R; dc->is_jmp = DISAS_NEXT; dc->pc = tb->pc; From patchwork Tue Jun 29 18:53:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468316 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5237786jao; Tue, 29 Jun 2021 12:07:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKQrgwO6ah8SaplqJ8etaqUPXuH9nY9Fi+/eoS5uz3eQKG4dJWhR0GIj6jOMc67i4hjWkN X-Received: by 2002:a25:ce92:: with SMTP id x140mr11475907ybe.131.1624993661114; Tue, 29 Jun 2021 12:07:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624993661; cv=none; d=google.com; s=arc-20160816; b=b3tj/Zz4d2mo2pSRT1zcu0V15fvvdIEGcuo/DSabJ4kOwGkNBbSUH8lKPq1UQelxeM 8ll6ilTvAyrw7JBCLmfSoy47G2QIWU98xJruFRR1l8Yo+j2/8wspWjGeLvgFYrUm1ZdV psFJmeTwSR+eJYK4c8Ac0Em/bl2fQPULqMQaO3s+cI/61vKdS0JHbeMznjceL6Olygx6 RAYRHj1XIgSDlIoTawazjCLcc4lC/e/iILSrR73aCN5RysB11LYn1W29bS7h2Og58iiN cPnbimsfhZjezBwcK1/6q/6TZpoTUxUU6C+3nwFFun+r5gihPiYSen5P3j/xwWY57veo IGSg== 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=/YZiQOWpMFmRWAnx16Cxj31dHDc5RxHIDs7FILi+mNg=; b=y9tg4aqYn9a3ZOo/rDKL+mpZ+jm/eqo9dc+FjOhvbW22dqdkkANx1oUWLOCoUGwE4i wqFvlQ/XAkZ72Aui6KMrNTXHzduv0j7CAFLGgC2ZfpNW0jFK8qWcXRC2Zlz9ibmhSFcF pJ5+ED7KrKmyMUWvmL4dJKz/vEksSLqZDvEigHebjr7f7vaGR92ZfaXbr9iUFaVmiIlb TBtIkuGgNvBStlb/ymzh2OgrHpww3uEd9etBH12dE+DiVUXj173qCeR6AZnBbh41swi7 UB1cd9KS996h0Vyl9e/yZ9hpe4Hxj4ml7qPmqmNZQi9Foz1zV5OCHZ0vDCbqYJ4uZHa2 UCpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SdsOEyjx; 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 n76si16180667ybg.183.2021.06.29.12.07.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:07: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=SdsOEyjx; 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]:41280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJ5A-0006nx-GD for patch@linaro.org; Tue, 29 Jun 2021 15:07:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItA-0007z6-9a for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:16 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:36376) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIst-0000qX-5a for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:09 -0400 Received: by mail-pf1-x430.google.com with SMTP id 21so111562pfp.3 for ; Tue, 29 Jun 2021 11:54: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=/YZiQOWpMFmRWAnx16Cxj31dHDc5RxHIDs7FILi+mNg=; b=SdsOEyjx7ILb5UddQCShpNkJ1jY8L7qJfkfignMufduNggsDmfKwwB06/o2TCKfyNQ ZGY8b4gyQgjPzRIDsPCMyHV11/w7bi10Tj9XxT2WT2x4wjw3dxZtDMDr2LXZXFJUGjlA EDB87hzEC9g4KfWqDhf+pZTWuIphfmwJFhURpk17WZK6H/YqhLbPbrYxca7nWXdmHm7x SP8FOuQmbY17zWUPUILpiQIbdfsWUm4GIQw09kCoV4KoyTyJ9KBhYDqWfpglqhM47dbD vrIcbVlj1pZleLEbW/wsGkZQ2HceiFzWNc0VGG8hfluusBbENGuYbh15k/50b6iD5XP8 nOlQ== 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=/YZiQOWpMFmRWAnx16Cxj31dHDc5RxHIDs7FILi+mNg=; b=bh1RmPqZyfiC3OSke3u97kaVYHo/5HBZMx4IgSLuNoRekdUAExiIlMj+1QWvE0xOek fx6Vw0o7HErJk2xrZ9tUFcqKUf+HNPe/fS0DtZSYfswAbNQl9NQ6jW/XUnkKvOqc/Y1w k7x1Av+M7v11KI4nmVZMXrynNQOj8UTi3rYlOxBIwCkBzS20EK1/ILKd7nKxrfun6/VF 91Ga/fKRNvFoNlewyvgTfTrITvYC9EMRWDDgE9lCWPUdahsaHXyfFmLRkDzQWbe3fOHN njd0339QeWzA+DyBCDNYTV9hm53bmfn64JL1yh6wJnNTb2WlKlV5FtvCykNjj2uOjvdi eadQ== X-Gm-Message-State: AOAM532JDqnvQF8evl5Xpw+hOGDvLosDP+4HL7ztYBagXGyxiwr06RIP mj2VwhbC7h0hv/y0azJdsE9CZ1H49Xye3Q== X-Received: by 2002:a63:4c19:: with SMTP id z25mr29760079pga.160.1624992897832; Tue, 29 Jun 2021 11:54:57 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:54:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 03/63] target/nios2: Use global cpu_R Date: Tue, 29 Jun 2021 11:53:55 -0700 Message-Id: <20210629185455.3131172-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We do not need to copy this into DisasContext. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 73 +++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 39 deletions(-) -- 2.25.1 diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 39538e1870..6bdd388bd8 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -97,7 +97,6 @@ } typedef struct DisasContext { - TCGv *cpu_R; TCGv_i32 zero; int is_jmp; target_ulong pc; @@ -106,6 +105,8 @@ typedef struct DisasContext { bool singlestep_enabled; } DisasContext; +static TCGv cpu_R[NUM_CORE_REGS]; + typedef struct Nios2Instruction { void (*handler)(DisasContext *dc, uint32_t code, uint32_t flags); uint32_t flags; @@ -134,7 +135,7 @@ static TCGv load_zero(DisasContext *dc) static TCGv load_gpr(DisasContext *dc, uint8_t reg) { if (likely(reg != R_ZERO)) { - return dc->cpu_R[reg]; + return cpu_R[reg]; } else { return load_zero(dc); } @@ -145,7 +146,7 @@ static void t_gen_helper_raise_exception(DisasContext *dc, { TCGv_i32 tmp = tcg_const_i32(index); - tcg_gen_movi_tl(dc->cpu_R[R_PC], dc->pc); + tcg_gen_movi_tl(cpu_R[R_PC], dc->pc); gen_helper_raise_exception(cpu_env, tmp); tcg_temp_free_i32(tmp); dc->is_jmp = DISAS_NORETURN; @@ -170,10 +171,10 @@ static void gen_goto_tb(DisasContext *dc, int n, uint32_t dest) if (use_goto_tb(dc, dest)) { tcg_gen_goto_tb(n); - tcg_gen_movi_tl(dc->cpu_R[R_PC], dest); + tcg_gen_movi_tl(cpu_R[R_PC], dest); tcg_gen_exit_tb(tb, n); } else { - tcg_gen_movi_tl(dc->cpu_R[R_PC], dest); + tcg_gen_movi_tl(cpu_R[R_PC], dest); tcg_gen_exit_tb(NULL, 0); } } @@ -212,7 +213,7 @@ static void jmpi(DisasContext *dc, uint32_t code, uint32_t flags) static void call(DisasContext *dc, uint32_t code, uint32_t flags) { - tcg_gen_movi_tl(dc->cpu_R[R_RA], dc->pc + 4); + tcg_gen_movi_tl(cpu_R[R_RA], dc->pc + 4); jmpi(dc, code, flags); } @@ -234,7 +235,7 @@ static void gen_ldx(DisasContext *dc, uint32_t code, uint32_t flags) * the Nios2 CPU. */ if (likely(instr.b != R_ZERO)) { - data = dc->cpu_R[instr.b]; + data = cpu_R[instr.b]; } else { data = tcg_temp_new(); } @@ -275,7 +276,7 @@ static void gen_bxx(DisasContext *dc, uint32_t code, uint32_t flags) I_TYPE(instr, code); TCGLabel *l1 = gen_new_label(); - tcg_gen_brcond_tl(flags, dc->cpu_R[instr.a], dc->cpu_R[instr.b], l1); + tcg_gen_brcond_tl(flags, cpu_R[instr.a], cpu_R[instr.b], l1); gen_goto_tb(dc, 0, dc->pc + 4); gen_set_label(l1); gen_goto_tb(dc, 1, dc->pc + 4 + (instr.imm16.s & -4)); @@ -287,8 +288,7 @@ static void gen_bxx(DisasContext *dc, uint32_t code, uint32_t flags) static void (fname)(DisasContext *dc, uint32_t code, uint32_t flags) \ { \ I_TYPE(instr, (code)); \ - tcg_gen_setcondi_tl(flags, (dc)->cpu_R[instr.b], (dc)->cpu_R[instr.a], \ - (op3)); \ + tcg_gen_setcondi_tl(flags, cpu_R[instr.b], cpu_R[instr.a], (op3)); \ } gen_i_cmpxx(gen_cmpxxsi, instr.imm16.s) @@ -302,10 +302,9 @@ static void (fname)(DisasContext *dc, uint32_t code, uint32_t flags) \ if (unlikely(instr.b == R_ZERO)) { /* Store to R_ZERO is ignored */ \ return; \ } else if (instr.a == R_ZERO) { /* MOVxI optimizations */ \ - tcg_gen_movi_tl(dc->cpu_R[instr.b], (resimm) ? (op3) : 0); \ + tcg_gen_movi_tl(cpu_R[instr.b], (resimm) ? (op3) : 0); \ } else { \ - tcg_gen_##insn##_tl((dc)->cpu_R[instr.b], (dc)->cpu_R[instr.a], \ - (op3)); \ + tcg_gen_##insn##_tl(cpu_R[instr.b], cpu_R[instr.a], (op3)); \ } \ } @@ -400,8 +399,8 @@ static const Nios2Instruction i_type_instructions[] = { */ static void eret(DisasContext *dc, uint32_t code, uint32_t flags) { - tcg_gen_mov_tl(dc->cpu_R[CR_STATUS], dc->cpu_R[CR_ESTATUS]); - tcg_gen_mov_tl(dc->cpu_R[R_PC], dc->cpu_R[R_EA]); + tcg_gen_mov_tl(cpu_R[CR_STATUS], cpu_R[CR_ESTATUS]); + tcg_gen_mov_tl(cpu_R[R_PC], cpu_R[R_EA]); dc->is_jmp = DISAS_JUMP; } @@ -409,7 +408,7 @@ static void eret(DisasContext *dc, uint32_t code, uint32_t flags) /* PC <- ra */ static void ret(DisasContext *dc, uint32_t code, uint32_t flags) { - tcg_gen_mov_tl(dc->cpu_R[R_PC], dc->cpu_R[R_RA]); + tcg_gen_mov_tl(cpu_R[R_PC], cpu_R[R_RA]); dc->is_jmp = DISAS_JUMP; } @@ -417,7 +416,7 @@ static void ret(DisasContext *dc, uint32_t code, uint32_t flags) /* PC <- ba */ static void bret(DisasContext *dc, uint32_t code, uint32_t flags) { - tcg_gen_mov_tl(dc->cpu_R[R_PC], dc->cpu_R[R_BA]); + tcg_gen_mov_tl(cpu_R[R_PC], cpu_R[R_BA]); dc->is_jmp = DISAS_JUMP; } @@ -427,7 +426,7 @@ static void jmp(DisasContext *dc, uint32_t code, uint32_t flags) { R_TYPE(instr, code); - tcg_gen_mov_tl(dc->cpu_R[R_PC], load_gpr(dc, instr.a)); + tcg_gen_mov_tl(cpu_R[R_PC], load_gpr(dc, instr.a)); dc->is_jmp = DISAS_JUMP; } @@ -438,7 +437,7 @@ static void nextpc(DisasContext *dc, uint32_t code, uint32_t flags) R_TYPE(instr, code); if (likely(instr.c != R_ZERO)) { - tcg_gen_movi_tl(dc->cpu_R[instr.c], dc->pc + 4); + tcg_gen_movi_tl(cpu_R[instr.c], dc->pc + 4); } } @@ -450,8 +449,8 @@ static void callr(DisasContext *dc, uint32_t code, uint32_t flags) { R_TYPE(instr, code); - tcg_gen_mov_tl(dc->cpu_R[R_PC], load_gpr(dc, instr.a)); - tcg_gen_movi_tl(dc->cpu_R[R_RA], dc->pc + 4); + tcg_gen_mov_tl(cpu_R[R_PC], load_gpr(dc, instr.a)); + tcg_gen_movi_tl(cpu_R[R_RA], dc->pc + 4); dc->is_jmp = DISAS_JUMP; } @@ -470,10 +469,10 @@ static void rdctl(DisasContext *dc, uint32_t code, uint32_t flags) { #if !defined(CONFIG_USER_ONLY) if (likely(instr.c != R_ZERO)) { - tcg_gen_mov_tl(dc->cpu_R[instr.c], dc->cpu_R[instr.imm5 + CR_BASE]); + tcg_gen_mov_tl(cpu_R[instr.c], cpu_R[instr.imm5 + CR_BASE]); #ifdef DEBUG_MMU TCGv_i32 tmp = tcg_const_i32(instr.imm5 + CR_BASE); - gen_helper_mmu_read_debug(dc->cpu_R[instr.c], cpu_env, tmp); + gen_helper_mmu_read_debug(cpu_R[instr.c], cpu_env, tmp); tcg_temp_free_i32(tmp); #endif } @@ -483,7 +482,7 @@ static void rdctl(DisasContext *dc, uint32_t code, uint32_t flags) default: if (likely(instr.c != R_ZERO)) { - tcg_gen_mov_tl(dc->cpu_R[instr.c], dc->cpu_R[instr.imm5 + CR_BASE]); + tcg_gen_mov_tl(cpu_R[instr.c], cpu_R[instr.imm5 + CR_BASE]); } break; } @@ -510,7 +509,7 @@ static void wrctl(DisasContext *dc, uint32_t code, uint32_t flags) } default: - tcg_gen_mov_tl(dc->cpu_R[instr.imm5 + CR_BASE], load_gpr(dc, instr.a)); + tcg_gen_mov_tl(cpu_R[instr.imm5 + CR_BASE], load_gpr(dc, instr.a)); break; } @@ -531,8 +530,8 @@ static void gen_cmpxx(DisasContext *dc, uint32_t code, uint32_t flags) { R_TYPE(instr, code); if (likely(instr.c != R_ZERO)) { - tcg_gen_setcond_tl(flags, dc->cpu_R[instr.c], dc->cpu_R[instr.a], - dc->cpu_R[instr.b]); + tcg_gen_setcond_tl(flags, cpu_R[instr.c], cpu_R[instr.a], + cpu_R[instr.b]); } } @@ -542,8 +541,7 @@ static void (fname)(DisasContext *dc, uint32_t code, uint32_t flags) \ { \ R_TYPE(instr, (code)); \ if (likely(instr.c != R_ZERO)) { \ - tcg_gen_##insn((dc)->cpu_R[instr.c], load_gpr((dc), instr.a), \ - (op3)); \ + tcg_gen_##insn(cpu_R[instr.c], load_gpr((dc), instr.a), (op3)); \ } \ } @@ -567,8 +565,8 @@ static void (fname)(DisasContext *dc, uint32_t code, uint32_t flags) \ R_TYPE(instr, (code)); \ if (likely(instr.c != R_ZERO)) { \ TCGv t0 = tcg_temp_new(); \ - tcg_gen_##insn(t0, dc->cpu_R[instr.c], \ - load_gpr(dc, instr.a), load_gpr(dc, instr.b)); \ + tcg_gen_##insn(t0, cpu_R[instr.c], \ + load_gpr(dc, instr.a), load_gpr(dc, instr.b)); \ tcg_temp_free(t0); \ } \ } @@ -584,7 +582,7 @@ static void (fname)(DisasContext *dc, uint32_t code, uint32_t flags) \ if (likely(instr.c != R_ZERO)) { \ TCGv t0 = tcg_temp_new(); \ tcg_gen_andi_tl(t0, load_gpr((dc), instr.b), 31); \ - tcg_gen_##insn((dc)->cpu_R[instr.c], load_gpr((dc), instr.a), t0); \ + tcg_gen_##insn(cpu_R[instr.c], load_gpr((dc), instr.a), t0); \ tcg_temp_free(t0); \ } \ } @@ -618,8 +616,8 @@ static void divs(DisasContext *dc, uint32_t code, uint32_t flags) tcg_gen_or_tl(t2, t2, t3); tcg_gen_movi_tl(t3, 0); tcg_gen_movcond_tl(TCG_COND_NE, t1, t2, t3, t2, t1); - tcg_gen_div_tl(dc->cpu_R[instr.c], t0, t1); - tcg_gen_ext32s_tl(dc->cpu_R[instr.c], dc->cpu_R[instr.c]); + tcg_gen_div_tl(cpu_R[instr.c], t0, t1); + tcg_gen_ext32s_tl(cpu_R[instr.c], cpu_R[instr.c]); tcg_temp_free(t3); tcg_temp_free(t2); @@ -644,8 +642,8 @@ static void divu(DisasContext *dc, uint32_t code, uint32_t flags) tcg_gen_ext32u_tl(t0, load_gpr(dc, instr.a)); tcg_gen_ext32u_tl(t1, load_gpr(dc, instr.b)); tcg_gen_movcond_tl(TCG_COND_EQ, t1, t1, t2, t3, t1); - tcg_gen_divu_tl(dc->cpu_R[instr.c], t0, t1); - tcg_gen_ext32s_tl(dc->cpu_R[instr.c], dc->cpu_R[instr.c]); + tcg_gen_divu_tl(cpu_R[instr.c], t0, t1); + tcg_gen_ext32s_tl(cpu_R[instr.c], cpu_R[instr.c]); tcg_temp_free(t3); tcg_temp_free(t2); @@ -794,8 +792,6 @@ static const char * const regnames[] = { "rpc" }; -static TCGv cpu_R[NUM_CORE_REGS]; - #include "exec/gen-icount.h" static void gen_exception(DisasContext *dc, uint32_t excp) @@ -816,7 +812,6 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) int num_insns; /* Initialize DC */ - dc->cpu_R = cpu_R; dc->is_jmp = DISAS_NEXT; dc->pc = tb->pc; dc->tb = tb; From patchwork Tue Jun 29 18:53:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468327 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5250201jao; Tue, 29 Jun 2021 12:24:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxets1A3BVDV24XDQC/naNssoKQnR2Tgz2hU04dwoy7czn5c5BfFo2uPNK05RVxR4tBffpB X-Received: by 2002:a25:b09f:: with SMTP id f31mr39751959ybj.9.1624994676040; Tue, 29 Jun 2021 12:24:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994676; cv=none; d=google.com; s=arc-20160816; b=iXIf0iYeSK/KZ+LR3YScKBhTOwJdWMj4U/fdefhvDnjyQF7xLzZdYFC3ecOpJt6Aya mfNgW+ebbezenZPu780SH0UF9EWQLImxoORe5ZoKEZjzq+ltaR4qhKr4IFiFI6OCbjSb D8atXzOvIzxQB44xESEE5sksLF3Pf01wNhK25utf2W+UtBYiDKwW2sCCkPczKIoGc65y RE1RcaoekvyfJbQZSkagWuvdzh76UAi3a55MY93H/6RKkuPzygbMoVebCcyIo049zuoI /WahNif4E1TlXgbYb0uGnRoGnGTQqxRhkGUZiCr8RMr+98NYWEku+/7YEA/F3kGmckoS P6Dg== 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=jI3bEU+f0zZItWGOzZW4leD8dAQuDRrKyQbHa4mJbTE=; b=V0uSAKLQxFlPswW8J7j3AgU8uQduKnkI7GzjZMywr4tJ5gcmtixzuqWDetYyM3K5ku YzzBC95se26IwLclCOwqCMdt628/Rvbz5z5aC/dgQhBeoh0Kf0PpyFoaMKAfqStg/eHF p6vUQW4ct+6tOWfDy4UFKnMjuLyn8QU4FXtE2gUVzq7gtw10EcO0s2SuG4aV4pWOQTVL 8YiWMWZk39g1aTgGW3T8nyfd6P75hKk0B078YW1CW1BMYcuPVWtqn+XJVdcnfTalDqnw irKkwLJk10M3sKtL1t1t/lRsjgC5paGSwwynmEoTmMx91ePIcQAh0I6Lks1BB8MJanhC Ubhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SYVIreNw; 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 s11si5004419ybq.334.2021.06.29.12.24.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:24: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=SYVIreNw; 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]:57896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJLX-0003nK-F6 for patch@linaro.org; Tue, 29 Jun 2021 15:24:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItA-0007zD-AP for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:16 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:54178) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIst-0000qs-QG for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:06 -0400 Received: by mail-pj1-x102c.google.com with SMTP id q91so136966pjk.3 for ; Tue, 29 Jun 2021 11:54: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=jI3bEU+f0zZItWGOzZW4leD8dAQuDRrKyQbHa4mJbTE=; b=SYVIreNwVkmNgZxkL2935gLcc1YkH3mk+aFKjf7Q/fog9zTqyTq6kFs8etvR5H7xtz s58oWqImp6rC/S6pa6wuQc5haqmllksBEle+5rDuDGarI7pxLkKYMWO4Zp9RKOn95lhW JhBpQSNCoI4VdRZOR4YlTL7xsCYRM/uFRVzJ6/MsN4PLDJ90tR7T45b5IAuDwJp11tLd KVQV6zi7jTOomUwlILc4Kd4XonXT14RuqlD8cJtmL+3CBNVJMLGPzohDMXmzcsNkEOIz qbmMrteoyrzfQQa5XED3x0XQqpb8CEQf1/unfA8EotKv628foZ9Xw/VH9kGnXMDVvcz0 kt7Q== 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=jI3bEU+f0zZItWGOzZW4leD8dAQuDRrKyQbHa4mJbTE=; b=lDyM1iUINmqRTEmZ0boofYHYcKup6uELxf4gk3TlnIiVt/nNQecSiUyjT/pm+DdJBg YRB0oAln1MroD+gWcAAHo0vo/aa7Eul9E7InIdKGAQez3PrEyPcx4cAv7MLR28N1LRfi oFeQbb+BM93EinlwKWOaaSOgaoRWqHx8CwEgN6NODntVv2+0qrmEzQY5UD8XOQeVXi8b rIMqZFcIdYXgeol0LMgVtsF5yFzAfEvWvfFlK3+vUnC+RTPQG+fUHpBjP85GLldWYLZS Ab6CWInGnx7nS11CPVO2tRfIv4leH2KEmTu+hIEgVO4Nm5kw0ltBNFchMXVY+gdY+upf Dnfg== X-Gm-Message-State: AOAM533ubRL5ZAF8fdlBHDUoW3s161nNHMXfp5UoR4OfkRPLqKnQ17gB cdqaUvAbu3DklVi/1wKdV8ATQq6BZc0Y6w== X-Received: by 2002:a17:90a:e517:: with SMTP id t23mr321499pjy.110.1624992898319; Tue, 29 Jun 2021 11:54:58 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:54:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 04/63] target/nios2: Add DisasContextBase to DisasContext Date: Tue, 29 Jun 2021 11:53:56 -0700 Message-Id: <20210629185455.3131172-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Migrate the is_jmp, tb and singlestep_enabled fields from DisasContext into the base. Use pc_first instead of tb->pc. Increment pc_next prior to decode, leaving the address of the current insn in dc->pc. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 70 +++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 34 deletions(-) -- 2.25.1 diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 6bdd388bd8..64cba02230 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -97,12 +97,10 @@ } typedef struct DisasContext { + DisasContextBase base; TCGv_i32 zero; - int is_jmp; target_ulong pc; - TranslationBlock *tb; int mem_idx; - bool singlestep_enabled; } DisasContext; static TCGv cpu_R[NUM_CORE_REGS]; @@ -149,17 +147,17 @@ static void t_gen_helper_raise_exception(DisasContext *dc, tcg_gen_movi_tl(cpu_R[R_PC], dc->pc); gen_helper_raise_exception(cpu_env, tmp); tcg_temp_free_i32(tmp); - dc->is_jmp = DISAS_NORETURN; + dc->base.is_jmp = DISAS_NORETURN; } static bool use_goto_tb(DisasContext *dc, uint32_t dest) { - if (unlikely(dc->singlestep_enabled)) { + if (unlikely(dc->base.singlestep_enabled)) { return false; } #ifndef CONFIG_USER_ONLY - return (dc->tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK); + return (dc->base.pc_first & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK); #else return true; #endif @@ -167,7 +165,7 @@ static bool use_goto_tb(DisasContext *dc, uint32_t dest) static void gen_goto_tb(DisasContext *dc, int n, uint32_t dest) { - TranslationBlock *tb = dc->tb; + const TranslationBlock *tb = dc->base.tb; if (use_goto_tb(dc, dest)) { tcg_gen_goto_tb(n); @@ -186,7 +184,7 @@ static void gen_excp(DisasContext *dc, uint32_t code, uint32_t flags) static void gen_check_supervisor(DisasContext *dc) { - if (dc->tb->flags & CR_STATUS_U) { + if (dc->base.tb->flags & CR_STATUS_U) { /* CPU in user mode, privileged instruction called, stop. */ t_gen_helper_raise_exception(dc, EXCP_SUPERI); } @@ -208,7 +206,7 @@ static void jmpi(DisasContext *dc, uint32_t code, uint32_t flags) { J_TYPE(instr, code); gen_goto_tb(dc, 0, (dc->pc & 0xF0000000) | (instr.imm26 << 2)); - dc->is_jmp = DISAS_NORETURN; + dc->base.is_jmp = DISAS_NORETURN; } static void call(DisasContext *dc, uint32_t code, uint32_t flags) @@ -268,7 +266,7 @@ static void br(DisasContext *dc, uint32_t code, uint32_t flags) I_TYPE(instr, code); gen_goto_tb(dc, 0, dc->pc + 4 + (instr.imm16.s & -4)); - dc->is_jmp = DISAS_NORETURN; + dc->base.is_jmp = DISAS_NORETURN; } static void gen_bxx(DisasContext *dc, uint32_t code, uint32_t flags) @@ -280,7 +278,7 @@ static void gen_bxx(DisasContext *dc, uint32_t code, uint32_t flags) gen_goto_tb(dc, 0, dc->pc + 4); gen_set_label(l1); gen_goto_tb(dc, 1, dc->pc + 4 + (instr.imm16.s & -4)); - dc->is_jmp = DISAS_NORETURN; + dc->base.is_jmp = DISAS_NORETURN; } /* Comparison instructions */ @@ -402,7 +400,7 @@ static void eret(DisasContext *dc, uint32_t code, uint32_t flags) tcg_gen_mov_tl(cpu_R[CR_STATUS], cpu_R[CR_ESTATUS]); tcg_gen_mov_tl(cpu_R[R_PC], cpu_R[R_EA]); - dc->is_jmp = DISAS_JUMP; + dc->base.is_jmp = DISAS_JUMP; } /* PC <- ra */ @@ -410,7 +408,7 @@ static void ret(DisasContext *dc, uint32_t code, uint32_t flags) { tcg_gen_mov_tl(cpu_R[R_PC], cpu_R[R_RA]); - dc->is_jmp = DISAS_JUMP; + dc->base.is_jmp = DISAS_JUMP; } /* PC <- ba */ @@ -418,7 +416,7 @@ static void bret(DisasContext *dc, uint32_t code, uint32_t flags) { tcg_gen_mov_tl(cpu_R[R_PC], cpu_R[R_BA]); - dc->is_jmp = DISAS_JUMP; + dc->base.is_jmp = DISAS_JUMP; } /* PC <- rA */ @@ -428,7 +426,7 @@ static void jmp(DisasContext *dc, uint32_t code, uint32_t flags) tcg_gen_mov_tl(cpu_R[R_PC], load_gpr(dc, instr.a)); - dc->is_jmp = DISAS_JUMP; + dc->base.is_jmp = DISAS_JUMP; } /* rC <- PC + 4 */ @@ -452,7 +450,7 @@ static void callr(DisasContext *dc, uint32_t code, uint32_t flags) tcg_gen_mov_tl(cpu_R[R_PC], load_gpr(dc, instr.a)); tcg_gen_movi_tl(cpu_R[R_RA], dc->pc + 4); - dc->is_jmp = DISAS_JUMP; + dc->base.is_jmp = DISAS_JUMP; } /* rC <- ctlN */ @@ -516,11 +514,11 @@ static void wrctl(DisasContext *dc, uint32_t code, uint32_t flags) /* If interrupts were enabled using WRCTL, trigger them. */ #if !defined(CONFIG_USER_ONLY) if ((instr.imm5 + CR_BASE) == CR_STATUS) { - if (tb_cflags(dc->tb) & CF_USE_ICOUNT) { + if (tb_cflags(dc->base.tb) & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_check_interrupts(cpu_env); - dc->is_jmp = DISAS_UPDATE; + dc->base.is_jmp = DISAS_UPDATE; } #endif } @@ -801,7 +799,7 @@ static void gen_exception(DisasContext *dc, uint32_t excp) tcg_gen_movi_tl(cpu_R[R_PC], dc->pc); gen_helper_raise_exception(cpu_env, tmp); tcg_temp_free_i32(tmp); - dc->is_jmp = DISAS_NORETURN; + dc->base.is_jmp = DISAS_NORETURN; } /* generate intermediate code for basic block 'tb'. */ @@ -812,11 +810,14 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) int num_insns; /* Initialize DC */ - dc->is_jmp = DISAS_NEXT; - dc->pc = tb->pc; - dc->tb = tb; + + dc->base.tb = tb; + dc->base.singlestep_enabled = cs->singlestep_enabled; + dc->base.is_jmp = DISAS_NEXT; + dc->base.pc_first = tb->pc; + dc->base.pc_next = tb->pc; + dc->mem_idx = cpu_mmu_index(env, false); - dc->singlestep_enabled = cs->singlestep_enabled; /* Set up instruction counts */ num_insns = 0; @@ -829,10 +830,10 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) gen_tb_start(tb); do { - tcg_gen_insn_start(dc->pc); + tcg_gen_insn_start(dc->base.pc_next); num_insns++; - if (unlikely(cpu_breakpoint_test(cs, dc->pc, BP_ANY))) { + if (unlikely(cpu_breakpoint_test(cs, dc->base.pc_next, BP_ANY))) { gen_exception(dc, EXCP_DEBUG); /* The address covered by the breakpoint must be included in [tb->pc, tb->pc + tb->size) in order to for it to be @@ -846,25 +847,26 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) gen_io_start(); } + dc->pc = dc->base.pc_next; + dc->base.pc_next += 4; + /* Decode an instruction */ handle_instruction(dc, env); - dc->pc += 4; - /* Translation stops when a conditional branch is encountered. * Otherwise the subsequent code could get translated several times. * Also stop translation when a page boundary is reached. This * ensures prefetch aborts occur at the right place. */ - } while (!dc->is_jmp && + } while (!dc->base.is_jmp && !tcg_op_buf_full() && num_insns < max_insns); /* Indicate where the next block should start */ - switch (dc->is_jmp) { + switch (dc->base.is_jmp) { case DISAS_NEXT: case DISAS_UPDATE: /* Save the current PC back into the CPU register */ - tcg_gen_movi_tl(cpu_R[R_PC], dc->pc); + tcg_gen_movi_tl(cpu_R[R_PC], dc->base.pc_next); tcg_gen_exit_tb(NULL, 0); break; @@ -883,15 +885,15 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) gen_tb_end(tb, num_insns); /* Mark instruction starts for the final generated instruction */ - tb->size = dc->pc - tb->pc; + tb->size = dc->base.pc_next - dc->base.pc_first; tb->icount = num_insns; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) - && qemu_log_in_addr_range(tb->pc)) { + && qemu_log_in_addr_range(dc->base.pc_first)) { FILE *logfile = qemu_log_lock(); - qemu_log("IN: %s\n", lookup_symbol(tb->pc)); - log_target_disas(cs, tb->pc, dc->pc - tb->pc); + qemu_log("IN: %s\n", lookup_symbol(dc->base.pc_first)); + log_target_disas(cs, tb->pc, tb->size); qemu_log("\n"); qemu_log_unlock(logfile); } From patchwork Tue Jun 29 18:53:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468344 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5257395jao; Tue, 29 Jun 2021 12:36:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys89xszjmMs28d/oif7F8uVeSggU5Oq+rUzsLEhWw9yb4GdRGzplGr3hZZ/yItim1klxu3 X-Received: by 2002:a25:4109:: with SMTP id o9mr26292303yba.353.1624995386176; Tue, 29 Jun 2021 12:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995386; cv=none; d=google.com; s=arc-20160816; b=QAPbVALKb/icnJs0jlRP7u5KDp+w9cHyk90pDsolMfRiOG1/l70t262BbGNmj4wGdl tyGaBmvRtGXEANXYT4bnC96HxxRzaKvDlKlT0HaNM68Bw+9ZW6CKJhunWZ7z5c4L1Qx0 ++9f3ZexcHc4QajHKer1pgeknO2v5NR6FWWhW0OVS47i2Bx+j/fqUC9M7ZiJK+UOIukD ns6H+C3Zt7hxxHoDM/fb1ro627diPBsbZGvOZCkFlHJnnRB+evdp1m1EtIJuwaEoIyGk CoTFOM5E3ldipVBMj2MTjbv8+7GpJapdbFC3emtRoJv21QYqBvHAkDPP2H4Q0Y9Zy6dT TsVQ== 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=xmxrOHZpSFj7JKNDeodYwqrJCJWQuRYw5m+Zqx3aVjs=; b=neF2EqnK2YI6FxsgoX78uNpwM6Ynm1Fqe2FIeSQqJH4GN6JlEA6xdq0yaenEyuMdSK eaBKakcp6sOmzrQTreRFdks/+QW43+H1a19urU+EN56mGCHP4BRnTYT7ofs6ptKkum8F xROoFKZG03SwW6fPpbv/rEXj7PJQtfQkYhqSxdwra1czrjlU+jxBP0KyHk4i2BtoGpG+ L/woTAC+VmkKNRwtblmexf855REgfHia1lvBNl0X6SEWBIFGo5fDdJ331qUEk/CzglwS KE5EHprtuV6LqaUDVxQjA9ZOM5rvRm6uSUERTMome0QiL474l80v4fWZEtSchvNTleZ5 Ylow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yac47MRF; 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 l201si590151ybl.388.2021.06.29.12.36.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12: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=yac47MRF; 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]:42842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJWz-0006zK-4S for patch@linaro.org; Tue, 29 Jun 2021 15:36:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItA-0007zQ-CQ for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:16 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:41747) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIsu-0000r4-LT for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:11 -0400 Received: by mail-pf1-x436.google.com with SMTP id c5so90057pfv.8 for ; Tue, 29 Jun 2021 11:54: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=xmxrOHZpSFj7JKNDeodYwqrJCJWQuRYw5m+Zqx3aVjs=; b=yac47MRFCKHKskEwMeKBvakn9qRM0Orp7ZqDBMCz6pN6ANph1hBcDdep/OpwnRyKGU 8bHCnRBjbyb0JLMEzI3Ni7+Mgp0cKfRUTf8siWsyGIjVV8rsmtzsG4+XzWHyLsVysZ+O Cs5YSSsRYKJa+ue09kPRvzMUXorZYmHuf6Q2sipCP/nul24htT6bp9Sz6kVPPqJcmFBv voeRW/Jppv4fUdqftNRsuhka/r6U4SjzLqdsYsU4E+QGuChSCl3mcLlsSGbCL9fQ23uS e4QyZV0FQA5B85b21BgEXFEZ5xD99GolVA+fv4kzRKRGnYhn1Uf9U4mWrFZif7jj4aid FFXw== 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=xmxrOHZpSFj7JKNDeodYwqrJCJWQuRYw5m+Zqx3aVjs=; b=pSCAqp00TNecC0cQZHWmNytnCxYPUd8hoZTLoszsVudpRxXbG5kU0zu2ZbjHaE94rH Hv8klSS0GY/feZhguvh1D796NoIjNbMR1IA8IGvf+mjVpLLBxo9VaxX6BXPhN/4ftRgH zmReU9sVi3++dZNzg5y+Nd8EWTlcjdhPvui2eGYgb6x1vIk1WRs2sMe13uU8mvSrtDkY +K2QrXd5jFSUcZYHOCR6smXNBSOO0OqTcz1t2f9VLkojXPYhM/GVTm8Yqwg6OFXBdT4r xdfkGRB/3/5aWzVxhIePYpQLI7KLu88bHoCLRKJi8qgUX1c9nzzSvoyQB7TAewqJZDGs 2arg== X-Gm-Message-State: AOAM531HpYzgS+MQ7wi0B+oy0RaIRS09KbIfQDxuGMPu0ExC6/xo2Y/y hbj+kIJ5UyPqM5OYFxy/CdhxKXQrcPsNMQ== X-Received: by 2002:a65:41c6:: with SMTP id b6mr29807514pgq.206.1624992899013; Tue, 29 Jun 2021 11:54:59 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.54.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:54:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 05/63] target/nios2: Convert to TranslatorOps Date: Tue, 29 Jun 2021 11:53:57 -0700 Message-Id: <20210629185455.3131172-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 128 ++++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 63 deletions(-) -- 2.25.1 diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 64cba02230..66f4c25b06 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -803,74 +803,69 @@ static void gen_exception(DisasContext *dc, uint32_t excp) } /* generate intermediate code for basic block 'tb'. */ -void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) +static void nios2_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) { + DisasContext *dc = container_of(dcbase, DisasContext, base); CPUNios2State *env = cs->env_ptr; - DisasContext dc1, *dc = &dc1; - int num_insns; - - /* Initialize DC */ - - dc->base.tb = tb; - dc->base.singlestep_enabled = cs->singlestep_enabled; - dc->base.is_jmp = DISAS_NEXT; - dc->base.pc_first = tb->pc; - dc->base.pc_next = tb->pc; + int page_insns; dc->mem_idx = cpu_mmu_index(env, false); - /* Set up instruction counts */ - num_insns = 0; - if (max_insns > 1) { - int page_insns = (TARGET_PAGE_SIZE - (tb->pc & ~TARGET_PAGE_MASK)) / 4; - if (max_insns > page_insns) { - max_insns = page_insns; - } - } + /* Bound the number of insns to execute to those left on the page. */ + page_insns = -(dc->base.pc_first | TARGET_PAGE_MASK) / 4; + dc->base.max_insns = MIN(page_insns, dc->base.max_insns); +} - gen_tb_start(tb); - do { - tcg_gen_insn_start(dc->base.pc_next); - num_insns++; +static void nios2_tr_tb_start(DisasContextBase *db, CPUState *cs) +{ +} - if (unlikely(cpu_breakpoint_test(cs, dc->base.pc_next, BP_ANY))) { - gen_exception(dc, EXCP_DEBUG); - /* The address covered by the breakpoint must be included in - [tb->pc, tb->pc + tb->size) in order to for it to be - properly cleared -- thus we increment the PC here so that - the logic setting tb->size below does the right thing. */ - dc->pc += 4; - break; - } +static void nios2_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) +{ + tcg_gen_insn_start(dcbase->pc_next); +} - if (num_insns == max_insns && (tb_cflags(tb) & CF_LAST_IO)) { - gen_io_start(); - } +static bool nios2_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, + const CPUBreakpoint *bp) +{ + DisasContext *dc = container_of(dcbase, DisasContext, base); - dc->pc = dc->base.pc_next; - dc->base.pc_next += 4; + gen_exception(dc, EXCP_DEBUG); + /* + * The address covered by the breakpoint must be included in + * [tb->pc, tb->pc + tb->size) in order to for it to be + * properly cleared -- thus we increment the PC here so that + * the logic setting tb->size below does the right thing. + */ + dc->base.pc_next += 4; + return true; +} - /* Decode an instruction */ - handle_instruction(dc, env); +static void nios2_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) +{ + DisasContext *dc = container_of(dcbase, DisasContext, base); + CPUNios2State *env = cs->env_ptr; - /* Translation stops when a conditional branch is encountered. - * Otherwise the subsequent code could get translated several times. - * Also stop translation when a page boundary is reached. This - * ensures prefetch aborts occur at the right place. */ - } while (!dc->base.is_jmp && - !tcg_op_buf_full() && - num_insns < max_insns); + dc->pc = dc->base.pc_next; + dc->base.pc_next += 4; + + /* Decode an instruction */ + handle_instruction(dc, env); +} + +static void nios2_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) +{ + DisasContext *dc = container_of(dcbase, DisasContext, base); /* Indicate where the next block should start */ switch (dc->base.is_jmp) { - case DISAS_NEXT: + case DISAS_TOO_MANY: case DISAS_UPDATE: /* Save the current PC back into the CPU register */ tcg_gen_movi_tl(cpu_R[R_PC], dc->base.pc_next); tcg_gen_exit_tb(NULL, 0); break; - default: case DISAS_JUMP: /* The jump will already have updated the PC register */ tcg_gen_exit_tb(NULL, 0); @@ -879,25 +874,32 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) case DISAS_NORETURN: /* nothing more to generate */ break; + + default: + g_assert_not_reached(); } +} - /* End off the block */ - gen_tb_end(tb, num_insns); +static void nios2_tr_disas_log(const DisasContextBase *dcbase, CPUState *cpu) +{ + qemu_log("IN: %s\n", lookup_symbol(dcbase->pc_first)); + log_target_disas(cpu, dcbase->pc_first, dcbase->tb->size); +} - /* Mark instruction starts for the final generated instruction */ - tb->size = dc->base.pc_next - dc->base.pc_first; - tb->icount = num_insns; +static const TranslatorOps nios2_tr_ops = { + .init_disas_context = nios2_tr_init_disas_context, + .tb_start = nios2_tr_tb_start, + .insn_start = nios2_tr_insn_start, + .breakpoint_check = nios2_tr_breakpoint_check, + .translate_insn = nios2_tr_translate_insn, + .tb_stop = nios2_tr_tb_stop, + .disas_log = nios2_tr_disas_log, +}; -#ifdef DEBUG_DISAS - if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) - && qemu_log_in_addr_range(dc->base.pc_first)) { - FILE *logfile = qemu_log_lock(); - qemu_log("IN: %s\n", lookup_symbol(dc->base.pc_first)); - log_target_disas(cs, tb->pc, tb->size); - qemu_log("\n"); - qemu_log_unlock(logfile); - } -#endif +void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) +{ + DisasContext dc; + translator_loop(&nios2_tr_ops, &dc.base, cs, tb, max_insns); } void nios2_cpu_dump_state(CPUState *cs, FILE *f, int flags) From patchwork Tue Jun 29 18:53:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468324 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5249153jao; Tue, 29 Jun 2021 12:22:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1j7KY1gZudWtbSDP6TNtiDc8L15CduOh57tl16IV/nO4/Qt7oEd/hNfMNZ+C9BldwEWYL X-Received: by 2002:a05:6102:212a:: with SMTP id f10mr18629449vsg.56.1624994574517; Tue, 29 Jun 2021 12:22:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994574; cv=none; d=google.com; s=arc-20160816; b=oU+i1wquV7JhS8Sk8CX7+LJukqIvr7po29cJ/hUuDNEDCycor7jubq9hsupDwhBGxu q9VcLLL924fchML/8IRGPFmfKnbLZTHiaCDmakuH8lYkSr0WKoAe1fZBRxejDYofSfUn uwUpMS4yRmSQGHo8NpZsblEhRFk+m/dDz+HYds8xNniellaK4cmSU7AzejRaJuR/JLNB Y7q6tdNU5klUeHt+tsG0H6BuxPJ420lmWGi7qh8zdKv4ICC6YwX0Bhf6Z3QIp0XDxdpg 1w8qxhmZGb1ihLpU6WAm1AeMGWDqNYAfK0Q/TtzkDhlFsZe37Bc2dat7D3uxRcmCTJcx 8EIA== 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=xTwMJU3bsMsUDKAuT4u9lBehIy/XuCs4LFcFtzDowXM=; b=MquF1W3qwq7c5doKy1mKSopyWgY+D01JnPW/8L1HCU8oXL9NYIqEQZVGHZ9j5ZX44p j8TLTfcR3LrFq5UswRKcSSY5Fy1TIzzbsoDMo8bGEzez0NJM9v7WARythjyR9lQFlVsG BltA7bd0ZGOJzWNUYr2ic9hM/pFyRWnDy7XJHY9N9iF3s73CcrnN9hb/Sz+IgsLw9Rop oxsTrfau5IuKrMCzIT+bk1PngsJ95wKy+jXCpQjyTEtLCG7BdOIjsBeZcGIi5EDXCeSB TLvmTy0nXh7AFPqQgeg3L30eYZamhJIIo8+ghueOH/GZlxqVvez47F0vnqsIXTJ8LRe8 yRzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PzZJcqo8; 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 w11si11918508vsa.205.2021.06.29.12.22.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:22: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=PzZJcqo8; 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]:51004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJJt-0007bw-V4 for patch@linaro.org; Tue, 29 Jun 2021 15:22:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItA-0007z5-9D for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:16 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:45628) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIsu-0000rg-Qa for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:10 -0400 Received: by mail-pj1-x1033.google.com with SMTP id z3-20020a17090a3983b029016bc232e40bso3078525pjb.4 for ; Tue, 29 Jun 2021 11:55: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=xTwMJU3bsMsUDKAuT4u9lBehIy/XuCs4LFcFtzDowXM=; b=PzZJcqo8Wkz008DtPhOldpFKhSJk7j5GP27thyDGmacx5ATG2SBfZ9NeQuLCs1iEiP 6XYG4a4CdAeG0FPWmcjQn4kAInUTenGrQ6+pO97R4TsCtTvNXA8R3RxYouMwdbduvmom u+aQWWw9WNYwsc0Enk2DDS8qplNe+RYZey3LAuVHRB4bo9RkkpJuvgw48NLJn+4EhimP PMxNaeg0jlSubcj2DSTkvKxM5zIMbb03ueYV+T3hFnHZiuAvaNodlA2A8a4aMGgIQ3N1 IFK9SEKkdlSr1reSZfCXu6RYQuV0q6Wtovicchc8brQbtne/KZo/KQgyZZA3SLOi2JXT qp9A== 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=xTwMJU3bsMsUDKAuT4u9lBehIy/XuCs4LFcFtzDowXM=; b=kBAa39kSlxZx2VAjqqBadxdvL2N2s/hqgYBnLHefcjtO5YpFMVrCx8KTZHR/R/P2vW IGGwxUF3FYahzX5lrYMNCNmoQ5mDoivWOw/UJgaoW0byqbBfU1moKOqghcz3HVACUgEb 1krR4hduo8enboH6QMFnEvG1ftu27Q4Y3Fb6Va0S8hoHW2yqZx2CiU5D7+O2+hD4Bqmz FEZ0fRoFhHN9R4nepUZLiO9jO12fC/PnCsYeqJ37Kk6TCRxU5yBCYBe7mMoUb142WLCQ AB+DtjJO/Kp+s2Lb8w1c2BZ4YGS3jgf28g23boACGr7MlB2cQqhNocttPTKTmh8LGbDZ iiSg== X-Gm-Message-State: AOAM532xiwYAe2u513mJyv/lOl/oMfPkBPcVl3abVdQNp37roSL9cDtf xbXi5vLGHEYHXCtSNMzDOyBi7xrUIKrsSA== X-Received: by 2002:a17:90b:4f44:: with SMTP id pj4mr18851189pjb.100.1624992899566; Tue, 29 Jun 2021 11:54:59 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.54.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:54:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 06/63] target/nios2: Remove assignment to env in handle_instruction Date: Tue, 29 Jun 2021 11:53:58 -0700 Message-Id: <20210629185455.3131172-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Direct assignments to env during translation do not work. As it happens, the only way we can get here is if env->pc is already set to dc->pc. We will trap on the first insn we execute anywhere on the page. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 66f4c25b06..6fd4330b31 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -740,14 +740,15 @@ static void handle_instruction(DisasContext *dc, CPUNios2State *env) uint32_t code; uint8_t op; const Nios2Instruction *instr; + #if defined(CONFIG_USER_ONLY) /* FIXME: Is this needed ? */ if (dc->pc >= 0x1000 && dc->pc < 0x2000) { - env->regs[R_PC] = dc->pc; t_gen_helper_raise_exception(dc, 0xaa); return; } #endif + code = cpu_ldl_code(env, dc->pc); op = get_opcode(code); From patchwork Tue Jun 29 18:53:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468330 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5251224jao; Tue, 29 Jun 2021 12:26:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4dM9pkjo8jnWVPMWUyexiLmfqIUelP+8IX0vVvHtlocnnHbv1gvChXi8rsznnMdNdCX93 X-Received: by 2002:a25:6088:: with SMTP id u130mr41912118ybb.257.1624994791248; Tue, 29 Jun 2021 12:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994791; cv=none; d=google.com; s=arc-20160816; b=b9dEcfA2V29MUZ9eam1UMKPkfoOJyO5ZqSLQcuNivKzMDCCaTz5QDQpEvfu9hPGeRB EXVcy9OI4/OjkEKNMNkyHTxHxCvnwHTla1oOGcg0bdJoTk9M6NBZXSJlJNR392BPY2FR f3rfoEOTo9N1EPifga2yRPnQSH5wgcBsgI9IhlctUkxwDCZ03sDpmihy6jb90rHwecow zaApAETdMMw+bqpQeTM7OdjXm3f9bwzZcV7CcgQPMY9XVPlN5yy1Swaf3Z0N19KgPGvf Fx4/SvCpdGHAIHM9/iobv48KHSHHtWELtDxuKHTVz9dEoUl02Xzek1HfrltpQhwEmLs2 M8XQ== 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=Mh5EZkP0+byxDxbYNRT/+ZJFV0r5FEDwMRHJL2U5umA=; b=fD2lNUEgui2Hi+DnImLAVMD8dBltqjGpCLwlWKVMo2/8yED8mRDPHw9UsXKWdb2IaL bFeLn1VuFlfUxwWXpeqFjxNCM/JUwA119PGhgXwrrLL5wPt+0vKaIdI0MP4FnLlZv22s Mdz7JZBVgnv5GVlBZy1/ydqw+BLjGA5uIQMTa7wuOB7ELSCr8wW3Fu7YPYy94T74QqFM lgBmzqYWq+II2nkZfiu+56u+udWYIPoFRZu9guBOK2lY5kVQPKw5IEWKeoysy8aD5YPP zNu2VrE8g0NRvjiNaedmWEtwnjjSIV7fn0vM6SlFyj2D6E1oXZUEbzMnYBHXUFhljk6j cc3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PCAnACyl; 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 s95si5499144ybi.476.2021.06.29.12.26.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:26:31 -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=PCAnACyl; 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]:37174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJNO-0000KP-Ng for patch@linaro.org; Tue, 29 Jun 2021 15:26:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38404) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItA-0007zX-E9 for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:16 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:42511) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIsv-0000ru-ED for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:16 -0400 Received: by mail-pl1-x631.google.com with SMTP id v13so28569ple.9 for ; Tue, 29 Jun 2021 11:55:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Mh5EZkP0+byxDxbYNRT/+ZJFV0r5FEDwMRHJL2U5umA=; b=PCAnACylR+xDqvAL1HKR5NfjoFNG8Jc/sQRgW7JUGpXZoXN3G8yY8SHq6UMGCJ97PO 0+PD6p3Y8gEd9y3Mt6P67QJKr/Dm5szerJ3404uEHEyedel8trpXUJqU5QqgusCEmpx9 fGw/oKyQ/6Pcnit0xndTMv5Y34z2e7G5Bmztf3cEOdijP3mOarsufrRF+eAgEv/03kQG Q9tJmBpdAQsRiQN8MGnL6flllVINjoRDom284G/MwyLgORPiHTOMLidF9mWCsnhlHDEm RLTy8SPAWpCj84xD5axn/yAB/ouE5vlJA26UjYQuXQ9r9oubuTwo0+VV0R7YfD2jnda1 HjFg== 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=Mh5EZkP0+byxDxbYNRT/+ZJFV0r5FEDwMRHJL2U5umA=; b=cmSqHn4RiPjYXLqhzeui9wFZ6l3GXRGjakRgXgOoMEz6KYsptAJkc4rCpcHDH8VtCU bo+EVYXIuME4M/Ih/On/vXOnXwmCR0qvPDadufao7RTBhbpLxyoWGf88+PhRN/d8GHr3 zBIs5VvNN22sptpWGjRVLyMvUKhNN80F+piI0D3DC7cUB+DzCfq192NOXSkL03M9LEPq 2pandQ7wrks2gc3KwXapFdWEzQfE1LCNYg1jF7v/JF1fTVNbXImDtng0BQ5EozImrCIP nRMx7M6/nXc2+8CicV6l/HzksLvf/OakGzvsb+2afuLsQgzUMY055uz5hYg/C7uVaJ4B 2WrQ== X-Gm-Message-State: AOAM533+/jR1TEIb1PklhvWSXs8IlBzR3XcIe9RlKw1p4sF4DomB4kDw A5a0z3gAe2cNbiEhX5aqjaUwCXL3tzGA3g== X-Received: by 2002:a17:90a:4216:: with SMTP id o22mr297028pjg.3.1624992900212; Tue, 29 Jun 2021 11:55:00 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.54.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:54:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 07/63] target/nios2: Clean up goto in handle_instruction Date: Tue, 29 Jun 2021 11:53:59 -0700 Message-Id: <20210629185455.3131172-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 6fd4330b31..9e71267b42 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -753,7 +753,8 @@ static void handle_instruction(DisasContext *dc, CPUNios2State *env) op = get_opcode(code); if (unlikely(op >= ARRAY_SIZE(i_type_instructions))) { - goto illegal_op; + t_gen_helper_raise_exception(dc, EXCP_ILLEGAL); + return; } dc->zero = NULL; @@ -764,11 +765,6 @@ static void handle_instruction(DisasContext *dc, CPUNios2State *env) if (dc->zero) { tcg_temp_free(dc->zero); } - - return; - -illegal_op: - t_gen_helper_raise_exception(dc, EXCP_ILLEGAL); } static const char * const regnames[] = { From patchwork Tue Jun 29 18:54:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468335 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5252922jao; Tue, 29 Jun 2021 12:29:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEtlN8V1201ye08rjoN55oi4QDWoywDWqklXAzXdWoleZUTX23EqmNO+rkwrRuDCoD9duq X-Received: by 2002:a25:ea53:: with SMTP id o19mr40886481ybe.2.1624994966031; Tue, 29 Jun 2021 12:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994966; cv=none; d=google.com; s=arc-20160816; b=IqNPiWJL74T4Q3Wt6rea5sSyJk89TrCktyRmSR2MADCVLEAueONRLWw0QTpofw6o9z 1EgbPkJZ6dAgAS07VSzGkx+k8r+5LpaXaqrL3IIbeAwTnVxBdlYUr0EzKhVDW/L9B4Gx z69l98YtdYnZcUkM8Kh7nZVuetpFr5nlFoDXXSxMwFFGmEsm5TGmKiU3Ho3ZX2MbFJcW hrz1Egkbfpq1Y89GjKC9TaY4QA4Z6f9P6nJIiXdz6Vxa/5EH6YLMq0cM6iFeJwWtvn/8 48baqm1GBpcBymBH/C3llDTtQ9Qrn58Fz9NWDl+aTBQtEWDU3f1HNl54gsyofcDLpkDw zTkQ== 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=B/3UYnAw/Iw5+lYVvwYrCl8yQAl4h8zPvaGurMEMOTY=; b=d9Yggy+D/i2ECrD3pP68MpiJqs2NNXqBhEtRNY5CUgZKTQZYbLe/9PrIceuR6MdgNy qdNTKQgx9EcQwHcqbFvcP/JYiTdkys/6HoEg2B2FGXowPHcPQimPCdYP7/FTeFsoR/l/ p871w2wXJDzDnIoj/5VVWc/wN6wgS63JXCyj1YPtyzhp0iJQHmpCWJVEyNNajuKJLj5d SJmMBzAqWaA/obwbeP6VimArNzBHtN02BOHKdwr03CE4b+pvaQU4whUpM6na0CgIvc7b 4kgyjm1nhwsTFahLNtlbErXimpJmmwxaPsmHgMNekBJgeesl2NbsyEc5eN3Tl38l+YzW fhNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RsKPgkt8; 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 a3si16859721ybn.493.2021.06.29.12.29.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:29: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=RsKPgkt8; 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]:49982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJQD-0000az-Gw for patch@linaro.org; Tue, 29 Jun 2021 15:29:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItB-00081O-1L for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:17 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:44895) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIsw-0000s4-Uy for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:16 -0400 Received: by mail-pj1-x102b.google.com with SMTP id p4-20020a17090a9304b029016f3020d867so3079694pjo.3 for ; Tue, 29 Jun 2021 11:55:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B/3UYnAw/Iw5+lYVvwYrCl8yQAl4h8zPvaGurMEMOTY=; b=RsKPgkt8YNh2p9EUfdlzEM0Vx/9va1HVXT+wqNjovQO6F72giuv8HRhPKpbuag8/+3 jeG9s8E2Tp9+mAnw+Hcyt3r9HRkcgHqXZQKE02en8MPdawwKGqyXWurjVWBxD6AH+lng gomB3h9wKCoiY5jCnHmDLBOITNM0GgYhgJtwNW3L3iadSjiLEt8ZWYauhh7w2/f/4Tuv mMDfuPSICIhmKq79xmhCBH7aFrnqPWkU9G6hAyD54g1K3+PW4mlgLx6+dEi59NpiPqte nkOTqqHD9VlGd5EeKuydQRvt+ZVM9ZcZqaV4MYZyET5tvhmzF1omFbkl5qCLcRQS9OCS G1Ew== 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=B/3UYnAw/Iw5+lYVvwYrCl8yQAl4h8zPvaGurMEMOTY=; b=TGmoze4zLJ6pQDMn9Q13e630E+c9A0ZxTmV+2nsi2l4w0A1DsFXe1BhxwKCOGDDOeq /M8CIO/8s4cicBxF15rHQOX0NiDvzz3yJmWQPUBabr3nsuzPDLeswzGA4p2cl3y4FTdG h5z/JM2NV6TSfZ+MM/e/qZjvUBYLzc7YgDT1lQQ45IKIkzP76joZ8/1gSkyiaqdTWuCg SW0ecUOueJS2dS/T/rNTx2KKoSzJpQx9ie/lMDBdT2L2ogHXjcTJOYo3DGA+DSLrDjSd RggJFJeYf1HE8YXvS0UtkEIsRAAWu6IvHOPbsEONHSQTys7LYDd2ZY+kEWZizuYW3YF6 Odog== X-Gm-Message-State: AOAM533e7D6hkF3B7TXWpNApcb1LZ1ksBIErh2Xh6qW/xertskRptOs+ 4Rugo+kAmX2OalMLEkTWLs0TbSOmwhgm3A== X-Received: by 2002:a17:90a:6548:: with SMTP id f8mr36310253pjs.106.1624992900729; Tue, 29 Jun 2021 11:55:00 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 08/63] target/nios2: Inline handle_instruction Date: Tue, 29 Jun 2021 11:54:00 -0700 Message-Id: <20210629185455.3131172-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Move handle_instruction into nios2_tr_translate_insn as the only caller. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 66 +++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 35 deletions(-) -- 2.25.1 diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 9e71267b42..abc7e5f96a 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -735,38 +735,6 @@ illegal_op: t_gen_helper_raise_exception(dc, EXCP_ILLEGAL); } -static void handle_instruction(DisasContext *dc, CPUNios2State *env) -{ - uint32_t code; - uint8_t op; - const Nios2Instruction *instr; - -#if defined(CONFIG_USER_ONLY) - /* FIXME: Is this needed ? */ - if (dc->pc >= 0x1000 && dc->pc < 0x2000) { - t_gen_helper_raise_exception(dc, 0xaa); - return; - } -#endif - - code = cpu_ldl_code(env, dc->pc); - op = get_opcode(code); - - if (unlikely(op >= ARRAY_SIZE(i_type_instructions))) { - t_gen_helper_raise_exception(dc, EXCP_ILLEGAL); - return; - } - - dc->zero = NULL; - - instr = &i_type_instructions[op]; - instr->handler(dc, code, instr->flags); - - if (dc->zero) { - tcg_temp_free(dc->zero); - } -} - static const char * const regnames[] = { "zero", "at", "r2", "r3", "r4", "r5", "r6", "r7", @@ -842,12 +810,40 @@ static void nios2_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) { DisasContext *dc = container_of(dcbase, DisasContext, base); CPUNios2State *env = cs->env_ptr; + const Nios2Instruction *instr; + uint32_t code, pc; + uint8_t op; - dc->pc = dc->base.pc_next; - dc->base.pc_next += 4; + pc = dc->base.pc_next; + dc->pc = pc; + dc->base.pc_next = pc + 4; /* Decode an instruction */ - handle_instruction(dc, env); + +#if defined(CONFIG_USER_ONLY) + /* FIXME: Is this needed ? */ + if (pc >= 0x1000 && pc < 0x2000) { + t_gen_helper_raise_exception(dc, 0xaa); + return; + } +#endif + + code = cpu_ldl_code(env, pc); + op = get_opcode(code); + + if (unlikely(op >= ARRAY_SIZE(i_type_instructions))) { + t_gen_helper_raise_exception(dc, EXCP_ILLEGAL); + return; + } + + dc->zero = NULL; + + instr = &i_type_instructions[op]; + instr->handler(dc, code, instr->flags); + + if (dc->zero) { + tcg_temp_free(dc->zero); + } } static void nios2_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) From patchwork Tue Jun 29 18:54:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468333 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5252094jao; Tue, 29 Jun 2021 12:28:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqABYuZSvHqE6NNsfs4ELK5JcBzjn1g1U+qck7YnpczIz1UCO5hV/WB19rFfJuo/FKI479 X-Received: by 2002:a67:7d4f:: with SMTP id y76mr106329vsc.33.1624994881995; Tue, 29 Jun 2021 12:28:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994881; cv=none; d=google.com; s=arc-20160816; b=iKMlKx9X65S7DT2KqwRbqLlQq4PNq/aYA05vNgc2BaaaCL4lNhd3CCpRBz4nK2DIy9 /KBOV8adOlvyrIo7dGItLDemyWbVnQH9EPLmQ7WIgNepk60t4U3jL0g9K6LyVdamr9Yl X1QT8NTftz3B+zF5aeFEeKxkbDGdyT0jJSVeaQ3B8b5eOjFY8HJfrNBliHHdZx4BhUcJ /uNeaQv1o35cJ3REYBwu1ZyvcEK03ZTO7fzDI5yLtYPO0WYTFO8uvlfs4ntb9tBefdBj /mXsG9FX4Ibvt2mNorhRTh+zIhu+/vjyNapLxwGd/jfQObGq4zrSh8BxXOHM7rSTrpiJ 81cA== 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=FrwBhDQCYCaJpwhSjdhf5fz+by0Enz353wq4Nv/2fq8=; b=ZAZ6lI+Qa9ZcxW7o2voUjN3rRU7MXV29OZXvhrTCZxtlVsWyPcC/YPqTxwZGVoUeBP 0hKYsbuBdIeuMwkL3C59RgTFTyOyngdjz+8ht/zQ9V8Dck67dpbrwaVaib7mN3wzrLc/ 5MVxCToorwf2BycWdEQXi5ywQI21IxK0If8DQjlhrMxIC2hEr1Ua5dmBbLHfPwXqaTBD JhUq6nFyE2fYAFUUDA34atm/R5P7e0GvAmE20KSEcHAIxqXSE579ZttWlVbammqfyCLT Y3rsTii+973GhkARCdfIJ7m9Ynp2adPYX+UITzHV9JKGHbA5Ul3V1ntmm0TsWdV+PQPM sdKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xR2fVcSd; 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 j10si13549607vso.13.2021.06.29.12.28.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:28: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=xR2fVcSd; 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]:44446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJOr-0005JP-1T for patch@linaro.org; Tue, 29 Jun 2021 15:28:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItB-00082s-Pb for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:17 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:39680) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIt0-0000sN-8f for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:17 -0400 Received: by mail-pj1-x1033.google.com with SMTP id in17-20020a17090b4391b0290170ba0ec7fcso2259761pjb.4 for ; Tue, 29 Jun 2021 11:55: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=FrwBhDQCYCaJpwhSjdhf5fz+by0Enz353wq4Nv/2fq8=; b=xR2fVcSdD4e5r70xErdBfEGnpO63HV70xfraA6+n/GTVW7wdxdigqe3TEo6vCJkUFc H8vpcWRgOnFkecA92lUlVRN3G86du/xi31XMi6pexQQZnlDFgu4pQjNkDU2bAemrRNd9 CXseCEGS4HjAn19/9icakwRV06t1exqp69zZfHaM1oqOUXLPi7sNFRZt/cmNYhNsLX71 ctoFPygXxwc29tqqAVwjB90MaUiy//tVTyMLPm5xc3LLS1PpK4Iereg6YxwngNW6DtrK xRv4qhxlprj+W49Hb5gWa2J6dt6+0RX8kbYdZD2Qsy5ot/iLslOO9crqNqfcMSDh39YV 6++Q== 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=FrwBhDQCYCaJpwhSjdhf5fz+by0Enz353wq4Nv/2fq8=; b=cLsJJjWyXQ6lMOgZowMXcbxvcgipixkN52hii0Z8OVJI+7Cuio/ZOj9o67dA3HbSLP eoBQ7GbKvCR5DYHaNPe66237t7jyoHgx9gHt06lgaifRlzjcMDsz22MqrdFDHegT9HH0 DEKlGR24ZOu/HA/HWEjAsn5ihESmudRa3enFqxG0+EnIb5XZbPsfp0H1lR2pkvET/NKJ q74yXk8MQJ5eFRi14zZo2CcyMOrr7fDRTQKBbDonT5EgMKNKmndyjxBwmPx/XbDP3lmt H24OM4l4QuLU6pGZ4uB2P18GIuETJ1FE9FeiavONDLYa/f1ck8LfCXesclqxUhvcTeyN xzkA== X-Gm-Message-State: AOAM530smYrrfcFHbqKRgNEVOAyc6kWUP8nSFxywO8w0rM9G4uS2po5G CzrUl8Wucmxmwsi/9mNy+wg1XpFQT66X7w== X-Received: by 2002:a17:90a:5202:: with SMTP id v2mr29064848pjh.169.1624992901224; Tue, 29 Jun 2021 11:55:01 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 09/63] target/nios2: Use pc_next for pc + 4 Date: Tue, 29 Jun 2021 11:54:01 -0700 Message-Id: <20210629185455.3131172-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We have pre-computed the next instruction address into dc->base.pc_next, so we might as well use it. Reviewed-by: Peter Maydell Suggested-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/target/nios2/translate.c b/target/nios2/translate.c index abc7e5f96a..930f3d3395 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -211,7 +211,7 @@ static void jmpi(DisasContext *dc, uint32_t code, uint32_t flags) static void call(DisasContext *dc, uint32_t code, uint32_t flags) { - tcg_gen_movi_tl(cpu_R[R_RA], dc->pc + 4); + tcg_gen_movi_tl(cpu_R[R_RA], dc->base.pc_next); jmpi(dc, code, flags); } @@ -265,7 +265,7 @@ static void br(DisasContext *dc, uint32_t code, uint32_t flags) { I_TYPE(instr, code); - gen_goto_tb(dc, 0, dc->pc + 4 + (instr.imm16.s & -4)); + gen_goto_tb(dc, 0, dc->base.pc_next + (instr.imm16.s & -4)); dc->base.is_jmp = DISAS_NORETURN; } @@ -275,9 +275,9 @@ static void gen_bxx(DisasContext *dc, uint32_t code, uint32_t flags) TCGLabel *l1 = gen_new_label(); tcg_gen_brcond_tl(flags, cpu_R[instr.a], cpu_R[instr.b], l1); - gen_goto_tb(dc, 0, dc->pc + 4); + gen_goto_tb(dc, 0, dc->base.pc_next); gen_set_label(l1); - gen_goto_tb(dc, 1, dc->pc + 4 + (instr.imm16.s & -4)); + gen_goto_tb(dc, 1, dc->base.pc_next + (instr.imm16.s & -4)); dc->base.is_jmp = DISAS_NORETURN; } @@ -435,7 +435,7 @@ static void nextpc(DisasContext *dc, uint32_t code, uint32_t flags) R_TYPE(instr, code); if (likely(instr.c != R_ZERO)) { - tcg_gen_movi_tl(cpu_R[instr.c], dc->pc + 4); + tcg_gen_movi_tl(cpu_R[instr.c], dc->base.pc_next); } } @@ -448,7 +448,7 @@ static void callr(DisasContext *dc, uint32_t code, uint32_t flags) R_TYPE(instr, code); tcg_gen_mov_tl(cpu_R[R_PC], load_gpr(dc, instr.a)); - tcg_gen_movi_tl(cpu_R[R_RA], dc->pc + 4); + tcg_gen_movi_tl(cpu_R[R_RA], dc->base.pc_next); dc->base.is_jmp = DISAS_JUMP; } From patchwork Tue Jun 29 18:54:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468345 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5257630jao; Tue, 29 Jun 2021 12:36:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOZMA3vrrGBWO7zXjXpEJ+NMUsa03OYj7xbxxoPf/+Aow6s5nNW/ojT54BC7ObTnsF8atb X-Received: by 2002:a25:208b:: with SMTP id g133mr35747366ybg.211.1624995412384; Tue, 29 Jun 2021 12:36:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995412; cv=none; d=google.com; s=arc-20160816; b=i9yW+/IDVIK6tBGyWd6Li8Ooouou2COqsPCz4UwDaq7lx0ss7d02HST/j9jYJ99v95 XKSUSvsFUUKWnTBXPG1f1UpGvDXOkYg3CA7npwwrQ3Q9Lr2l0+KeB5cFdrdc5lvp11fH rq9L45qe/sanar5uqWpydFnVxc7Cu18KAQ9/JhU1Upml65GoKHBEIwmeLyUel6JeRtXy Sw0NVl8dFDjfIF5yMCjRVOT1Y3Tqa0pKP5viA3Hi4rjsQZ49BUdD4aReN/0x6+omYQnW EDbjeudZS8viBtOm9l2ewQT66xzKawVuLUwSnNQ+Kc+tDC3kniZiREo8qgLDn3g/dSkz KLJA== 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=c7wduf7ObXc5wNVXm/AWx0SqQEc5dTrFADWEA55vQ1o=; b=PlnH+QhnimXx7JsbmrAeyTtXJdqJqCq80+XSDdX0uUQ3zdmLfMobE8d76xRW9AeWEj xjxesg5xAEm/sn0KdrMcDns0zHlTaL8/HGoXlkxIuYzKYVBuS0YddlZ2dpsizyl/KPxz JZpgUh8y/hdqmDp9YoKvsJWeydXjVNzQARcjZPT9/zoG1O2xQItw+U530RecBhcwI1Jg 5yhDTX9YXUwXInlU+2v0YOE6sYNImiVu3AOjiDnpiL4xeE/8eKaRFR3el9ZkbtdT50qm L34PNUdcw1xgqkPE5Rg/0GR4Kv+j09qBboadR/yd+1qLFZScJtDxLuBDB2bUMqdd9On9 EEMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=krT47Mhq; 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 n204si18902060ybc.412.2021.06.29.12.36.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:36:52 -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=krT47Mhq; 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]:44026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJXP-0007p2-QQ for patch@linaro.org; Tue, 29 Jun 2021 15:36:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38632) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItI-0008KF-GK for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:24 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:44004) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000se-2w for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:24 -0400 Received: by mail-pj1-x102e.google.com with SMTP id x21-20020a17090aa395b029016e25313bfcso3084051pjp.2 for ; Tue, 29 Jun 2021 11:55: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=c7wduf7ObXc5wNVXm/AWx0SqQEc5dTrFADWEA55vQ1o=; b=krT47MhqZXLs0OqCYA2T7hkInbAmvRok5H/TxKdLa5DG77Zrh8y6+RzFinCKF+nWUy NaL/2dYhb+B7rtIzWcJo45xanLmxh3/s1Gm6TBcidC2/YNSQXAO1Khw70HkPZQyW8mja eMPKjTzAAdjnd9FyndK5YnPZK1kT8iIOmN/wqcnLgNc5UEVVE7iigYEvDJIeSx5mSXk9 w8NEZU7YLraw5uL/eBj7/5QgDuuEaUIT3jBAudBzz5Yt+fCCazXPvWiwM3FwPTWBnK3Q 7W3bpcXBj5nKnOu4mv6H1FW6Ex1osm8qE52vGmo3+iUViWcbXxM6Tmle+ZUqcgHVJZFq epDg== 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=c7wduf7ObXc5wNVXm/AWx0SqQEc5dTrFADWEA55vQ1o=; b=n44b/cvl+AjO7Dq7oCV0+HleSHWeCut3BgrX/e2CeIVAyMYwVTn8cezDA5OG9VoCdF kqSorncqAF4/5Ge9kYSuBLVUT/QYxEB2OoOE22heiu/+zk84JOSRGcfFo+4Wnkujsh/3 L5lXgu0HSMlHxs1LhH9GUf8jHL/2aOpbcE/sKfI0NL099JH8hSU0J2Z61+evrc2A/7JP e341u12QElW7oxo2eeJHqLtVd10pYWsHy+/cm9mx8lrlfYKRx4Qmcl6ipeHXprUghFNo oQNvqhKObxUh9dCm/UBXCMxX4fXzXihtBfe/atd4ZS+7jky5OG1frZhL51k4dC/GAXrk oDpw== X-Gm-Message-State: AOAM533JKhe+ELfThkfcMmClMOL5ql7NR6GSzC4jDNrRzM5i9KglMn1W X8s1LFFzpWhX8kUYL0x8LHwUyZ9NDNBMyg== X-Received: by 2002:a17:90b:1509:: with SMTP id le9mr295313pjb.35.1624992901895; Tue, 29 Jun 2021 11:55:01 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 10/63] target/avr: Add DisasContextBase to DisasContext Date: Tue, 29 Jun 2021 11:54:02 -0700 Message-Id: <20210629185455.3131172-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Rolnik , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Migrate the bstate, tb and singlestep_enabled fields from DisasContext into the base. Tested-by: Michael Rolnik Reviewed-by: Michael Rolnik Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/avr/translate.c | 58 +++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 29 deletions(-) -- 2.25.1 diff --git a/target/avr/translate.c b/target/avr/translate.c index 850c5941d9..20c5062730 100644 --- a/target/avr/translate.c +++ b/target/avr/translate.c @@ -80,7 +80,7 @@ typedef struct DisasContext DisasContext; /* This is the state at translation time. */ struct DisasContext { - TranslationBlock *tb; + DisasContextBase base; CPUAVRState *env; CPUState *cs; @@ -90,8 +90,6 @@ struct DisasContext { /* Routine used to access memory */ int memidx; - int bstate; - int singlestep; /* * some AVR instructions can make the following instruction to be skipped @@ -191,7 +189,7 @@ static bool avr_have_feature(DisasContext *ctx, int feature) { if (!avr_feature(ctx->env, feature)) { gen_helper_unsupported(cpu_env); - ctx->bstate = DISAS_NORETURN; + ctx->base.is_jmp = DISAS_NORETURN; return false; } return true; @@ -1011,13 +1009,13 @@ static void gen_jmp_ez(DisasContext *ctx) { tcg_gen_deposit_tl(cpu_pc, cpu_r[30], cpu_r[31], 8, 8); tcg_gen_or_tl(cpu_pc, cpu_pc, cpu_eind); - ctx->bstate = DISAS_LOOKUP; + ctx->base.is_jmp = DISAS_LOOKUP; } static void gen_jmp_z(DisasContext *ctx) { tcg_gen_deposit_tl(cpu_pc, cpu_r[30], cpu_r[31], 8, 8); - ctx->bstate = DISAS_LOOKUP; + ctx->base.is_jmp = DISAS_LOOKUP; } static void gen_push_ret(DisasContext *ctx, int ret) @@ -1083,9 +1081,9 @@ static void gen_pop_ret(DisasContext *ctx, TCGv ret) static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) { - TranslationBlock *tb = ctx->tb; + const TranslationBlock *tb = ctx->base.tb; - if (ctx->singlestep == 0) { + if (!ctx->base.singlestep_enabled) { tcg_gen_goto_tb(n); tcg_gen_movi_i32(cpu_pc, dest); tcg_gen_exit_tb(tb, n); @@ -1094,7 +1092,7 @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) gen_helper_debug(cpu_env); tcg_gen_exit_tb(NULL, 0); } - ctx->bstate = DISAS_NORETURN; + ctx->base.is_jmp = DISAS_NORETURN; } /* @@ -1254,7 +1252,7 @@ static bool trans_RET(DisasContext *ctx, arg_RET *a) { gen_pop_ret(ctx, cpu_pc); - ctx->bstate = DISAS_LOOKUP; + ctx->base.is_jmp = DISAS_LOOKUP; return true; } @@ -1272,7 +1270,7 @@ static bool trans_RETI(DisasContext *ctx, arg_RETI *a) tcg_gen_movi_tl(cpu_If, 1); /* Need to return to main loop to re-evaluate interrupts. */ - ctx->bstate = DISAS_EXIT; + ctx->base.is_jmp = DISAS_EXIT; return true; } @@ -1484,7 +1482,7 @@ static bool trans_BRBC(DisasContext *ctx, arg_BRBC *a) gen_goto_tb(ctx, 0, ctx->npc + a->imm); gen_set_label(not_taken); - ctx->bstate = DISAS_CHAIN; + ctx->base.is_jmp = DISAS_CHAIN; return true; } @@ -1533,7 +1531,7 @@ static bool trans_BRBS(DisasContext *ctx, arg_BRBS *a) gen_goto_tb(ctx, 0, ctx->npc + a->imm); gen_set_label(not_taken); - ctx->bstate = DISAS_CHAIN; + ctx->base.is_jmp = DISAS_CHAIN; return true; } @@ -1610,7 +1608,7 @@ static TCGv gen_get_zaddr(void) */ static void gen_data_store(DisasContext *ctx, TCGv data, TCGv addr) { - if (ctx->tb->flags & TB_FLAGS_FULL_ACCESS) { + if (ctx->base.tb->flags & TB_FLAGS_FULL_ACCESS) { gen_helper_fullwr(cpu_env, data, addr); } else { tcg_gen_qemu_st8(data, addr, MMU_DATA_IDX); /* mem[addr] = data */ @@ -1619,7 +1617,7 @@ static void gen_data_store(DisasContext *ctx, TCGv data, TCGv addr) static void gen_data_load(DisasContext *ctx, TCGv data, TCGv addr) { - if (ctx->tb->flags & TB_FLAGS_FULL_ACCESS) { + if (ctx->base.tb->flags & TB_FLAGS_FULL_ACCESS) { gen_helper_fullrd(data, cpu_env, addr); } else { tcg_gen_qemu_ld8u(data, addr, MMU_DATA_IDX); /* data = mem[addr] */ @@ -2793,7 +2791,7 @@ static bool trans_BREAK(DisasContext *ctx, arg_BREAK *a) #ifdef BREAKPOINT_ON_BREAK tcg_gen_movi_tl(cpu_pc, ctx->npc - 1); gen_helper_debug(cpu_env); - ctx->bstate = DISAS_EXIT; + ctx->base.is_jmp = DISAS_EXIT; #else /* NOP */ #endif @@ -2819,7 +2817,7 @@ static bool trans_NOP(DisasContext *ctx, arg_NOP *a) static bool trans_SLEEP(DisasContext *ctx, arg_SLEEP *a) { gen_helper_sleep(cpu_env); - ctx->bstate = DISAS_NORETURN; + ctx->base.is_jmp = DISAS_NORETURN; return true; } @@ -2850,7 +2848,7 @@ static void translate(DisasContext *ctx) if (!decode_insn(ctx, opcode)) { gen_helper_unsupported(cpu_env); - ctx->bstate = DISAS_NORETURN; + ctx->base.is_jmp = DISAS_NORETURN; } } @@ -2903,13 +2901,15 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) { CPUAVRState *env = cs->env_ptr; DisasContext ctx = { - .tb = tb, + .base.tb = tb, + .base.is_jmp = DISAS_NEXT, + .base.pc_first = tb->pc, + .base.pc_next = tb->pc, + .base.singlestep_enabled = cs->singlestep_enabled, .cs = cs, .env = env, .memidx = 0, - .bstate = DISAS_NEXT, .skip_cond = TCG_COND_NEVER, - .singlestep = cs->singlestep_enabled, }; target_ulong pc_start = tb->pc / 2; int num_insns = 0; @@ -2921,7 +2921,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) */ max_insns = 1; } - if (ctx.singlestep) { + if (ctx.base.singlestep_enabled) { max_insns = 1; } @@ -2946,7 +2946,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) * b main - sets breakpoint at address 0x00000100 (code) * b *0x100 - sets breakpoint at address 0x00800100 (data) */ - if (unlikely(!ctx.singlestep && + if (unlikely(!ctx.base.singlestep_enabled && (cpu_breakpoint_test(cs, OFFSET_CODE + ctx.npc * 2, BP_ANY) || cpu_breakpoint_test(cs, OFFSET_DATA + ctx.npc * 2, BP_ANY)))) { canonicalize_skip(&ctx); @@ -2989,11 +2989,11 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) if (skip_label) { canonicalize_skip(&ctx); gen_set_label(skip_label); - if (ctx.bstate == DISAS_NORETURN) { - ctx.bstate = DISAS_CHAIN; + if (ctx.base.is_jmp == DISAS_NORETURN) { + ctx.base.is_jmp = DISAS_CHAIN; } } - } while (ctx.bstate == DISAS_NEXT + } while (ctx.base.is_jmp == DISAS_NEXT && num_insns < max_insns && (ctx.npc - pc_start) * 2 < TARGET_PAGE_SIZE - 4 && !tcg_op_buf_full()); @@ -3004,7 +3004,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) bool nonconst_skip = canonicalize_skip(&ctx); - switch (ctx.bstate) { + switch (ctx.base.is_jmp) { case DISAS_NORETURN: assert(!nonconst_skip); break; @@ -3019,13 +3019,13 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) tcg_gen_movi_tl(cpu_pc, ctx.npc); /* fall through */ case DISAS_LOOKUP: - if (!ctx.singlestep) { + if (!ctx.base.singlestep_enabled) { tcg_gen_lookup_and_goto_ptr(); break; } /* fall through */ case DISAS_EXIT: - if (ctx.singlestep) { + if (ctx.base.singlestep_enabled) { gen_helper_debug(cpu_env); } else { tcg_gen_exit_tb(NULL, 0); From patchwork Tue Jun 29 18:54:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468336 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5253714jao; Tue, 29 Jun 2021 12:30:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwO3Sc5izPwOYTWt3daPuhd8I6GVXw3qTrJBA64HbW8NfZlNfF294P7xV6BOpGVN5c6pqXE X-Received: by 2002:a25:6c43:: with SMTP id h64mr40446887ybc.348.1624995040520; Tue, 29 Jun 2021 12:30:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995040; cv=none; d=google.com; s=arc-20160816; b=N2lSRE89JfOCLt6Rrw4ARxftMUmy+QEDG7ZajXeTAyfUs65KYD3IzfCDOxcCooq4ac WV6W6wl8mrLyQNrsOPmgmvr+R9/9BYmxi6nkIR8neUQF6E4aGTuOLoKVjvCV1jwYlLqw mhVp6XuJ6nN1pSArII8M1uIifzYP30+/jecQI1lPTKc0WFiqb4E1v95unLFlRJ9P1Rf/ TMHCEr9xG4WJu8sMimTBTtGHkVke9eHm4e7XG1erpgQPE0NPX5c/LW9KT7+OWVtB+BmD z+I78wob9+euKkESuG9lDObFEO/KIisiTFcHESYo2MriJu2p45qbmEB/3TE5523Nb0Pt /A8g== 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=fGRHMcrVsTBuc+poYCILKBwWahcIDUOmxH2NMmMtJuY=; b=TaqJkyBofk0IgZM9gscqz4OhQreI9oEg6eA2yPvVp+Cz5gyU7c+5w20A3JOp+xJff4 F4jrx0ZcdD5kyxByGCVmpwcxDjPwcFEtBZ7iTN1JlxB3ZxeKpDYClo+b1hpiETDCQ/30 tM9L8Ci0Yq5anv8oTY0bV01p8SlKJ3XE/K6S4CciB1kOirtbltJxgDELfUihicj3ET9C Xb4zXo6tKH+hjH3lOgxYuFe7FetR6veAVW+Uiiq2u+tfHin+i5GUYFdMRfg0H1FqqDgi qWpXvj0XSs+FoxQR8gXijDOFYT5ubfrAKkcey+k3IANOAvKV9UGn3ajpOXT/gSdDWMNS kyyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TUXp0LSR; 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 u8si17461123ybb.267.2021.06.29.12.30.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:30:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TUXp0LSR; 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]:51860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJRP-00021G-TY for patch@linaro.org; Tue, 29 Jun 2021 15:30:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItC-000850-Sw for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:18 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:40468) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIt1-0000sk-42 for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:18 -0400 Received: by mail-pg1-x52b.google.com with SMTP id g22so1096429pgl.7 for ; Tue, 29 Jun 2021 11:55:03 -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=fGRHMcrVsTBuc+poYCILKBwWahcIDUOmxH2NMmMtJuY=; b=TUXp0LSR2d53p7lKsVXDg1/Zpoc0eovkepHahcioGYO82QqrvTMw9hYQ1JAH0kmxJT HmfE19G+fU6lQIBkd9pk9nt5NbM7hBjC3SZ4j31qMQ2T3xMCFRyTMThTXR4pLF50KoeE Fb0uuSsOkG1/3EmZAbDCsxYUySJ21WEbxg6H6qfWbhiH3GDIuTChUXVEQ5W3LIXkrjM3 Wn6Q11DpkGPW1ULZqjZDaRAOLCYYdTzUzIxkV6IIA3AEn/1vVP1/ZWMcHdby1mPk7xjE 84VvMo1IJ3SG5TH6cvHrr/gf7rZWO3SkecMCtzwjAPq4R+ggfQvMRjikpfnVQFEWsXnT l/8w== 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=fGRHMcrVsTBuc+poYCILKBwWahcIDUOmxH2NMmMtJuY=; b=DhD1uK2yisnqrHSKpGYeuwtABxEalNpXOm1vhSJVWI8BjCPlZf+xYMfPIOJe/Xo48c t42olibj0JMrknxDgkIwp22JI5uwqbUWwXeByIxkLcvBJ4pGNMVGf+iILv2kLW44oIMK ssZpNceCjgRdJBm8mWND4/8lYwDms8GW5niuCLkMv4ETUIpBeGyZk6sNuXT3wWvTdOtA PDgkhQCRTlBJSovE337KFldkHclFb8ukmSh0G8jilkpIXPA11xtbDVoM43yQoYdWOugT 03SajkLMWxtG8Q1AQ676ykbSyApQYZeRY+NZPpAOgRmmVPIfHFDHPg0pYTf4EcanFZAf Pb2g== X-Gm-Message-State: AOAM531grAPw9/ptu7mlq03Ail8/6DB6pnGf82VGpdmEY3+ZoBMopiiJ xdRICjdPuXH/6mU5DI2Zd9HgZVI7FX1yDg== X-Received: by 2002:a63:9256:: with SMTP id s22mr26210553pgn.166.1624992902433; Tue, 29 Jun 2021 11:55:02 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 11/63] target/avr: Change ctx to DisasContext* in gen_intermediate_code Date: Tue, 29 Jun 2021 11:54:03 -0700 Message-Id: <20210629185455.3131172-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Rolnik , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Prepare for receiving it as a pointer input. Tested-by: Michael Rolnik Reviewed-by: Michael Rolnik Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/avr/translate.c | 84 +++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 41 deletions(-) -- 2.25.1 diff --git a/target/avr/translate.c b/target/avr/translate.c index 20c5062730..66e9882422 100644 --- a/target/avr/translate.c +++ b/target/avr/translate.c @@ -104,7 +104,7 @@ struct DisasContext { * used in the following manner (sketch) * * TCGLabel *skip_label = NULL; - * if (ctx.skip_cond != TCG_COND_NEVER) { + * if (ctx->skip_cond != TCG_COND_NEVER) { * skip_label = gen_new_label(); * tcg_gen_brcond_tl(skip_cond, skip_var0, skip_var1, skip_label); * } @@ -114,7 +114,7 @@ struct DisasContext { * free_skip_var0 = false; * } * - * translate(&ctx); + * translate(ctx); * * if (skip_label) { * gen_set_label(skip_label); @@ -2900,7 +2900,7 @@ static bool canonicalize_skip(DisasContext *ctx) void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) { CPUAVRState *env = cs->env_ptr; - DisasContext ctx = { + DisasContext ctx1 = { .base.tb = tb, .base.is_jmp = DISAS_NEXT, .base.pc_first = tb->pc, @@ -2911,6 +2911,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) .memidx = 0, .skip_cond = TCG_COND_NEVER, }; + DisasContext *ctx = &ctx1; target_ulong pc_start = tb->pc / 2; int num_insns = 0; @@ -2921,23 +2922,23 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) */ max_insns = 1; } - if (ctx.base.singlestep_enabled) { + if (ctx->base.singlestep_enabled) { max_insns = 1; } gen_tb_start(tb); - ctx.npc = pc_start; + ctx->npc = pc_start; if (tb->flags & TB_FLAGS_SKIP) { - ctx.skip_cond = TCG_COND_ALWAYS; - ctx.skip_var0 = cpu_skip; + ctx->skip_cond = TCG_COND_ALWAYS; + ctx->skip_var0 = cpu_skip; } do { TCGLabel *skip_label = NULL; /* translate current instruction */ - tcg_gen_insn_start(ctx.npc); + tcg_gen_insn_start(ctx->npc); num_insns++; /* @@ -2946,65 +2947,66 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) * b main - sets breakpoint at address 0x00000100 (code) * b *0x100 - sets breakpoint at address 0x00800100 (data) */ - if (unlikely(!ctx.base.singlestep_enabled && - (cpu_breakpoint_test(cs, OFFSET_CODE + ctx.npc * 2, BP_ANY) || - cpu_breakpoint_test(cs, OFFSET_DATA + ctx.npc * 2, BP_ANY)))) { - canonicalize_skip(&ctx); - tcg_gen_movi_tl(cpu_pc, ctx.npc); + if (unlikely(!ctx->base.singlestep_enabled && + (cpu_breakpoint_test(cs, OFFSET_CODE + ctx->npc * 2, BP_ANY) || + cpu_breakpoint_test(cs, OFFSET_DATA + ctx->npc * 2, BP_ANY)))) { + canonicalize_skip(ctx); + tcg_gen_movi_tl(cpu_pc, ctx->npc); gen_helper_debug(cpu_env); goto done_generating; } /* Conditionally skip the next instruction, if indicated. */ - if (ctx.skip_cond != TCG_COND_NEVER) { + if (ctx->skip_cond != TCG_COND_NEVER) { skip_label = gen_new_label(); - if (ctx.skip_var0 == cpu_skip) { + if (ctx->skip_var0 == cpu_skip) { /* * Copy cpu_skip so that we may zero it before the branch. * This ensures that cpu_skip is non-zero after the label * if and only if the skipped insn itself sets a skip. */ - ctx.free_skip_var0 = true; - ctx.skip_var0 = tcg_temp_new(); - tcg_gen_mov_tl(ctx.skip_var0, cpu_skip); + ctx->free_skip_var0 = true; + ctx->skip_var0 = tcg_temp_new(); + tcg_gen_mov_tl(ctx->skip_var0, cpu_skip); tcg_gen_movi_tl(cpu_skip, 0); } - if (ctx.skip_var1 == NULL) { - tcg_gen_brcondi_tl(ctx.skip_cond, ctx.skip_var0, 0, skip_label); + if (ctx->skip_var1 == NULL) { + tcg_gen_brcondi_tl(ctx->skip_cond, ctx->skip_var0, + 0, skip_label); } else { - tcg_gen_brcond_tl(ctx.skip_cond, ctx.skip_var0, - ctx.skip_var1, skip_label); - ctx.skip_var1 = NULL; + tcg_gen_brcond_tl(ctx->skip_cond, ctx->skip_var0, + ctx->skip_var1, skip_label); + ctx->skip_var1 = NULL; } - if (ctx.free_skip_var0) { - tcg_temp_free(ctx.skip_var0); - ctx.free_skip_var0 = false; + if (ctx->free_skip_var0) { + tcg_temp_free(ctx->skip_var0); + ctx->free_skip_var0 = false; } - ctx.skip_cond = TCG_COND_NEVER; - ctx.skip_var0 = NULL; + ctx->skip_cond = TCG_COND_NEVER; + ctx->skip_var0 = NULL; } - translate(&ctx); + translate(ctx); if (skip_label) { - canonicalize_skip(&ctx); + canonicalize_skip(ctx); gen_set_label(skip_label); - if (ctx.base.is_jmp == DISAS_NORETURN) { - ctx.base.is_jmp = DISAS_CHAIN; + if (ctx->base.is_jmp == DISAS_NORETURN) { + ctx->base.is_jmp = DISAS_CHAIN; } } - } while (ctx.base.is_jmp == DISAS_NEXT + } while (ctx->base.is_jmp == DISAS_NEXT && num_insns < max_insns - && (ctx.npc - pc_start) * 2 < TARGET_PAGE_SIZE - 4 + && (ctx->npc - pc_start) * 2 < TARGET_PAGE_SIZE - 4 && !tcg_op_buf_full()); if (tb->cflags & CF_LAST_IO) { gen_io_end(); } - bool nonconst_skip = canonicalize_skip(&ctx); + bool nonconst_skip = canonicalize_skip(ctx); - switch (ctx.base.is_jmp) { + switch (ctx->base.is_jmp) { case DISAS_NORETURN: assert(!nonconst_skip); break; @@ -3013,19 +3015,19 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) case DISAS_CHAIN: if (!nonconst_skip) { /* Note gen_goto_tb checks singlestep. */ - gen_goto_tb(&ctx, 1, ctx.npc); + gen_goto_tb(ctx, 1, ctx->npc); break; } - tcg_gen_movi_tl(cpu_pc, ctx.npc); + tcg_gen_movi_tl(cpu_pc, ctx->npc); /* fall through */ case DISAS_LOOKUP: - if (!ctx.base.singlestep_enabled) { + if (!ctx->base.singlestep_enabled) { tcg_gen_lookup_and_goto_ptr(); break; } /* fall through */ case DISAS_EXIT: - if (ctx.base.singlestep_enabled) { + if (ctx->base.singlestep_enabled) { gen_helper_debug(cpu_env); } else { tcg_gen_exit_tb(NULL, 0); @@ -3038,7 +3040,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) done_generating: gen_tb_end(tb, num_insns); - tb->size = (ctx.npc - pc_start) * 2; + tb->size = (ctx->npc - pc_start) * 2; tb->icount = num_insns; #ifdef DEBUG_DISAS From patchwork Tue Jun 29 18:54:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468317 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5239588jao; Tue, 29 Jun 2021 12:09:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVyx/VVJ03jGZrNkQaZjlZpGIudXlaqV+StI5kzO5OMTPimwtLJc3yyReS59YBTqvPx8e0 X-Received: by 2002:a25:ac04:: with SMTP id w4mr3229982ybi.431.1624993777558; Tue, 29 Jun 2021 12:09:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624993777; cv=none; d=google.com; s=arc-20160816; b=ZUyn4luUFu+rAOcIYZSy6WRFAafpa9sSZyugRiODpYA0tuWzJH2om4pR3UFSn2DD0K EEAxhkcXrOmXVmVdv8KJeVEynoQo9Za85BENkuaEvSFzP1jGk2e5cfQFrCf7SVuH9khs y4nDQIPvWB7WDrqAwBa60r+gqikfWJabuPkTaI7qi8fVpjP4mQBhvij+TcJTWs8fFeRm emWiYRCVfr2jFwn4MV3LxGqBsZn5aPABrKOIXJ9bNiVDr2X93f4w4I1SXwfQY9pst2wQ nds9mveSeJw6wyymg7L5oEHkoS1fz8R5IXgNFDrnlAL1iz3j6/KcBzuuG9InV+KsoKXp 8lJg== 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=EwjSjIzX7OecDhVxAUgcxoNalQtQhSbjjCChXF3d7tM=; b=GqcseeVxXmJmSDNCmozud7QRwlBsJ7UstP3/K4CXotRUG85M5/yAqHUnL/7TZqGdvi +89PjT7zI10QsRmimJta6rm2rDHQ540W5kFEhSoEA+ZV0zD2Hy8JBI337I8rIfrJK0eD oXov7har/UrXHpz09maI1Z8xLPj8id9mzb8NOtxKXt2UrDkUNDRicb35HnyXWQADnZAY humRpBM1DMBd8LVIpVkPr7GrW+Q5vFg4C2XQHWW47kjs0O1dSu1pR04l+m74+WUk/A/4 9H26IE7A2VM8IPx/npSWn67ZbZDXL2FZIHjgWb27GaOHNkZfQUSGV2zX1KAEmQCwuV43 LuNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fiDJshG5; 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 t9si13919088ybl.98.2021.06.29.12.09.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:09:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fiDJshG5; 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]:46228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJ73-0001eI-0b for patch@linaro.org; Tue, 29 Jun 2021 15:09:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItC-00084Q-Kn for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:18 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:42808) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIt0-0000sp-8r for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:18 -0400 Received: by mail-pf1-x42f.google.com with SMTP id y4so85598pfi.9 for ; Tue, 29 Jun 2021 11:55:03 -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=EwjSjIzX7OecDhVxAUgcxoNalQtQhSbjjCChXF3d7tM=; b=fiDJshG5pTOyxIivsPzogp/VSLuzeGiqfpNZJixzlVuj+0r/PB0jpn8LZ8+ljKgYwi 3dyOGHkvjtm2X43Mizzg7sVUJdqayqZYrCtuofuFjyw++HuVSMKXOk0t3XI4+etIXLU/ P2+XkKADsMViX1ecvO3GONfKbGyBcsRzjyvy/mbxmsLM4XmOpIwkoe7Dl7Q2BvaK27Sn qkxkAxjX+ec4AxheM2VPc7nqbfwL0DCg3Gt+TIOjT0DCdbJuJKNoVZTmamkwRu+gPUHs ZS9ST7e12viPgsgLYLB8Ckaw5F35w+XnhlFD2FS9UiNcm2VPLSWhPse652b/AyUL1tho PuGA== 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=EwjSjIzX7OecDhVxAUgcxoNalQtQhSbjjCChXF3d7tM=; b=YvB2KkiWrz1vHIFPsuu0GRp+7n2OdNwkby3QV5TKUIV3o2ZMHad2RvlZgYmL9OyZeh 1cC4WHCfX475dfbyWOhrLF5sazRJIai00pr4lh8KHsWIqE9AJE0OOPMErr0hV+6UuxWH r1vx5ZyZRLtFkASRBkSZod7Ya8f6/sdcmv1BYA2s5OxrJucWiKzA5ckud0tTI6lFIvXa XPqD6rg75Z4qAp6195VFDyybCw3fjoPlxPcRhjUWJNwi6R4nTnqiaFUOs0sKqMcTcExs Cfh5pyAXYRCLp3Shc2bAvFIs6V0rxYf3MRstdxLPJCmZVV2y8wEgTGJTY7KVukaWLnLU rQPg== X-Gm-Message-State: AOAM530MnI603qoxwnQl3XcxfWplJb63MpaBAkd60QIeuqMs7PpxmMpY FXaHb/pKDMcyqc8IifQSwItNkUgzkmkuRQ== X-Received: by 2002:a62:ee14:0:b029:309:715f:563f with SMTP id e20-20020a62ee140000b0290309715f563fmr24013805pfi.38.1624992903089; Tue, 29 Jun 2021 11:55:03 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 12/63] target/avr: Convert to TranslatorOps Date: Tue, 29 Jun 2021 11:54:04 -0700 Message-Id: <20210629185455.3131172-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Rolnik Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Tested-by: Michael Rolnik Reviewed-by: Michael Rolnik Signed-off-by: Richard Henderson --- target/avr/translate.c | 234 ++++++++++++++++++++++------------------- 1 file changed, 128 insertions(+), 106 deletions(-) -- 2.25.1 diff --git a/target/avr/translate.c b/target/avr/translate.c index 66e9882422..c06ce45bc7 100644 --- a/target/avr/translate.c +++ b/target/avr/translate.c @@ -2897,113 +2897,131 @@ static bool canonicalize_skip(DisasContext *ctx) return true; } -void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) +static void gen_breakpoint(DisasContext *ctx) { + canonicalize_skip(ctx); + tcg_gen_movi_tl(cpu_pc, ctx->npc); + gen_helper_debug(cpu_env); + ctx->base.is_jmp = DISAS_NORETURN; +} + +static void avr_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) +{ + DisasContext *ctx = container_of(dcbase, DisasContext, base); CPUAVRState *env = cs->env_ptr; - DisasContext ctx1 = { - .base.tb = tb, - .base.is_jmp = DISAS_NEXT, - .base.pc_first = tb->pc, - .base.pc_next = tb->pc, - .base.singlestep_enabled = cs->singlestep_enabled, - .cs = cs, - .env = env, - .memidx = 0, - .skip_cond = TCG_COND_NEVER, - }; - DisasContext *ctx = &ctx1; - target_ulong pc_start = tb->pc / 2; - int num_insns = 0; + uint32_t tb_flags = ctx->base.tb->flags; - if (tb->flags & TB_FLAGS_FULL_ACCESS) { - /* - * This flag is set by ST/LD instruction we will regenerate it ONLY - * with mem/cpu memory access instead of mem access - */ - max_insns = 1; - } - if (ctx->base.singlestep_enabled) { - max_insns = 1; - } + ctx->cs = cs; + ctx->env = env; + ctx->npc = ctx->base.pc_first / 2; - gen_tb_start(tb); - - ctx->npc = pc_start; - if (tb->flags & TB_FLAGS_SKIP) { + ctx->skip_cond = TCG_COND_NEVER; + if (tb_flags & TB_FLAGS_SKIP) { ctx->skip_cond = TCG_COND_ALWAYS; ctx->skip_var0 = cpu_skip; } - do { - TCGLabel *skip_label = NULL; - - /* translate current instruction */ - tcg_gen_insn_start(ctx->npc); - num_insns++; - + if (tb_flags & TB_FLAGS_FULL_ACCESS) { /* - * this is due to some strange GDB behavior - * let's assume main has address 0x100 - * b main - sets breakpoint at address 0x00000100 (code) - * b *0x100 - sets breakpoint at address 0x00800100 (data) + * This flag is set by ST/LD instruction we will regenerate it ONLY + * with mem/cpu memory access instead of mem access */ - if (unlikely(!ctx->base.singlestep_enabled && - (cpu_breakpoint_test(cs, OFFSET_CODE + ctx->npc * 2, BP_ANY) || - cpu_breakpoint_test(cs, OFFSET_DATA + ctx->npc * 2, BP_ANY)))) { - canonicalize_skip(ctx); - tcg_gen_movi_tl(cpu_pc, ctx->npc); - gen_helper_debug(cpu_env); - goto done_generating; - } + ctx->base.max_insns = 1; + } +} - /* Conditionally skip the next instruction, if indicated. */ - if (ctx->skip_cond != TCG_COND_NEVER) { - skip_label = gen_new_label(); - if (ctx->skip_var0 == cpu_skip) { - /* - * Copy cpu_skip so that we may zero it before the branch. - * This ensures that cpu_skip is non-zero after the label - * if and only if the skipped insn itself sets a skip. - */ - ctx->free_skip_var0 = true; - ctx->skip_var0 = tcg_temp_new(); - tcg_gen_mov_tl(ctx->skip_var0, cpu_skip); - tcg_gen_movi_tl(cpu_skip, 0); - } - if (ctx->skip_var1 == NULL) { - tcg_gen_brcondi_tl(ctx->skip_cond, ctx->skip_var0, - 0, skip_label); - } else { - tcg_gen_brcond_tl(ctx->skip_cond, ctx->skip_var0, - ctx->skip_var1, skip_label); - ctx->skip_var1 = NULL; - } - if (ctx->free_skip_var0) { - tcg_temp_free(ctx->skip_var0); - ctx->free_skip_var0 = false; - } - ctx->skip_cond = TCG_COND_NEVER; - ctx->skip_var0 = NULL; - } +static void avr_tr_tb_start(DisasContextBase *db, CPUState *cs) +{ +} - translate(ctx); +static void avr_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) +{ + DisasContext *ctx = container_of(dcbase, DisasContext, base); - if (skip_label) { - canonicalize_skip(ctx); - gen_set_label(skip_label); - if (ctx->base.is_jmp == DISAS_NORETURN) { - ctx->base.is_jmp = DISAS_CHAIN; - } - } - } while (ctx->base.is_jmp == DISAS_NEXT - && num_insns < max_insns - && (ctx->npc - pc_start) * 2 < TARGET_PAGE_SIZE - 4 - && !tcg_op_buf_full()); + tcg_gen_insn_start(ctx->npc); +} - if (tb->cflags & CF_LAST_IO) { - gen_io_end(); +static bool avr_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, + const CPUBreakpoint *bp) +{ + DisasContext *ctx = container_of(dcbase, DisasContext, base); + + gen_breakpoint(ctx); + return true; +} + +static void avr_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) +{ + DisasContext *ctx = container_of(dcbase, DisasContext, base); + TCGLabel *skip_label = NULL; + + /* + * This is due to some strange GDB behavior + * Let's assume main has address 0x100: + * b main - sets breakpoint at address 0x00000100 (code) + * b *0x100 - sets breakpoint at address 0x00800100 (data) + * + * The translator driver has already taken care of the code pointer. + */ + if (!ctx->base.singlestep_enabled && + cpu_breakpoint_test(cs, OFFSET_DATA + ctx->base.pc_next, BP_ANY)) { + gen_breakpoint(ctx); + return; } + /* Conditionally skip the next instruction, if indicated. */ + if (ctx->skip_cond != TCG_COND_NEVER) { + skip_label = gen_new_label(); + if (ctx->skip_var0 == cpu_skip) { + /* + * Copy cpu_skip so that we may zero it before the branch. + * This ensures that cpu_skip is non-zero after the label + * if and only if the skipped insn itself sets a skip. + */ + ctx->free_skip_var0 = true; + ctx->skip_var0 = tcg_temp_new(); + tcg_gen_mov_tl(ctx->skip_var0, cpu_skip); + tcg_gen_movi_tl(cpu_skip, 0); + } + if (ctx->skip_var1 == NULL) { + tcg_gen_brcondi_tl(ctx->skip_cond, ctx->skip_var0, 0, skip_label); + } else { + tcg_gen_brcond_tl(ctx->skip_cond, ctx->skip_var0, + ctx->skip_var1, skip_label); + ctx->skip_var1 = NULL; + } + if (ctx->free_skip_var0) { + tcg_temp_free(ctx->skip_var0); + ctx->free_skip_var0 = false; + } + ctx->skip_cond = TCG_COND_NEVER; + ctx->skip_var0 = NULL; + } + + translate(ctx); + + ctx->base.pc_next = ctx->npc * 2; + + if (skip_label) { + canonicalize_skip(ctx); + gen_set_label(skip_label); + if (ctx->base.is_jmp == DISAS_NORETURN) { + ctx->base.is_jmp = DISAS_CHAIN; + } + } + + if (ctx->base.is_jmp == DISAS_NEXT) { + target_ulong page_first = ctx->base.pc_first & TARGET_PAGE_MASK; + + if ((ctx->base.pc_next - page_first) >= TARGET_PAGE_SIZE - 4) { + ctx->base.is_jmp = DISAS_TOO_MANY; + } + } +} + +static void avr_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) +{ + DisasContext *ctx = container_of(dcbase, DisasContext, base); bool nonconst_skip = canonicalize_skip(ctx); switch (ctx->base.is_jmp) { @@ -3036,24 +3054,28 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) default: g_assert_not_reached(); } +} -done_generating: - gen_tb_end(tb, num_insns); +static void avr_tr_disas_log(const DisasContextBase *dcbase, CPUState *cs) +{ + qemu_log("IN: %s\n", lookup_symbol(dcbase->pc_first)); + log_target_disas(cs, dcbase->pc_first, dcbase->tb->size); +} - tb->size = (ctx->npc - pc_start) * 2; - tb->icount = num_insns; +static const TranslatorOps avr_tr_ops = { + .init_disas_context = avr_tr_init_disas_context, + .tb_start = avr_tr_tb_start, + .insn_start = avr_tr_insn_start, + .breakpoint_check = avr_tr_breakpoint_check, + .translate_insn = avr_tr_translate_insn, + .tb_stop = avr_tr_tb_stop, + .disas_log = avr_tr_disas_log, +}; -#ifdef DEBUG_DISAS - if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) - && qemu_log_in_addr_range(tb->pc)) { - FILE *fd; - fd = qemu_log_lock(); - qemu_log("IN: %s\n", lookup_symbol(tb->pc)); - log_target_disas(cs, tb->pc, tb->size); - qemu_log("\n"); - qemu_log_unlock(fd); - } -#endif +void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) +{ + DisasContext dc = { }; + translator_loop(&avr_tr_ops, &dc.base, cs, tb, max_insns); } void restore_state_to_opc(CPUAVRState *env, TranslationBlock *tb, From patchwork Tue Jun 29 18:54:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468318 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5241501jao; Tue, 29 Jun 2021 12:11:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpin7ClPW2Q0EbRVmYvZ+uXGqlRTG2heK6hJLHVeFsFSO7aFrBTwCStkp8b6y1x0vA6ber X-Received: by 2002:a5b:ac1:: with SMTP id a1mr44530865ybr.289.1624993911307; Tue, 29 Jun 2021 12:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624993911; cv=none; d=google.com; s=arc-20160816; b=nyGx74KkkIwX7hdDUlaUXd64PPPiFyRS4l1wuOSlevFkpbBphTEcDtIowI4jMTnfy5 HvLeWJqkziHAfBWuG4QhMDvjODT2uIcWlJjGUtWwstIBjJtj+35kUuBHASg4m631+tWx cO3BSKV3zLjq4yOXbcbtEMB4btU36z6Muyds20bcj/mmGNMIDiyPBQdjPLzBQlRzdzuJ 6guC8EzncImH2wzoHTpMVi7+tMb+3iBRsQAKBhkW61zG8N4Y/1+T5yoYfbsWOoz4WajQ 6+IU5zqUgvWzVPkaJW3njnalUVmOmFftDTJ+qAcnZ00M1MQPZA3q0D+ZVOplG36Ax3XV fj7g== 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=t0BZw837rtG1/qKvMeg+BUbNh24zWhCtJZPnucx0CFE=; b=EonTZguOkApbZtjEBGV6DdenBYXx4E6obhBhA4H+ZiK/1vAPEzn2zXVo6NiKD5nVYc +stMAYPJDN+KpUnxmBlNBVMRzXBhE9CTULc4C66RjubIGVq1UH7PucqwnGw2x3Q75295 6411EZykYxBdKgRvEEyUR+vdclV+bEWqKIV3Wu5Dg9RxvIL7z3sSDHV0sCj/dCk0u1hx UuVn/v3Iebkhjp2zktJhV2DkWE1OWkTVNspLn4vzm9ixoWKHqamKu9EGk9YCAVthubpa m+ER6fYvEcobqHuyPBy+rc5WX7Z7hOjZJp5+I5rXW5QDb9TmBnGCYIe7GoYv0zESka4S Z7QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Di1tUUiA; 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 d6si15331641ybl.10.2021.06.29.12.11.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:11:51 -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=Di1tUUiA; 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]:51752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJ9C-0005Wu-Mj for patch@linaro.org; Tue, 29 Jun 2021 15:11:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItE-00088Y-74 for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:20 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:37781) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIt9-0000sx-Vg for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:19 -0400 Received: by mail-pl1-x62b.google.com with SMTP id o3so42952plg.4 for ; Tue, 29 Jun 2021 11:55: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=t0BZw837rtG1/qKvMeg+BUbNh24zWhCtJZPnucx0CFE=; b=Di1tUUiAuDusPtpkN4AX8I6umpq6hLGE17gI18klAnpxG7fneESbc8XH1A52dPKRCg 1yoVHDLj5RTMvo8O7/LDZ8c5guoqWtbeUOpNHEx1Hmr+F+tuZcUWYjflcsyQeGrthxyP kh6kn+flL+5vIAM8Hz2CG8YgeiPpdlotXDvpIdflTe9AaaqQox64Ajz9Hq+YDKm2pb9j /1pCYwtvsgGR+hxcVpn8cek7XFvwSwy6yelQDQI4/WOu3b+YwEeW24OOMsm+v3GPU4jx BsthuFUp/61GFX/Qf2xODSbhq1H5/sHG0cmWuLJ4JNSG6GZdXaSyoWDSb0Bie07HH4e6 jLog== 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=t0BZw837rtG1/qKvMeg+BUbNh24zWhCtJZPnucx0CFE=; b=GI1eZZd13AmOjXQfTwbweVD53tQauZ8z4JHrXXHoTHE7Eezx2syazp02I7tN6DDu/f xuyIttiUJzf144IQi9JWQdI/9R98fOT1y/VLVix0fY4T2wqm2xkFhAq1gd2ExMTkyQ/S jq3do2TIOgFsRvttqw1XffTGDaRB6jrY8lIjJIVuTm+ydJW2LlUs5ms8vUX7AUHow3oA 0G1F1M6rg3AGy7LaHz2J9Mir3mZAuaz5KcgrgRWqO+EzcYilfW+3jve20sRBS7EvITSU d6xs37lnJAyi6qN3Zn7u4ESmTdqL4mqOGTnSjmMXSZXqhEsGllJXuLtanfQ7CJtbOk8/ V5vg== X-Gm-Message-State: AOAM532H6qRdL/MgRCL5fyePkdacVJ+7PGtpJNlWq6Iyv5T+z/7yxyeZ ytdoRkpOSQLxhk7j4F4xiDUxpCwRLxWssQ== X-Received: by 2002:a17:90b:8cc:: with SMTP id ds12mr35599456pjb.36.1624992903619; Tue, 29 Jun 2021 11:55:03 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 13/63] target/cris: Add DisasContextBase to DisasContext Date: Tue, 29 Jun 2021 11:54:05 -0700 Message-Id: <20210629185455.3131172-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Migrate the is_jmp, tb and singlestep_enabled fields from DisasContext into the base. Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/cris/translate.c | 49 +++++++++++++++++---------------- target/cris/translate_v10.c.inc | 4 +-- 2 files changed, 27 insertions(+), 26 deletions(-) -- 2.25.1 diff --git a/target/cris/translate.c b/target/cris/translate.c index 6dd5a267a6..bed7a7ed10 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -85,6 +85,8 @@ static TCGv env_pc; /* This is the state at translation time. */ typedef struct DisasContext { + DisasContextBase base; + CRISCPU *cpu; target_ulong pc, ppc; @@ -121,7 +123,6 @@ typedef struct DisasContext { int clear_locked_irq; /* Clear the irq lockout. */ int cpustate_changed; unsigned int tb_flags; /* tb dependent flags. */ - int is_jmp; #define JMP_NOJMP 0 #define JMP_DIRECT 1 @@ -131,9 +132,6 @@ typedef struct DisasContext { uint32_t jmp_pc; int delayed_branch; - - TranslationBlock *tb; - int singlestep_enabled; } DisasContext; static void gen_BUG(DisasContext *dc, const char *file, int line) @@ -531,7 +529,7 @@ static void t_gen_cc_jmp(TCGv pc_true, TCGv pc_false) static inline bool use_goto_tb(DisasContext *dc, target_ulong dest) { #ifndef CONFIG_USER_ONLY - return (dc->tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK) || + return (dc->base.pc_first & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK) || (dc->ppc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK); #else return true; @@ -543,7 +541,7 @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest) if (use_goto_tb(dc, dest)) { tcg_gen_goto_tb(n); tcg_gen_movi_tl(env_pc, dest); - tcg_gen_exit_tb(dc->tb, n); + tcg_gen_exit_tb(dc->base.tb, n); } else { tcg_gen_movi_tl(env_pc, dest); tcg_gen_exit_tb(NULL, 0); @@ -2037,14 +2035,14 @@ static int dec_setclrf(CPUCRISState *env, DisasContext *dc) /* Break the TB if any of the SPI flag changes. */ if (flags & (P_FLAG | S_FLAG)) { tcg_gen_movi_tl(env_pc, dc->pc + 2); - dc->is_jmp = DISAS_UPDATE; + dc->base.is_jmp = DISAS_UPDATE; dc->cpustate_changed = 1; } /* For the I flag, only act on posedge. */ if ((flags & I_FLAG)) { tcg_gen_movi_tl(env_pc, dc->pc + 2); - dc->is_jmp = DISAS_UPDATE; + dc->base.is_jmp = DISAS_UPDATE; dc->cpustate_changed = 1; } @@ -2886,14 +2884,14 @@ static int dec_rfe_etc(CPUCRISState *env, DisasContext *dc) LOG_DIS("rfe\n"); cris_evaluate_flags(dc); gen_helper_rfe(cpu_env); - dc->is_jmp = DISAS_UPDATE; + dc->base.is_jmp = DISAS_UPDATE; break; case 5: /* rfn. */ LOG_DIS("rfn\n"); cris_evaluate_flags(dc); gen_helper_rfn(cpu_env); - dc->is_jmp = DISAS_UPDATE; + dc->base.is_jmp = DISAS_UPDATE; break; case 6: LOG_DIS("break %d\n", dc->op1); @@ -2904,7 +2902,7 @@ static int dec_rfe_etc(CPUCRISState *env, DisasContext *dc) /* Breaks start at 16 in the exception vector. */ t_gen_movi_env_TN(trap_vector, dc->op1 + 16); t_gen_raise_exception(EXCP_BREAK); - dc->is_jmp = DISAS_UPDATE; + dc->base.is_jmp = DISAS_UPDATE; break; default: printf("op2=%x\n", dc->op2); @@ -3146,13 +3144,16 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) * delayslot, like in real hw. */ pc_start = tb->pc & ~1; - dc->cpu = env_archcpu(env); - dc->tb = tb; - dc->is_jmp = DISAS_NEXT; + dc->base.tb = tb; + dc->base.pc_first = pc_start; + dc->base.pc_next = pc_start; + dc->base.is_jmp = DISAS_NEXT; + dc->base.singlestep_enabled = cs->singlestep_enabled; + + dc->cpu = env_archcpu(env); dc->ppc = pc_start; dc->pc = pc_start; - dc->singlestep_enabled = cs->singlestep_enabled; dc->flags_uptodate = 1; dc->flagx_known = 1; dc->flags_x = tb->flags & X_FLAG; @@ -3189,7 +3190,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) cris_evaluate_flags(dc); tcg_gen_movi_tl(env_pc, dc->pc); t_gen_raise_exception(EXCP_DEBUG); - dc->is_jmp = DISAS_UPDATE; + dc->base.is_jmp = DISAS_UPDATE; /* The address covered by the breakpoint must be included in [tb->pc, tb->pc + tb->size) in order to for it to be properly cleared -- thus we increment the PC here so that @@ -3242,18 +3243,18 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) gen_goto_tb(dc, 1, dc->jmp_pc); gen_set_label(l1); gen_goto_tb(dc, 0, dc->pc); - dc->is_jmp = DISAS_TB_JUMP; + dc->base.is_jmp = DISAS_TB_JUMP; dc->jmp = JMP_NOJMP; } else if (dc->jmp == JMP_DIRECT) { cris_evaluate_flags(dc); gen_goto_tb(dc, 0, dc->jmp_pc); - dc->is_jmp = DISAS_TB_JUMP; + dc->base.is_jmp = DISAS_TB_JUMP; dc->jmp = JMP_NOJMP; } else { TCGv c = tcg_const_tl(dc->pc); t_gen_cc_jmp(env_btarget, c); tcg_temp_free(c); - dc->is_jmp = DISAS_JUMP; + dc->base.is_jmp = DISAS_JUMP; } break; } @@ -3264,7 +3265,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) if (!(tb->pc & 1) && cs->singlestep_enabled) { break; } - } while (!dc->is_jmp && !dc->cpustate_changed + } while (!dc->base.is_jmp && !dc->cpustate_changed && !tcg_op_buf_full() && !singlestep && (dc->pc - page_start < TARGET_PAGE_SIZE) @@ -3277,10 +3278,10 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) npc = dc->pc; /* Force an update if the per-tb cpu state has changed. */ - if (dc->is_jmp == DISAS_NEXT + if (dc->base.is_jmp == DISAS_NEXT && (dc->cpustate_changed || !dc->flagx_known || (dc->flags_x != (tb->flags & X_FLAG)))) { - dc->is_jmp = DISAS_UPDATE; + dc->base.is_jmp = DISAS_UPDATE; tcg_gen_movi_tl(env_pc, npc); } /* Broken branch+delayslot sequence. */ @@ -3293,12 +3294,12 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) cris_evaluate_flags(dc); if (unlikely(cs->singlestep_enabled)) { - if (dc->is_jmp == DISAS_NEXT) { + if (dc->base.is_jmp == DISAS_NEXT) { tcg_gen_movi_tl(env_pc, npc); } t_gen_raise_exception(EXCP_DEBUG); } else { - switch (dc->is_jmp) { + switch (dc->base.is_jmp) { case DISAS_NEXT: gen_goto_tb(dc, 1, npc); break; diff --git a/target/cris/translate_v10.c.inc b/target/cris/translate_v10.c.inc index f7cd67be37..dd44a7eb97 100644 --- a/target/cris/translate_v10.c.inc +++ b/target/cris/translate_v10.c.inc @@ -1169,7 +1169,7 @@ static unsigned int dec10_ind(CPUCRISState *env, DisasContext *dc) t_gen_mov_env_TN(trap_vector, c); tcg_temp_free(c); t_gen_raise_exception(EXCP_BREAK); - dc->is_jmp = DISAS_UPDATE; + dc->base.is_jmp = DISAS_UPDATE; return insn_len; } LOG_DIS("%d: jump.%d %d r%d r%d\n", __LINE__, size, @@ -1277,7 +1277,7 @@ static unsigned int crisv10_decoder(CPUCRISState *env, DisasContext *dc) if (dc->clear_prefix && dc->tb_flags & PFIX_FLAG) { dc->tb_flags &= ~PFIX_FLAG; tcg_gen_andi_tl(cpu_PR[PR_CCS], cpu_PR[PR_CCS], ~PFIX_FLAG); - if (dc->tb_flags != dc->tb->flags) { + if (dc->tb_flags != dc->base.tb->flags) { dc->cpustate_changed = 1; } } From patchwork Tue Jun 29 18:54:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468321 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5246290jao; Tue, 29 Jun 2021 12:18:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzG/3Z5GTzWMuaGeck7AMOo+oodWdjIJr7xfwO3JEopcbBuioaYeAb80eWEiA30DBAfH29b X-Received: by 2002:a25:3447:: with SMTP id b68mr25634704yba.319.1624994322907; Tue, 29 Jun 2021 12:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994322; cv=none; d=google.com; s=arc-20160816; b=x/aq1g4ivflhx64Pbe/4rGtiJ2SRWAJPSfN8FxNaJpQb962Cx/EtquiSsZRlEUp6yR Fv3SX0t/HJX2rYHV57q1MZQdHP81jVP2QedFlXWKzpm81Y1psodx/8ERs3fBOCbcSWmD SIqe7B6aSezIyVNa1tKpQYE4IPRnHCskTKOTXmvs0jN56YHzQ+eF7vHg77SWQCKrg39b NB43VyNLb2e0EhdjTbsyW69jPJD/fyyWcFdYjT5OGFFsPAyxYZIEXzLQGquFSPiVL+as PSbGXf9Aeh8qagqhKF4JlJmuRcES6dB7acla656XqIy090rWlv7eq2axfzaccJAAzUNv /BQw== 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=NDbsMBGPa6/4ZsuEztiF+PhUKF/lepvzPP4S1PK622w=; b=ISM7Z92kV0GF5Nxz7j4NKnVIHpVDeE/rBRRJRrVqAS6uiukvPlEyj1hsZxKN8wYW/h k6AdlRQQq8gp0pBRdRXeNE+q1GqNPj/2QU5Ioo1YNhwDrlA0Rg39k4vS3iYuhbhEjIRv 1E0PZJL0DCR6g7e5dXun2Mj14OkMVDE63laE4babFuTAGa+qamBLjlgmUVg70sDVzGkK 8p7/8tEQGwVDLtI/Weyije90aB93zCqjBN8b/TpcB/f1dQvTMwt+5HiGel0eEaKGBTIz dlKKYT5bL2QrroGHEWzt1zpilwDdSJiqIBYKK3Ox8ISWt6EBmx3nAphioLDRI3tWMVkC 8DoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="V2JD17V/"; 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 i196si17925566ybg.133.2021.06.29.12.18.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:18: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="V2JD17V/"; 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]:38592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJFq-0007VK-B7 for patch@linaro.org; Tue, 29 Jun 2021 15:18:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItI-0008LV-Ry for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:29 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:46755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000t1-4v for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:24 -0400 Received: by mail-pl1-x62f.google.com with SMTP id c15so17020pls.13 for ; Tue, 29 Jun 2021 11:55: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=NDbsMBGPa6/4ZsuEztiF+PhUKF/lepvzPP4S1PK622w=; b=V2JD17V/4VGr5L3FiC1cQ0e9TLeoTfzozFQ5MhySRU4s7beiEB/4nB87b65L6lAjaT ZxZbugJIu8lqEh1MbcjY6GXXX+wpSLZYcygIz0f3i04BjEsuwO+2MWYYAoUmJTpz6n0p yeUKgAtcXgIKFngtiVai+Ue8JAiTpXnOrfCQi9o/+JAL41WJYjUpYqOzsVA8EWQc8cEK 3imrIb2BaPRrbFuE2FhfrB0epU9WcLJ+XADYNSl5wJECPeljfkoDkn3YFO32lKH1UyNQ Ubh94g9zkgh7XJP5ic61P2ekMqutjSx87XCoXAg/UreNDVj1xzcmUPObhbBMpN3UGayD nluA== 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=NDbsMBGPa6/4ZsuEztiF+PhUKF/lepvzPP4S1PK622w=; b=OMR6TAV4oRLu1+4jiI7CQRrv0QcIeGuTRz98qsrkCCzlRh9LXm8iilXpPE+5Y+gE5J Y9YztOYBw/pX3KalAh+chp5OaNxqgosBP+0raKWdwW5Bg7BZ4Rz+9xfPEzcRoUobbigd haH5dksNUDOGUuD9fhN+OjKpobw7FlfL9hozAjA5pwGmaeB3e+YwcT3aYb1B4rrpaiz+ l/SOLAkwtTJNk+eR3veM8jlw94TjI++Gh5WzWbvmJ8tXOMBC+jiYKWYdpHzl+7C6M4f3 mGfEOe5S+SrDDtK6Fdi3T24UTQvBRkdcfi6LM+GKDKGYDlOKa74CMqnb3ElGJ1K4WDIh sJzg== X-Gm-Message-State: AOAM532yclpMJmA5HDwuD0HAIoSVBPGn8GeA01Pv/l5ZVghD7ott6bF5 OjdQkf+/Y7qGEoLfIhzRQHEr05NTqDcYyw== X-Received: by 2002:a17:90a:cc08:: with SMTP id b8mr318462pju.128.1624992904127; Tue, 29 Jun 2021 11:55:04 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 14/63] target/cris: Remove DISAS_SWI Date: Tue, 29 Jun 2021 11:54:06 -0700 Message-Id: <20210629185455.3131172-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This value is unused. Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/cris/translate.c | 2 -- 1 file changed, 2 deletions(-) -- 2.25.1 diff --git a/target/cris/translate.c b/target/cris/translate.c index bed7a7ed10..8c1bad9564 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -56,7 +56,6 @@ #define DISAS_JUMP DISAS_TARGET_0 /* only pc was modified dynamically */ #define DISAS_UPDATE DISAS_TARGET_1 /* cpu state was modified dynamically */ #define DISAS_TB_JUMP DISAS_TARGET_2 /* only pc was modified statically */ -#define DISAS_SWI DISAS_TARGET_3 /* Used by the decoder. */ #define EXTRACT_FIELD(src, start, end) \ @@ -3310,7 +3309,6 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) to find the next TB */ tcg_gen_exit_tb(NULL, 0); break; - case DISAS_SWI: case DISAS_TB_JUMP: /* nothing more to generate */ break; From patchwork Tue Jun 29 18:54:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468347 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5258870jao; Tue, 29 Jun 2021 12:39:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4OtQ92JwspU5QgBll2YG+8ShphU/67rNV3hQv+AK0d3r8GgSkedOZZP5RlAMpr3sIq4+g X-Received: by 2002:a25:b3c8:: with SMTP id x8mr42914897ybf.466.1624995546740; Tue, 29 Jun 2021 12:39:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995546; cv=none; d=google.com; s=arc-20160816; b=HSQxiCvb2pVnj+f56NhRLuryWm/bxkfHh5jZmKsSBhSG0fjb1nOy7DeirINLd1ktYc DWmnhRDl7A5QRi9IG/Sxu5K1ih4c0Hmmb9WIySh5Nwj4mKyAo2MsgcDV6w/CMJy8RkSx c7hNzgVcsrIbvOdIPeSCxzeQYSO+K9izaST0zliqQRc6RJaCLt9ndHwN9Fc9Vy/rXl+W fgFAMQwuzNiz64JcLuk5/9BDEqdsIkkd1e8pCS1Z10aUWWie7iwtiy0yHwXUN/qmXaZx iSPSHdpH3TnQpCYqYE22SbS1CimwBLdD9HrV3/PMTQ1eOPahv1sVS0v02GGIkXaRimK2 6nlA== 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=aUaGX+sm0NS0DUU+29DBSLSesa8Faq3SdPEvW0Ohij4=; b=CbHD0BrgG/WBiO6vbaD6lbAfPhZA+XepuO5jBShm6I6V/5V4EJXMeI4nA6PwytzzaG qyROTmMWYHXCcR1hVMsA8oOoLhbOs/c1YkoHvOLBE2WLV4pF7SeeB06/R3p/CPW8+5wG i7YwfzoLs23fowC5D0FaPxFET9rBseL+nOuGa5EvM9ivxaQQN73UPIRWOt7Iw4fyytJC AfA5qfuXORia6I4yvOxkXxRW1zPOibqjAdWGs2j90qC+qtiQUnv7lJf1MfuEl89ycXAN Dq/ZkfBtr6bwS9ZXlVrEbuH4UCuY35EzjUEd6+159Pm0t+gcJTECwcj635xN1uZZAs6j MSFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UHS4IsIJ; 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 f126si11995651ybb.255.2021.06.29.12.39.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:39:06 -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=UHS4IsIJ; 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]:51194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJZZ-0004Eh-QA for patch@linaro.org; Tue, 29 Jun 2021 15:39:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItD-00085V-4t for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:19 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:42858) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIt0-0000t6-8l for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:18 -0400 Received: by mail-pj1-x102a.google.com with SMTP id ce18-20020a17090aff12b0290170a3e3eb07so3087872pjb.1 for ; Tue, 29 Jun 2021 11:55: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=aUaGX+sm0NS0DUU+29DBSLSesa8Faq3SdPEvW0Ohij4=; b=UHS4IsIJwBOUMmFaHdgAnBQ9+WynlInRgIkYMA9Kq6IbBzQgL0KVV5ytjjUy3bzu61 9s52GhpUh23Wgdh+KZopwOE4ksqvOI+rD0st6i3wWUo1MyppWkHOz5HTjQ0TaDvPkOOt MrC0Ol/Uv9OwdvFO8YhQKzCND98sB1OjXdDgCNKuB2507WGpg13Db+Qs1ciOOtf1C/RD QqvM+ffdOXGscd3JN7/goq4inwHT0VBDw9fNoHXvEfM0nilKQSUYcFIOohNsB6FUCWNX O948KPm/UIVRo+L9PeOcF3qCe+BTSbmn8bE3PqGyS3nPok3C07dnUjaK/x60/HgZXGG1 TKXw== 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=aUaGX+sm0NS0DUU+29DBSLSesa8Faq3SdPEvW0Ohij4=; b=NaRWir5fopaIj4B/V1MbbCN8PO9oM66hY98aWLp8LcYyt5it46SZHdYpS5M/jdEa0V IXyyh0tlHn8g3LJbyuSiUwLm3y85RiTCYmwHv0+8UiZ2+Ia9C5dMpTHeVt+GniM+4bhu uRLgVpCAL5by2PQzvxQ8PR3Ee4yRASaArCJTFUlfEyzZCfpR4D7I8bGNVVyNiMKtlCrF yweYi2xCxZBfy5qvylmYgTGjBV6hasqLiIHmuocANmVRoNjd4y3J5gZFuPl/8OvDrLjV VMt0U8Vnk2Xamzy4UPVAIoieH1b6/dWBwAgGidOwGUZSejjaN+ASLkiME3v8GyR00InA Gncw== X-Gm-Message-State: AOAM533muIkwdaBahp2y66hS0i0YZhIEEjqUgps8CisyWMddCRpOeWMP Td5MNJWolMQtMuPQIyYvPyEAs80ZC6UvdQ== X-Received: by 2002:a17:902:da84:b029:129:fdf:f929 with SMTP id j4-20020a170902da84b02901290fdff929mr1123503plx.53.1624992904677; Tue, 29 Jun 2021 11:55:04 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 15/63] target/cris: Replace DISAS_TB_JUMP with DISAS_NORETURN Date: Tue, 29 Jun 2021 11:54:07 -0700 Message-Id: <20210629185455.3131172-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The only semantic of DISAS_TB_JUMP is that we've done goto_tb, which is the same as DISAS_NORETURN -- we've exited the tb. Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/cris/translate.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/target/cris/translate.c b/target/cris/translate.c index 8c1bad9564..e086ff9131 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -55,7 +55,6 @@ /* is_jmp field values */ #define DISAS_JUMP DISAS_TARGET_0 /* only pc was modified dynamically */ #define DISAS_UPDATE DISAS_TARGET_1 /* cpu state was modified dynamically */ -#define DISAS_TB_JUMP DISAS_TARGET_2 /* only pc was modified statically */ /* Used by the decoder. */ #define EXTRACT_FIELD(src, start, end) \ @@ -3242,12 +3241,12 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) gen_goto_tb(dc, 1, dc->jmp_pc); gen_set_label(l1); gen_goto_tb(dc, 0, dc->pc); - dc->base.is_jmp = DISAS_TB_JUMP; + dc->base.is_jmp = DISAS_NORETURN; dc->jmp = JMP_NOJMP; } else if (dc->jmp == JMP_DIRECT) { cris_evaluate_flags(dc); gen_goto_tb(dc, 0, dc->jmp_pc); - dc->base.is_jmp = DISAS_TB_JUMP; + dc->base.is_jmp = DISAS_NORETURN; dc->jmp = JMP_NOJMP; } else { TCGv c = tcg_const_tl(dc->pc); @@ -3309,7 +3308,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) to find the next TB */ tcg_gen_exit_tb(NULL, 0); break; - case DISAS_TB_JUMP: + case DISAS_NORETURN: /* nothing more to generate */ break; } From patchwork Tue Jun 29 18:54:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468326 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5249346jao; Tue, 29 Jun 2021 12:23:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTfO3sVW40WlYzHcHik3jJUTKFMpWHjJwDg2q3YglJ56fX1xTW1PF0RSTnetkGLAkA6s3e X-Received: by 2002:a05:6102:a83:: with SMTP id n3mr26268071vsg.21.1624994590436; Tue, 29 Jun 2021 12:23:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994590; cv=none; d=google.com; s=arc-20160816; b=V3ZggRN5JotF/q00un5KBRMKbH2lNR24rLoyowCNkaX64+p54+fmqF7oQqzZzi7fiR Lmjn1FqXyH7xEE1LyjFS6RgIVHarIRFzJEEiemErn9I00IQlUOdP7QRGkCjus5tcn2/0 xmjxys0q5dpS/ji+1NsXNk5v6pcCuu4fQV5kqtjeUcGVjXSJOJs6RaTe1kK7AblRF0L7 EWHAHJ0XyooPDtZuNVgmT0RVzLOZEhRTCh6x1wJQFAhQ2MdMQuSdrQME7HDubI/A4A1S nW6zWxrTqubn09JnqzKJE0vUY2IRK/GCPalTnQE5pwNfVCchgh1A5yobTo1wRmtEEUhq gxDw== 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=XHdB1I8aK6ZOFpKMHs281yG5ahJFgJAsOdRjioJDUOI=; b=PmXrP4y3He3mXOdmv3yO627Ru3fpGJSbH4chkz3e5QVqgUif3M86K3RDJsx77LZn36 p4ReBsqHoqRgrJ3aQYny+fPVVLlOCS0+N25L3YI93m3EZMwxcBjQokSup2Qe6w0KsXmn fHbxCtMC+EfY1RM3SdMnwmJnHVVtH9HGflkOBXzwKj+/ojUs+qMOEDV2AdfwWNH3p++C HSkvAWEqs7uzCQtqcjpHHsx2s+1ZGNSJu28Cd7ND06S6IwibQCM5E8kJ4pl39ZTLVRuQ a3TRfwQ95p36ZdtXhP9HiiEOX6g6bpnzwdvPLMCAm1lcN/UOXu5Kf+vYxXRZ18RIPk8P sX4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mduk+61y; 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 g14si4816190vsf.21.2021.06.29.12.23.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:23:10 -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=mduk+61y; 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]:54162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJK9-0001GG-Pd for patch@linaro.org; Tue, 29 Jun 2021 15:23:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38744) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItR-0008WJ-Bp for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:33 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:39847) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000tA-5J for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:33 -0400 Received: by mail-pl1-x629.google.com with SMTP id d1so33179plg.6 for ; Tue, 29 Jun 2021 11:55: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=XHdB1I8aK6ZOFpKMHs281yG5ahJFgJAsOdRjioJDUOI=; b=mduk+61ykcVZeK4Er7w5axnTJO5lVejLQpBHQcJ8b5iK/cCq15K/G3w2RdVvRVi3oM qPi2vDowSKJmRlYcx7Tzrrh3e06VFw6A3sTktBzxk0ne7MqBwDAKbEAFo92Up7BweTAc yxY5WXTyxMCrt9GoXktnrcddMf74QCPzwYIgn+dqD0vJDcrzRc+xAc0JGlC7gu1RPD8H rx0p71+b1v/5XZxNRd3kUwyOqTW4fNLY9QlK0cMDitY+DtZi7cFEuCfOrvapMda9Ickm W/IzDVFWBBWMxUXtybzaBDohfOuIB+KEbO4rqj0lmMg2PfnsiMF4oDqRnAP6bwEaSXo3 tsPA== 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=XHdB1I8aK6ZOFpKMHs281yG5ahJFgJAsOdRjioJDUOI=; b=j5SV6SV8l9l196IZhTG5RC7DSPfdpH/KrArvK9s47KLcq9r+z8HvL+Huybn6xVyluI G2ObnWIii6YPJvfzvo5G2MMDihiP9BL4iWIByXTh7AFGEfAiO0YKtb6D9mDWX2MPKo4R e+Sx5FI4u6wGOFBecKGOmFufuiKxDW0syzVvSFN+u0Y63wnHsGoSoJJl+fUNuse3KLdE XqLUEN7meQsaGSBDrjWI+5rUHzPfdgK4CWdZ2Q/9gvYuFgTrNqoAkqHMEjCwdY2y9J/C KQcqp6c41tJHYPSGBWzAKLf9bdmgaabVureMIS4kRaITvnHZqmXx9LtMsfIkOy7u6bVW pQvw== X-Gm-Message-State: AOAM530NiTGjIQ3j/5dxxeUDXOsdBbIOIwZV9BOkVGm1VXXfprLiCV+v 4vqcj7DYyYC40+/+c9/17JRcTfQuVXmUcA== X-Received: by 2002:a17:902:ecc6:b029:128:ed8c:a025 with SMTP id a6-20020a170902ecc6b0290128ed8ca025mr7658086plh.64.1624992905174; Tue, 29 Jun 2021 11:55:05 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 16/63] target/cris: Mark exceptions as DISAS_NORETURN Date: Tue, 29 Jun 2021 11:54:08 -0700 Message-Id: <20210629185455.3131172-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" After we've raised the exception, we have left the TB. Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/cris/translate.c | 5 +++-- target/cris/translate_v10.c.inc | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/target/cris/translate.c b/target/cris/translate.c index e086ff9131..24dbae6d58 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -2873,6 +2873,7 @@ static int dec_rfe_etc(CPUCRISState *env, DisasContext *dc) -offsetof(CRISCPU, env) + offsetof(CPUState, halted)); tcg_gen_movi_tl(env_pc, dc->pc + 2); t_gen_raise_exception(EXCP_HLT); + dc->base.is_jmp = DISAS_NORETURN; return 2; } @@ -2900,7 +2901,7 @@ static int dec_rfe_etc(CPUCRISState *env, DisasContext *dc) /* Breaks start at 16 in the exception vector. */ t_gen_movi_env_TN(trap_vector, dc->op1 + 16); t_gen_raise_exception(EXCP_BREAK); - dc->base.is_jmp = DISAS_UPDATE; + dc->base.is_jmp = DISAS_NORETURN; break; default: printf("op2=%x\n", dc->op2); @@ -3188,7 +3189,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) cris_evaluate_flags(dc); tcg_gen_movi_tl(env_pc, dc->pc); t_gen_raise_exception(EXCP_DEBUG); - dc->base.is_jmp = DISAS_UPDATE; + dc->base.is_jmp = DISAS_NORETURN; /* The address covered by the breakpoint must be included in [tb->pc, tb->pc + tb->size) in order to for it to be properly cleared -- thus we increment the PC here so that diff --git a/target/cris/translate_v10.c.inc b/target/cris/translate_v10.c.inc index dd44a7eb97..0ba2aca96f 100644 --- a/target/cris/translate_v10.c.inc +++ b/target/cris/translate_v10.c.inc @@ -61,6 +61,7 @@ static inline void cris_illegal_insn(DisasContext *dc) { qemu_log_mask(LOG_GUEST_ERROR, "illegal insn at pc=%x\n", dc->pc); t_gen_raise_exception(EXCP_BREAK); + dc->base.is_jmp = DISAS_NORETURN; } static void gen_store_v10_conditional(DisasContext *dc, TCGv addr, TCGv val, @@ -1169,7 +1170,7 @@ static unsigned int dec10_ind(CPUCRISState *env, DisasContext *dc) t_gen_mov_env_TN(trap_vector, c); tcg_temp_free(c); t_gen_raise_exception(EXCP_BREAK); - dc->base.is_jmp = DISAS_UPDATE; + dc->base.is_jmp = DISAS_NORETURN; return insn_len; } LOG_DIS("%d: jump.%d %d r%d r%d\n", __LINE__, size, From patchwork Tue Jun 29 18:54:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468350 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5260180jao; Tue, 29 Jun 2021 12:41:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHjE7niE6VUfZCjbAJLODxhi7xlUnDRauyGZjPc5pTrfxo1iC4y6f1cH3/fnR9iFKsOhki X-Received: by 2002:a05:622a:1102:: with SMTP id e2mr28347706qty.370.1624995690160; Tue, 29 Jun 2021 12:41:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995690; cv=none; d=google.com; s=arc-20160816; b=jBnuBMjOe/dUEVOlBP0s6FTsDyNHGkX232A8dg3EjCxYrm5vmmlhPrkt4dyqH1Zkbk F08ic0+CvtPh1luknBaT4/oRoqoxc7W1NCGu/dnJ5/H6NX5tz6Zh3gCLyRJgKctgZ9pl NKWEJDn4eqNrXrmfM1kZJELoa+WbEGvhfXPpaSIRbFIddpSTcGGEDj/hzOOPyego1SWZ 1AF/xvEv5SUSDw4MwwcBKRj3CLsE8p/hSnJyEhOcN8K8jJZ053qATThiYybPNctBjRB0 P7s0An9tvXuQlamQKTxnzWxaRoBvGpviVa/PRK8oIfME+iOtGWZsY0i7jS7IFc0OIxSZ 5mMw== 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=FVO3wAM4GMS2A+lnpro1PCsnjfTs6t0dHZi0wN04Hig=; b=R4A6spm01sUnEuZnmS+pccfrFZZbFgdeJmAVoYX9WjV40rwqEEGzEe0DLLzUiVXabn S4fMoLC7PbSx/guDKW4jCPFtwgfJ59IyPg+QEgvhLa0dNaDk6jR4HiGxX1YnDTwf9G4b +BEZs1TN35dwEFNtlvP24bF2pPOFk/nAdhvZDMg5PhltGy/T4SgSYxXwBJfHSFLUQcMc JZqpkHgoID39xh0rrrmXtktH03NcSZfzkA7BPyBJW3Yq6svPAORjHY2YSdVHnxsGIWqK XdmlA1TK1hkDUu5/pw9yt0eUP9zeeTOdadGhHQNFsQoIl7WuCgMVbZJIg4lApH4UREdQ JPtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TLL+4wK3; 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 gi12si966557qvb.205.2021.06.29.12.41.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:41: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=TLL+4wK3; 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]:59612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJbt-0001wx-Hw for patch@linaro.org; Tue, 29 Jun 2021 15:41:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItD-00085j-7I for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:19 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:54183) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIt9-0000tE-VI for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:18 -0400 Received: by mail-pj1-x1031.google.com with SMTP id q91so137176pjk.3 for ; Tue, 29 Jun 2021 11:55: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=FVO3wAM4GMS2A+lnpro1PCsnjfTs6t0dHZi0wN04Hig=; b=TLL+4wK3udpyDWyTPeyZSXGi0i8iQLf8fe0LnLYK46dwU3u/IX01h6Tqv1UMr0V9Eg KyfOx9OnItPeBLLAgCRtrkyS79byqODTm17pr0r58kSJo3LvtqerERQ47l/xv1JnwvCt uxuR9V0AFojt2+Ye7RNU4BRGGylD4ENnu+d9IgJ//1nBfMy2IYJFoA3Xx1vhQYmbGbUn SCuuk91GPpC9psXHSeCJ/gt3IennLifpQbpQmS+0lEHv9kLRlvYnh7j1zUmLV8HwTHVB Dt0JZPy5oWboq4gWnINVhySuDEHKFkkabsbpQ8AqrpkClgSe/kgBR4PdtYkPDjAYAkOk hsUQ== 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=FVO3wAM4GMS2A+lnpro1PCsnjfTs6t0dHZi0wN04Hig=; b=uXw59/wcSHgCWGsTuj8wNVXuNLBAn2H0XV1kTIL9QMDokQhw0IQpzxpYrnr8b958y+ fbgFG1Eg92El/dY+hZWtncto7//1soM/h704Vj4+IP2T4AKekCPqu8XsQyEefAK2mTuV JjAb8tEJc2iQ8WeUTgUT78rTIAsMNFvAzXpBtCjMS7/kTqmycYTQnDiQ4quPlThw/Q6r dsYoKzqlzx2v2imlWXZPnyDJzLN5p9IvU0FVlbCGuj8VTRvxY56rwvVNzH0bkVtihvA9 q3JVixYZDP2y3nLM+uEHqyaLTTaE7DzBwz3u2sqh4CQoAS/NPwmcjwqsjLSrI39oUUxN JjBw== X-Gm-Message-State: AOAM533n4QAAKcC/1jETEMyKfL3+nJwITwISqUgWRWXIaLVAQBBcBb9M 4QikYy6QVsYaC4zTxZPaBfHhGbMnIzyqgQ== X-Received: by 2002:a17:90a:bb13:: with SMTP id u19mr34543270pjr.113.1624992905721; Tue, 29 Jun 2021 11:55:05 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 17/63] target/cris: Fix use_goto_tb Date: Tue, 29 Jun 2021 11:54:09 -0700 Message-Id: <20210629185455.3131172-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Do not skip the page check for user-only -- mmap/mprotect can still change page mappings. Only check dc->base.pc_first, not dc->ppc -- the start page is the only one that's relevant. Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/cris/translate.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) -- 2.25.1 diff --git a/target/cris/translate.c b/target/cris/translate.c index 24dbae6d58..9e1f2f9239 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -524,14 +524,9 @@ static void t_gen_cc_jmp(TCGv pc_true, TCGv pc_false) gen_set_label(l1); } -static inline bool use_goto_tb(DisasContext *dc, target_ulong dest) +static bool use_goto_tb(DisasContext *dc, target_ulong dest) { -#ifndef CONFIG_USER_ONLY - return (dc->base.pc_first & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK) || - (dc->ppc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK); -#else - return true; -#endif + return ((dest ^ dc->base.pc_first) & TARGET_PAGE_MASK) == 0; } static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest) From patchwork Tue Jun 29 18:54:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468356 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5262984jao; Tue, 29 Jun 2021 12:46:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuXWEJzfCvBsY5CJHiWQ/2cDaTMmFhgJ+CineKsPj0C7+Zikg49pKJPdII+TAanx1qoPGo X-Received: by 2002:a05:6102:212a:: with SMTP id f10mr18728188vsg.56.1624995971578; Tue, 29 Jun 2021 12:46:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995971; cv=none; d=google.com; s=arc-20160816; b=l1HCezxMZ/A23VuJXpMKYshP2z0HgPb7e7jndABFnpZtXbnunXlhM3kQvj1vi4+/+b 75D7LOUCa+Z5mj0rtbTn7e9YjXWRXX8MWVi0b3GykeUOXzSehqbnRkDxQWmSCzIpBHUw 4LTcRAgOhfW3RrMPLQAgmgN2xtf9YGyxriVNSiiLCpiFpiDMUz3tWkjJyXkXfS/AO3Wy mb3CSihdSbWv+3nQnghFAJTNBWwbM3iLs52x5b86JxafNM4FTWvMhM99EWIUSlE+Wqgl a5yPwz4FVEhbZLLBQtXjSkJKinPOU9gg0+JlicziuIFQWHc87MOTPIaugkWYIuXbNzmb 1zJw== 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=O3Pu6sbbfX1sxFU91NPaVI1FfQFZ4zCnd2dJ56GNVpc=; b=HPX6F73vzDvoj6l3lDqT/6qutFefE7z3bGj1CR9lUzMJHgfSrUiLvLcT6f07VRqea6 d02oCLJTQ4kto9wvFcjQbKwzZKTIeEYYvd0aic/MjYSicvpw9BO45EXoKY8+VrKwsH2O 4/SR3UTzMjbW7wkJrJrbtfEgtSXvpsRbt1hVUFbGuG9lJkXuCH1bKVQZWh+qe5tZANMK 3BlDWyxIVmfUOq4eWHDQfYtJFif8+i4c9xslTDOk/E2G/YW24N9PKTgu3/ZDQl0IX0HC fHoABQN9pSebJ3sIY6zAETu5wzujU897HxZim7fUZI5g10oOguxjFEMYVH09/YD9EEVb JCdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qf16dM1N; 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 d21si11057754vsp.272.2021.06.29.12.46.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:46: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=Qf16dM1N; 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]:48634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJgQ-0005Iv-RD for patch@linaro.org; Tue, 29 Jun 2021 15:46:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItI-0008Iw-1P for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:24 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:35538) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000tL-4E for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:23 -0400 Received: by mail-pf1-x429.google.com with SMTP id d12so116411pfj.2 for ; Tue, 29 Jun 2021 11:55: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=O3Pu6sbbfX1sxFU91NPaVI1FfQFZ4zCnd2dJ56GNVpc=; b=Qf16dM1NgXTovKqMlD8Gy5X3lEhr/okvmHJnTMxgB22ydgplCaMENaMqWcaA8c79md K/4LL26UFpJecHQetkrKQkI8+dYHCumPdAAj12lKbXJTOvSXhcoBntTttZT8nLP09e76 Y1NwxGn9Bn8+mWM1lUMKAWjv+X+VrQvD7fcz/vI2xHx991Y2W102oOUdd677E00ZR21A f8GuEov7SV2WuAsbA5/P+h/GWuH9vslZDR4dPthTa3fxSvPGWcNJeE6vUDcAvAPI++1j v9mBjMIHY//+pxtNu55upXC85LpMia1eeqT4yycGvrF2C/3Ru618VtNza1LHVc63S4OV cCiw== 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=O3Pu6sbbfX1sxFU91NPaVI1FfQFZ4zCnd2dJ56GNVpc=; b=FelLMakt3ZRLIjD9WB4WGOFwUnTMBM18DteDFZK7Uv96+6/2IZPZNmE5imeRgonAsS vkts4aPvTumX1UHrBA8Q+cYfxKfTVhK1UIOq9y1ewqucwsy/x+rkRWItWMUDim2QS0IY vNDqJoeeqX7O9+WCjx2J7TSxIOlzlx9qATit8g4HI87wLDYOEvsdgOdfouQqvYrFBip+ GsW6APK6gmsbQqbndrzZ7pPsbh4Snid3mfSo7m8I9Z5tpsyDrHTlJU7WxzizgmmoGQMx U1lx6U3CAnMVJPau5BhUQXv6SFx0YpKZHDMa4MHStpAY3Fb+GWzXQY2Bze6UgGLgrEGh b6nA== X-Gm-Message-State: AOAM531iUkAKfdp8heeZWMrqIeB+mzoa1OcPDx1p3BH523OK1qf2gFF7 jGW9YLPx6CEoFOt6AVzmPgXs423ZCl1hyA== X-Received: by 2002:a62:6447:0:b029:30d:4bba:8b5a with SMTP id y68-20020a6264470000b029030d4bba8b5amr9068797pfb.71.1624992906270; Tue, 29 Jun 2021 11:55:06 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 18/63] target/cris: Convert to TranslatorOps Date: Tue, 29 Jun 2021 11:54:10 -0700 Message-Id: <20210629185455.3131172-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/cris/translate.c | 317 ++++++++++++++++++++++------------------ 1 file changed, 174 insertions(+), 143 deletions(-) -- 2.25.1 diff --git a/target/cris/translate.c b/target/cris/translate.c index 9e1f2f9239..eabede5251 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -3114,17 +3114,12 @@ static unsigned int crisv32_decoder(CPUCRISState *env, DisasContext *dc) * */ -/* generate intermediate code for basic block 'tb'. */ -void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) +static void cris_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) { + DisasContext *dc = container_of(dcbase, DisasContext, base); CPUCRISState *env = cs->env_ptr; + uint32_t tb_flags = dc->base.tb->flags; uint32_t pc_start; - unsigned int insn_len; - struct DisasContext ctx; - struct DisasContext *dc = &ctx; - uint32_t page_start; - target_ulong npc; - int num_insns; if (env->pregs[PR_VR] == 32) { dc->decoder = crisv32_decoder; @@ -3134,150 +3129,174 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) dc->clear_locked_irq = 1; } - /* Odd PC indicates that branch is rexecuting due to exception in the + /* + * Odd PC indicates that branch is rexecuting due to exception in the * delayslot, like in real hw. */ - pc_start = tb->pc & ~1; - - dc->base.tb = tb; + pc_start = dc->base.pc_first & ~1; dc->base.pc_first = pc_start; dc->base.pc_next = pc_start; - dc->base.is_jmp = DISAS_NEXT; - dc->base.singlestep_enabled = cs->singlestep_enabled; dc->cpu = env_archcpu(env); dc->ppc = pc_start; dc->pc = pc_start; dc->flags_uptodate = 1; dc->flagx_known = 1; - dc->flags_x = tb->flags & X_FLAG; + dc->flags_x = tb_flags & X_FLAG; dc->cc_x_uptodate = 0; dc->cc_mask = 0; dc->update_cc = 0; dc->clear_prefix = 0; + dc->cpustate_changed = 0; cris_update_cc_op(dc, CC_OP_FLAGS, 4); dc->cc_size_uptodate = -1; /* Decode TB flags. */ - dc->tb_flags = tb->flags & (S_FLAG | P_FLAG | U_FLAG \ - | X_FLAG | PFIX_FLAG); - dc->delayed_branch = !!(tb->flags & 7); + dc->tb_flags = tb_flags & (S_FLAG | P_FLAG | U_FLAG | X_FLAG | PFIX_FLAG); + dc->delayed_branch = !!(tb_flags & 7); if (dc->delayed_branch) { dc->jmp = JMP_INDIRECT; } else { dc->jmp = JMP_NOJMP; } +} - dc->cpustate_changed = 0; +static void cris_tr_tb_start(DisasContextBase *db, CPUState *cpu) +{ +} - page_start = pc_start & TARGET_PAGE_MASK; - num_insns = 0; +static void cris_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) +{ + DisasContext *dc = container_of(dcbase, DisasContext, base); - gen_tb_start(tb); - do { - tcg_gen_insn_start(dc->delayed_branch == 1 - ? dc->ppc | 1 : dc->pc); - num_insns++; + tcg_gen_insn_start(dc->delayed_branch == 1 ? dc->ppc | 1 : dc->pc); +} - if (unlikely(cpu_breakpoint_test(cs, dc->pc, BP_ANY))) { +static bool cris_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, + const CPUBreakpoint *bp) +{ + DisasContext *dc = container_of(dcbase, DisasContext, base); + + cris_evaluate_flags(dc); + tcg_gen_movi_tl(env_pc, dc->pc); + t_gen_raise_exception(EXCP_DEBUG); + dc->base.is_jmp = DISAS_NORETURN; + /* + * The address covered by the breakpoint must be included in + * [tb->pc, tb->pc + tb->size) in order to for it to be + * properly cleared -- thus we increment the PC here so that + * the logic setting tb->size below does the right thing. + */ + dc->pc += 2; + return true; +} + +static void cris_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) +{ + DisasContext *dc = container_of(dcbase, DisasContext, base); + CPUCRISState *env = cs->env_ptr; + unsigned int insn_len; + + /* Pretty disas. */ + LOG_DIS("%8.8x:\t", dc->pc); + + dc->clear_x = 1; + + insn_len = dc->decoder(env, dc); + dc->ppc = dc->pc; + dc->pc += insn_len; + dc->base.pc_next += insn_len; + + if (dc->base.is_jmp == DISAS_NORETURN) { + return; + } + + if (dc->clear_x) { + cris_clear_x_flag(dc); + } + + /* + * Check for delayed branches here. If we do it before + * actually generating any host code, the simulator will just + * loop doing nothing for on this program location. + */ + if (dc->delayed_branch && --dc->delayed_branch == 0) { + if (dc->base.tb->flags & 7) { + t_gen_movi_env_TN(dslot, 0); + } + + if (dc->cpustate_changed + || !dc->flagx_known + || (dc->flags_x != (dc->base.tb->flags & X_FLAG))) { + cris_store_direct_jmp(dc); + } + + if (dc->clear_locked_irq) { + dc->clear_locked_irq = 0; + t_gen_movi_env_TN(locked_irq, 0); + } + + if (dc->jmp == JMP_DIRECT_CC) { + TCGLabel *l1 = gen_new_label(); cris_evaluate_flags(dc); - tcg_gen_movi_tl(env_pc, dc->pc); - t_gen_raise_exception(EXCP_DEBUG); + + /* Conditional jmp. */ + tcg_gen_brcondi_tl(TCG_COND_EQ, env_btaken, 0, l1); + gen_goto_tb(dc, 1, dc->jmp_pc); + gen_set_label(l1); + gen_goto_tb(dc, 0, dc->pc); dc->base.is_jmp = DISAS_NORETURN; - /* The address covered by the breakpoint must be included in - [tb->pc, tb->pc + tb->size) in order to for it to be - properly cleared -- thus we increment the PC here so that - the logic setting tb->size below does the right thing. */ - dc->pc += 2; - break; + dc->jmp = JMP_NOJMP; + } else if (dc->jmp == JMP_DIRECT) { + cris_evaluate_flags(dc); + gen_goto_tb(dc, 0, dc->jmp_pc); + dc->base.is_jmp = DISAS_NORETURN; + dc->jmp = JMP_NOJMP; + } else { + TCGv c = tcg_const_tl(dc->pc); + t_gen_cc_jmp(env_btarget, c); + tcg_temp_free(c); + dc->base.is_jmp = DISAS_JUMP; } + } - /* Pretty disas. */ - LOG_DIS("%8.8x:\t", dc->pc); + /* Force an update if the per-tb cpu state has changed. */ + if (dc->base.is_jmp == DISAS_NEXT + && (dc->cpustate_changed + || !dc->flagx_known + || (dc->flags_x != (dc->base.tb->flags & X_FLAG)))) { + dc->base.is_jmp = DISAS_UPDATE; + tcg_gen_movi_tl(env_pc, dc->pc); + } - if (num_insns == max_insns && (tb_cflags(tb) & CF_LAST_IO)) { - gen_io_start(); - } - dc->clear_x = 1; + /* + * FIXME: Only the first insn in the TB should cross a page boundary. + * If we can detect the length of the next insn easily, we should. + * In the meantime, simply stop when we do cross. + */ + if (dc->base.is_jmp == DISAS_NEXT + && ((dc->pc ^ dc->base.pc_first) & TARGET_PAGE_MASK) != 0) { + dc->base.is_jmp = DISAS_TOO_MANY; + } +} - insn_len = dc->decoder(env, dc); - dc->ppc = dc->pc; - dc->pc += insn_len; - if (dc->clear_x) { - cris_clear_x_flag(dc); - } +static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) +{ + DisasContext *dc = container_of(dcbase, DisasContext, base); + DisasJumpType is_jmp = dc->base.is_jmp; + target_ulong npc = dc->pc; - /* Check for delayed branches here. If we do it before - actually generating any host code, the simulator will just - loop doing nothing for on this program location. */ - if (dc->delayed_branch) { - dc->delayed_branch--; - if (dc->delayed_branch == 0) { - if (tb->flags & 7) { - t_gen_movi_env_TN(dslot, 0); - } - if (dc->cpustate_changed || !dc->flagx_known - || (dc->flags_x != (tb->flags & X_FLAG))) { - cris_store_direct_jmp(dc); - } - - if (dc->clear_locked_irq) { - dc->clear_locked_irq = 0; - t_gen_movi_env_TN(locked_irq, 0); - } - - if (dc->jmp == JMP_DIRECT_CC) { - TCGLabel *l1 = gen_new_label(); - cris_evaluate_flags(dc); - - /* Conditional jmp. */ - tcg_gen_brcondi_tl(TCG_COND_EQ, - env_btaken, 0, l1); - gen_goto_tb(dc, 1, dc->jmp_pc); - gen_set_label(l1); - gen_goto_tb(dc, 0, dc->pc); - dc->base.is_jmp = DISAS_NORETURN; - dc->jmp = JMP_NOJMP; - } else if (dc->jmp == JMP_DIRECT) { - cris_evaluate_flags(dc); - gen_goto_tb(dc, 0, dc->jmp_pc); - dc->base.is_jmp = DISAS_NORETURN; - dc->jmp = JMP_NOJMP; - } else { - TCGv c = tcg_const_tl(dc->pc); - t_gen_cc_jmp(env_btarget, c); - tcg_temp_free(c); - dc->base.is_jmp = DISAS_JUMP; - } - break; - } - } - - /* If we are rexecuting a branch due to exceptions on - delay slots don't break. */ - if (!(tb->pc & 1) && cs->singlestep_enabled) { - break; - } - } while (!dc->base.is_jmp && !dc->cpustate_changed - && !tcg_op_buf_full() - && !singlestep - && (dc->pc - page_start < TARGET_PAGE_SIZE) - && num_insns < max_insns); + if (is_jmp == DISAS_NORETURN) { + /* If we have a broken branch+delayslot sequence, it's too late. */ + assert(dc->delayed_branch != 1); + return; + } if (dc->clear_locked_irq) { t_gen_movi_env_TN(locked_irq, 0); } - npc = dc->pc; - - /* Force an update if the per-tb cpu state has changed. */ - if (dc->base.is_jmp == DISAS_NEXT - && (dc->cpustate_changed || !dc->flagx_known - || (dc->flags_x != (tb->flags & X_FLAG)))) { - dc->base.is_jmp = DISAS_UPDATE; - tcg_gen_movi_tl(env_pc, npc); - } /* Broken branch+delayslot sequence. */ if (dc->delayed_branch == 1) { /* Set env->dslot to the size of the branch insn. */ @@ -3287,45 +3306,57 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) cris_evaluate_flags(dc); - if (unlikely(cs->singlestep_enabled)) { - if (dc->base.is_jmp == DISAS_NEXT) { + if (unlikely(dc->base.singlestep_enabled)) { + switch (is_jmp) { + case DISAS_TOO_MANY: tcg_gen_movi_tl(env_pc, npc); - } - t_gen_raise_exception(EXCP_DEBUG); - } else { - switch (dc->base.is_jmp) { - case DISAS_NEXT: - gen_goto_tb(dc, 1, npc); - break; - default: + /* fall through */ case DISAS_JUMP: case DISAS_UPDATE: - /* indicate that the hash table must be used - to find the next TB */ - tcg_gen_exit_tb(NULL, 0); - break; - case DISAS_NORETURN: - /* nothing more to generate */ + t_gen_raise_exception(EXCP_DEBUG); + return; + default: break; } + g_assert_not_reached(); } - gen_tb_end(tb, num_insns); - tb->size = dc->pc - pc_start; - tb->icount = num_insns; - -#ifdef DEBUG_DISAS -#if !DISAS_CRIS - if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) - && qemu_log_in_addr_range(pc_start)) { - FILE *logfile = qemu_log_lock(); - qemu_log("--------------\n"); - qemu_log("IN: %s\n", lookup_symbol(pc_start)); - log_target_disas(cs, pc_start, dc->pc - pc_start); - qemu_log_unlock(logfile); + switch (is_jmp) { + case DISAS_TOO_MANY: + gen_goto_tb(dc, 0, npc); + break; + case DISAS_JUMP: + case DISAS_UPDATE: + /* Indicate that interupts must be re-evaluated before the next TB. */ + tcg_gen_exit_tb(NULL, 0); + break; + default: + g_assert_not_reached(); } -#endif -#endif +} + +static void cris_tr_disas_log(const DisasContextBase *dcbase, CPUState *cpu) +{ + if (!DISAS_CRIS) { + qemu_log("IN: %s\n", lookup_symbol(dcbase->pc_first)); + log_target_disas(cpu, dcbase->pc_first, dcbase->tb->size); + } +} + +static const TranslatorOps cris_tr_ops = { + .init_disas_context = cris_tr_init_disas_context, + .tb_start = cris_tr_tb_start, + .insn_start = cris_tr_insn_start, + .breakpoint_check = cris_tr_breakpoint_check, + .translate_insn = cris_tr_translate_insn, + .tb_stop = cris_tr_tb_stop, + .disas_log = cris_tr_disas_log, +}; + +void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) +{ + DisasContext dc; + translator_loop(&cris_tr_ops, &dc.base, cs, tb, max_insns); } void cris_cpu_dump_state(CPUState *cs, FILE *f, int flags) From patchwork Tue Jun 29 18:54:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468353 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5261885jao; Tue, 29 Jun 2021 12:44:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuebv33iOBdrqOeM3YVES+daCCQOM+AOA6FNwhSN8ZkmE+t3CJhPRqbME4pf15QZWLL+Nj X-Received: by 2002:a05:622a:104:: with SMTP id u4mr29002038qtw.254.1624995863705; Tue, 29 Jun 2021 12:44:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995863; cv=none; d=google.com; s=arc-20160816; b=hRQMW08ibCpjmrJhT/cmnWf/V9+XDm1FoknLfSNz4HsrEajwtfH5VTVZNHMjxZpazF 74c0Q+hIuYEtLXx5r2q9u1yUhwkTwUJciQpKsr5dhbtN06QkebIgnRF1BOOPm2O7lxS8 j546ut9TGlXnIcduu/epNvtgejqPRRqcoj6hEBptVywEdUauLXtGCTafYqlba0OJGNbl YnbueUZhGlxnq/nKRCINCE8o+1TXM2uyYqpHrsp+oQiC9yfMx/9KoRzH3DYMBkjsd1+1 rhmw2haAE0Xz4Gsyx2WjDL8z95N+8jVJ5zXeilvjuU96TaExHDeoMHY4jmCZy2y/5nek j1YA== 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=kyxtC+kqjqK4PDBqr8WaoSRRXVEmRAU87eOnEmBs4hM=; b=jl9y1jJYi+1aTWNONFEOrst7w2Q43AESOufF1oZz5/aD4uC8bNfQRFVQmFUii0bYUK 3FeWSXlJ00Ez1J6eOb9fjEiPuzwPlTktYf9mgWkqb/weDbbBr+yY1y2Jxf55JqJTk5s+ rxVU6YvpZ8+zLGZFcy4LF7BTR5WZ6G/f8/BGID9BDyIdPycZthMWGqdAaGOG7X51r2W/ zZHMgnnwtg8WNDZPMmfOWy0f7TOX8vRXc34OWFoVU7KgGLuc2nvjCNfxxlA/FDzRZmAq aIZrnvq2CMd7VbCTStlRhIhoEmfnlcaQBTS6Cg19YyLij90w08HgngRjQUuX/HoMmFT/ lz0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P6kWESdH; 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 h24si12168831qka.244.2021.06.29.12.44.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:44:23 -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=P6kWESdH; 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]:39956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJeh-0007oY-0U for patch@linaro.org; Tue, 29 Jun 2021 15:44:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItG-0008FR-J8 for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:22 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:37494) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000tR-3c for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:22 -0400 Received: by mail-pg1-x52b.google.com with SMTP id t9so19371190pgn.4 for ; Tue, 29 Jun 2021 11:55: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=kyxtC+kqjqK4PDBqr8WaoSRRXVEmRAU87eOnEmBs4hM=; b=P6kWESdHZEU5CtrWsAUvJSEsiiqpADnXFawTtNgA0w/h0pnWIoAsG67dud7HhLZrEn NU/ygbRKUr61y4dbZQi+YS88j2yg8wWJE7OmB1j6lA/PT4qkz/a2+EeefP/q4KovDvp0 A65QGEulc1BtB0K8/X7k/pOeQ0o9T97kW6mBAXDDVfG+X3ao5gcC6pZRKKjjEc1CCHkk W7FlzKwnDrmfRaWVV3UWBbm1QQI9KavSBkwz4ZkA3A77ITYKvS+yu40xvx55hLl1lp1e RlU0FMeyxeCrp+PO2uEEqyA/m/74f7okvQw1KHmBquXnoZs73po8AMaJjp4tZpddtj6H A0Wg== 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=kyxtC+kqjqK4PDBqr8WaoSRRXVEmRAU87eOnEmBs4hM=; b=aYPlpthjERGiPalFFmssxtjZmrxBWPteTGUqtW/Hp53hmNgB+LzBbUGRjSdt2/lZoL Lf6MZRnMeqabaeS2n7B/aacSyp3ZPiTrBtC9PhBJEHBrwrms/YjLc+12qCelI/hAppwd Wb9HXwRD81F86KebqPtMN7WYJUxtqeXMl01pIx5n4GMBNGFvLcKK9E8/1K78aL9sQnHc WV03+Z6tzoaJT5Uq5CNca06THrXrSt5QThc+CMAhenEOKPXkvY+hGsIQ04Q+J5qjWjQA sy7/X+iI4z58dXKOHzhbPNIuvDupgKnAwxfUBtDwrF7L+80j095aAhZiXh320iPbV0wP mL4A== X-Gm-Message-State: AOAM531cVOBXYverUr0y8HnHWdhH/WDiz/sS32s6HW7efHt3RVD1al1K BinVNLx+6RXV2llQjosyXzhlsF9xR/s2dg== X-Received: by 2002:a05:6a00:be2:b029:30c:b0e:6cc5 with SMTP id x34-20020a056a000be2b029030c0b0e6cc5mr13166161pfu.79.1624992906751; Tue, 29 Jun 2021 11:55:06 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 19/63] target/cris: Mark helper_raise_exception noreturn Date: Tue, 29 Jun 2021 11:54:11 -0700 Message-Id: <20210629185455.3131172-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/cris/helper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 diff --git a/target/cris/helper.h b/target/cris/helper.h index 20d21c4358..3abf608682 100644 --- a/target/cris/helper.h +++ b/target/cris/helper.h @@ -1,4 +1,4 @@ -DEF_HELPER_2(raise_exception, void, env, i32) +DEF_HELPER_2(raise_exception, noreturn, env, i32) DEF_HELPER_2(tlb_flush_pid, void, env, i32) DEF_HELPER_2(spc_write, void, env, i32) DEF_HELPER_1(rfe, void, env) From patchwork Tue Jun 29 18:54:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468342 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5256211jao; Tue, 29 Jun 2021 12:34:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMJvkAhbhL9O5hLisBlhoBo4ddQmR+U5uT9boXANAwkJoVKTI44YOXy7Vy0u3bIH7W6U0K X-Received: by 2002:a05:6902:102d:: with SMTP id x13mr43625887ybt.408.1624995287914; Tue, 29 Jun 2021 12:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995287; cv=none; d=google.com; s=arc-20160816; b=FfhRaK+kyL+4b1aCZqZl1GNqCjRQBzAKFSFxDGDqtHs4wApNlvHbTFsI0nWlkObSA2 L0SSqrA7qY8FG2dgj2pH6zSggH0BJz6jMsp9lzSFWbyVCB1UYAXg6MkoJFqRmIlCBVFC vF8k95vwL5W/6JIG3V8k2feD8fSmRVRE1w337/Wq4vWY1JNfFVY/e3D+n9TRDY2sThsb EzlRch2tXSM8Q4OMk+IjLBsV2Z5WIIjGQuRN8dB1LFZ6w/uMUXMaVAsOjOc2KqqkcH3J AigpUIL6vJHH6yjhW9rhr5H3+yS3STDGFTmkSOvu6rXBQxgn74P07uqYGUKIK7/vG5Gp SLpA== 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=UDzjdzY2uNgirunivl38O17B6vfKe1pDPaF+QZIpYjM=; b=pVMo/FRLCQoUAWa716z0VtyBDEcumoGIJaEO0SCDRxJT3xUUH9rHOERSbnnvgyp0Gb uvhn7dOXWNS/LpkOBQSxuU5sac1sLJFxbw4O6/EGE8FSzvTssYGgcIq1QdglikGkWvAz BRgDZtRGdFqFhL4zxKpeI2T2nSri/C1Ms+4OpCYU6Vwz3dnE2dj3fNkHf/z9Z/UWaS02 brqk43vPeWE6i9aRtlww6sV38yiHutRuBklMYgOgli31yZOt54cEZIWW2JRMEQzp95KT r8YJ5kSNo7AvKUmYnZuYx/Hf9lFsIybn6y+uJtFTzCXiKt7Siu6Gl8IaK2+Nc9IyfaOr VMEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="IDf7F/H8"; 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 m11si7625851ybp.374.2021.06.29.12.34.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:34: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="IDf7F/H8"; 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]:36372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJVP-0002UL-DA for patch@linaro.org; Tue, 29 Jun 2021 15:34:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItF-0008CE-Jd for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:21 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:40602) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000ta-0N for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:21 -0400 Received: by mail-pj1-x102c.google.com with SMTP id bb10-20020a17090b008ab029016eef083425so2556316pjb.5 for ; Tue, 29 Jun 2021 11:55: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=UDzjdzY2uNgirunivl38O17B6vfKe1pDPaF+QZIpYjM=; b=IDf7F/H87WZSPij1x46NiqLZub5PUnG986U3ixBWWB+7GYfgcoX33dd+26ujFL+JdZ IlCWjEzUtFL8Y5F9gEDl7i+AWhKfZiZmY9Slfkm93Gt6xjop5frRcbvrDi70ZZnZSjFP LYxEcdQ/+Lwp/q8QCN5Rl//r3nB4wtYXNm8Y2aMUD8K+pvx//i+SUUJCNlddqtrPKeQD qgxd0awCP201CsOmHRjQWdrWI0YZ5lmKj1/1sijDwm/E9t7O8+cxHJLsTFotUuCOrd8U P9TR1BX+Be+HViUzuDH8HOE417V9F6ZCg8SwgpGSn1qEchzOqu3+AX5BxofsCCaw0kD+ /hkQ== 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=UDzjdzY2uNgirunivl38O17B6vfKe1pDPaF+QZIpYjM=; b=UyMNu5oi7brbzSmw/Eg806Msyt3rY4zNpwv9PVcYdiwxuoxI9COI/OXxcWBpeOxeCR 5EjFH7a+leR5ERmHafDzGvy8fba9hXRDiAB0yengh9BpgMA4DPtnQxq+Y8auzahRm1VW iC5Z9hulUEkSL0UUVrRK/X3rgYq+i/nzQ3PbdoKoKA0decCxi5G7SGrD2t96oo6L2EdT Fl1bVPxZS8m0fNQVLUfuqaytq0SMt6qhHHLwrFzJvoDeSC/QStjELyGl/5LauwREZiDw rlOGPzlWfUI0DCj0xBPwDEUODGhjdS2goeIesg6dO2+/pUhVyoLfjD5Vi33JbB+qN9eM sOug== X-Gm-Message-State: AOAM531AGTGH7fIEXaK5Mw2RlXEi9mf9h+rgljeINIGcoaOhZXd0od/Z 885nI7FgjIi2cfpwQzwE/s/BmPLvM5a3Ww== X-Received: by 2002:a17:90a:f0c3:: with SMTP id fa3mr19518267pjb.90.1624992907414; Tue, 29 Jun 2021 11:55:07 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 20/63] target/cris: Mark static arrays const Date: Tue, 29 Jun 2021 11:54:12 -0700 Message-Id: <20210629185455.3131172-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/cris/translate.c | 19 ++++++++++--------- target/cris/translate_v10.c.inc | 6 +++--- 2 files changed, 13 insertions(+), 12 deletions(-) -- 2.25.1 diff --git a/target/cris/translate.c b/target/cris/translate.c index eabede5251..e14b7acb10 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -137,14 +137,15 @@ static void gen_BUG(DisasContext *dc, const char *file, int line) cpu_abort(CPU(dc->cpu), "%s:%d pc=%x\n", file, line, dc->pc); } -static const char *regnames_v32[] = +static const char * const regnames_v32[] = { "$r0", "$r1", "$r2", "$r3", "$r4", "$r5", "$r6", "$r7", "$r8", "$r9", "$r10", "$r11", "$r12", "$r13", "$sp", "$acr", }; -static const char *pregnames_v32[] = + +static const char * const pregnames_v32[] = { "$bz", "$vr", "$pid", "$srs", "$wz", "$exs", "$eda", "$mof", @@ -153,7 +154,7 @@ static const char *pregnames_v32[] = }; /* We need this table to handle preg-moves with implicit width. */ -static int preg_sizes[] = { +static const int preg_sizes[] = { 1, /* bz. */ 1, /* vr. */ 4, /* pid. */ @@ -475,9 +476,9 @@ static inline void t_gen_swapw(TCGv d, TCGv s) ((T0 >> 5) & 0x02020202) | ((T0 >> 7) & 0x01010101)); */ -static inline void t_gen_swapr(TCGv d, TCGv s) +static void t_gen_swapr(TCGv d, TCGv s) { - struct { + static const struct { int shift; /* LSL when positive, LSR when negative. */ uint32_t mask; } bitrev[] = { @@ -1279,7 +1280,7 @@ static int dec_prep_alu_m(CPUCRISState *env, DisasContext *dc, #if DISAS_CRIS static const char *cc_name(int cc) { - static const char *cc_names[16] = { + static const char * const cc_names[16] = { "cc", "cs", "ne", "eq", "vc", "vs", "pl", "mi", "ls", "hi", "ge", "lt", "gt", "le", "a", "p" }; @@ -2926,7 +2927,7 @@ static int dec_null(CPUCRISState *env, DisasContext *dc) return 2; } -static struct decoder_info { +static const struct decoder_info { struct { uint32_t bits; uint32_t mask; @@ -3363,8 +3364,8 @@ void cris_cpu_dump_state(CPUState *cs, FILE *f, int flags) { CRISCPU *cpu = CRIS_CPU(cs); CPUCRISState *env = &cpu->env; - const char **regnames; - const char **pregnames; + const char * const *regnames; + const char * const *pregnames; int i; if (!env) { diff --git a/target/cris/translate_v10.c.inc b/target/cris/translate_v10.c.inc index 0ba2aca96f..4ab43dc404 100644 --- a/target/cris/translate_v10.c.inc +++ b/target/cris/translate_v10.c.inc @@ -21,7 +21,7 @@ #include "qemu/osdep.h" #include "crisv10-decode.h" -static const char *regnames_v10[] = +static const char * const regnames_v10[] = { "$r0", "$r1", "$r2", "$r3", "$r4", "$r5", "$r6", "$r7", @@ -29,7 +29,7 @@ static const char *regnames_v10[] = "$r12", "$r13", "$sp", "$pc", }; -static const char *pregnames_v10[] = +static const char * const pregnames_v10[] = { "$bz", "$vr", "$p2", "$p3", "$wz", "$ccr", "$p6-prefix", "$mof", @@ -38,7 +38,7 @@ static const char *pregnames_v10[] = }; /* We need this table to handle preg-moves with implicit width. */ -static int preg_sizes_v10[] = { +static const int preg_sizes_v10[] = { 1, /* bz. */ 1, /* vr. */ 1, /* pid. */ From patchwork Tue Jun 29 18:54:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468341 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5256184jao; Tue, 29 Jun 2021 12:34:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCdnCmLB94Sm91reAQBy7/F0BzBr09or21v2p0KCIE5wtNtghModAxgTNKTwPw5wQcVV+t X-Received: by 2002:a25:ec06:: with SMTP id j6mr40161568ybh.510.1624995285430; Tue, 29 Jun 2021 12:34:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995285; cv=none; d=google.com; s=arc-20160816; b=r0zWaslJ27uLqX+knZuetfUL3At0lvad4hUIiLOfiklJO0uwGWbC7GJgUCA16k+Bph KfBq0Hzrpn762LqlxlQMYOdXbxuktbw8VF4yHsJzxlw9rWSmcZcgv8TSeBi2sA+ksioL 9JvfawbTgekfsMFsvWx78tbBbn0zlz/cjEV0R3O1A25IJArmgB2u5xvWDGLgrjaiYLfm Sf3rQr9u0MykRRjS+0/4Q8ypVkTYhOaFR2lT7riM8D8RSgyeALbbsokC/ph631UXBmPT 7IzqudUuI/VUhvu64Y625Shqndr2JJ43ZD7mS5Qslxvz366DHv+Nhtz33ktyAyLwjjHt dvRw== 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=UpFFrLOSrARsKBhNwiFx6rXuoH136/XwhR/W6bC1nH0=; b=eKR+NGOqrxMncB9PQfJpHfzaFA74kDdolZWf7PdWK0JGBNbZaSbIgNjAe6X1wjSE53 131jSeGeSZhvtKDiVycwbm9z6F8ICrXNxXcFF7cyq+XClVZbrb2cxTeiqLpKH8V74mRA 6Mr4QzdVfx6fOLQbiC4kLesim3utnNnCON51KeuisDBJlFYmQJ+klOOwNjBEqw6P96a4 czF0BIaLNw5HqQ12dMVoTm3IqJi8EG8+CNZReNEPRcGZ4vn2i6RrVfRbOlx/EcHqEbmR iZoCFlXjIhbhfCXWqCxYNEDWEhS8403tQbvGLyPNrW8H/f5Mv/ifiRJKB0CDa45ZBO2N ocQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W0xriqz1; 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 w12si19367641ybj.381.2021.06.29.12.34.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:34:45 -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=W0xriqz1; 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]:38254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJVM-0003mE-U8 for patch@linaro.org; Tue, 29 Jun 2021 15:34:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItH-0008GT-4O for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:23 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:39672) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000tf-3M for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:22 -0400 Received: by mail-pj1-x102a.google.com with SMTP id in17-20020a17090b4391b0290170ba0ec7fcso2259987pjb.4 for ; Tue, 29 Jun 2021 11:55: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=UpFFrLOSrARsKBhNwiFx6rXuoH136/XwhR/W6bC1nH0=; b=W0xriqz1xkZ4oxC9IhK4EhE7b7kGmL+b89SaDo4xB+p2FVVdKZWv+JpeKPC14Ytn8V Ikimro5mWotU0LCXVJHm8d0l9MoP6QYEJxRbc1LJKYOUdMN85OfrnyMTKI8aLRAdDA6F jGD39QTpuKV1p/lU0rhLgS1vfYERLz8Hscj4YhOhfDTaUx4/bEHH2Ki8O1Ndu7rHOSue JSgcoFkjHHuZpXRy5Twbxp9VTG7YnpUu18/zMdPnhH563FWmsNyCe96uz26HTx1tAaPv 4BJAiedf9CYg8642fKpfPBjU6QdWV7C3YkfiZA9KMTX2dQuqj+oLxlRL8VJmAc1oaj5A Vy1Q== 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=UpFFrLOSrARsKBhNwiFx6rXuoH136/XwhR/W6bC1nH0=; b=NFn+MVX1Oa/kRbRn6ydUz7KW7ZmMh9cR4/KaCDEvQMgajtDQ5qnRQtf0Tqp8H0LY80 fzBC3NBAyzWLP4LIXGMPY1dV1rFCRoKrggHn+76yIS7xC05e1bw2cTSKI0RnpCwr1mGV sEbS7LcWPCJdW/G/Wb2Xuv9uoYMa6ba3ORDnJxw+QhDqkBIXtSECcMLjPBSxJd4IEFRq u8j+bcB0DtsJ+t1qviNVtkuNIATCYMO82XWBN6S1dPrbr3wp0gWNavoisKx6A7AHbHyO EnOL7mstVmB/0RISSmRDRNFUaq1nx5mnlqPrHOfjN3sJ7cMRfeapZjxpngpsvCyYaVJY gHTQ== X-Gm-Message-State: AOAM533JJKTerv/sC5ilNVya/nrK7VX8myqGrwROfMQbYc6gkMOCldSR l8XkStkjIUQjy0aD3kt8YB8BPuz3VDMsGQ== X-Received: by 2002:a17:902:8503:b029:127:8abc:191c with SMTP id bj3-20020a1709028503b02901278abc191cmr28932000plb.21.1624992907969; Tue, 29 Jun 2021 11:55:07 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 21/63] target/cris: Fold unhandled X_FLAG changes into cpustate_changed Date: Tue, 29 Jun 2021 11:54:13 -0700 Message-Id: <20210629185455.3131172-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We really do this already, by including them into the same test. This just hoists the expression up a bit. Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/cris/translate.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) -- 2.25.1 diff --git a/target/cris/translate.c b/target/cris/translate.c index e14b7acb10..80276ae84d 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -3217,6 +3217,10 @@ static void cris_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) cris_clear_x_flag(dc); } + /* Fold unhandled changes to X_FLAG into cpustate_changed. */ + dc->cpustate_changed |= !dc->flagx_known; + dc->cpustate_changed |= dc->flags_x != (dc->base.tb->flags & X_FLAG); + /* * Check for delayed branches here. If we do it before * actually generating any host code, the simulator will just @@ -3227,9 +3231,7 @@ static void cris_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) t_gen_movi_env_TN(dslot, 0); } - if (dc->cpustate_changed - || !dc->flagx_known - || (dc->flags_x != (dc->base.tb->flags & X_FLAG))) { + if (dc->cpustate_changed) { cris_store_direct_jmp(dc); } @@ -3263,10 +3265,7 @@ static void cris_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) } /* Force an update if the per-tb cpu state has changed. */ - if (dc->base.is_jmp == DISAS_NEXT - && (dc->cpustate_changed - || !dc->flagx_known - || (dc->flags_x != (dc->base.tb->flags & X_FLAG)))) { + if (dc->base.is_jmp == DISAS_NEXT && dc->cpustate_changed) { dc->base.is_jmp = DISAS_UPDATE; tcg_gen_movi_tl(env_pc, dc->pc); } From patchwork Tue Jun 29 18:54:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468337 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5254503jao; Tue, 29 Jun 2021 12:31:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYBYAqfvKps8RdtCNrX7YS6LPOzRDCESl5OH5ZInNlYQ7dJaTdW5XoE1eFKAXgtW8pJIqa X-Received: by 2002:a25:1c86:: with SMTP id c128mr6344006ybc.81.1624995115884; Tue, 29 Jun 2021 12:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995115; cv=none; d=google.com; s=arc-20160816; b=f9G4BFrSfgYc3P2pFPKAnKygB16MzYCRN5jz2ZuAeY44J2rLu5zuUimCdv+MVZvh2N 4a8X7EzdZlReh6q2UyOYMBtgX4Rr5Te7GfPvmxiQe4kqNLQrYP/AuDolh1PxV35IjGsz JEp1YMAZSg/CBPiqkQvlOyylnHldA/A7ignDuXoaLE8W2GxSJ6LOt+H26RhQK0U0Q3qN WEpWcm6Eeg5o5HYHrLlwDno4EoPlM1NlVXEnDGzhvXg9lAgbs6oKqW1XW4iNBxlaJtXX qoikaU5VyEzs1bygdrzmS4eH3QHTmKYWSTAWlsS+O9rXk7ws2yXVXjrutczF9DZpNhw1 jSNA== 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=1eZd84MrBkQ4EtK0PZ1SOJT9XE+/f091S9/PfyqFFNM=; b=Ogd5na1IrqTF4udKPyYNXLEFVPiqyD4ZWMsDQPoAmHNvOMfU4nDjf/qsq7tvelw6N1 dG0jWjiOZqy3902/1Rhq4fysXJGc2QqLpPO8uE7Pss6TLnDqD5MY86mT4enedNA5WGCw fUQ0PYTTL32Pxy4t1+xebq4JBbvZu1gzz9V0VGihqWrwoqhNLo8tftoI7WREE2ttTCpC /yGOauMVFDjGAmzbQNb6VBe23WO1XH57EtwzoWWjZPlgWH6AFp68zpQY/Ip60r+O0hBa NNHfLurqIpVkQVglKRFyw8Y8X6/tIcE8R+720e1mUHvPyQW8uT/9W0zmC+TUOCY3Qebx spGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jQp7NEdl; 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 a18si18833304ybc.456.2021.06.29.12.31.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:31: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=jQp7NEdl; 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]:57350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJSd-0005rW-83 for patch@linaro.org; Tue, 29 Jun 2021 15:31:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItF-0008BA-8a for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:21 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:39481) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000tj-2R for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:20 -0400 Received: by mail-pf1-x42f.google.com with SMTP id g192so99559pfb.6 for ; Tue, 29 Jun 2021 11:55:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1eZd84MrBkQ4EtK0PZ1SOJT9XE+/f091S9/PfyqFFNM=; b=jQp7NEdldcfa5yQ4mQ8N/t7nyrZtU/bzgPnsjGRG0z/aDxEGc0kzFBtDhig9j9QcLq fTIFmDbImVST3PQBDEAU5RFa8og0++ptRmw8t4XSdPUSRonZkYzmsXD2LY5FMQ5PXAGL Wl02vB1pzFheMl+62MZaNFEuG7VZjzWiTGpsvFWJwxDDrV7jg14Yb+mopGi3XjwVs7pa G35pJsxMpie0TB+l2iVMJEPYUgZMRV7WikV0hBxTsSiMlScq7XYDZ5z92Jf4iPGV5ztk AVsKmzJ4oTpGCuvo9bixN+5mOL6YN2hCA1sByBV4t/UPSXsoX7l2T9d4XBh02u/vOrmn 2x5A== 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=1eZd84MrBkQ4EtK0PZ1SOJT9XE+/f091S9/PfyqFFNM=; b=U+oQ305tw/LV4M5w5ULOSmdl3lJpq7qJqHOZv9xznxGgfhODqnfvsQjPXD9T8WMBjW caUxRNgZlFBNqBOpXZcmrmd9x3lC8UWOc9Qgx6JFTIiOftgIIodS7DraqI68iVHTv4zB fWOG3WEzdPAi+M744C+G2lbb0vTKweBTPxeuRaN0NG8lMOluQnrHTG90DGiU9Nl63iRM OIawMcVxHMwGUbHOL8AQz5sLjw5fEOeBG7xo3MPW8sV3n4BKYCTckud3GYQ52b+YKU3e cVzQPJO2BNbFAs7rv+mcleIFarV16ZsRQCaN3TRGb/kPqpWWIRBn5C3v3pOTSrcs+PV4 emfw== X-Gm-Message-State: AOAM530/wZLk0OdrIL6CTZD1/x91vZN/6QirY7SbpoCu6+zmMOf/+NRI NoPdnZjNu59Wi8CoqBqu2UGwqUDw6zagrQ== X-Received: by 2002:a63:5d5:: with SMTP id 204mr29525072pgf.72.1624992908561; Tue, 29 Jun 2021 11:55:08 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 22/63] target/cris: Set cpustate_changed for rfe/rfn Date: Tue, 29 Jun 2021 11:54:14 -0700 Message-Id: <20210629185455.3131172-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These insns set DISAS_UPDATE without cpustate_changed, which isn't quite right. Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/cris/translate.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.25.1 diff --git a/target/cris/translate.c b/target/cris/translate.c index 80276ae84d..df92b90d4e 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -2880,6 +2880,7 @@ static int dec_rfe_etc(CPUCRISState *env, DisasContext *dc) cris_evaluate_flags(dc); gen_helper_rfe(cpu_env); dc->base.is_jmp = DISAS_UPDATE; + dc->cpustate_changed = true; break; case 5: /* rfn. */ @@ -2887,6 +2888,7 @@ static int dec_rfe_etc(CPUCRISState *env, DisasContext *dc) cris_evaluate_flags(dc); gen_helper_rfn(cpu_env); dc->base.is_jmp = DISAS_UPDATE; + dc->cpustate_changed = true; break; case 6: LOG_DIS("break %d\n", dc->op1); From patchwork Tue Jun 29 18:54:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468319 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5242760jao; Tue, 29 Jun 2021 12:13:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEtIHOpal2GRVcDj7psVsJczlFpqChaiU0dp+mqdPQih4+9IEtocWNf99HZnF3Uhv4kEN7 X-Received: by 2002:a05:6902:70c:: with SMTP id k12mr27442420ybt.125.1624994022088; Tue, 29 Jun 2021 12:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994022; cv=none; d=google.com; s=arc-20160816; b=Lsd36aDQi1igkhe15VlT4rM/Xm0sN/11JaGcWeOpXIJdCctm6tIIfjeNrTKVCeRGV2 fJx0TN1Tw7BGT72Jt82tdjcid0rWrmCq5nG87DzrYBVlnrGyuJlR9Jqy1MaW9VD0Irr4 rYiDM3eXxA7eicJCcOGY+bXBJNxB2A+lFhnJ/7HQhdA3FyBhx6nGTMyqLw8AOztg9aMV iUn344BxuBBzWpwd3YKKZWE9aNTd5RvML0yhmpy5ejRSgAyclXtHANUfwiUSO9iFTCY2 3KLFbKZFn9aP5lcjFYSPY9B8nDtjtYyD9sY10fVEWPzBfGhjfJTJknePrpXre8mt0qXt M6dg== 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=kqh2og0wEwr/ALN9/Tn9edLBUCiuTurWoZvmUbX68qE=; b=upbjYxOQUawQyFuqy3Bd/bUViE+HnACJ9kN2fps9yV1oSKpOKQNWxuku801fNV9KzR RqQdYytnWxa39Ih9a7phMSJ9GUVtPlM2MU4pRbJyXbWfP4wqPKannP9qMB51894Bx5SB SBxcwJhDQKohI8GZUMwgAPQyfc/RkIrmHfa+oDEW7AwG8p9IJ7mgVL9CAwnxrUo3+Qcs ruf1NQQwXsJ/GHWmf6jZFqAWAVAyN5Vlrmoy8aCh30pItewttRHCp85HQykYniY/b6yB KyaL6ByDHmf0+YXERRENTuW62/DZE4lYSRCTaXvXmITgeDwjXN+buFCq4YS7kD0zwbVY EFNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Uirq0MEO; 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 y78si13271286yby.492.2021.06.29.12.13.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:13: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=Uirq0MEO; 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]:56762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJAz-0000TE-Gb for patch@linaro.org; Tue, 29 Jun 2021 15:13:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItE-00088x-Ha for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:20 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:41818) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000to-26 for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:20 -0400 Received: by mail-pj1-x1032.google.com with SMTP id cx9-20020a17090afd89b0290170a3e085edso3117314pjb.0 for ; Tue, 29 Jun 2021 11:55: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=kqh2og0wEwr/ALN9/Tn9edLBUCiuTurWoZvmUbX68qE=; b=Uirq0MEO+S57FBVOSqsnn2dIQ6e9YWmQqobQyxfk0HGH0WGHbdEuOKYDowVwk6xCyX Mqka5vHs2OahvM9XdpzsJAMx4lAG4ZgNMloYhloh5M91h1W6TsuAojA8hP4wlOAysQL5 +edBKPUsgUZSYQpSzilio9ecALPexu6LrWALGMc+Vx6lh690NnrpV/3tK5SaBVZMkUn2 MU9iUY9M/txGVg9GdOievZ6KyEML49lZvmtZ3Cjjh9bu/RuZETkT3CqQNa/c/qUTjSqx Yj9kp8aXgB0IJr6478FtF44u7jbM8C6r6IW0xp4RCOdhmuPrNaiNgcgp/p6V4GzBZ5tc EsHg== 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=kqh2og0wEwr/ALN9/Tn9edLBUCiuTurWoZvmUbX68qE=; b=SwYx0t6bi5pU9q2lq69588XM7U0yfGC/mjPrTcHoKlAnWjvLwUubnM2Y7dEIJ3qPul T4fzMlAX7y5eoG62ADPpEXJo+5AeOz3k9Pro8A3j2Qx7+IKvG129q/mVvJGU8OUT9Wp5 o2y7FR6k4BMs3DEbrZ4aut7x/DT2GWH5hY8DXf6+m+u4r7WhsLH6kbhR4IWBuuAHmPHP h1vTfgHoaob4YSftqyAPCPzC1psrPz00pSfExAtaLbiUhFaFNQ8dnxSRj+cfaVwdrGIO UDPeYvuIoZTbGDcjlycA1ncLluyl19KkEwZwQ1X0apYCcXvKJTlGRmeOzA1o6YeUcVvQ 0JCw== X-Gm-Message-State: AOAM532db4ImyRC16HothEsROqkR15YVWLLAMOegDJAz3dAT6TqTG/gg 3Q8LiS0fphtx/ju/4BRwbsszoVsn5lA0ew== X-Received: by 2002:a17:902:8e88:b029:11c:51bc:def8 with SMTP id bg8-20020a1709028e88b029011c51bcdef8mr28537709plb.57.1624992909166; Tue, 29 Jun 2021 11:55:09 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 23/63] target/cris: Add DISAS_UPDATE_NEXT Date: Tue, 29 Jun 2021 11:54:15 -0700 Message-Id: <20210629185455.3131172-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Move this pc update into tb_stop. We will be able to re-use this code shortly. Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/cris/translate.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) -- 2.25.1 diff --git a/target/cris/translate.c b/target/cris/translate.c index df92b90d4e..a2124ffcd5 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -52,9 +52,15 @@ #define BUG() (gen_BUG(dc, __FILE__, __LINE__)) #define BUG_ON(x) ({if (x) BUG();}) -/* is_jmp field values */ -#define DISAS_JUMP DISAS_TARGET_0 /* only pc was modified dynamically */ -#define DISAS_UPDATE DISAS_TARGET_1 /* cpu state was modified dynamically */ +/* + * Target-specific is_jmp field values + */ +/* Only pc was modified dynamically */ +#define DISAS_JUMP DISAS_TARGET_0 +/* Cpu state was modified dynamically, including pc */ +#define DISAS_UPDATE DISAS_TARGET_1 +/* Cpu state was modified dynamically, excluding pc -- use npc */ +#define DISAS_UPDATE_NEXT DISAS_TARGET_2 /* Used by the decoder. */ #define EXTRACT_FIELD(src, start, end) \ @@ -3268,8 +3274,8 @@ static void cris_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) /* Force an update if the per-tb cpu state has changed. */ if (dc->base.is_jmp == DISAS_NEXT && dc->cpustate_changed) { - dc->base.is_jmp = DISAS_UPDATE; - tcg_gen_movi_tl(env_pc, dc->pc); + dc->base.is_jmp = DISAS_UPDATE_NEXT; + return; } /* @@ -3311,6 +3317,7 @@ static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) if (unlikely(dc->base.singlestep_enabled)) { switch (is_jmp) { case DISAS_TOO_MANY: + case DISAS_UPDATE_NEXT: tcg_gen_movi_tl(env_pc, npc); /* fall through */ case DISAS_JUMP: @@ -3327,6 +3334,9 @@ static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) case DISAS_TOO_MANY: gen_goto_tb(dc, 0, npc); break; + case DISAS_UPDATE_NEXT: + tcg_gen_movi_tl(env_pc, npc); + /* fall through */ case DISAS_JUMP: case DISAS_UPDATE: /* Indicate that interupts must be re-evaluated before the next TB. */ From patchwork Tue Jun 29 18:54:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468320 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5245037jao; Tue, 29 Jun 2021 12:16:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwJ9jyyMj4B+kB0Jl6XEI9zNwfGMcRALqrDX3+RIxFrNT0N4URSj0YJOrdHHkeNvmOv84E X-Received: by 2002:a67:6e47:: with SMTP id j68mr8987729vsc.54.1624994205749; Tue, 29 Jun 2021 12:16:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994205; cv=none; d=google.com; s=arc-20160816; b=NzXsRUymEYp6NWCWwXphZR/Wg9suQyK37ky+lb9VPZdmEop2gXc8RlhFcSzbMU1HaN OkokVdUDaqqYvspjQO4ZTQ2t+VozJzghTv+zTqnL6OnK9/YWJ6wBAabp5yKtGFLClHz6 n30F8jk0GvwSpSingxbmEv+ak5+rsjsT9w2cUfIQZuoiDu9MNb9ZXcB/1kDUVTG9eodg POI6J/ks//f1KIwK6TkDKNRhzYvWhwLslxZr6ykS+wYz01+n1CBtEcpvZXdnsEZOP+Op bQctn6KZ4MPWtMhRv0aN5fJNQnhtDEJR32cqCi2mOghmjJBEvy8dzgO9GoHAjtCTUUVo whag== 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=TEPibjiZ3WGZdlbuijoRm6/TkAySQTI8yVWDgR6dGzo=; b=e/MidWliuAniI2ytefDw62fz//V4pok55TjOiPLwSakbdswJkS9e7Jja3rCyRU9QC5 TqXMK4ua/eJ4UBzWTvZ471QmxIVTroIDrwc9nPkEeW/ioNM+P4XeluxO1Qv8hyj5JwfE vWu6dD5ektgfRcTo9dgk/2/a0ugYLyIihP6GwzLln8MdsgfbC5uUth8547Yp+O9N+h92 01PSY4bptPSNYxc/R+l7E79kyg9AIEFmc+c/K59eHM5Xg0BJrZ+nPW1E1QPsezbkRsmd jWZuNwGSJtOAzYNr4EqhNQkSdxY+frKVtYxfQpcanJGYRiuHMtAcT33XiAFdD41Vtain Fwsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nXrjCxUs; 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 m1si12962497ual.52.2021.06.29.12.16.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:16:45 -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=nXrjCxUs; 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]:33482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJDx-0003tE-3P for patch@linaro.org; Tue, 29 Jun 2021 15:16:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItH-0008Gn-CG for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:23 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]:38607) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000tq-3k for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:23 -0400 Received: by mail-pg1-x52d.google.com with SMTP id h4so19372713pgp.5 for ; Tue, 29 Jun 2021 11:55: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=TEPibjiZ3WGZdlbuijoRm6/TkAySQTI8yVWDgR6dGzo=; b=nXrjCxUsM0VYCyeUmkNbu+SJdKBBgmWOiDxI3iEVrwiaOYhl3o6mgBavHLyQwGJ3/C WuBf7cojznS5HFTngksmHnmBIfT0bwipGhzCRs8TF71BAKc+2Lk35qM8MZQ0fkkMGejj QySfSDNJa0ILf33dORYCYMaSt+fXnLMUrp5k5ALwBRsowKDzkQEfwEVyGlsd5/x+pIZY AUrVmXl6U0vctTgyhQNfejteqx4C5Q6k2J7COuuFJ0+TvxpKvqjkNBUl5jj+C7KQ0DHx HUXm2taPSy550HiQutpDVpQhyG+fLGXZ43H3WsLbDPcN/UusYC1CjaAkIfXu1+CiYbgE EHng== 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=TEPibjiZ3WGZdlbuijoRm6/TkAySQTI8yVWDgR6dGzo=; b=UkVyokoP29JuTqURMhuoeEbH8bwD83v2/sG6iIPMYFPjEQxRGJWtR4O7bvN845R5fZ k3dODAqXFpHX7cvILgZweGy81dg2d5FCQ4lcs+aBpYolzidIPJikdAU4Fo3QucHlZn9h jEWiHVDBlHJ5qni7bVqfTdi7PUjOCVYS+L6E09QuvWSKGzadEV2MlTtmxQR7IRLoDZ1l l8l1o3lFS+JseP4zJU0mvTgIO7thMfJbzH/xk84khdEeyOD1E6yooEkem7hJ4ltRpQ8r ansv2nBc7wwfMhWIAZFpFgVssR2tAL623vFUQRvNn/IZTD2Np6kLWUrpHqPLpp3GZHi4 tgDA== X-Gm-Message-State: AOAM5309wolWD+wkSR2UndyoHO13n2db5PG1v1XDbfvlbFy5p1v1q9x4 Ynsk6S5qFm7xIx9oMxlm9OLTbJn5TjA22w== X-Received: by 2002:a05:6a00:8c4:b029:2b4:8334:ed4d with SMTP id s4-20020a056a0008c4b02902b48334ed4dmr31304216pfu.36.1624992909724; Tue, 29 Jun 2021 11:55:09 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 24/63] target/cris: Add DISAS_DBRANCH Date: Tue, 29 Jun 2021 11:54:16 -0700 Message-Id: <20210629185455.3131172-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Move delayed branch handling to tb_stop, where we can re-use other end-of-tb code, e.g. the evaluation of flags. Honor single stepping. Validate that we aren't losing state by overwriting is_jmp. Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/cris/translate.c | 96 ++++++++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 40 deletions(-) -- 2.25.1 diff --git a/target/cris/translate.c b/target/cris/translate.c index a2124ffcd5..7035426a9c 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -61,6 +61,8 @@ #define DISAS_UPDATE DISAS_TARGET_1 /* Cpu state was modified dynamically, excluding pc -- use npc */ #define DISAS_UPDATE_NEXT DISAS_TARGET_2 +/* PC update for delayed branch, see cpustate_changed otherwise */ +#define DISAS_DBRANCH DISAS_TARGET_3 /* Used by the decoder. */ #define EXTRACT_FIELD(src, start, end) \ @@ -3230,50 +3232,22 @@ static void cris_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) dc->cpustate_changed |= dc->flags_x != (dc->base.tb->flags & X_FLAG); /* - * Check for delayed branches here. If we do it before - * actually generating any host code, the simulator will just - * loop doing nothing for on this program location. + * All branches are delayed branches, handled immediately below. + * We don't expect to see odd combinations of exit conditions. */ + assert(dc->base.is_jmp == DISAS_NEXT || dc->cpustate_changed); + if (dc->delayed_branch && --dc->delayed_branch == 0) { - if (dc->base.tb->flags & 7) { - t_gen_movi_env_TN(dslot, 0); - } + dc->base.is_jmp = DISAS_DBRANCH; + return; + } - if (dc->cpustate_changed) { - cris_store_direct_jmp(dc); - } - - if (dc->clear_locked_irq) { - dc->clear_locked_irq = 0; - t_gen_movi_env_TN(locked_irq, 0); - } - - if (dc->jmp == JMP_DIRECT_CC) { - TCGLabel *l1 = gen_new_label(); - cris_evaluate_flags(dc); - - /* Conditional jmp. */ - tcg_gen_brcondi_tl(TCG_COND_EQ, env_btaken, 0, l1); - gen_goto_tb(dc, 1, dc->jmp_pc); - gen_set_label(l1); - gen_goto_tb(dc, 0, dc->pc); - dc->base.is_jmp = DISAS_NORETURN; - dc->jmp = JMP_NOJMP; - } else if (dc->jmp == JMP_DIRECT) { - cris_evaluate_flags(dc); - gen_goto_tb(dc, 0, dc->jmp_pc); - dc->base.is_jmp = DISAS_NORETURN; - dc->jmp = JMP_NOJMP; - } else { - TCGv c = tcg_const_tl(dc->pc); - t_gen_cc_jmp(env_btarget, c); - tcg_temp_free(c); - dc->base.is_jmp = DISAS_JUMP; - } + if (dc->base.is_jmp != DISAS_NEXT) { + return; } /* Force an update if the per-tb cpu state has changed. */ - if (dc->base.is_jmp == DISAS_NEXT && dc->cpustate_changed) { + if (dc->cpustate_changed) { dc->base.is_jmp = DISAS_UPDATE_NEXT; return; } @@ -3283,8 +3257,7 @@ static void cris_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) * If we can detect the length of the next insn easily, we should. * In the meantime, simply stop when we do cross. */ - if (dc->base.is_jmp == DISAS_NEXT - && ((dc->pc ^ dc->base.pc_first) & TARGET_PAGE_MASK) != 0) { + if ((dc->pc ^ dc->base.pc_first) & TARGET_PAGE_MASK) { dc->base.is_jmp = DISAS_TOO_MANY; } } @@ -3314,6 +3287,49 @@ static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) cris_evaluate_flags(dc); + /* Evaluate delayed branch destination and fold to another is_jmp case. */ + if (is_jmp == DISAS_DBRANCH) { + if (dc->base.tb->flags & 7) { + t_gen_movi_env_TN(dslot, 0); + } + + switch (dc->jmp) { + case JMP_DIRECT: + npc = dc->jmp_pc; + is_jmp = dc->cpustate_changed ? DISAS_UPDATE_NEXT : DISAS_TOO_MANY; + break; + + case JMP_DIRECT_CC: + /* + * Use a conditional branch if either taken or not-taken path + * can use goto_tb. If neither can, then treat it as indirect. + */ + if (likely(!dc->base.singlestep_enabled) + && likely(!dc->cpustate_changed) + && (use_goto_tb(dc, dc->jmp_pc) || use_goto_tb(dc, npc))) { + TCGLabel *not_taken = gen_new_label(); + + tcg_gen_brcondi_tl(TCG_COND_EQ, env_btaken, 0, not_taken); + gen_goto_tb(dc, 1, dc->jmp_pc); + gen_set_label(not_taken); + + /* not-taken case handled below. */ + is_jmp = DISAS_TOO_MANY; + break; + } + tcg_gen_movi_tl(env_btarget, dc->jmp_pc); + /* fall through */ + + case JMP_INDIRECT: + t_gen_cc_jmp(env_btarget, tcg_constant_tl(npc)); + is_jmp = dc->cpustate_changed ? DISAS_UPDATE : DISAS_JUMP; + break; + + default: + g_assert_not_reached(); + } + } + if (unlikely(dc->base.singlestep_enabled)) { switch (is_jmp) { case DISAS_TOO_MANY: From patchwork Tue Jun 29 18:54:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468363 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5267049jao; Tue, 29 Jun 2021 12:52:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcQ67EkxCgB7VBrARG60QEx73YFHNw90XU3klKJG9YQR7dPcNdNcfkFEzAiyv9vAkaGe/3 X-Received: by 2002:ae9:f006:: with SMTP id l6mr31210901qkg.420.1624996376187; Tue, 29 Jun 2021 12:52:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996376; cv=none; d=google.com; s=arc-20160816; b=GCXdVXyE20s7JVnHYoZNmSE4flB3rJPjSRux2uD2yH87OidiKyLW7FEJIRYGrhq5HO apmkW7SU/ZyoZuJK2eK0caWyZW5lGNInpKZVPnbY5SxAaR01rKcmTA1eETu1h1dq3979 qHbj5iAn0DGkBKFdkwYeGv11F/aGLTtn478SSIt3ONlGKoKOaY+J6ODAKjq0QJgw4SrB KbCYu7cesq9pAg145TTfdxcv3b2xZ5IxA+H1Tpl6TQFvZQcIJpMtOZ9mFscp0U8wUv2d dVXbQMGxdWKQfa6ibmvsDzvUG830Clsn7wsG/w2ow8ak++Q/nwMW9rRT4HsNJG2N8eps fOXw== 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=u029qEzk6yP7ESQgeOfYtlytu0PVU2mUIoDbqOaagp8=; b=g/dn0ApxCiE53YtwJJGVfIBXvrx44undn3yGijd/fcUYLFHN8z6/iMfWJjkO7n4yiG qDOrEmw4qUm/s09/28gKNL++u8PrV2c+fwEhxK9r2ac66t4Arzw/txVuqeE6S0WP3Eo+ ML9jPCSCAHV0E/uXgJhIyAfgvNVqe20XGgqkkxt9jAKD/xRilRG+YRhUkmj5g16BR0PR kMVooVoDZcHm88j+uxRtOSblIbXX7KcVGxLnXjt8sOWe9nz+E2a+ol9BFUlme8FlCoz2 aKsmG8yarAL28CUq6eHMkaRUKWGikPkqPGuo6vlMjPkdBcgjSEVmAmPqZ6vZTihdGzkF tYgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s5dWuXzZ; 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 q5si1439028qvx.200.2021.06.29.12.52.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:52: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=s5dWuXzZ; 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]:38048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJmx-0000bH-Je for patch@linaro.org; Tue, 29 Jun 2021 15:52:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItO-0008RQ-Pa for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:30 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:39674) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000tw-5b for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:30 -0400 Received: by mail-pj1-x102c.google.com with SMTP id in17-20020a17090b4391b0290170ba0ec7fcso2260063pjb.4 for ; Tue, 29 Jun 2021 11:55:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u029qEzk6yP7ESQgeOfYtlytu0PVU2mUIoDbqOaagp8=; b=s5dWuXzZcS7b3PDVR4VRBbItc/wZm+8ra50LzI5tknb6rPLSqWkxTkxHUSeMrdDqWs sQlhWYZSvVnbRQYc0Xcrrc6gIQNFsmiV7UPuz4EzCkUwywHdaI/lnN1yve4Q+Dshk/TQ 1tTR/dFfpSCv+Vb+LAj2Gt8+6x7Zl5eR1Pef86/Aa/CKVsZVwvIG2phxlDScUKXsBfD2 kuKXl5GORnagEG3J1xD7CxJu+pj5S5wjgL/40oquSoSbr+Q/iQOYad6IFfmxzNTiQO/o Mm5pdYhEeo0OU5GlTaXQPEvdMe+DI7QJTfm9bX4p8+44cHzu+Vj1JbateBPGhbRi0Ydv xOaw== 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=u029qEzk6yP7ESQgeOfYtlytu0PVU2mUIoDbqOaagp8=; b=V6S6q48N+yTcmKvv1YKYfntNX0TUSR+QddTQiCOOMVIEyICbcJ/Gut7Wqiw2M9KKOY cUfwrCZEKmCOYQllg3zv4qhTldhPgn7sNeSeCA3AM4420x/eYAqasRe/KDOTyp9235c7 Ni/8/yA+H2SDLW/9eL0fctMw4Tj5QEdPQ9Fci7ArJj8Y/3qMNFRooIdof7NLQzfXuu9N fnS+ECrbEokwSsql5lKO3tb3EXYMQsXQC9CrSJ1FYV9EqfCPcOmT8fbIxSldtTaZDRdJ 7KC9UoP3Rge+Bpj3Mto/PgqUu+9A2GeT0M6Dje6n1F2nO+jtjaVcGSpsUD5sZ2CgoT9k yXig== X-Gm-Message-State: AOAM530MccqwVI31V6um1d7wPf0k8kxXzVG1PQ3jPbayfOnenz/sH3gP VsNL80zToFxpG1s9e1EzkoBQLuZzJcMqkg== X-Received: by 2002:a17:902:e282:b029:128:dd80:5c3c with SMTP id o2-20020a170902e282b0290128dd805c3cmr10760336plc.81.1624992910459; Tue, 29 Jun 2021 11:55:10 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 25/63] target/cris: Use tcg_gen_lookup_and_goto_ptr Date: Tue, 29 Jun 2021 11:54:17 -0700 Message-Id: <20210629185455.3131172-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We can use this in gen_goto_tb and for DISAS_JUMP to indirectly chain to the next TB. Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/cris/translate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/target/cris/translate.c b/target/cris/translate.c index 7035426a9c..8b379522c6 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -546,7 +546,7 @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest) tcg_gen_exit_tb(dc->base.tb, n); } else { tcg_gen_movi_tl(env_pc, dest); - tcg_gen_exit_tb(NULL, 0); + tcg_gen_lookup_and_goto_ptr(); } } @@ -3354,6 +3354,8 @@ static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) tcg_gen_movi_tl(env_pc, npc); /* fall through */ case DISAS_JUMP: + tcg_gen_lookup_and_goto_ptr(); + break; case DISAS_UPDATE: /* Indicate that interupts must be re-evaluated before the next TB. */ tcg_gen_exit_tb(NULL, 0); From patchwork Tue Jun 29 18:54:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468346 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5258134jao; Tue, 29 Jun 2021 12:37:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlrG2qbeamJSJxxZZa8WfA1biqKD3Bri2aLUbNJCo3SRnFBkO4R3qWOGF+waYWk++ctf2i X-Received: by 2002:a25:888e:: with SMTP id d14mr39434069ybl.443.1624995463792; Tue, 29 Jun 2021 12:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995463; cv=none; d=google.com; s=arc-20160816; b=f88CeYe3JqhoC0CXD9QLySAx7qVE0ddw+eDH6iLTNmnszzEGEnxCDHng6nKKvdifyK h01X0gJXXhf4PaqbXPMDpbjljFfak8s35RFkRTPklMuryJpLyb03z1xBvfUI8LkaGxxk /inve+afEIrw3ebrmqpUtORZmm0vOJ2bcdr1QdqQLJ9AO1Grf8X/f38GeX33zKC+Oupe 0mcjig/Fzy6lLm7NBr65Y3+t80KQ/E/dMI1P9iHJs4iYqR5zxFK23e3dav/dJ1RMOJu8 6ZYHm558EX9msGG5zSW1bgAEOldvdsH/trmfJ6j1w9/t2qpLE3p+/KCm4dBIkq7SBJew htnQ== 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=TmE3ty8MFHw5l53WoOarVMR7r8mrPkuN/VqQisWZNow=; b=qhMXKI+/1OaQGGg1UISWM59Gf7dPzRUkHwobjTrP1QpaccMjltgPOlWo9gVsaCVHRD ATc82TVoGsySgUABo+Wj6S1YopdkPE59SkZ09GbSST3k+OBvxCTTuWd+qVoAN+gnoNvQ tLWRE1DK7qvTQJoJufF8Gii8stTDDWV4u6PiuXVzDb56hAOv2GHf10Bn6knOmI3MVt7s To/2Alacx3T8hPBCnMsauiFh0iQyLKdUnXBhfotb2NMm/wKDYbTRPXBR45NYI9LAe9jg AwIZ/hL180sLwOt1vTJ+GzaItnm6qa1DRtUF7I1ruXpBSD0tyh/hwXxCMi7auyVwxlTa cAmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VagcJCg+; 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 z1si17274625ybj.455.2021.06.29.12.37.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:37:43 -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=VagcJCg+; 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]:46294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJYF-0000vU-6L for patch@linaro.org; Tue, 29 Jun 2021 15:37:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItQ-0008U5-1o for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:32 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:39529) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000u0-6m for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:31 -0400 Received: by mail-pg1-x52b.google.com with SMTP id a2so19348443pgi.6 for ; Tue, 29 Jun 2021 11:55:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TmE3ty8MFHw5l53WoOarVMR7r8mrPkuN/VqQisWZNow=; b=VagcJCg+8PKv7Un9QpSXaMhROyqusSVdbeZJ8cNbFyOe1zJuOl26fxBdCUeRWsCYhJ jINVtJi30w1x9f2JLcYK7LroXYYo/eNa3cETC8MZDpfIN7YvJDstWEDlh69/ueqxxRhs A1fV8DBQ6rwAzJhNxqz0L1DnuWLZk8H7E4fuu/mnQz4I8yXfp9e/VeIqRaXjH3luKc8j ZhlCR+TyAbEPsTayQrFtbIer1511kbchtd6pSK5QukEYU8dI8T+E+mIiBuayUabRzYKA /58mWoK5KAAz8D5lqaaFjnhYYi36dOQVK7yR5JmA+KvfKOBzMNxh2AAqfCbJU22MJMnY 7N9g== 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=TmE3ty8MFHw5l53WoOarVMR7r8mrPkuN/VqQisWZNow=; b=sudcwY5wbv2d5uf7/RgJKT73SJT5WqeV1E81yD2T1zYSrTp0t5/HdUB2FHqnqaV+c1 uZkQCZy9vqtWNYEkY3i1JnfOB+7A1h/gc/nxHgTNC8TvaYvG28Pph2/dbF4cww/nkL7E xGIXQMjA8lcczDeTDE4VhxkfwNXezo7QEzYL0RUzn09dctfglIYvfDXyVf6W7DY7K1uu I8gw0a5fYJnxDKsNK5bDRL5ehylOedKWhsjnNK31fctOZjx1EcZ7Rps2lEx1t2aj94Kl M6A5v6UAZErpbqzt8eYl+Qzcd7SueTWno3U0A3yo2nO40nX8P1JmqaSOYkpG0qZ2sy5o hMfw== X-Gm-Message-State: AOAM5336wjIgglC7o/ENwPNKBFNA0z3Qvh4k98sfeYg9PNk5f4oykYIv 03Wr17Ji6Xr8WdfvMrfMInf7F28PvE3CuA== X-Received: by 2002:a63:f557:: with SMTP id e23mr29717312pgk.55.1624992911053; Tue, 29 Jun 2021 11:55:11 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 26/63] target/cris: Improve JMP_INDIRECT Date: Tue, 29 Jun 2021 11:54:18 -0700 Message-Id: <20210629185455.3131172-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use movcond instead of brcond to set env_pc. Discard the btarget and btaken variables to improve register allocation and avoid unnecessary writeback. Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/cris/translate.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) -- 2.25.1 diff --git a/target/cris/translate.c b/target/cris/translate.c index 8b379522c6..1d4c78eab2 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -522,17 +522,6 @@ static void t_gen_swapr(TCGv d, TCGv s) tcg_temp_free(org_s); } -static void t_gen_cc_jmp(TCGv pc_true, TCGv pc_false) -{ - TCGLabel *l1 = gen_new_label(); - - /* Conditional jmp. */ - tcg_gen_mov_tl(env_pc, pc_false); - tcg_gen_brcondi_tl(TCG_COND_EQ, env_btaken, 0, l1); - tcg_gen_mov_tl(env_pc, pc_true); - gen_set_label(l1); -} - static bool use_goto_tb(DisasContext *dc, target_ulong dest) { return ((dest ^ dc->base.pc_first) & TARGET_PAGE_MASK) == 0; @@ -3321,8 +3310,17 @@ static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) /* fall through */ case JMP_INDIRECT: - t_gen_cc_jmp(env_btarget, tcg_constant_tl(npc)); + tcg_gen_movcond_tl(TCG_COND_NE, env_pc, + env_btaken, tcg_constant_tl(0), + env_btarget, tcg_constant_tl(npc)); is_jmp = dc->cpustate_changed ? DISAS_UPDATE : DISAS_JUMP; + + /* + * We have now consumed btaken and btarget. Hint to the + * tcg compiler that the writeback to env may be dropped. + */ + tcg_gen_discard_tl(env_btaken); + tcg_gen_discard_tl(env_btarget); break; default: From patchwork Tue Jun 29 18:54:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468322 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5247383jao; Tue, 29 Jun 2021 12:20:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0l97kF+Mw8YTEqU0WeFOVUE4CAEHQunpcSqio8wrR5X4E+LqFG1UQtkGrcF+tZ4C+NC/Q X-Received: by 2002:a25:1c1:: with SMTP id 184mr20791770ybb.175.1624994420344; Tue, 29 Jun 2021 12:20:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994420; cv=none; d=google.com; s=arc-20160816; b=oypv463ulFYWOlRYRjZK4lmLtqVW5vZzpRCtA5DOZN+iOIBBGzZRHdfKYuMkoGvefa mfD3y1XxxdPShNgC752rdKnMAsdVVd3FBTK/P44Kp1yHahKSKenZ8AkmcJNI5knSflRB 5jP9bydSuefcgP5EzvRxQpRFNmEXYAGJaSALAvzitQQ8FjkJl55SgaHv0UTTZlP0W0qs Uw/W9v9r9nNu2hAoLS+fmA1Armzn0Duy1og34d+3zFBRJ88MSdSM7Y7JRCNPbKu9xPJa HAbTgKm/LOPDxtdfPD0Pg3N5ru8naJ74Z6uZHgkMUuue/fu13tGk7LXLIFd3EX88mbRy vUhg== 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=XkD3zAg3BgpWG1/1/ejQcAjqq103aTDKBL3ooamcmZ0=; b=pUJn/U4Hg+vkTYVCxmdqkCEu7xYdjftdCfKLN5ZDY1BL29c6N1PSONkFQjQKy2L5G6 5iKOhBM1P80WzX9gVEdN5D2NVFw+dUTTIe2n9NO8LmKKUsj7lQX5FWZA2b77o412kRsE tpGA4XQWv8nECbo4X+AUfqPLJZYVNNcx7umBizM5PjAgGDF8JXk0e1wiC2ACQsgcrpqg /CNIuTdlWA8hgvdFw5TBdKRZuajH8qNw6U1lUPJzHE2RK0lW1oDjk6vpngenzjDjzoJw Goo5Ebd8Xjpr98vBoh+WW4pWN4k3xFF57f5pncF72jgB4gMAmz0juYqA0vEyoSlbk0Qz JHzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SstRJdem; 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 s4si20079488ybu.194.2021.06.29.12.20.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:20:20 -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=SstRJdem; 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]:43550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJHP-0002WP-RY for patch@linaro.org; Tue, 29 Jun 2021 15:20:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItN-0008PP-VU for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:30 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:37693) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000u8-58 for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:29 -0400 Received: by mail-pj1-x102b.google.com with SMTP id 22-20020a17090a0c16b0290164a5354ad0so2580586pjs.2 for ; Tue, 29 Jun 2021 11:55:12 -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=XkD3zAg3BgpWG1/1/ejQcAjqq103aTDKBL3ooamcmZ0=; b=SstRJdemeQoBQn3790dxEz8N3mcPA2gAnVzv+nwMfNU3cul3ne3TWQdiXgvkcVuRzP mcXQ79ni7VbNRSS7odVnEN+Evi/nF7XkDd0hMUI5+uUDwQBGOYZgXQQdcpnenW2hCCQy +xfNVpqTMB3bmk+DUlDrH+yHzb+Ag8iQTqnPszgc0DD+JSTyUei0qBZguTblUI1uPMMF FAuF6CJFIQ9XsyQN1FhaK9FNqG22SiWqynWB8jgub3KHpLImQZYJJ/BXKNTy+ixmPnRL WLuxCnf6OaChcbinkhDlb2cgeIjCnrr0O/rFHHp6CM5xPIfhMUms3l4MBokCQF7+/Sc0 SrCQ== 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=XkD3zAg3BgpWG1/1/ejQcAjqq103aTDKBL3ooamcmZ0=; b=Xxp3iPP+YnXsvNQ2Ay19QlLB/PbQ5BjsxUSuxCenKUNnZj7yeHWYeP2PlcEJk2MFf+ pHCZh+eLxYn+iANKovs37LU8DF0ERH1I7rVLR9xW0qGluNI4khUI5OTzy3RPxTb8B7vN aNNXHupowuc4peAiiTeG50ObjxSjKf5sAapt3DlFSCdkA/THQ4T2k0Ff7+4KnFXhsqzG JMV0wLxAdolWPS1gd1V9FdkYGvmELinW/DC6cA9Puhxqz6hNJ2Xy0kCmJcLXzTkbo6R0 cll6bBBOvk4eSS9Bd/IXmHtWRupbGjCwgYMgECqYAQy7iu01/ARCvPOo9kATnqTu4ob7 BDpg== X-Gm-Message-State: AOAM530tMHAPYpAGF8Y6cqrd3T5gG3AzxnG07d8YMTP4scu3phFEBsZL vjkXZOE97XeFFhDwfS1zBM7qCCQoNiZt5g== X-Received: by 2002:a17:902:8305:b029:120:1d69:6bd8 with SMTP id bd5-20020a1709028305b02901201d696bd8mr29333514plb.2.1624992911690; Tue, 29 Jun 2021 11:55:11 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 27/63] target/cris: Remove dc->flagx_known Date: Tue, 29 Jun 2021 11:54:19 -0700 Message-Id: <20210629185455.3131172-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Ever since 2a44f7f17364, flagx_known is always true. Fold away all of the tests against the flag. Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/cris/translate.c | 99 ++++++++------------------------- target/cris/translate_v10.c.inc | 6 +- 2 files changed, 24 insertions(+), 81 deletions(-) -- 2.25.1 diff --git a/target/cris/translate.c b/target/cris/translate.c index 1d4c78eab2..0be10390e9 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -120,8 +120,6 @@ typedef struct DisasContext { int cc_x_uptodate; /* 1 - ccs, 2 - known | X_FLAG. 0 not up-to-date. */ int flags_uptodate; /* Whether or not $ccs is up-to-date. */ - int flagx_known; /* Whether or not flags_x has the x flag known at - translation time. */ int flags_x; int clear_x; /* Clear x after this insn? */ @@ -377,66 +375,26 @@ static inline void t_gen_add_flag(TCGv d, int flag) static inline void t_gen_addx_carry(DisasContext *dc, TCGv d) { - if (dc->flagx_known) { - if (dc->flags_x) { - TCGv c; - - c = tcg_temp_new(); - t_gen_mov_TN_preg(c, PR_CCS); - /* C flag is already at bit 0. */ - tcg_gen_andi_tl(c, c, C_FLAG); - tcg_gen_add_tl(d, d, c); - tcg_temp_free(c); - } - } else { - TCGv x, c; + if (dc->flags_x) { + TCGv c = tcg_temp_new(); - x = tcg_temp_new(); - c = tcg_temp_new(); - t_gen_mov_TN_preg(x, PR_CCS); - tcg_gen_mov_tl(c, x); - - /* Propagate carry into d if X is set. Branch free. */ + t_gen_mov_TN_preg(c, PR_CCS); + /* C flag is already at bit 0. */ tcg_gen_andi_tl(c, c, C_FLAG); - tcg_gen_andi_tl(x, x, X_FLAG); - tcg_gen_shri_tl(x, x, 4); - - tcg_gen_and_tl(x, x, c); - tcg_gen_add_tl(d, d, x); - tcg_temp_free(x); + tcg_gen_add_tl(d, d, c); tcg_temp_free(c); } } static inline void t_gen_subx_carry(DisasContext *dc, TCGv d) { - if (dc->flagx_known) { - if (dc->flags_x) { - TCGv c; - - c = tcg_temp_new(); - t_gen_mov_TN_preg(c, PR_CCS); - /* C flag is already at bit 0. */ - tcg_gen_andi_tl(c, c, C_FLAG); - tcg_gen_sub_tl(d, d, c); - tcg_temp_free(c); - } - } else { - TCGv x, c; + if (dc->flags_x) { + TCGv c = tcg_temp_new(); - x = tcg_temp_new(); - c = tcg_temp_new(); - t_gen_mov_TN_preg(x, PR_CCS); - tcg_gen_mov_tl(c, x); - - /* Propagate carry into d if X is set. Branch free. */ + t_gen_mov_TN_preg(c, PR_CCS); + /* C flag is already at bit 0. */ tcg_gen_andi_tl(c, c, C_FLAG); - tcg_gen_andi_tl(x, x, X_FLAG); - tcg_gen_shri_tl(x, x, 4); - - tcg_gen_and_tl(x, x, c); - tcg_gen_sub_tl(d, d, x); - tcg_temp_free(x); + tcg_gen_sub_tl(d, d, c); tcg_temp_free(c); } } @@ -541,11 +499,9 @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest) static inline void cris_clear_x_flag(DisasContext *dc) { - if (dc->flagx_known && dc->flags_x) { + if (dc->flags_x) { dc->flags_uptodate = 0; } - - dc->flagx_known = 1; dc->flags_x = 0; } @@ -630,12 +586,10 @@ static void cris_evaluate_flags(DisasContext *dc) break; } - if (dc->flagx_known) { - if (dc->flags_x) { - tcg_gen_ori_tl(cpu_PR[PR_CCS], cpu_PR[PR_CCS], X_FLAG); - } else if (dc->cc_op == CC_OP_FLAGS) { - tcg_gen_andi_tl(cpu_PR[PR_CCS], cpu_PR[PR_CCS], ~X_FLAG); - } + if (dc->flags_x) { + tcg_gen_ori_tl(cpu_PR[PR_CCS], cpu_PR[PR_CCS], X_FLAG); + } else if (dc->cc_op == CC_OP_FLAGS) { + tcg_gen_andi_tl(cpu_PR[PR_CCS], cpu_PR[PR_CCS], ~X_FLAG); } dc->flags_uptodate = 1; } @@ -670,16 +624,11 @@ static void cris_update_cc_op(DisasContext *dc, int op, int size) static inline void cris_update_cc_x(DisasContext *dc) { /* Save the x flag state at the time of the cc snapshot. */ - if (dc->flagx_known) { - if (dc->cc_x_uptodate == (2 | dc->flags_x)) { - return; - } - tcg_gen_movi_tl(cc_x, dc->flags_x); - dc->cc_x_uptodate = 2 | dc->flags_x; - } else { - tcg_gen_andi_tl(cc_x, cpu_PR[PR_CCS], X_FLAG); - dc->cc_x_uptodate = 1; + if (dc->cc_x_uptodate == (2 | dc->flags_x)) { + return; } + tcg_gen_movi_tl(cc_x, dc->flags_x); + dc->cc_x_uptodate = 2 | dc->flags_x; } /* Update cc prior to executing ALU op. Needs source operands untouched. */ @@ -1131,7 +1080,7 @@ static void gen_store (DisasContext *dc, TCGv addr, TCGv val, /* Conditional writes. We only support the kind were X and P are known at translation time. */ - if (dc->flagx_known && dc->flags_x && (dc->tb_flags & P_FLAG)) { + if (dc->flags_x && (dc->tb_flags & P_FLAG)) { dc->postinc = 0; cris_evaluate_flags(dc); tcg_gen_ori_tl(cpu_PR[PR_CCS], cpu_PR[PR_CCS], C_FLAG); @@ -1140,7 +1089,7 @@ static void gen_store (DisasContext *dc, TCGv addr, TCGv val, tcg_gen_qemu_st_tl(val, addr, mem_index, MO_TE + ctz32(size)); - if (dc->flagx_known && dc->flags_x) { + if (dc->flags_x) { cris_evaluate_flags(dc); tcg_gen_andi_tl(cpu_PR[PR_CCS], cpu_PR[PR_CCS], ~C_FLAG); } @@ -1727,8 +1676,8 @@ static int dec_addc_r(CPUCRISState *env, DisasContext *dc) LOG_DIS("addc $r%u, $r%u\n", dc->op1, dc->op2); cris_evaluate_flags(dc); + /* Set for this insn. */ - dc->flagx_known = 1; dc->flags_x = X_FLAG; cris_cc_mask(dc, CC_MASK_NZVC); @@ -2015,7 +1964,6 @@ static int dec_setclrf(CPUCRISState *env, DisasContext *dc) } if (flags & X_FLAG) { - dc->flagx_known = 1; if (set) { dc->flags_x = X_FLAG; } else { @@ -2479,7 +2427,6 @@ static int dec_addc_mr(CPUCRISState *env, DisasContext *dc) cris_evaluate_flags(dc); /* Set for this insn. */ - dc->flagx_known = 1; dc->flags_x = X_FLAG; cris_alu_m_alloc_temps(t); @@ -3141,7 +3088,6 @@ static void cris_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) dc->ppc = pc_start; dc->pc = pc_start; dc->flags_uptodate = 1; - dc->flagx_known = 1; dc->flags_x = tb_flags & X_FLAG; dc->cc_x_uptodate = 0; dc->cc_mask = 0; @@ -3217,7 +3163,6 @@ static void cris_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) } /* Fold unhandled changes to X_FLAG into cpustate_changed. */ - dc->cpustate_changed |= !dc->flagx_known; dc->cpustate_changed |= dc->flags_x != (dc->base.tb->flags & X_FLAG); /* diff --git a/target/cris/translate_v10.c.inc b/target/cris/translate_v10.c.inc index 4ab43dc404..f500e93447 100644 --- a/target/cris/translate_v10.c.inc +++ b/target/cris/translate_v10.c.inc @@ -106,9 +106,8 @@ static void gen_store_v10(DisasContext *dc, TCGv addr, TCGv val, cris_store_direct_jmp(dc); } - /* Conditional writes. We only support the kind were X is known - at translation time. */ - if (dc->flagx_known && dc->flags_x) { + /* Conditional writes. */ + if (dc->flags_x) { gen_store_v10_conditional(dc, addr, val, size, mem_index); return; } @@ -376,7 +375,6 @@ static unsigned int dec10_setclrf(DisasContext *dc) if (flags & X_FLAG) { - dc->flagx_known = 1; if (set) dc->flags_x = X_FLAG; else From patchwork Tue Jun 29 18:54:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468360 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5265502jao; Tue, 29 Jun 2021 12:50:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBbAH30aNzb2seJU0dbDJu97M5aK0Q7EHdF6m7avelNMxgLpGLZMnpLrMP+C9gZMlR3Jl1 X-Received: by 2002:ae9:e712:: with SMTP id m18mr1873635qka.78.1624996218289; Tue, 29 Jun 2021 12:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996218; cv=none; d=google.com; s=arc-20160816; b=uxB8nGejudf1fd3wI/y6gRGW9F4SwcGHmPSUJLfNLaQWRy67XcFk+tcm3Ul6c3rs4J ZMjaBVvj/XR7rQ1WwF6qHavupJA2JgRnbM4DyWOMVRWXh1iwRb50D+/OZ/DNe9Etl5pE NasVKduNQa57tt683NLV1XSjQq7Y6c1BpFnrLpN8kJSLU90DnfZeq/nazagdCGSQJeW/ xC/p/NLkFNiA7Ch/ydcgPBeUWvpjo9wcHhbR2Fdk7ikWue702BTzhXIkrrjb0KO96+6o bASz6el2JGvAcvgXO8y20Cq9+8LrCBvDIgZK42xul9lG/mhvaAo2H0DRGtHpk9NHoT/h mZdw== 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=6mHNvh8GQr8Ns4Dt4cntg6+kxVIm+bnqy/XzRJW5X88=; b=jozyeIP6GuO8AMK8qnRgFXOl6JytCVnEHEIkDX20/qd6putqIQyxXjVE1lDxYItsnQ /9HxmluRc/gERdwU3jMQpWjOJhBzhbLPmz7Uyny4avJBaH6T3ml9UAUx6OFNCSewRj3x OuydTvHqxcQ7dmJLFVa9wqof/ps9Jr+cV8Dd4VBrSHzdQKrqKDK2A6QR1KiWxz7FRz1l RoZDhVW1EwDODsh2MemBYeM7de3Ww+dw6I0LM7/JKJYd1g/rTKKJH1NdTX4dSltZKJ/R Mkul5gxvbytkyQmoMqP2sTGpf1dpGgHTF7CmwNWqhPoqVqNTy8fK252x9tRjvGqp+eJ1 TQ3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W3NRwJo7; 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 m14si7389555qtk.217.2021.06.29.12.50.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:50: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=W3NRwJo7; 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]:57212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJkP-0002q9-LN for patch@linaro.org; Tue, 29 Jun 2021 15:50:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38664) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItN-0008P3-N1 for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:29 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:34340) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000uB-4V for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:29 -0400 Received: by mail-pf1-x42f.google.com with SMTP id i6so124574pfq.1 for ; Tue, 29 Jun 2021 11:55:13 -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=6mHNvh8GQr8Ns4Dt4cntg6+kxVIm+bnqy/XzRJW5X88=; b=W3NRwJo7Q5v1/ls0JwKb7vZF6M+WMEfpGDEmNiLuUNO8h4c5jTumkwnc9OZ3OQ5Pvs z9OcVP/AvndfPZ/UmQDWKlVU3FGHii60ykdfvs4C7Ti2zd9Ymf6gOQ0J1AMFQGYyyS6l u0PXpiS6xC9g14B7j3afceM+I69r5lf2Ck16fgJAJziO1bpV0inrO3e1PjxB4FLIbrCa LnR1xGrMpT8mye/1li1RTHAjQHzARPgrExxQOjHoNp5q5itFEH71Ynu2TSbnGstcK4OD SV3OKPiN+rHCtU9+Tmb67bugIw969/lZsKOQ07zkSf2cKUfuZhkV0DIgJopP+jRhxdfc bskg== 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=6mHNvh8GQr8Ns4Dt4cntg6+kxVIm+bnqy/XzRJW5X88=; b=nWYN3TZsmNbsKJE+4jMlOr72jmCEQ46s8hVsn8CMiW2Mc/lyY5a7F2daJFEOwltaQS S/BHyhpnAPem54SmlhKNea1UpX013DnGj82EO+FrXyC/mWj2C7eFakbL4JRFj6rqg9BH dLxUjxBP+fwdcAFtcHEmFl0cgEVP2eNLz/sVhi6yufZn91XD8+8jeZXlX8fQp97HcQRa NYVjBMQVdaoVI+8AXlew2tkgowk/ddFE1iiZhlEW47CJFgw8I6kK5F6+TszbvKAQ3zVT nnD1IPnR3GDRd8xCR2k/0nF5FD//wPld/msMX2WFtw5hT8q2vwXZ/9Gj9rFcFm3H6IWk xPtQ== X-Gm-Message-State: AOAM532FMUYfiTxzQ9GWwdJG3v8YS9/lKTvcxsdccc7Is3LmH4v091Xu 1N73SsTY8SrWqX/fDw3z5ugJfd7xl5rStA== X-Received: by 2002:a62:77ca:0:b029:30f:7c5f:8a4 with SMTP id s193-20020a6277ca0000b029030f7c5f08a4mr446511pfc.59.1624992912205; Tue, 29 Jun 2021 11:55:12 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 28/63] target/cris: Do not exit tb for X_FLAG changes Date: Tue, 29 Jun 2021 11:54:20 -0700 Message-Id: <20210629185455.3131172-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We always know the exact value of X, that's all that matters. This avoids splitting the TB e.g. between "ax" and "addq". Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/cris/translate.c | 3 --- 1 file changed, 3 deletions(-) -- 2.25.1 diff --git a/target/cris/translate.c b/target/cris/translate.c index 0be10390e9..4cfe5c86d9 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -3162,9 +3162,6 @@ static void cris_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) cris_clear_x_flag(dc); } - /* Fold unhandled changes to X_FLAG into cpustate_changed. */ - dc->cpustate_changed |= dc->flags_x != (dc->base.tb->flags & X_FLAG); - /* * All branches are delayed branches, handled immediately below. * We don't expect to see odd combinations of exit conditions. From patchwork Tue Jun 29 18:54:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468339 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5255291jao; Tue, 29 Jun 2021 12:33:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzF8t7bRlUQjOuHshWWcIhFlOINAVnqhSc/E00Ufccqz33ktXzGT41EZA6dsdEfp9myPag2 X-Received: by 2002:a05:6122:6aa:: with SMTP id r10mr12903626vkq.24.1624995194251; Tue, 29 Jun 2021 12:33:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995194; cv=none; d=google.com; s=arc-20160816; b=K6goVv9mBE02ARoVjSbKpZt7DDktUdOh0hZle+aHh+ju/ApKvVqtJKaRaYypHzkvXh 1iLGJnJ0XjABvqMT0U6Wa3ERn3JXPmVzzk+ISzrCiAOQ8cFkWUNGr3HtPB0Tjm84YEgD QYEkZCYo18wkl5nXcXl2tgZwbKakJzl3oyqR6thfZxq0XeMmp8x8Eq66nQRRbNvHA378 0GimIB2wuHLbBdsXP5TGUNsFaLiavHtNc9kZMJdSaCe6jh2SR6PhdJw2md2TXplxLyFw UPc8PxsuemcFJHrRRAY6ke7uwlTG3v8KAXx4Ye7hW3DVp5XjcXyeYah6iqgGFUnp2iyX KoSw== 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=z6UwI1RxNTo4T8wHnycHVVtlEB9fHtDjgwur3ezSLaU=; b=xWGOUjJKqUS+FXAsZPz/ySZ3wgLB+SfK70snx4MUL0HdLL/MX9njmrgjnJhTNgsyGk 0Ghz+EfA8dRNETjX1P7NlogLXsPQ0NDfpHEglSl2ownb8zxFS4ZJQA7e5W6M2s5mxwY0 0Sj1ZHS+G6vg9/aFT1dkvQuOfop8783YdrH+RfCIIvAuYIak9YkuVeczYSM0iXzIZQxV J044nKfuz/DeIWy/U7lZIxyIyzFal+F8ZXHI1EGPfA4A382cNr0x9gIfbsKsyd7eRSyL UakgCfwVZE87HJh4c1SqHfF5+zB6LlxwMjRkJYVwVx1qb3KTGJgkaZCiUVLbZOMaesWP 2YBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y7k6+5WA; 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 q2si6862396vkg.62.2021.06.29.12.33.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:33:14 -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=y7k6+5WA; 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]:59274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJTt-0007E9-KX for patch@linaro.org; Tue, 29 Jun 2021 15:33:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItE-00089f-Li for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:20 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:38611) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000uL-2A for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:20 -0400 Received: by mail-pg1-x531.google.com with SMTP id h4so19372828pgp.5 for ; Tue, 29 Jun 2021 11:55:13 -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=z6UwI1RxNTo4T8wHnycHVVtlEB9fHtDjgwur3ezSLaU=; b=y7k6+5WABYdLN4xRMZtCkO2/rWJsLPwGTf4liJL3rslzUVMJNzqbxRNEvStgim+TaJ ieuWlx3rdfRpOFoVeAMCJ+DuGrNBT/TfJAMj4fAOLH5preEK7pC3jNqyn/iCbQfjy/bx w8B5fiWJKnMBIDW5b8qkNMtUHw5dz5WR/Hhit8BJWaq+Jq2v9itMYCrNTboSWj+7TpaX GKGFsgIqi6Sd/3yX0bBSOZoCzm3XR3ADDWXJ4ZwT7L9Iz7YaxUmb6lYZvK1fNKYv9Qe0 QCf4Nv/L+mQ60TsMH6muyp4Zsapd2f7CUG7XLSCGVxbb+chqt3/Ixjt6QSnHeR8e88Hm Oz2g== 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=z6UwI1RxNTo4T8wHnycHVVtlEB9fHtDjgwur3ezSLaU=; b=PqWngVKcrKFA0VPXFJB9Tx5SNZTgfNdcUoAop+apmrR+viV01kMvqhtFiyTZuhMrbV rzZ1qedSTyyoFPydv9tIMkTTY0IFBPFkORUT5Agst6+BVOyQzXQqGBeXKs+ZeB8WIXU+ AeSw859W7K8pfLyL0kL02x62yaL+vy0CfSpFe6+LvFclKryI8WPVqQGY0qAo/u3Zs2Pl /e8jVywJdYkSUz3xkc8X+mMkGmramKvxrGqppi/wBtEozTeQtmEQvAUFldz9hZjihWvF Tzg3g2vZCFHhW1PLHLWS9MV4qo2AG/LPJNV/lt+hr9ptwg7hws7GW/xh/0uKEddBZ/4b FyHQ== X-Gm-Message-State: AOAM533RIU1av8QgfPiLL8sLK3qz/M3pQsJ/i5K41ZoiJ8EeB5oyHZfa JFrnJMIntUejgMcbf1Jl5j9vX+dAJE9n+w== X-Received: by 2002:a65:5c4a:: with SMTP id v10mr29482050pgr.142.1624992912902; Tue, 29 Jun 2021 11:55:12 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 29/63] tcg: Add tcg_gen_vec_add{sub}16_i32 Date: Tue, 29 Jun 2021 11:54:21 -0700 Message-Id: <20210629185455.3131172-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: LIU Zhiwei Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: LIU Zhiwei Implement tcg_gen_vec_add{sub}16_tl by adding corresponding i32 OP. Signed-off-by: LIU Zhiwei Message-Id: <20210624105023.3852-2-zhiwei_liu@c-sky.com> Signed-off-by: Richard Henderson --- include/tcg/tcg-op-gvec.h | 13 +++++++++++++ tcg/tcg-op-gvec.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) -- 2.25.1 diff --git a/include/tcg/tcg-op-gvec.h b/include/tcg/tcg-op-gvec.h index c69a7de984..9b67822f54 100644 --- a/include/tcg/tcg-op-gvec.h +++ b/include/tcg/tcg-op-gvec.h @@ -401,4 +401,17 @@ 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); +/* 32-bit vector operations. */ +void tcg_gen_vec_add16_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b); + +void tcg_gen_vec_sub16_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b); + +#if TARGET_LONG_BITS == 64 +#define tcg_gen_vec_add16_tl tcg_gen_vec_add16_i64 +#define tcg_gen_vec_sub16_tl tcg_gen_vec_sub16_i64 +#else +#define tcg_gen_vec_add16_tl tcg_gen_vec_add16_i32 +#define tcg_gen_vec_sub16_tl tcg_gen_vec_sub16_i32 +#endif + #endif diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 515db120cc..7ddd56c0e6 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -1742,6 +1742,20 @@ void tcg_gen_vec_add16_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) gen_addv_mask(d, a, b, m); } +void tcg_gen_vec_add16_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) +{ + TCGv_i32 t1 = tcg_temp_new_i32(); + TCGv_i32 t2 = tcg_temp_new_i32(); + + tcg_gen_andi_i32(t1, a, ~0xffff); + tcg_gen_add_i32(t2, a, b); + tcg_gen_add_i32(t1, t1, b); + tcg_gen_deposit_i32(d, t1, t2, 0, 16); + + tcg_temp_free_i32(t1); + tcg_temp_free_i32(t2); +} + void tcg_gen_vec_add32_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { TCGv_i64 t1 = tcg_temp_new_i64(); @@ -1892,6 +1906,20 @@ void tcg_gen_vec_sub16_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) gen_subv_mask(d, a, b, m); } +void tcg_gen_vec_sub16_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) +{ + TCGv_i32 t1 = tcg_temp_new_i32(); + TCGv_i32 t2 = tcg_temp_new_i32(); + + tcg_gen_andi_i32(t1, b, ~0xffff); + tcg_gen_sub_i32(t2, a, b); + tcg_gen_sub_i32(t1, a, t1); + tcg_gen_deposit_i32(d, t1, t2, 0, 16); + + tcg_temp_free_i32(t1); + tcg_temp_free_i32(t2); +} + void tcg_gen_vec_sub32_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { TCGv_i64 t1 = tcg_temp_new_i64(); From patchwork Tue Jun 29 18:54:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468349 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5259111jao; Tue, 29 Jun 2021 12:39:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrVmXujqQG+2fRvm5UXPzHwttoKB4rEa9Fzm29qmMDECB5uWG9xkNXl8BfwghehT02mtZ0 X-Received: by 2002:a25:98c3:: with SMTP id m3mr41296620ybo.116.1624995568230; Tue, 29 Jun 2021 12:39:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995568; cv=none; d=google.com; s=arc-20160816; b=jIjTm5pNUXSQpFIKO6RixsOeo0LOWwYAxNR8gjI/vQEfkcFNiX7cnkmRaZGPGqNgee wFTzT/tiJeYCCywIBShq8CSR6n8Q3Qz93SBSo2gn925OThaqPAHEOkGbI82mQ1QGbOk+ Hz9PMr5DaYVFLwwd9V5boL143QLDOkqw/D18d1cpQKwN32OfZslP3fr1c8bIBVUlIINn zUmBAPjtqkWunJL9fk125iHwtjbIEAqZ4bLQc81uI08gRkm1I1EQwjiGmd2M3iTaWM5d TbVH1Ziq/AsgpJk1ZHcCaTRjh0m8WkLs0w5ffAk0aTdEwzArW8uqR0CUf2hnI5uqGbQQ jp5g== 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=AkdZtWwj/8ggy1eq6EhClTwBg3K4IFRXh2vcItTXzCk=; b=NGTdghu6I60hjRautMR+d8I4Si7kL9AtCJ/t+1M2pOViV3142hXczSUW9j3iN4/YYJ OupIVlahdPyt8ihTHRVOkTSicv8fowlyTeeXc+KpH5AX6Cc+GVYmzU/J6KcZOaYWOjrR 6rM4R98R0mWfw0aDOPxGqUv44x00r8hhdFSB5IauWm4lhbOHdV7C6sQK/kQiEyVlSoYY IHbxFVdorkehz6uUwj3uhS3Q6o4jrXhFUiUy9g/+cY46ArtBvupDFTa3/rXYaVnJXIoF yFf5tdqs/oDDOdTJAqsUcxDXyEwUdbVhmquoa0geo5zoyImkeKlbYN1XMunUuj6pC8Ad vzOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wxqldrgu; 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 t2si16454018ybo.375.2021.06.29.12.39.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:39:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wxqldrgu; 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]:52294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJZv-0004yh-JP for patch@linaro.org; Tue, 29 Jun 2021 15:39:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItO-0008Qt-KV for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:30 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:39477) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000uO-4L for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:30 -0400 Received: by mail-pf1-x42a.google.com with SMTP id g192so99734pfb.6 for ; Tue, 29 Jun 2021 11:55:14 -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=AkdZtWwj/8ggy1eq6EhClTwBg3K4IFRXh2vcItTXzCk=; b=Wxqldrguoqye5KOvfRW41fpSOsAovJ01QJAqjLSQ5W0o1NuHSVGGl2gMOoqvaXfmbE euQlIXEnJe5zvpewgWDA+gXI8SPVAdSeOaQY+5EQ9vETrmaazH8AXrDjMc52cwNdmkCN vlW/AbHrE2pqR6YSrpgd/FaNY90HQQ1jk15d4hiRuYR5giuVnDt8T+dMlPYsEcwgcweI j3q4IW4fTN14eL5mza7STLTlzw62TC1For/M75QFjLx4+EtzFZz1EUpscR6oA5s0Fj7G jXogDk8O1KUWzUVItZwBtVNw5XjsTmEc5zuGl9CcYjg9k9FGSQ3oX4urKh0RyIs+BN8A TXXw== 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=AkdZtWwj/8ggy1eq6EhClTwBg3K4IFRXh2vcItTXzCk=; b=a7jfmcPT2Zlia4UdzZNeihAGSsijqT97peSngneqjr9nJLEWQyo386NjUCJBYJRLLi Z5vQg0oYaj32uICNI255RVvn4czNpsKTcpLfp/tZujArD3kxqocov2LCcjOCmD5iD07N Cy6aUWZ4aHQNLUybBqgHIHqfzMeIjD6uCZA5RgcDGjzFIY6hp4YiKR3TTysBgWqb2y7l gMYhuwOsPXXHd8lBa/Mzy6mdN6aJ/imVfduv6L+PFp1TeB9iFeBbYoqYaaVtZqd5mOWY ZSudQVmD0oM5G2K4KAjtg3zX8DmRTIsqjk8N3/Hb+pXgNFyTzzSXJaIFKQPhq3YvRjoo z7pw== X-Gm-Message-State: AOAM532U4+yix6p8iMNRvm/YhzYCtnHi/teIzvjrx+LuUaCjFx0PkJHa cIhnzwnYOWHYPT0kmoxnsftPjz9XPqFrww== X-Received: by 2002:a63:fd0c:: with SMTP id d12mr22841592pgh.119.1624992913491; Tue, 29 Jun 2021 11:55:13 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 30/63] tcg: Add tcg_gen_vec_add{sub}8_i32 Date: Tue, 29 Jun 2021 11:54:22 -0700 Message-Id: <20210629185455.3131172-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: LIU Zhiwei Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: LIU Zhiwei Implement tcg_gen_vec_add{sub}8_tl by adding corresponging i32 OP. Signed-off-by: LIU Zhiwei Message-Id: <20210624105023.3852-3-zhiwei_liu@c-sky.com> Signed-off-by: Richard Henderson --- include/tcg/tcg-op-gvec.h | 6 ++++++ tcg/tcg-op-gvec.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) -- 2.25.1 diff --git a/include/tcg/tcg-op-gvec.h b/include/tcg/tcg-op-gvec.h index 9b67822f54..2d5ad6ce12 100644 --- a/include/tcg/tcg-op-gvec.h +++ b/include/tcg/tcg-op-gvec.h @@ -402,14 +402,20 @@ 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); /* 32-bit vector operations. */ +void tcg_gen_vec_add8_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b); void tcg_gen_vec_add16_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b); +void tcg_gen_vec_sub8_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b); void tcg_gen_vec_sub16_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b); #if TARGET_LONG_BITS == 64 +#define tcg_gen_vec_add8_tl tcg_gen_vec_add8_i64 +#define tcg_gen_vec_sub8_tl tcg_gen_vec_sub8_i64 #define tcg_gen_vec_add16_tl tcg_gen_vec_add16_i64 #define tcg_gen_vec_sub16_tl tcg_gen_vec_sub16_i64 #else +#define tcg_gen_vec_add8_tl tcg_gen_vec_add8_i32 +#define tcg_gen_vec_sub8_tl tcg_gen_vec_sub8_i32 #define tcg_gen_vec_add16_tl tcg_gen_vec_add16_i32 #define tcg_gen_vec_sub16_tl tcg_gen_vec_sub16_i32 #endif diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 7ddd56c0e6..6d9a0aed62 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -1736,6 +1736,25 @@ void tcg_gen_vec_add8_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) gen_addv_mask(d, a, b, m); } +void tcg_gen_vec_add8_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) +{ + TCGv_i32 m = tcg_constant_i32((int32_t)dup_const(MO_8, 0x80)); + TCGv_i32 t1 = tcg_temp_new_i32(); + TCGv_i32 t2 = tcg_temp_new_i32(); + TCGv_i32 t3 = tcg_temp_new_i32(); + + tcg_gen_andc_i32(t1, a, m); + tcg_gen_andc_i32(t2, b, m); + tcg_gen_xor_i32(t3, a, b); + tcg_gen_add_i32(d, t1, t2); + tcg_gen_and_i32(t3, t3, m); + tcg_gen_xor_i32(d, d, t3); + + tcg_temp_free_i32(t1); + tcg_temp_free_i32(t2); + tcg_temp_free_i32(t3); +} + void tcg_gen_vec_add16_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { TCGv_i64 m = tcg_constant_i64(dup_const(MO_16, 0x8000)); @@ -1900,6 +1919,25 @@ void tcg_gen_vec_sub8_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) gen_subv_mask(d, a, b, m); } +void tcg_gen_vec_sub8_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) +{ + TCGv_i32 m = tcg_constant_i32((int32_t)dup_const(MO_8, 0x80)); + TCGv_i32 t1 = tcg_temp_new_i32(); + TCGv_i32 t2 = tcg_temp_new_i32(); + TCGv_i32 t3 = tcg_temp_new_i32(); + + tcg_gen_or_i32(t1, a, m); + tcg_gen_andc_i32(t2, b, m); + tcg_gen_eqv_i32(t3, a, b); + tcg_gen_sub_i32(d, t1, t2); + tcg_gen_and_i32(t3, t3, m); + tcg_gen_xor_i32(d, d, t3); + + tcg_temp_free_i32(t1); + tcg_temp_free_i32(t2); + tcg_temp_free_i32(t3); +} + void tcg_gen_vec_sub16_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { TCGv_i64 m = tcg_constant_i64(dup_const(MO_16, 0x8000)); From patchwork Tue Jun 29 18:54:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468351 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5260436jao; Tue, 29 Jun 2021 12:41:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGMXyyu/IgbQDenD8WZbTFcPycltZYnCRRFS1ic5py7uQeZdv1jejJ+nvCaibMvorSdZzJ X-Received: by 2002:a37:a513:: with SMTP id o19mr32280599qke.347.1624995714626; Tue, 29 Jun 2021 12:41:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995714; cv=none; d=google.com; s=arc-20160816; b=w0Ds/PQ9dHmpjRe1COTqhZ2VN3N2t/ctWf2LTsj82G9qCWY1AjKGyxZG77C4CLP3mR ypTsOI5cSfTRyhrhGa/Ef9rav79ITx/2GD6l5S94X306dc4dXieTPaQe9Y+IcIEmH2ok idklepOiLmUwP11AB4cBGtiZI9AQSydLSnywcCbZRPTBQytDnYaWVeHYRvceqxziNt4X iSGdjp5kulMLozrqnWOM7Km6I8r9OEAeD8v3heS5WicDyvWdKC07BxP58JQSZ1pOjaXD qKCouJDlmjMJeOQtsN8I7R1U4AfxrIKEQPXg2nIHo1MnbF6Qh4DEqNxXgzYp3FIP1tGn 7ezA== 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=UCyT6Sp8EBenir7CdpDEblAqtnl7+66OyhKqBXjwbpE=; b=wl652NDnngKGLbuUpIB44qZQTKiR+cVzXAKDJhHSbNLQvl7UfrAX5Y/OnEUi+CBPd4 eAm//45dpKZk7GrUUn5kSxdZrJNXS4KZ+UjFxGYnQJ6LjQKVsBV0p4zSriavKZeJ0/MO 78i1XPkUi3ycGJK9Le8RJtQj5pbsYKeohOm4VinsCda9oMbh4z0lF/PZkzmqguFF7U7A V6lyo8AOoaScd+l9fzMHNzLIwvWU0dlHZzo2QZNtROKirqc8JsbRiwKSI3utLLwaL1aI WdKA3OJ5CvYrp2ayyD8KI6D/sbLi/kDOsfnPN+99wrab5cR95M9TJPIiQ6VMh8k3FFT7 5NYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dJsRkeBD; 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 r3si4518126qta.86.2021.06.29.12.41.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:41: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=dJsRkeBD; 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]:60782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJcH-0002jJ-Vg for patch@linaro.org; Tue, 29 Jun 2021 15:41:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItP-0008Sh-7F for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:31 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:44906) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000uT-5T for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:30 -0400 Received: by mail-pj1-x1036.google.com with SMTP id p4-20020a17090a9304b029016f3020d867so3080065pjo.3 for ; Tue, 29 Jun 2021 11:55:14 -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=UCyT6Sp8EBenir7CdpDEblAqtnl7+66OyhKqBXjwbpE=; b=dJsRkeBD6WT/23tWYpS8yXYqkBt4hi2jZsnKGVWlHYJoJIQc2VLEWhHqUEqM9gAT/J lZNfJzBGzJRmwT6+x5D91PSlXqJO1tWg6MKWgk/o6ItstdfQ8hlrPhO70K79wTZ6U7w3 KZroIAsxv2pxbt9VJEpde23hxfNqEPhQnUxOoFKI480bfjGeyZiZJ9ELH4Venug8EXFG pGpgV4bA2HGDGdtH663wgozfaQ8D2U9Z9q2GNONefPAQI08ZgBs7SLLklq9y+Wzi785P i9fWAJhKuh/48IYeQ6dBi+H5qlX4QK1qZk7GFzscM5uAKcaZVhIwBGqt8vUeD5gVUMaW sZZA== 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=UCyT6Sp8EBenir7CdpDEblAqtnl7+66OyhKqBXjwbpE=; b=eKU6BhSg8vK/JtQ7eLiNUFHBHjuxx9miJaYD1Dh+RtouG5fE5Iot+PX+5XDb2FfpVG GBehH++SgtB2AbYozeIJd9GPm5WHTxB/SCa+SO3AZ6iqNPqOdG2onZnTrsrFcekfW794 nXgeBqC5j5HDutofL7Ptsq+QNxbRI8tGnRr0BKuIv7BJX4/inoN77o80ccWW8GdJg7Nn COMmEpWtoel9hdEBDogDtHI7Q1tmCp8k8/lXte1Qan49v1Onmo6NKJVyuBA2c+QgEXGH CZuyNLewZ+QWcnK2mRMUJQED/2tws7L05sAEdgc8PvDF4b5Y/QYMKu9g+I1CzpTHuY+9 oncA== X-Gm-Message-State: AOAM533GLmSI3kh8UmIfuzsmrnGtKV0OaZYyRTspBPEb4Rr2jTGc2z9V A6XesxJmrhYrW/y+0whYQCdLEHvE1TiV9w== X-Received: by 2002:a17:902:b188:b029:11b:1549:da31 with SMTP id s8-20020a170902b188b029011b1549da31mr28475290plr.7.1624992914126; Tue, 29 Jun 2021 11:55:14 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 31/63] tcg: Add tcg_gen_vec_shl{shr}{sar}16i_i32 Date: Tue, 29 Jun 2021 11:54:23 -0700 Message-Id: <20210629185455.3131172-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: LIU Zhiwei Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: LIU Zhiwei Implement tcg_gen_vec_shl{shr}{sar}16i_tl by adding corresponging i32 OP. Signed-off-by: LIU Zhiwei Message-Id: <20210624105023.3852-4-zhiwei_liu@c-sky.com> Signed-off-by: Richard Henderson --- include/tcg/tcg-op-gvec.h | 10 ++++++++++ tcg/tcg-op-gvec.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) -- 2.25.1 diff --git a/include/tcg/tcg-op-gvec.h b/include/tcg/tcg-op-gvec.h index 2d5ad6ce12..e3c9f45926 100644 --- a/include/tcg/tcg-op-gvec.h +++ b/include/tcg/tcg-op-gvec.h @@ -408,16 +408,26 @@ void tcg_gen_vec_add16_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b); void tcg_gen_vec_sub8_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b); void tcg_gen_vec_sub16_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b); +void tcg_gen_vec_shl16i_i32(TCGv_i32 d, TCGv_i32 a, int32_t); +void tcg_gen_vec_shr16i_i32(TCGv_i32 d, TCGv_i32 a, int32_t); +void tcg_gen_vec_sar16i_i32(TCGv_i32 d, TCGv_i32 a, int32_t); + #if TARGET_LONG_BITS == 64 #define tcg_gen_vec_add8_tl tcg_gen_vec_add8_i64 #define tcg_gen_vec_sub8_tl tcg_gen_vec_sub8_i64 #define tcg_gen_vec_add16_tl tcg_gen_vec_add16_i64 #define tcg_gen_vec_sub16_tl tcg_gen_vec_sub16_i64 +#define tcg_gen_vec_shl16i_tl tcg_gen_vec_shl16i_i64 +#define tcg_gen_vec_shr16i_tl tcg_gen_vec_shr16i_i64 +#define tcg_gen_vec_sar16i_tl tcg_gen_vec_sar16i_i64 #else #define tcg_gen_vec_add8_tl tcg_gen_vec_add8_i32 #define tcg_gen_vec_sub8_tl tcg_gen_vec_sub8_i32 #define tcg_gen_vec_add16_tl tcg_gen_vec_add16_i32 #define tcg_gen_vec_sub16_tl tcg_gen_vec_sub16_i32 +#define tcg_gen_vec_shl16i_tl tcg_gen_vec_shl16i_i32 +#define tcg_gen_vec_shr16i_tl tcg_gen_vec_shr16i_i32 +#define tcg_gen_vec_sar16i_tl tcg_gen_vec_sar16i_i32 #endif #endif diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 6d9a0aed62..c8fb403957 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -2678,6 +2678,13 @@ void tcg_gen_vec_shl16i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c) tcg_gen_andi_i64(d, d, mask); } +void tcg_gen_vec_shl16i_i32(TCGv_i32 d, TCGv_i32 a, int32_t c) +{ + uint32_t mask = dup_const(MO_16, 0xffff << c); + tcg_gen_shli_i32(d, a, c); + tcg_gen_andi_i32(d, d, mask); +} + void tcg_gen_gvec_shli(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t shift, uint32_t oprsz, uint32_t maxsz) { @@ -2729,6 +2736,13 @@ void tcg_gen_vec_shr16i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c) tcg_gen_andi_i64(d, d, mask); } +void tcg_gen_vec_shr16i_i32(TCGv_i32 d, TCGv_i32 a, int32_t c) +{ + uint32_t mask = dup_const(MO_16, 0xffff >> c); + tcg_gen_shri_i32(d, a, c); + tcg_gen_andi_i32(d, d, mask); +} + void tcg_gen_gvec_shri(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t shift, uint32_t oprsz, uint32_t maxsz) { @@ -2794,6 +2808,20 @@ void tcg_gen_vec_sar16i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c) tcg_temp_free_i64(s); } +void tcg_gen_vec_sar16i_i32(TCGv_i32 d, TCGv_i32 a, int32_t c) +{ + uint32_t s_mask = dup_const(MO_16, 0x8000 >> c); + uint32_t c_mask = dup_const(MO_16, 0xffff >> c); + TCGv_i32 s = tcg_temp_new_i32(); + + tcg_gen_shri_i32(d, a, c); + tcg_gen_andi_i32(s, d, s_mask); /* isolate (shifted) sign bit */ + tcg_gen_andi_i32(d, d, c_mask); /* clear out bits above sign */ + tcg_gen_muli_i32(s, s, (2 << c) - 2); /* replicate isolated signs */ + tcg_gen_or_i32(d, d, s); /* include sign extension */ + tcg_temp_free_i32(s); +} + void tcg_gen_gvec_sari(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t shift, uint32_t oprsz, uint32_t maxsz) { From patchwork Tue Jun 29 18:54:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468323 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5248326jao; Tue, 29 Jun 2021 12:21:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGxlCUkOgGrQWgckwIorXwGTSPRaHejpsosMzyWWKt8uPY9SxGpeQ+KcwT4RYvYJ7irg1Z X-Received: by 2002:a25:d68c:: with SMTP id n134mr23258802ybg.446.1624994500500; Tue, 29 Jun 2021 12:21:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994500; cv=none; d=google.com; s=arc-20160816; b=ZJFOPuwfukJEHHKww+qUr1w9XfG7vLKtkBuRaei3LElPP5/cjCjnL+JIH2aQINhPpt dp9H5nKyv6puj6VbrqVojfpVBEM4N152HPBb9KAL49K30mZjiWJv0cb5nGGLRoy43oy+ xAjdN8KeFxAp1Q1prY+oXegjWsCC2UrzJGJFIGd4OTn3n3sZ4D7xnE081uuN9VezYEVx JleOhW1AdOPSQfMvDbvixsG6XqPgSHadRLqFiwRHiFx3DpAPJyvLCD/yWKyTwYlawUo+ EABuDefwCD6wlUwDww1Xn0PrlVIC+KlD3JljrFJaqvyIZJntDzmxgxZZ/D0unI0+Z96j 5z+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=p5LfB36r6i3yx5bOwYc8DmXqbz43Ns7565tCjIvpo+w=; b=mLAuvRAZ1I9Hm748oyyWA/IX3AnOX2sJV92nqyBPJrCo14ZJmXblDrXYjSdfl93SST cH6GQnatnxwFDnaHzr+eRwT9+h777OVD53R53Co2zJwVv7k8cBnvGjd9F3GH7eqzxnbG Qe/sp+CgCfNCHWkdDwaI1Mvfl7SBAOhrlj7bvgRt9pQ1jEwqC0+DRKV4x/TeSElFeZe3 rNm6JnlZO5C7Z/uFiWD+YW9lFm2xt3mFcCqWf8LXrWWTzrQoT24YvuKcQXwNQm7vG2eE ZhKDRZkcLTK0ZhZaqVCOFxLgMcn7PQXvkx5l+AMeYCPtbaBc5h1M+5ld7zElSgT50j7k G+Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l14gK2Py; 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 l125si18868545ybc.464.2021.06.29.12.21.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:21:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l14gK2Py; 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]:48502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJIh-0005ww-Uj for patch@linaro.org; Tue, 29 Jun 2021 15:21:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38708) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItP-0008TE-LZ for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:31 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:38622) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000uX-6T for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:31 -0400 Received: by mail-pf1-x434.google.com with SMTP id c8so104363pfp.5 for ; Tue, 29 Jun 2021 11:55:15 -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=p5LfB36r6i3yx5bOwYc8DmXqbz43Ns7565tCjIvpo+w=; b=l14gK2Py0dhAv0Ah5n4QDAfvu07JZ4Nnv8ExxeWD1YIBzrQSKJGXDela0Ozyi4PqGb lpDT5wfiWYuzn/i6bGeEwh/a5U7aaeHjQkvzBQblY+F6fYDm9zFlCGFfkk4qk1Y91dyf YZN3sJ8EhtlfFEsKKl7YC81/8z6L5TimFQp2MyXUpwkpTtgeDM0Uj6hXCMOD32Ys7Dq/ 2jTXlPduNYmCxXLxKCVRip9DD2jqqQkKdzGkJSXsN9a7aWjGRMIdvM67W1vwtVNoNO/6 M2tZ2kdZDTtxkjR8YOH/5qvvmQbRkYoPZVdpDkWHdjgx8GncDtFcD6h2snENZdB4hW2i BdMA== 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=p5LfB36r6i3yx5bOwYc8DmXqbz43Ns7565tCjIvpo+w=; b=fHT1rpnqID2xvR9aSshyTUDee35VvrLRxpa/uebOd8m879N8vqH5mbd5K5QNbggIv/ a865qGJvTFHrCrcSjG+PJh1Q0odJVWuaY+iwb1NEGDVRBQ7QiuW+eqsF+cwBROeXDZo1 OEHWAw2mf7HtjL6DNJ5obBYwtYVybup1NKiN8A2DRmfVJ3zWShttSDNMTDSb++XJHfDP 0YPH3Do1Oq61RZucExQJGMibZplA3V8I9QLQtm9vnZROTse+my94VtLiwJ29A+OCGoW6 nAcULQxgsUT+ko7XhN3+1hrKiHd9F4eZpI74gKXCWgNpSA+wBs3Rmrk2zLCjDsmnWpxf lzaw== X-Gm-Message-State: AOAM53080hDZFgPwoAQhICNhE6Cipx1R1uUEYY7/aOq9LCCNzUi+koNw s2B6ysAF3ypPx0asBCv7BkNzqrGwij9Jiw== X-Received: by 2002:a63:fa11:: with SMTP id y17mr30095407pgh.128.1624992914711; Tue, 29 Jun 2021 11:55:14 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 32/63] tcg: Add tcg_gen_vec_shl{shr}{sar}8i_i32 Date: Tue, 29 Jun 2021 11:54:24 -0700 Message-Id: <20210629185455.3131172-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: LIU Zhiwei Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: LIU Zhiwei Implement tcg_gen_vec_shl{shr}{sar}8i_tl by adding corresponging i32 OP. Signed-off-by: LIU Zhiwei Message-Id: <20210624105023.3852-5-zhiwei_liu@c-sky.com> Signed-off-by: Richard Henderson --- include/tcg/tcg-op-gvec.h | 10 ++++++++++ tcg/tcg-op-gvec.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) -- 2.25.1 diff --git a/include/tcg/tcg-op-gvec.h b/include/tcg/tcg-op-gvec.h index e3c9f45926..e3b274502c 100644 --- a/include/tcg/tcg-op-gvec.h +++ b/include/tcg/tcg-op-gvec.h @@ -408,8 +408,11 @@ void tcg_gen_vec_add16_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b); void tcg_gen_vec_sub8_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b); void tcg_gen_vec_sub16_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b); +void tcg_gen_vec_shl8i_i32(TCGv_i32 d, TCGv_i32 a, int32_t); void tcg_gen_vec_shl16i_i32(TCGv_i32 d, TCGv_i32 a, int32_t); +void tcg_gen_vec_shr8i_i32(TCGv_i32 d, TCGv_i32 a, int32_t); void tcg_gen_vec_shr16i_i32(TCGv_i32 d, TCGv_i32 a, int32_t); +void tcg_gen_vec_sar8i_i32(TCGv_i32 d, TCGv_i32 a, int32_t); void tcg_gen_vec_sar16i_i32(TCGv_i32 d, TCGv_i32 a, int32_t); #if TARGET_LONG_BITS == 64 @@ -417,14 +420,21 @@ void tcg_gen_vec_sar16i_i32(TCGv_i32 d, TCGv_i32 a, int32_t); #define tcg_gen_vec_sub8_tl tcg_gen_vec_sub8_i64 #define tcg_gen_vec_add16_tl tcg_gen_vec_add16_i64 #define tcg_gen_vec_sub16_tl tcg_gen_vec_sub16_i64 +#define tcg_gen_vec_shl8i_tl tcg_gen_vec_shl8i_i64 +#define tcg_gen_vec_shr8i_tl tcg_gen_vec_shr8i_i64 +#define tcg_gen_vec_sar8i_tl tcg_gen_vec_sar8i_i64 #define tcg_gen_vec_shl16i_tl tcg_gen_vec_shl16i_i64 #define tcg_gen_vec_shr16i_tl tcg_gen_vec_shr16i_i64 #define tcg_gen_vec_sar16i_tl tcg_gen_vec_sar16i_i64 + #else #define tcg_gen_vec_add8_tl tcg_gen_vec_add8_i32 #define tcg_gen_vec_sub8_tl tcg_gen_vec_sub8_i32 #define tcg_gen_vec_add16_tl tcg_gen_vec_add16_i32 #define tcg_gen_vec_sub16_tl tcg_gen_vec_sub16_i32 +#define tcg_gen_vec_shl8i_tl tcg_gen_vec_shl8i_i32 +#define tcg_gen_vec_shr8i_tl tcg_gen_vec_shr8i_i32 +#define tcg_gen_vec_sar8i_tl tcg_gen_vec_sar8i_i32 #define tcg_gen_vec_shl16i_tl tcg_gen_vec_shl16i_i32 #define tcg_gen_vec_shr16i_tl tcg_gen_vec_shr16i_i32 #define tcg_gen_vec_sar16i_tl tcg_gen_vec_sar16i_i32 diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index c8fb403957..ffe55e908f 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -2678,6 +2678,13 @@ void tcg_gen_vec_shl16i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c) tcg_gen_andi_i64(d, d, mask); } +void tcg_gen_vec_shl8i_i32(TCGv_i32 d, TCGv_i32 a, int32_t c) +{ + uint32_t mask = dup_const(MO_8, 0xff << c); + tcg_gen_shli_i32(d, a, c); + tcg_gen_andi_i32(d, d, mask); +} + void tcg_gen_vec_shl16i_i32(TCGv_i32 d, TCGv_i32 a, int32_t c) { uint32_t mask = dup_const(MO_16, 0xffff << c); @@ -2736,6 +2743,13 @@ void tcg_gen_vec_shr16i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c) tcg_gen_andi_i64(d, d, mask); } +void tcg_gen_vec_shr8i_i32(TCGv_i32 d, TCGv_i32 a, int32_t c) +{ + uint32_t mask = dup_const(MO_8, 0xff >> c); + tcg_gen_shri_i32(d, a, c); + tcg_gen_andi_i32(d, d, mask); +} + void tcg_gen_vec_shr16i_i32(TCGv_i32 d, TCGv_i32 a, int32_t c) { uint32_t mask = dup_const(MO_16, 0xffff >> c); @@ -2808,6 +2822,20 @@ void tcg_gen_vec_sar16i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c) tcg_temp_free_i64(s); } +void tcg_gen_vec_sar8i_i32(TCGv_i32 d, TCGv_i32 a, int32_t c) +{ + uint32_t s_mask = dup_const(MO_8, 0x80 >> c); + uint32_t c_mask = dup_const(MO_8, 0xff >> c); + TCGv_i32 s = tcg_temp_new_i32(); + + tcg_gen_shri_i32(d, a, c); + tcg_gen_andi_i32(s, d, s_mask); /* isolate (shifted) sign bit */ + tcg_gen_muli_i32(s, s, (2 << c) - 2); /* replicate isolated signs */ + tcg_gen_andi_i32(d, d, c_mask); /* clear out bits above sign */ + tcg_gen_or_i32(d, d, s); /* include sign extension */ + tcg_temp_free_i32(s); +} + void tcg_gen_vec_sar16i_i32(TCGv_i32 d, TCGv_i32 a, int32_t c) { uint32_t s_mask = dup_const(MO_16, 0x8000 >> c); From patchwork Tue Jun 29 18:54:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468354 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5262137jao; Tue, 29 Jun 2021 12:44:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz18HqBskTzTG+y1P4rLCe/io/xTpgxCl2DjaOVuEpfJ0SXtUe84hD0bAonE2ntnSHP0z2S X-Received: by 2002:a05:6214:931:: with SMTP id dk17mr2752039qvb.4.1624995888551; Tue, 29 Jun 2021 12:44:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995888; cv=none; d=google.com; s=arc-20160816; b=JsVvKp8VirDIS/qN9KO1Qywz3o5zSF2Pp/AhFUtIJ4dnHHW3MkhSFX4YlrTD0y1yv5 Gdh4ri2y8MieT7Y0570ZWbKK+iutir1DqOP0icHN4Sm8cHrZoehqtqsTmPwpuFwD0LV9 uWABQRFHPqXeFZQDRw36sNklQ4r8MXwcn9koLxBjFmH40Jq54eS3RV8dmLpbGdD/QXiG ZTAEmxRDShiPR3kA0J0scN2BudxQMEvVm1EEO9nho4f2gqDdJiE5phu+bwKfql3vbIXh o5Nhn0NAXzEIx2U1PX1KLOKcMRrpSGKfpvU7kZ7YeeNmEwACvs8tRKec+qSSitCfJpnp swtQ== 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=MS+54kxIfTXZuvkER1/bNkljAmYnUsI7C3BvDWc6sZw=; b=V7pjsHjPuanZvlZbpV0AeH9i+fGxrTtvp6YGf0l1YZml9QqUMNB49rgWfYtdPMueA/ VKgLBAcZNRvXmTdK+iQ4jWbgaV5JmPHXhYjyTV1mj5Y+potIpfGpusVVyrWtmBQZBcmN iDPvXeAQkSd2URL3UELrpnIm8EFcvuIXXt+JnV8pOeACp9s7SqyTbGZDYJEIymyh8m/j Hcs2PI3gYYqpq3KtzEjmfdqn2thErkShmSTzaqpOm2T0VkhV1B85b8nhlrkL/THOCeE+ Z9uTdv8hlhchhVVJZDd4unsuyN0L9rTFKmsHW/DxjFWjto43Qec7ObUUcybZqYxnozgx Z0Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GGRftq6Y; 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 d16si13546244qtx.357.2021.06.29.12.44.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:44: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=GGRftq6Y; 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]:41138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJf5-0000C7-VL for patch@linaro.org; Tue, 29 Jun 2021 15:44:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38792) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItT-00008H-2B for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:35 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:40479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000ua-Ez for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:34 -0400 Received: by mail-pg1-x535.google.com with SMTP id g22so1096957pgl.7 for ; Tue, 29 Jun 2021 11:55:16 -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=MS+54kxIfTXZuvkER1/bNkljAmYnUsI7C3BvDWc6sZw=; b=GGRftq6Y0ulesKfLDfLjoi/mKkxwHOyr0beTdcWBbP48NZ+jTD1pVOh0u28FDPY3rO JGVySeqb9lQ3dmVWN3AWMKkwuMekfP7cedVVMQ9Dvpoywx7I+5iZGfuL+efINCAYc+zw 2DqH29qizPaPfQ2TiUS50xqAuXRWmFGMIIlN9Mg8iXktb2OidAp82LnS/gruDJCV7+5z FPaCBTHvqQgI6jHo5+tf6ToEWJVa5PW+zEovQKTRi1bccPuWQ/K5Fg/3WzISxpCcOrBC 89J3a0S2c6esjDTKVMksyZsgdga8GnLK6H3y8lIgXY9dQbcCmq9c6GydkOOvrBL5DAT3 +vgw== 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=MS+54kxIfTXZuvkER1/bNkljAmYnUsI7C3BvDWc6sZw=; b=A0PSIFcFouZR4ah6Yo5i4UnrJH1aYyA/FwlezEFFFs136XV3MePxuS3vEWraX99P/n otust/Tp9MQWGCriH7NCDtGJOTqhpalN6s3U/EzAbKTi7iYy90P3wIuWjtLZ5qLKDT7W B7NTdKrCEImAL4fHROOY4ngqTzOG2lxUiHNmfleTwtRocApqdmWsZ72boCAXzI6bDaLu ucZHMaAi1zl39b9BXZDc6F+jWnZZh6rDArkKYkOTpuYAxy1mVH26QL6UuRDF3+PQyCvi m+KCLQxSz0JW0WYUndheRy0zd9oLs9Yf8nXyYVWDahz2e8rmnfcQxSIi1BOBYq+wOelj QcxQ== X-Gm-Message-State: AOAM533lI859am2G/plywFsy/JO35UY3bVJ1wZupMZRL8q0eN7sAA8Mb fxmJA28lHr3kDdgJcG6PGFoj0uVqp0O1LQ== X-Received: by 2002:a63:a44:: with SMTP id z4mr29359549pgk.379.1624992915195; Tue, 29 Jun 2021 11:55:15 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 33/63] tcg: Implement tcg_gen_vec_add{sub}32_tl Date: Tue, 29 Jun 2021 11:54:25 -0700 Message-Id: <20210629185455.3131172-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TVD_SPACE_RATIO=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: LIU Zhiwei Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: LIU Zhiwei Signed-off-by: LIU Zhiwei Message-Id: <20210624105023.3852-6-zhiwei_liu@c-sky.com> Signed-off-by: Richard Henderson --- include/tcg/tcg-op-gvec.h | 4 ++++ 1 file changed, 4 insertions(+) -- 2.25.1 diff --git a/include/tcg/tcg-op-gvec.h b/include/tcg/tcg-op-gvec.h index e3b274502c..da55fed870 100644 --- a/include/tcg/tcg-op-gvec.h +++ b/include/tcg/tcg-op-gvec.h @@ -420,6 +420,8 @@ void tcg_gen_vec_sar16i_i32(TCGv_i32 d, TCGv_i32 a, int32_t); #define tcg_gen_vec_sub8_tl tcg_gen_vec_sub8_i64 #define tcg_gen_vec_add16_tl tcg_gen_vec_add16_i64 #define tcg_gen_vec_sub16_tl tcg_gen_vec_sub16_i64 +#define tcg_gen_vec_add32_tl tcg_gen_vec_add32_i64 +#define tcg_gen_vec_sub32_tl tcg_gen_vec_sub32_i64 #define tcg_gen_vec_shl8i_tl tcg_gen_vec_shl8i_i64 #define tcg_gen_vec_shr8i_tl tcg_gen_vec_shr8i_i64 #define tcg_gen_vec_sar8i_tl tcg_gen_vec_sar8i_i64 @@ -432,6 +434,8 @@ void tcg_gen_vec_sar16i_i32(TCGv_i32 d, TCGv_i32 a, int32_t); #define tcg_gen_vec_sub8_tl tcg_gen_vec_sub8_i32 #define tcg_gen_vec_add16_tl tcg_gen_vec_add16_i32 #define tcg_gen_vec_sub16_tl tcg_gen_vec_sub16_i32 +#define tcg_gen_vec_add32_tl tcg_gen_add_i32 +#define tcg_gen_vec_sub32_tl tcg_gen_sub_i32 #define tcg_gen_vec_shl8i_tl tcg_gen_vec_shl8i_i32 #define tcg_gen_vec_shr8i_tl tcg_gen_vec_shr8i_i32 #define tcg_gen_vec_sar8i_tl tcg_gen_vec_sar8i_i32 From patchwork Tue Jun 29 18:54:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468357 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5263890jao; Tue, 29 Jun 2021 12:47:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbJYHaiSJ7YkB57y/SLrOIkkZZaVBOKm9nEGq3a21C7D6wD+yIsUbbkqpqa5zdfpJdm3on X-Received: by 2002:a9f:2633:: with SMTP id 48mr13806157uag.117.1624996065321; Tue, 29 Jun 2021 12:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996065; cv=none; d=google.com; s=arc-20160816; b=ycQGUugeuk5oENvQlDfpJnuf7WhZBftsf09VYkPOMbUNDI4U7iZKUohfNHqwl1o9xY WjxG5nbmSYwz3yNgvCIabPwKs1B9DRyFdnYTYL5gMC1HLnY0HqkaXNxoW87jTJ1wtIKd cPtz+hHg4lh9KVn7bqCK0EDRe/vv5u2low7Jof9NZdA5gIdOyNWsujRmmeYv3anrRfsz ZcBWjPQmtmmzLo8HveVOLFPXGYDqWfnJjLtpgRPja6MmKonYl0CdfHaW8iZ/zys4Tq0e arkbBxV4dyXOlAFaxQx45KbAcSoIGSxDcefzoNRXNkVX54FOIXYlizzm/imzdbglKl8j xODg== 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=9Zapp0K87eHLqDH9uXtHOc8lqqdhk1016Rq7nGzaj2E=; b=fpIGwAz1f93VWCHta0Y6gTQyDr5Ym1ZcTB7to00C4y8Bivo2JXiMJlh9jjAuLYnq/s Cm8YhfcA0vJ+4Hs+2uc8VYGZJURd9gnyLnjuc6PZgtOrBH7oRmmfAe9TpHkJyGQB3jfR u2JFBJhC6bSyOYKBgoSXUqVGTwefPZRaqbT2J+TrsMJkg2M3GdbBFbmymsTkRirvAdXy 4TRIvZM6IdQtuamL+y0XRLbx8Z/bf7utCOWVBVgJ3ZejQQiCluTge3zUDGgZ7GPogXHg uWRQ8d1VV9iQ7pBn6h/TAJR8vw8TuGk98UF1ExVfHvIof/fEMhAelRAm3sj8SXhoAfFu i0pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=QjX9pJ6j; 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 y5si2016441ual.252.2021.06.29.12.47.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:47:45 -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=QjX9pJ6j; 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]:49838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJhw-00069R-Ku for patch@linaro.org; Tue, 29 Jun 2021 15:47:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItU-0000Bc-6d for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:36 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:38623) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItC-0000wf-JX for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:35 -0400 Received: by mail-pf1-x435.google.com with SMTP id c8so104495pfp.5 for ; Tue, 29 Jun 2021 11:55:18 -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=9Zapp0K87eHLqDH9uXtHOc8lqqdhk1016Rq7nGzaj2E=; b=QjX9pJ6jB5H8fuTkUsMw+Rfxx+TBAM+XKt2XF/j/aRaxGvdEdNEU1/gyFb/lfnmnKS onDPXS1QozvlxUCEPKOrGCaglc2NcGbnIhYDxQcpc82TuT1ulNQPvw2GbLdiP+zApC/b F1pJq7K2vNd80ChWn50SZIO2WCxEiCk5lA1CbjRgY+Wy8z1hFPXet42kaq+NzGG5UWT/ 79nE1C6YFE8fSck2Qcxc1UGeT9W+CKL+U9Lc2m2avJ2DZM9aAvC1C6cBeE80lQb7GKq4 KXreiMPvfunxcOJxo5QbcyHHVhOEs9eIvwlaLFKntK2HvmBcaG8qevK3TXNV4sq5Gtp3 ++hg== 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=9Zapp0K87eHLqDH9uXtHOc8lqqdhk1016Rq7nGzaj2E=; b=rxGn6dke5UtIymtw5d/kyfxpOJbGyo/TKjibWYTJ+BucEp3CyROGv7KraLx3QpwTm9 WftSVvtQWxdiV5SixxeuTzOeFdQX4omZl0YfNCyd1YVVjlmwwON5zETIJZabfo1YyXaT sfQrUGd4UaVOn3uNqABgub+Xf7m2W6XQGg/c/sgHvFMAvaMtgA/UL53WJvYfTh4uVE9j JudryV1Xy1+nFGrrVp4cWbBP24Oaqc7+28OZ5cI3XxSYgenjwuSl4WUSnfX70NleerOd aAOekRzLllznE8O/6b2surH77719By86pi5b8jbN7ZNAKyX0X2JliUNho9YchEVbf4bE hsmw== X-Gm-Message-State: AOAM531qhJf3t9FvIqgeBekt8ISS9d437o0AoTAnDcIowDD1vaT9qEK3 IzQvIVURwqdLaSGiH6HdqkpITlbHgHAn1Q== X-Received: by 2002:a65:6494:: with SMTP id e20mr2796181pgv.101.1624992917326; Tue, 29 Jun 2021 11:55:17 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 34/63] tcg: Use correct trap number for page faults on *BSD systems Date: Tue, 29 Jun 2021 11:54:26 -0700 Message-Id: <20210629185455.3131172-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juergen Lock , Mark Johnston , Warner Losh Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh The trap number for a page fault on BSD systems is T_PAGEFLT not 0xe -- 0xe is used by Linux and represents the intel hardware trap vector. The BSD kernels, however, translate this to T_PAGEFLT in their Xpage, Xtrap0e, Xtrap14, etc fault handlers. This is true for i386 and x86_64, though the name of the trap hanlder can very on the flavor of BSD. As far as I can tell, Linux doesn't provide a define for this value. Invent a new one (PAGE_FAULT_TRAP) and use it instead to avoid uglier ifdefs. Signed-off-by: Mark Johnston Signed-off-by: Juergen Lock [ Rework to avoid ifdefs and expand it to i386 ] Signed-off-by: Warner Losh Message-Id: <20210625045707.84534-3-imp@bsdimp.com> Signed-off-by: Richard Henderson --- accel/tcg/user-exec.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index e67b1617b5..ba09fd0413 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -254,28 +254,35 @@ void *probe_access(CPUArchState *env, target_ulong addr, int size, #if defined(__NetBSD__) #include +#include #define EIP_sig(context) ((context)->uc_mcontext.__gregs[_REG_EIP]) #define TRAP_sig(context) ((context)->uc_mcontext.__gregs[_REG_TRAPNO]) #define ERROR_sig(context) ((context)->uc_mcontext.__gregs[_REG_ERR]) #define MASK_sig(context) ((context)->uc_sigmask) +#define PAGE_FAULT_TRAP T_PAGEFLT #elif defined(__FreeBSD__) || defined(__DragonFly__) #include +#include #define EIP_sig(context) (*((unsigned long *)&(context)->uc_mcontext.mc_eip)) #define TRAP_sig(context) ((context)->uc_mcontext.mc_trapno) #define ERROR_sig(context) ((context)->uc_mcontext.mc_err) #define MASK_sig(context) ((context)->uc_sigmask) +#define PAGE_FAULT_TRAP T_PAGEFLT #elif defined(__OpenBSD__) +#include #define EIP_sig(context) ((context)->sc_eip) #define TRAP_sig(context) ((context)->sc_trapno) #define ERROR_sig(context) ((context)->sc_err) #define MASK_sig(context) ((context)->sc_mask) +#define PAGE_FAULT_TRAP T_PAGEFLT #else #define EIP_sig(context) ((context)->uc_mcontext.gregs[REG_EIP]) #define TRAP_sig(context) ((context)->uc_mcontext.gregs[REG_TRAPNO]) #define ERROR_sig(context) ((context)->uc_mcontext.gregs[REG_ERR]) #define MASK_sig(context) ((context)->uc_sigmask) +#define PAGE_FAULT_TRAP 0xe #endif int cpu_signal_handler(int host_signum, void *pinfo, @@ -301,34 +308,42 @@ int cpu_signal_handler(int host_signum, void *pinfo, pc = EIP_sig(uc); trapno = TRAP_sig(uc); return handle_cpu_signal(pc, info, - trapno == 0xe ? (ERROR_sig(uc) >> 1) & 1 : 0, + trapno == PAGE_FAULT_TRAP ? + (ERROR_sig(uc) >> 1) & 1 : 0, &MASK_sig(uc)); } #elif defined(__x86_64__) #ifdef __NetBSD__ +#include #define PC_sig(context) _UC_MACHINE_PC(context) #define TRAP_sig(context) ((context)->uc_mcontext.__gregs[_REG_TRAPNO]) #define ERROR_sig(context) ((context)->uc_mcontext.__gregs[_REG_ERR]) #define MASK_sig(context) ((context)->uc_sigmask) +#define PAGE_FAULT_TRAP T_PAGEFLT #elif defined(__OpenBSD__) +#include #define PC_sig(context) ((context)->sc_rip) #define TRAP_sig(context) ((context)->sc_trapno) #define ERROR_sig(context) ((context)->sc_err) #define MASK_sig(context) ((context)->sc_mask) +#define PAGE_FAULT_TRAP T_PAGEFLT #elif defined(__FreeBSD__) || defined(__DragonFly__) #include +#include #define PC_sig(context) (*((unsigned long *)&(context)->uc_mcontext.mc_rip)) #define TRAP_sig(context) ((context)->uc_mcontext.mc_trapno) #define ERROR_sig(context) ((context)->uc_mcontext.mc_err) #define MASK_sig(context) ((context)->uc_sigmask) +#define PAGE_FAULT_TRAP T_PAGEFLT #else #define PC_sig(context) ((context)->uc_mcontext.gregs[REG_RIP]) #define TRAP_sig(context) ((context)->uc_mcontext.gregs[REG_TRAPNO]) #define ERROR_sig(context) ((context)->uc_mcontext.gregs[REG_ERR]) #define MASK_sig(context) ((context)->uc_sigmask) +#define PAGE_FAULT_TRAP 0xe #endif int cpu_signal_handler(int host_signum, void *pinfo, @@ -346,7 +361,8 @@ int cpu_signal_handler(int host_signum, void *pinfo, pc = PC_sig(uc); return handle_cpu_signal(pc, info, - TRAP_sig(uc) == 0xe ? (ERROR_sig(uc) >> 1) & 1 : 0, + TRAP_sig(uc) == PAGE_FAULT_TRAP ? + (ERROR_sig(uc) >> 1) & 1 : 0, &MASK_sig(uc)); } From patchwork Tue Jun 29 18:54:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468332 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5251490jao; Tue, 29 Jun 2021 12:26:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycNQfp9DFcwqaBI0I2NlJzKmqAWyUDNm1T5uM71Vy6C72wmds4yFmjNJMWbsZioyflIFeu X-Received: by 2002:a25:53c5:: with SMTP id h188mr40647272ybb.113.1624994816592; Tue, 29 Jun 2021 12:26:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994816; cv=none; d=google.com; s=arc-20160816; b=syQZ2oYTg/950nbU2mZGthLsJ/JBHUxhUqKJKtYm9B9UorYx+jd2JS6E5nqRIvCmRQ MPduDo2/EKuVPXzPMXURNver08Sl39uCVMPUaReKTDuJ0CVmMmqa3v/r3NbtV+1S9MGo wH4itlyE69CMY5ogrTijA+pHLbgLGoQZFqZpVd2WwBHlzVTCSilkyRZlPgm62vB2M5dL rjtkpDhmoYfEfWwuJbMIMbyfWlYH2ULBBRLQBMo7p5H9Z8M6jAITgffp0z0l3z/FOr8b vds9B38norZXF9l4I+xxU7rjBGxfpypXBSa1xdsrJ0IX1TAC0fGZmizEtMllrCxsHbEO e6+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=kCiP3VSDiYczcJLXUPyx80NLpZIuJ9ygaJY4dh71cMc=; b=nMhTlTbbBKT349Cwz/qYFg9O5A40SUOEBQkmcw1uazMBqmZSWzgRKiZMnjtMi9YOgC SXOoUNOEIiDxVgVXPlhNaoW6QFzx9VuwPrVErCNo0BTW2KE9HYoX/fdwIMpZVz3Caulg 0nHrRs/TxMq3ax7zz5Ud4KoXsJy7WkmyNiplLSMDWuRLTYF4RHfKbopolq/k5CZx64cw JD4mfe3HvdO8dd60Yq5KOC0ECIJRVTe5F5EP+d4Qm/02OtV4ULhdAjHR9ESusOsKSMSy w4clOVVguErnGDwpLmHy3p1OJHJI60AmE5c+Cc0fM9XUl8zQY6D/ocld3XmQgTt/hl5I dDqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aYBeWqjq; 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 y8si17848555ybj.70.2021.06.29.12.26.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:26: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=aYBeWqjq; 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]:40736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJNo-0002oH-1d for patch@linaro.org; Tue, 29 Jun 2021 15:26:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38848) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItV-0000G5-OS for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:37 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:37782) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItD-0000xE-68 for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:37 -0400 Received: by mail-pl1-x62b.google.com with SMTP id o3so43294plg.4 for ; Tue, 29 Jun 2021 11:55:18 -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=kCiP3VSDiYczcJLXUPyx80NLpZIuJ9ygaJY4dh71cMc=; b=aYBeWqjqR0inrjIkOAZ0L24XThIsboDf+kFSi+snnC3vvraaBQaP8LOPWSnI65cJJh /eWP6bYSe9dKTo4IJUpo7xhAtGKDx6Swf4/1pR4blLaCqKWfWoDPaZdUde+wpSo8vKjH Hibk2HLdM/NalygVy+hEtLie0KVjOs9+Zt/fIDq1HfLzOVvMWTNvBHByCj2BlaAfjV7E bGYuhY8n8vnVzIJCGj63h/cJdpug2VBc9ufrhUcjVjgiIoLCVm/gIPiPPL7MwXAvap9n g42p9vHV2J7dPv1IQeCEdKRcRC8VFqRoyYw/ZsPpj9jjtLZ4OSsFMC6c80F3ETutAwAx pbnQ== 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=kCiP3VSDiYczcJLXUPyx80NLpZIuJ9ygaJY4dh71cMc=; b=I9QV5/Nr4SfazwTrrd5UrFMqXY8AH8HbX7kVJAmp4Sn5Vll8uxZF4wxC5RRE50drqj AIgSTF30aZhryuqx+iAabeT7yXtaAwZIoCx5aQlTdvnmyBf6CCxXECFzDyM6oDWznNDv fYyBiEAvPd71aE5ORhVZFO/T6EYJYgkVPLUxy/8RLB/0vy4P+sAmnnUTI1XGABf5/Lg5 bBmHsKPv5vTySH/6grHD3yYrQMR4nzxXHn6OGNdX1gQO1xECmz7lR5rw+ACUranDO6NP mIgTNiW3jnC2OQGuSVAIm6WHVtXsRhrz1KLw6k1/V5y4s5N+vnkoYPyd4HpgwVEJlOnh 4mNA== X-Gm-Message-State: AOAM531jlS4doUdJsbiOJLDVX7SupGb4oRSnve2QVUsDpv5QQExsCk2y 99xSUpPeFAfyWRPjmqoh8/toNkVUQryt4g== X-Received: by 2002:a17:902:8ec9:b029:11f:f1dc:6c8d with SMTP id x9-20020a1709028ec9b029011ff1dc6c8dmr28673232plo.34.1624992917828; Tue, 29 Jun 2021 11:55:17 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 35/63] tcg: Add flags argument to bswap opcodes Date: Tue, 29 Jun 2021 11:54:27 -0700 Message-Id: <20210629185455.3131172-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This will eventually simplify front-end usage, and will allow backends to unset TCG_TARGET_HAS_MEMORY_BSWAP without loss of optimization. The argument is added during expansion, not currently exposed to the front end translators. The backends currently only support a flags value of either TCG_BSWAP_IZ, or (TCG_BSWAP_IZ | TCG_BSWAP_OZ), since they all require zero top bytes and leave them that way. At the existing call sites we pass in (TCG_BSWAP_IZ | TCG_BSWAP_OZ), except for the flags-ignored cases of a 32-bit swap of a 32-bit value and or a 64-bit swap of a 64-bit value, where we pass 0. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- include/tcg/tcg-opc.h | 10 +++++----- include/tcg/tcg.h | 12 ++++++++++++ tcg/tcg-op.c | 13 ++++++++----- tcg/tcg.c | 28 ++++++++++++++++++++++++++++ tcg/README | 22 ++++++++++++++-------- 5 files changed, 67 insertions(+), 18 deletions(-) -- 2.25.1 diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h index 5bbec858aa..993992373e 100644 --- a/include/tcg/tcg-opc.h +++ b/include/tcg/tcg-opc.h @@ -96,8 +96,8 @@ DEF(ext8s_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_ext8s_i32)) DEF(ext16s_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_ext16s_i32)) DEF(ext8u_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_ext8u_i32)) DEF(ext16u_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_ext16u_i32)) -DEF(bswap16_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_bswap16_i32)) -DEF(bswap32_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_bswap32_i32)) +DEF(bswap16_i32, 1, 1, 1, IMPL(TCG_TARGET_HAS_bswap16_i32)) +DEF(bswap32_i32, 1, 1, 1, IMPL(TCG_TARGET_HAS_bswap32_i32)) DEF(not_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_not_i32)) DEF(neg_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_neg_i32)) DEF(andc_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_andc_i32)) @@ -165,9 +165,9 @@ DEF(ext32s_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_ext32s_i64)) DEF(ext8u_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_ext8u_i64)) DEF(ext16u_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_ext16u_i64)) DEF(ext32u_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_ext32u_i64)) -DEF(bswap16_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_bswap16_i64)) -DEF(bswap32_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_bswap32_i64)) -DEF(bswap64_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_bswap64_i64)) +DEF(bswap16_i64, 1, 1, 1, IMPL64 | IMPL(TCG_TARGET_HAS_bswap16_i64)) +DEF(bswap32_i64, 1, 1, 1, IMPL64 | IMPL(TCG_TARGET_HAS_bswap32_i64)) +DEF(bswap64_i64, 1, 1, 1, IMPL64 | IMPL(TCG_TARGET_HAS_bswap64_i64)) DEF(not_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_not_i64)) DEF(neg_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_neg_i64)) DEF(andc_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_andc_i64)) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 2dad364240..899493701c 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -408,6 +408,18 @@ typedef TCGv_ptr TCGv_env; /* Used to align parameters. See the comment before tcgv_i32_temp. */ #define TCG_CALL_DUMMY_ARG ((TCGArg)0) +/* + * Flags for the bswap opcodes. + * If IZ, the input is zero-extended, otherwise unknown. + * If OZ or OS, the output is zero- or sign-extended respectively, + * otherwise the high bits are undefined. + */ +enum { + TCG_BSWAP_IZ = 1, + TCG_BSWAP_OZ = 2, + TCG_BSWAP_OS = 4, +}; + typedef enum TCGTempVal { TEMP_VAL_DEAD, TEMP_VAL_REG, diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index dcc2ed0bbc..dc65577e2f 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -1005,7 +1005,8 @@ void tcg_gen_ext16u_i32(TCGv_i32 ret, TCGv_i32 arg) void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg) { if (TCG_TARGET_HAS_bswap16_i32) { - tcg_gen_op2_i32(INDEX_op_bswap16_i32, ret, arg); + tcg_gen_op3i_i32(INDEX_op_bswap16_i32, ret, arg, + TCG_BSWAP_IZ | TCG_BSWAP_OZ); } else { TCGv_i32 t0 = tcg_temp_new_i32(); @@ -1020,7 +1021,7 @@ void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg) void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg) { if (TCG_TARGET_HAS_bswap32_i32) { - tcg_gen_op2_i32(INDEX_op_bswap32_i32, ret, arg); + tcg_gen_op3i_i32(INDEX_op_bswap32_i32, ret, arg, 0); } else { TCGv_i32 t0 = tcg_temp_new_i32(); TCGv_i32 t1 = tcg_temp_new_i32(); @@ -1661,7 +1662,8 @@ void tcg_gen_bswap16_i64(TCGv_i64 ret, TCGv_i64 arg) tcg_gen_bswap16_i32(TCGV_LOW(ret), TCGV_LOW(arg)); tcg_gen_movi_i32(TCGV_HIGH(ret), 0); } else if (TCG_TARGET_HAS_bswap16_i64) { - tcg_gen_op2_i64(INDEX_op_bswap16_i64, ret, arg); + tcg_gen_op3i_i64(INDEX_op_bswap16_i64, ret, arg, + TCG_BSWAP_IZ | TCG_BSWAP_OZ); } else { TCGv_i64 t0 = tcg_temp_new_i64(); @@ -1680,7 +1682,8 @@ void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg) tcg_gen_bswap32_i32(TCGV_LOW(ret), TCGV_LOW(arg)); tcg_gen_movi_i32(TCGV_HIGH(ret), 0); } else if (TCG_TARGET_HAS_bswap32_i64) { - tcg_gen_op2_i64(INDEX_op_bswap32_i64, ret, arg); + tcg_gen_op3i_i64(INDEX_op_bswap32_i64, ret, arg, + TCG_BSWAP_IZ | TCG_BSWAP_OZ); } else { TCGv_i64 t0 = tcg_temp_new_i64(); TCGv_i64 t1 = tcg_temp_new_i64(); @@ -1717,7 +1720,7 @@ void tcg_gen_bswap64_i64(TCGv_i64 ret, TCGv_i64 arg) tcg_temp_free_i32(t0); tcg_temp_free_i32(t1); } else if (TCG_TARGET_HAS_bswap64_i64) { - tcg_gen_op2_i64(INDEX_op_bswap64_i64, ret, arg); + tcg_gen_op3i_i64(INDEX_op_bswap64_i64, ret, arg, 0); } else { TCGv_i64 t0 = tcg_temp_new_i64(); TCGv_i64 t1 = tcg_temp_new_i64(); diff --git a/tcg/tcg.c b/tcg/tcg.c index 5e53c3348f..5150ed700e 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1778,6 +1778,14 @@ static const char * const alignment_name[(MO_AMASK >> MO_ASHIFT) + 1] = { [MO_ALIGN_64 >> MO_ASHIFT] = "al64+", }; +static const char bswap_flag_name[][6] = { + [TCG_BSWAP_IZ] = "iz", + [TCG_BSWAP_OZ] = "oz", + [TCG_BSWAP_OS] = "os", + [TCG_BSWAP_IZ | TCG_BSWAP_OZ] = "iz,oz", + [TCG_BSWAP_IZ | TCG_BSWAP_OS] = "iz,os", +}; + static inline bool tcg_regset_single(TCGRegSet d) { return (d & (d - 1)) == 0; @@ -1921,6 +1929,26 @@ static void tcg_dump_ops(TCGContext *s, bool have_prefs) i = 1; } break; + case INDEX_op_bswap16_i32: + case INDEX_op_bswap16_i64: + case INDEX_op_bswap32_i32: + case INDEX_op_bswap32_i64: + case INDEX_op_bswap64_i64: + { + TCGArg flags = op->args[k]; + const char *name = NULL; + + if (flags < ARRAY_SIZE(bswap_flag_name)) { + name = bswap_flag_name[flags]; + } + if (name) { + col += qemu_log(",%s", name); + } else { + col += qemu_log(",$0x%" TCG_PRIlx, flags); + } + i = k = 1; + } + break; default: i = 0; break; diff --git a/tcg/README b/tcg/README index 8510d823e3..c2e7762a37 100644 --- a/tcg/README +++ b/tcg/README @@ -295,19 +295,25 @@ ext32u_i64 t0, t1 8, 16 or 32 bit sign/zero extension (both operands must have the same type) -* bswap16_i32/i64 t0, t1 +* bswap16_i32/i64 t0, t1, flags -16 bit byte swap on a 32/64 bit value. It assumes that the two/six high order -bytes are set to zero. +16 bit byte swap on the low bits of a 32/64 bit input. +If flags & TCG_BSWAP_IZ, then t1 is known to be zero-extended from bit 15. +If flags & TCG_BSWAP_OZ, then t0 will be zero-extended from bit 15. +If flags & TCG_BSWAP_OS, then t0 will be sign-extended from bit 15. +If neither TCG_BSWAP_OZ nor TCG_BSWAP_OS are set, then the bits of +t0 above bit 15 may contain any value. -* bswap32_i32/i64 t0, t1 +* bswap32_i64 t0, t1, flags -32 bit byte swap on a 32/64 bit value. With a 64 bit value, it assumes that -the four high order bytes are set to zero. +32 bit byte swap on a 64-bit value. The flags are the same as for bswap16, +except they apply from bit 31 instead of bit 15. -* bswap64_i64 t0, t1 +* bswap32_i32 t0, t1, flags +* bswap64_i64 t0, t1, flags -64 bit byte swap +32/64 bit byte swap. The flags are ignored, but still present +for consistency with the other bswap opcodes. * discard_i32/i64 t0 From patchwork Tue Jun 29 18:54:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468348 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5259099jao; Tue, 29 Jun 2021 12:39:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgS2LsOYmrfD5CuXCrfosRiysTKyfVnJoAlS/brq1eqx9LNXczCWpG7BMIomOP9St4Dbod X-Received: by 2002:a5b:f0a:: with SMTP id x10mr39793459ybr.447.1624995567028; Tue, 29 Jun 2021 12:39:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995567; cv=none; d=google.com; s=arc-20160816; b=swVANsRGIEEG30Qo2yv9a/330LOuoOyk/7bmkqNvtF0maolHYmOwmGoZbptrbbGZHZ uoCd/C7ewoOX0ViXsFL9HDMvDNNPGdPdtynj2X5cpudl5pWyjE5UwlkVijy3qEP+2+lG 9TGdc9yfG1moC5v2UX3zJ64rKCHGLWoFzQslQrdLpHAP1j/BEeroaDzEfoLbA3fbEPnm hQHeljMWVdqTfWFYSJfUVoyBpnd9+je3F7Ko/3Wc7FjGa0XTdMSdpUSTYfp7T/NG9ii1 FzREKQJD78xusANwhNYOzmw040JTelx4YmKXpnPfikkcYKdEBcE8oB7OkXSqCMJbCfuX bSsA== 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=CHsyqcYhDcvH4VyWNUvcKr7ulIJabCuia+q5kv3FL14=; b=EyQCDwDgRWzCroWmFskZhXSC5DiDrzI7vK1qoZHizTf1Wh+LG3l9EDLEOPHYQY+1s0 0U/Od1o7IEctjjEi2hKSLCOnmvCajm9pPQrEQ51OiB7O0eGhiY/k3A7zp7qWq69tBZLJ V8JyW8N6w4emdVVjqb+iCIfpaiaP6wRdCf3H/bSAgMz31+pAj3isTj+UYigibjhIMnVi dQBlcBc1YZBdRChSgKjqH57KXKAcbeC9zibRedrZYi1s9KoUwixeAzTW3ZSOZ21QSeet a0t0TAPaBOpGCfWhjGnKqz0xLCfOK6bFgXyN925OG14MT3JJxHTbrDA6Oj7rjL21qZit JKCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HrFkohaV; 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 f2si15356898ybi.353.2021.06.29.12.39.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:39:27 -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=HrFkohaV; 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]:54590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJZu-0006n8-Fk for patch@linaro.org; Tue, 29 Jun 2021 15:39:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItT-00008f-7N for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:35 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]:33519) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItD-0000xi-Ns for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:34 -0400 Received: by mail-pl1-x62d.google.com with SMTP id f11so69800plg.0 for ; Tue, 29 Jun 2021 11:55:19 -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=CHsyqcYhDcvH4VyWNUvcKr7ulIJabCuia+q5kv3FL14=; b=HrFkohaVYQ29xSYF4JQatHrvGdRzjAQzHsAkiObJMajF0mVSUX3EXDNPDOixiRZK24 sbz0P00epzQAUPRDnzxlyq/5GFr7zx7TNCYJFoX5ibNRSUjNjTanJFibBy4F1luOLDTI nbGNNjLKxVvzMaW0xnXhYt+qdq4KH3SVccv5yn8eZMNJlH+PQVGz1acDXg9a1rT/P5V2 vfYWvU3Rj4iJELL5ktBsY07ArR1W1gx8Y8NpcafPyFvw6sQvUM18NTnMZEaoxm0aQ5KQ ewDKCcP6Z6BcBxtmyNLguPcaRGtGlPSf8IyuSAW1sxqYwOFKgKcTkYGkF5ZGfqJJXj5B 5Bhw== 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=CHsyqcYhDcvH4VyWNUvcKr7ulIJabCuia+q5kv3FL14=; b=XBypyUM5Bv8g8ADo0bAnR9HH/IvYNL73cwS2C/jP40xcCpbYOCEPm9ejP2jKpoM2xf S9vzFYCPYWQ6f0Qg4yyXZyjAkwexg7kvNCDpX8BoZdQqQXSeIBPSGhM1QCIYalNCvMT9 9VjvhYxSn5+cOhEMRetCiiU/KrAy4bt1n2Tj4MYuTvM0y625CxAZFx9pz2sN63OUEioe sKXsly2OzqfTAZgl4lHitskJzycmU/mFLUU/UKwGV/zeRoFQuas6oGwTE/7BXHFn9+DL 0Tzd6M1PkoqBdyZLQZotVJrWo4fTUDcPqNID6QgSm4b+IcvLNkcH7R+N9XiVDYqPg9Gr Cs+w== X-Gm-Message-State: AOAM530jWx1qika6Z4DYliMW0gJp6S2msUXhFohOCoAi7/t+olJTXtPb 9uCPl1VBHo/0zKHgktU7kQ5VGZg15iPSAw== X-Received: by 2002:a17:902:249:b029:121:b9eb:a513 with SMTP id 67-20020a1709020249b0290121b9eba513mr29176665plc.6.1624992918425; Tue, 29 Jun 2021 11:55:18 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 36/63] tcg/i386: Support bswap flags Date: Tue, 29 Jun 2021 11:54:28 -0700 Message-Id: <20210629185455.3131172-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Retain the current rorw bswap16 expansion for the zero-in/zero-out case. Otherwise, perform a wider bswap plus a right-shift or extend. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 34113388ef..98d924b91a 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -2421,10 +2421,28 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, break; OP_32_64(bswap16): - tcg_out_rolw_8(s, a0); + if (a2 & TCG_BSWAP_OS) { + /* Output must be sign-extended. */ + if (rexw) { + tcg_out_bswap64(s, a0); + tcg_out_shifti(s, SHIFT_SAR + rexw, a0, 48); + } else { + tcg_out_bswap32(s, a0); + tcg_out_shifti(s, SHIFT_SAR, a0, 16); + } + } else if ((a2 & (TCG_BSWAP_IZ | TCG_BSWAP_OZ)) == TCG_BSWAP_OZ) { + /* Output must be zero-extended, but input isn't. */ + tcg_out_bswap32(s, a0); + tcg_out_shifti(s, SHIFT_SHR, a0, 16); + } else { + tcg_out_rolw_8(s, a0); + } break; OP_32_64(bswap32): tcg_out_bswap32(s, a0); + if (rexw && (a2 & TCG_BSWAP_OS)) { + tcg_out_ext32s(s, a0, a0); + } break; OP_32_64(neg): From patchwork Tue Jun 29 18:54:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468366 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5267992jao; Tue, 29 Jun 2021 12:54:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8U+ol1pVxGuxEhTGBQ7X7122eGdoJW5vfxDshhgwcgELZOJklGt3ALtf7e8R+cpqd1Z2K X-Received: by 2002:a37:8b47:: with SMTP id n68mr31835892qkd.209.1624996485574; Tue, 29 Jun 2021 12:54:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996485; cv=none; d=google.com; s=arc-20160816; b=LB8scDxu8Depxe/gZ+s6xIDTeEq2srwahPow1ebgJdq6B0y4uAJmS+4XTL5yGijLnR fqLpontElHPmSOuQcg8aH5durtiDmFvG15n7qhG58r3ljBKIjMpNZKg8e7yy9GBgy/Bk uDo5PR4vNat4+NvqefzQVgFI2QeTJAlvJXPnYd46oUF6hr80LW8kka5xLiYG6LGmCFjf Xs7EvHNXNqJnLbRYspBF5hsnW9pL0rHrxggm06etDQzt8JzzEFDvW7JvQhjmMn6MWgZX lzYFv1pM+v16C4FSH1+WoCpZXqo2vbOj3Di+UKcxvQFKPBoBZNzwpmKZV6WdYpi/umC9 Ho+g== 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=Byf+XhtG+qcZv627+lVjuBQ3l6+Bu+/qb7N4RrzRGKk=; b=PdYjShI5dkRLOIVXKfaLYNuyrffFYgahkkHcAbQVE2wFONiuJy6G8uPM1WCkLGAF/h 9M4cczuE+HNPhlccFzDLF86oP+y660Y2C4aKUF9XEJOtM/5oVOrU2kMi7VZiY68OweRZ o/gUhJ6OisiHWGXUxoNBoFXN0yFiX+S0omZRzvld0lXRuXH7S7JVuByows7CygYw9JHe ul+CZdAcfpDRqE8aYPpJJmCA3xniMw5VaRIMtzF6bJS1CcoiqyPcmnxXjy2pnzAe832M UFrMVWOS6PNG02kQyu/nuT2gokiKD2zooMshHeDNLjqFlMtlHL8a3qhrdVGchyOC0Bxv 4NMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f+elT2nZ; 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 w5si14080345qvi.35.2021.06.29.12.54.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:54:45 -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=f+elT2nZ; 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]:44566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJoi-0004wc-TY for patch@linaro.org; Tue, 29 Jun 2021 15:54:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItT-0000AG-Pt for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:35 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:35465) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItE-0000y2-C8 for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:35 -0400 Received: by mail-pg1-x52c.google.com with SMTP id v7so19397619pgl.2 for ; Tue, 29 Jun 2021 11:55:19 -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=Byf+XhtG+qcZv627+lVjuBQ3l6+Bu+/qb7N4RrzRGKk=; b=f+elT2nZ8H4YBwT3NHm8NAbDjOnBH1kRIVT+v2iMo+WIQaLOedK7AGevrHso+ub9gu vhpvkVMMglELhQaWgRB/sk6xsOMMBQILhTr5kgb5RMpQ/p3cBh48r1HFy4Gpp3dDpP3e db8hpW9/5d/Fy+IFDimJ6rnH3r10WZXrE/zKekex+4tZJmaL+Vn5ooVFaSjGL123jFB6 bKzYh0Hk6M0fF42jYn4+EI1zyV01wHvnhiTRZIUZ87svN/CJi3B14/sbplIH3a0plhrR wXeNggpeKHIrdoMFKjzIHVAkT+t6Od91DboD4L9WuIdiZDqHaNzvzDJ5aW15TWb78SyF xxJg== 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=Byf+XhtG+qcZv627+lVjuBQ3l6+Bu+/qb7N4RrzRGKk=; b=WuvOgnoYM/CK9EVtgb12VO6kT8VEDuEkbGgyphI+bJa0g3w1bNW/zo0d1Ycjei9q6p iN8IKLj+gvs7YfgiBbyIwONG0ulq5ggOcJVkQ2ktfEyoio1kVzwvccVV+iHTqr2+lKkO RNYguk7YsntFEfIHcDpfCe+rR8DS/7ociglb7hO/Kh1tztFSdDHo+dmBN8mPPaTDoB/r cpeXwfmL/ihCq15LszoXFOlPM2zd/5AjauGH91zZ4xkCOCwPslob9Y1dv5DQqBVcpn+B ZNN8i/N4Nn/+6oopia9ri1UVHqT7rkWNcmcOfrIVFRRGTP20RvjmCNOcxef8ERV3DPcv D9qA== X-Gm-Message-State: AOAM533O1JASESDVljb/mE1Kedqsy8DDHBQo8rqHhiEjbX+dQNyO1Pgi 4q3UQlTgSVrSAywIhf+6TeetXXMv/Rzqvg== X-Received: by 2002:aa7:818a:0:b029:309:a073:51cb with SMTP id g10-20020aa7818a0000b0290309a07351cbmr23699251pfi.40.1624992919014; Tue, 29 Jun 2021 11:55:19 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 37/63] tcg/aarch64: Merge tcg_out_rev{16,32,64} Date: Tue, 29 Jun 2021 11:54:29 -0700 Message-Id: <20210629185455.3131172-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Pass in the input and output size. We currently use 3 of the 5 possible combinations; the others may be used by new tcg opcodes. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c.inc | 42 ++++++++++++++---------------------- 1 file changed, 16 insertions(+), 26 deletions(-) -- 2.25.1 diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 27cde314a9..8619e54fca 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -475,9 +475,7 @@ typedef enum { /* Data-processing (1 source) instructions. */ I3507_CLZ = 0x5ac01000, I3507_RBIT = 0x5ac00000, - I3507_REV16 = 0x5ac00400, - I3507_REV32 = 0x5ac00800, - I3507_REV64 = 0x5ac00c00, + I3507_REV = 0x5ac00000, /* + size << 10 */ /* Data-processing (2 source) instructions. */ I3508_LSLV = 0x1ac02000, @@ -1417,19 +1415,11 @@ static void tcg_out_brcond(TCGContext *s, TCGType ext, TCGCond c, TCGArg a, } } -static inline void tcg_out_rev64(TCGContext *s, TCGReg rd, TCGReg rn) +static inline void tcg_out_rev(TCGContext *s, int ext, MemOp s_bits, + TCGReg rd, TCGReg rn) { - tcg_out_insn(s, 3507, REV64, TCG_TYPE_I64, rd, rn); -} - -static inline void tcg_out_rev32(TCGContext *s, TCGReg rd, TCGReg rn) -{ - tcg_out_insn(s, 3507, REV32, TCG_TYPE_I32, rd, rn); -} - -static inline void tcg_out_rev16(TCGContext *s, TCGReg rd, TCGReg rn) -{ - tcg_out_insn(s, 3507, REV16, TCG_TYPE_I32, rd, rn); + /* REV, REV16, REV32 */ + tcg_out_insn_3507(s, I3507_REV | (s_bits << 10), ext, rd, rn); } static inline void tcg_out_sxt(TCGContext *s, TCGType ext, MemOp s_bits, @@ -1737,13 +1727,13 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, MemOp memop, TCGType ext, case MO_UW: tcg_out_ldst_r(s, I3312_LDRH, data_r, addr_r, otype, off_r); if (bswap) { - tcg_out_rev16(s, data_r, data_r); + tcg_out_rev(s, TCG_TYPE_I32, MO_16, data_r, data_r); } break; case MO_SW: if (bswap) { tcg_out_ldst_r(s, I3312_LDRH, data_r, addr_r, otype, off_r); - tcg_out_rev16(s, data_r, data_r); + tcg_out_rev(s, TCG_TYPE_I32, MO_16, data_r, data_r); tcg_out_sxt(s, ext, MO_16, data_r, data_r); } else { tcg_out_ldst_r(s, (ext ? I3312_LDRSHX : I3312_LDRSHW), @@ -1753,13 +1743,13 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, MemOp memop, TCGType ext, case MO_UL: tcg_out_ldst_r(s, I3312_LDRW, data_r, addr_r, otype, off_r); if (bswap) { - tcg_out_rev32(s, data_r, data_r); + tcg_out_rev(s, TCG_TYPE_I32, MO_32, data_r, data_r); } break; case MO_SL: if (bswap) { tcg_out_ldst_r(s, I3312_LDRW, data_r, addr_r, otype, off_r); - tcg_out_rev32(s, data_r, data_r); + tcg_out_rev(s, TCG_TYPE_I32, MO_32, data_r, data_r); tcg_out_sxt(s, TCG_TYPE_I64, MO_32, data_r, data_r); } else { tcg_out_ldst_r(s, I3312_LDRSWX, data_r, addr_r, otype, off_r); @@ -1768,7 +1758,7 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, MemOp memop, TCGType ext, case MO_Q: tcg_out_ldst_r(s, I3312_LDRX, data_r, addr_r, otype, off_r); if (bswap) { - tcg_out_rev64(s, data_r, data_r); + tcg_out_rev(s, TCG_TYPE_I64, MO_64, data_r, data_r); } break; default: @@ -1788,21 +1778,21 @@ static void tcg_out_qemu_st_direct(TCGContext *s, MemOp memop, break; case MO_16: if (bswap && data_r != TCG_REG_XZR) { - tcg_out_rev16(s, TCG_REG_TMP, data_r); + tcg_out_rev(s, TCG_TYPE_I32, MO_16, TCG_REG_TMP, data_r); data_r = TCG_REG_TMP; } tcg_out_ldst_r(s, I3312_STRH, data_r, addr_r, otype, off_r); break; case MO_32: if (bswap && data_r != TCG_REG_XZR) { - tcg_out_rev32(s, TCG_REG_TMP, data_r); + tcg_out_rev(s, TCG_TYPE_I32, MO_32, TCG_REG_TMP, data_r); data_r = TCG_REG_TMP; } tcg_out_ldst_r(s, I3312_STRW, data_r, addr_r, otype, off_r); break; case MO_64: if (bswap && data_r != TCG_REG_XZR) { - tcg_out_rev64(s, TCG_REG_TMP, data_r); + tcg_out_rev(s, TCG_TYPE_I64, MO_64, TCG_REG_TMP, data_r); data_r = TCG_REG_TMP; } tcg_out_ldst_r(s, I3312_STRX, data_r, addr_r, otype, off_r); @@ -2184,15 +2174,15 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, break; case INDEX_op_bswap64_i64: - tcg_out_rev64(s, a0, a1); + tcg_out_rev(s, TCG_TYPE_I64, MO_64, a0, a1); break; case INDEX_op_bswap32_i64: case INDEX_op_bswap32_i32: - tcg_out_rev32(s, a0, a1); + tcg_out_rev(s, TCG_TYPE_I32, MO_32, a0, a1); break; case INDEX_op_bswap16_i64: case INDEX_op_bswap16_i32: - tcg_out_rev16(s, a0, a1); + tcg_out_rev(s, TCG_TYPE_I32, MO_16, a0, a1); break; case INDEX_op_ext8s_i64: From patchwork Tue Jun 29 18:54:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468359 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5265282jao; Tue, 29 Jun 2021 12:49:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzB5+YXBXxpKlkQZ2WxPz6r1g8FXgVaOaJLPhlaQneG9fFNSG+7zfMHL9p4DNs1bw62vdXF X-Received: by 2002:a9f:2c91:: with SMTP id w17mr29101535uaj.73.1624996197259; Tue, 29 Jun 2021 12:49:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996197; cv=none; d=google.com; s=arc-20160816; b=A6+XwIuQ2XM3d14+sVYWqRdQGGg1jH5IP36dKBsdOUrhHi0NPgLchVVnLedexIROn6 KZSiPe4UJQydVw97hzAgpZL/vyBTM+cQ07lrr7E74YkE/y0DGKUj2JGWEEme2T0VBEqu KpvOqcNe4nyA+fCUD/eEfY7LVUj8tOMSvXoaBjK+2ChK3L6eCIXKMMvJ3EHEzxglYio8 w1qz0TlXFlIn+jDstSilLLCQLCF4FkBuS22LtfvbiVaLPzNnNMWUl7szgZ3cteLo40Fj tVGmeuxm/meEha2EsGhH3vrWJ8nhCTSOcQSBqXwN31jOOTWYRjb/nNy5HOnTdzrPIoD6 dRZA== 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=RzG+IK53XdySkGDuIO25Vl9LUHRHkp4N6+CK9vmLiEo=; b=NMu2aPpq6Gp6i1jfhkjWJ6ChskqcOLDak/YPqDU5NiXCVQvoaC8aqYg+0K8cOkf1ui RY7ej4njWqvZTi5OYDc5AOLHaa1BZKfAQMy4ODOFjjwLhWr2JRBd7PKLOGFirwS9956o zhvtoKXrHagBzc/iqgRfDDMM2D0VopZRkowcjHJ0y2VPOi4iFCmxHcbWs8pCbB0czol4 a5FK+RFOVddKwhQfRPgH1PGtpY/snd4GtwHW2tHPg+bgb2cp+lKMma93yUzgHHntG8yR domIsaCRgKGmu8kvDM+0iFV/598NAITFyRS0s3zHJ4K+ERxcu6gw2YCyBU7hc4qKjVzc zCUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SXb3y76b; 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 a4si10951106vsn.4.2021.06.29.12.49.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:49:57 -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=SXb3y76b; 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]:58058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJk4-0003OJ-MC for patch@linaro.org; Tue, 29 Jun 2021 15:49:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItU-0000C0-B2 for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:36 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:41747) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItF-0000z2-58 for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:36 -0400 Received: by mail-pf1-x433.google.com with SMTP id c5so90902pfv.8 for ; Tue, 29 Jun 2021 11:55:20 -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=RzG+IK53XdySkGDuIO25Vl9LUHRHkp4N6+CK9vmLiEo=; b=SXb3y76bCDgPgKDSZJ7Zzzkh2RdxrRTnRcaZfdfa0OTJV+dtAEJsh+89cwc6Wz9GUn Ubc6/Kz2tquuejdADQaYMIWb26YY5aSXZCcYo38lTlDWABdOJRABb2elwpgvc7k3rPg7 aA5LIHAU5IWK1J6hcfFvBBbbPdYZuDO2FeDXHA7RTT47V6tUzsFIYiOpvkEu8R6j0g5w VvJd8RTdpd+WkdkawtFyxYGVni/ywBxC1TthS0G4YQtuKQOIwbjT34a0t6nT7O4rESJ3 UKBB7T/zYVH8MvY9YnG463gOQ7h3PIHMuS2zog9kCEG0NPe2qshCHN/kxNG+xV6MG0T4 H3sA== 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=RzG+IK53XdySkGDuIO25Vl9LUHRHkp4N6+CK9vmLiEo=; b=mMja9IF8llR82UQYGSBQ/PcsF/6q2WdZOwUkrLxROaLHBylTziRU86KupmysdgwKkE d1t+aeWJ0194W5xvD3BW1Qmc+BHH6MKcmoDh014o24h4ozycl4vDRdtzA12kAUaHElSa MWm1nUyuP35f8o6Lc4GSvNgL9k91raylsM9nKNu5s7wVPUutY09yIwciis6KSHto1J0n 8hnzU0R+yRNxRaYw9PIKDWKfzloRGfLoUTKLQzIGYWKbEGDsvn7aRnfNt1pm6zzI2B+b THHD/jxA+t7S6JWHeG5solB0gKaXe5Txji7VvpImxLCwzdDSMnomlomDUrPiio2KZ20l t10g== X-Gm-Message-State: AOAM5328hkK4+QaIP6klBg72sqqBjnQoglOtAlOmZFucip02CI5jYeeF zbzGuQGNwpRs85odgo7FBKIlgjgurfUmew== X-Received: by 2002:a62:cf02:0:b029:307:f3d:6a2a with SMTP id b2-20020a62cf020000b02903070f3d6a2amr4466948pfg.9.1624992919854; Tue, 29 Jun 2021 11:55:19 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 38/63] tcg/aarch64: Support bswap flags Date: Tue, 29 Jun 2021 11:54:30 -0700 Message-Id: <20210629185455.3131172-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?b?YXVkw6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c.inc | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.25.1 diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 8619e54fca..72aa7e0e74 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -2177,12 +2177,24 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_out_rev(s, TCG_TYPE_I64, MO_64, a0, a1); break; case INDEX_op_bswap32_i64: + tcg_out_rev(s, TCG_TYPE_I32, MO_32, a0, a1); + if (a2 & TCG_BSWAP_OS) { + tcg_out_sxt(s, TCG_TYPE_I64, MO_32, a0, a0); + } + break; case INDEX_op_bswap32_i32: tcg_out_rev(s, TCG_TYPE_I32, MO_32, a0, a1); break; case INDEX_op_bswap16_i64: case INDEX_op_bswap16_i32: tcg_out_rev(s, TCG_TYPE_I32, MO_16, a0, a1); + if (a2 & TCG_BSWAP_OS) { + /* Output must be sign-extended. */ + tcg_out_sxt(s, ext, MO_16, a0, a0); + } else if ((a2 & (TCG_BSWAP_IZ | TCG_BSWAP_OZ)) == TCG_BSWAP_OZ) { + /* Output must be zero-extended, but input isn't. */ + tcg_out_uxt(s, MO_16, a0, a0); + } break; case INDEX_op_ext8s_i64: From patchwork Tue Jun 29 18:54:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468329 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5250610jao; Tue, 29 Jun 2021 12:25:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJza4ML9Cu7+OU8omX+CjpeLzK2sXsP+cQDMdMmn8XKqu7DPaUowPShLeEDxj/PC+DK1aI53 X-Received: by 2002:a25:a225:: with SMTP id b34mr39933198ybi.485.1624994719837; Tue, 29 Jun 2021 12:25:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994719; cv=none; d=google.com; s=arc-20160816; b=YBTjiWMb8MeSa9/RQCFX4W3ZJJvyXcJryQ2oG8j0czc1dXhe5KvspnrA0Tjlz1+Dbm ObiU59CFCFYvM2Lk+S4kjocyHXngNvVlkWTwH3KJNj0RnoCsc+2kiDFADhIqxwvOdqX1 Ewm0oAW1Eyb1FkucYROXp5e3+Jz8t5Qht2CGWNEopEN4+Q+oFMXTF4STwqfLPIRf1J0a zg4WmUC59oskQeF2b7gSM3UgFJQOrdFaRtAmOzg13Xs8tYSIlcwcn5DbjER5Mlx+H5um Hr3CY/Mf76VW6481ideTkY12ilf3ley+jIk6/cmwYQRckxfy+sw82pPj7Xog08gpzjap 0tUw== 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=4YyQO3FbDlFClyDWmJjxOpZ7dtoBaiXSXTjpxONdiUM=; b=uVp0nkIpapgUJxqikjj5QKTiiRqibbkgv8oBKB1fY+wgbM8UnL0jBODmIOMWMvK1q5 b7QiXUFdIrsHHCVUdi3abdxEcNemhz1Mfka7Csx6djaDnEQ3L06XhaZE/PEc9cCk6JOO y9a1M1xFoOIJqz77cr11jCqFdQmK7/vcgPEyvqcJne32xwEG1wu0E+9wUNYKpvdnbAnd Utpq6RzNK9auCsN3CAgqeQ7GO67P+h9RPEPbjIY55qvRT5tbT+rba7RGgSbLawdtfUw7 c1qAq5CRmdC4ZdmXOo+B19Ea8GpgpTa0I4xCUVtZNpHML/y0GUPe6ve6LrfWOht17E9V BBOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WWr/PUYk"; 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 p3si22045473ybu.289.2021.06.29.12.25.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:25: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=pass header.i=@linaro.org header.s=google header.b="WWr/PUYk"; 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]:33284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJMF-0006BJ-9X for patch@linaro.org; Tue, 29 Jun 2021 15:25:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItV-0000FI-Ev for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:37 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]:33520) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItF-0000zh-RI for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:37 -0400 Received: by mail-pl1-x62e.google.com with SMTP id f11so69844plg.0 for ; Tue, 29 Jun 2021 11:55:21 -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=4YyQO3FbDlFClyDWmJjxOpZ7dtoBaiXSXTjpxONdiUM=; b=WWr/PUYkSSa/zt3903ubJTV2f3TtxRNFDWcAlfLVub1MaHZOvVlpBnDlzTZ3+oBbQ8 jMVqfxEcv4Q3irgjPDhnv1oLMtHNHM07VRk4uQML6IY+uP87wOsbjgv/ZHgV0TKPMDOj 8ksxTIOrKgpWjoF5MS8/oTT1W9UUkyLuvuXLkBtkqj5rcGvhRhS4PqTNZtFyDHwSM9KV 4+RDNy9Gedu3TzIfa/nBGVB8Qkex7SoaWeXSMrYQ7ny9J+rLuJqCnrcp5teT0iM3jD+T nzfHUtYsXU44feFqCfed53DdT05AQ/TXJGemOLnNa2trq0fiFa+ZG0W41GHjyOth5jaw m6VQ== 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=4YyQO3FbDlFClyDWmJjxOpZ7dtoBaiXSXTjpxONdiUM=; b=QnwXEqDYd2FGtRuxmCL4wxpPnSC86JYTQ/t/KAIqu0bBpzEG7AemOZSz7G9wyyO99z r6+CQDuvsgqNgsz3FH8kclejUAre2xXcc1H+RRaYaMBctY2XS/wL2RY8HEOJcTpnIsXB wYbwWqRC6u2FKpaBAIyD/ZLSqVI8OZ6Pbm1FX7HniRKggkJpAkT5Nr0QqQVncNXclENY RGnurxOi3DEADVKAZoXqLKG0d/rQ1YHBqH4uPU2jGV82MgSGfvR78IvCpktI+/64kTWZ xoseVf1KqZ13H2Mr07/uiaI4cNQEL4tYjUEPH5pQ8678gAHc5ETN1JqQviSeFLUuI4P3 O7TA== X-Gm-Message-State: AOAM530oWJKxKAblSU32W9blA8aw0u7xwtglvbsUOVnFjPmIwn1TsN72 2X0U7Y4tyP+4YH9YTHAN96Km7xgP0UTbmw== X-Received: by 2002:a17:902:7806:b029:128:cef0:e4f7 with SMTP id p6-20020a1709027806b0290128cef0e4f7mr13409564pll.14.1624992920467; Tue, 29 Jun 2021 11:55:20 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 39/63] tcg/arm: Support bswap flags Date: Tue, 29 Jun 2021 11:54:31 -0700 Message-Id: <20210629185455.3131172-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Combine the three bswap16 routines, and differentiate via the flags. Use the correct flags combination from the load/store routines, and pass along the constant parameter from tcg_out_op. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 101 ++++++++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 38 deletions(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 5157143246..73e0455511 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -1013,50 +1013,71 @@ static inline void tcg_out_ext16u(TCGContext *s, int cond, } } -static inline void tcg_out_bswap16s(TCGContext *s, int cond, int rd, int rn) +static void tcg_out_bswap16(TCGContext *s, int cond, int rd, int rn, int flags) { if (use_armv6_instructions) { - /* revsh */ - tcg_out32(s, 0x06ff0fb0 | (cond << 28) | (rd << 12) | rn); - } else { - tcg_out_dat_reg(s, cond, ARITH_MOV, - TCG_REG_TMP, 0, rn, SHIFT_IMM_LSL(24)); - tcg_out_dat_reg(s, cond, ARITH_MOV, - TCG_REG_TMP, 0, TCG_REG_TMP, SHIFT_IMM_ASR(16)); - tcg_out_dat_reg(s, cond, ARITH_ORR, - rd, TCG_REG_TMP, rn, SHIFT_IMM_LSR(8)); - } -} + if (flags & TCG_BSWAP_OS) { + /* revsh */ + tcg_out32(s, 0x06ff0fb0 | (cond << 28) | (rd << 12) | rn); + return; + } -static inline void tcg_out_bswap16(TCGContext *s, int cond, int rd, int rn) -{ - if (use_armv6_instructions) { /* rev16 */ tcg_out32(s, 0x06bf0fb0 | (cond << 28) | (rd << 12) | rn); - } else { - tcg_out_dat_reg(s, cond, ARITH_MOV, - TCG_REG_TMP, 0, rn, SHIFT_IMM_LSL(24)); - tcg_out_dat_reg(s, cond, ARITH_MOV, - TCG_REG_TMP, 0, TCG_REG_TMP, SHIFT_IMM_LSR(16)); - tcg_out_dat_reg(s, cond, ARITH_ORR, - rd, TCG_REG_TMP, rn, SHIFT_IMM_LSR(8)); + if ((flags & (TCG_BSWAP_IZ | TCG_BSWAP_OZ)) == TCG_BSWAP_OZ) { + /* uxth */ + tcg_out32(s, 0x06ff0070 | (cond << 28) | (rd << 12) | rd); + } + return; } -} -/* swap the two low bytes assuming that the two high input bytes and the - two high output bit can hold any value. */ -static inline void tcg_out_bswap16st(TCGContext *s, int cond, int rd, int rn) -{ - if (use_armv6_instructions) { - /* rev16 */ - tcg_out32(s, 0x06bf0fb0 | (cond << 28) | (rd << 12) | rn); - } else { + if (flags == 0) { + /* + * For stores, no input or output extension: + * rn = xxAB + * lsr tmp, rn, #8 tmp = 0xxA + * and tmp, tmp, #0xff tmp = 000A + * orr rd, tmp, rn, lsl #8 rd = xABA + */ tcg_out_dat_reg(s, cond, ARITH_MOV, TCG_REG_TMP, 0, rn, SHIFT_IMM_LSR(8)); tcg_out_dat_imm(s, cond, ARITH_AND, TCG_REG_TMP, TCG_REG_TMP, 0xff); tcg_out_dat_reg(s, cond, ARITH_ORR, rd, TCG_REG_TMP, rn, SHIFT_IMM_LSL(8)); + return; } + + /* + * Byte swap, leaving the result at the top of the register. + * We will then shift down, zero or sign-extending. + */ + if (flags & TCG_BSWAP_IZ) { + /* + * rn = 00AB + * ror tmp, rn, #8 tmp = B00A + * orr tmp, tmp, tmp, lsl #16 tmp = BA00 + */ + tcg_out_dat_reg(s, cond, ARITH_MOV, + TCG_REG_TMP, 0, rn, SHIFT_IMM_ROR(8)); + tcg_out_dat_reg(s, cond, ARITH_ORR, + TCG_REG_TMP, TCG_REG_TMP, TCG_REG_TMP, + SHIFT_IMM_LSL(16)); + } else { + /* + * rn = xxAB + * and tmp, rn, #0xff00 tmp = 00A0 + * lsl tmp, tmp, #8 tmp = 0A00 + * orr tmp, tmp, rn, lsl #24 tmp = BA00 + */ + tcg_out_dat_rI(s, cond, ARITH_AND, TCG_REG_TMP, rn, 0xff00, 1); + tcg_out_dat_reg(s, cond, ARITH_MOV, + TCG_REG_TMP, 0, TCG_REG_TMP, SHIFT_IMM_LSL(8)); + tcg_out_dat_reg(s, cond, ARITH_ORR, + TCG_REG_TMP, TCG_REG_TMP, rn, SHIFT_IMM_LSL(24)); + } + tcg_out_dat_reg(s, cond, ARITH_MOV, rd, 0, TCG_REG_TMP, + (flags & TCG_BSWAP_OS + ? SHIFT_IMM_ASR(8) : SHIFT_IMM_LSR(8))); } static inline void tcg_out_bswap32(TCGContext *s, int cond, int rd, int rn) @@ -1705,13 +1726,15 @@ static inline void tcg_out_qemu_ld_index(TCGContext *s, MemOp opc, case MO_UW: tcg_out_ld16u_r(s, COND_AL, datalo, addrlo, addend); if (bswap) { - tcg_out_bswap16(s, COND_AL, datalo, datalo); + tcg_out_bswap16(s, COND_AL, datalo, datalo, + TCG_BSWAP_IZ | TCG_BSWAP_OZ); } break; case MO_SW: if (bswap) { tcg_out_ld16u_r(s, COND_AL, datalo, addrlo, addend); - tcg_out_bswap16s(s, COND_AL, datalo, datalo); + tcg_out_bswap16(s, COND_AL, datalo, datalo, + TCG_BSWAP_IZ | TCG_BSWAP_OS); } else { tcg_out_ld16s_r(s, COND_AL, datalo, addrlo, addend); } @@ -1766,13 +1789,15 @@ static inline void tcg_out_qemu_ld_direct(TCGContext *s, MemOp opc, case MO_UW: tcg_out_ld16u_8(s, COND_AL, datalo, addrlo, 0); if (bswap) { - tcg_out_bswap16(s, COND_AL, datalo, datalo); + tcg_out_bswap16(s, COND_AL, datalo, datalo, + TCG_BSWAP_IZ | TCG_BSWAP_OZ); } break; case MO_SW: if (bswap) { tcg_out_ld16u_8(s, COND_AL, datalo, addrlo, 0); - tcg_out_bswap16s(s, COND_AL, datalo, datalo); + tcg_out_bswap16(s, COND_AL, datalo, datalo, + TCG_BSWAP_IZ | TCG_BSWAP_OS); } else { tcg_out_ld16s_8(s, COND_AL, datalo, addrlo, 0); } @@ -1862,7 +1887,7 @@ static inline void tcg_out_qemu_st_index(TCGContext *s, int cond, MemOp opc, break; case MO_16: if (bswap) { - tcg_out_bswap16st(s, cond, TCG_REG_R0, datalo); + tcg_out_bswap16(s, cond, TCG_REG_R0, datalo, 0); tcg_out_st16_r(s, cond, TCG_REG_R0, addrlo, addend); } else { tcg_out_st16_r(s, cond, datalo, addrlo, addend); @@ -1907,7 +1932,7 @@ static inline void tcg_out_qemu_st_direct(TCGContext *s, MemOp opc, break; case MO_16: if (bswap) { - tcg_out_bswap16st(s, COND_AL, TCG_REG_R0, datalo); + tcg_out_bswap16(s, COND_AL, TCG_REG_R0, datalo, 0); tcg_out_st16_8(s, COND_AL, TCG_REG_R0, addrlo, 0); } else { tcg_out_st16_8(s, COND_AL, datalo, addrlo, 0); @@ -2245,7 +2270,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, break; case INDEX_op_bswap16_i32: - tcg_out_bswap16(s, COND_AL, args[0], args[1]); + tcg_out_bswap16(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_bswap32_i32: tcg_out_bswap32(s, COND_AL, args[0], args[1]); From patchwork Tue Jun 29 18:54:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468352 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5261046jao; Tue, 29 Jun 2021 12:42:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLMWwTF+J6logiJ9zCLlEVGBx3f1r954/he8u9u7j2D8q0BFqW2r5w1yla9EbfiboWvjIq X-Received: by 2002:ac8:7f87:: with SMTP id z7mr1519642qtj.238.1624995776327; Tue, 29 Jun 2021 12:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995776; cv=none; d=google.com; s=arc-20160816; b=0mt0quFX726a5oCGT2LkaA7wNaPl3bCQgqlpUD2UhB92/u3PCd97HbT9iJVy5iJFsk MezSV74K4kDjqpkj+eUlaz2Ev7esG89xMsucLMHu99OMfGSyVmDM307i+KFnp7OmCA7l tqm0IxbaqzhpjXE6S/ml1JMqsOABaX4pope//iQm0Wfbzk0HIi9wzHkYSa8IYvL6BiWk +C7qcZDEMEy22S9e5pKsg+Ya0ud5/jm3s+SWTu20Wm5riQRmQmfo1/29u31kVa2bMgBa 852uRLpv1uOPw5S2dGDPJ7ey1Q+VBDTI1IHz6ZDJGAUU+3Xgrf4mVEsrGtoBb9tMOzYj mtxA== 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=nkUwvYz/H7E5G0Q9SrKLVPmT+1u2d8aWX4+EJ+0VG1o=; b=dicSmLAizdTA0IkLWQRYzSMWO+9a42aGLgCov/Ks8acrjCJ6RvBDRM9yDSovKSPrRV 0FnaEJgJJoIgWMHtw/poOBn3GKrlGfQ2O4fpo02weDr19yalansEyrF++q58JW+IKLsK 7ywF5qR5huslq/ISn3WAP2L8XmWId/2eTay4k9uByLqhrSZ8WGrXiPZGD5NccgbizExC NYd3nhU1JO9FpMfK48/KR4Z8kbzyTlR7eoGtAmf6kVbapa1ZAPvZZz0Vn0fwUBjTetyp LJiz184N9Kdw4UBIk/c5Z7ON2v3jyi+bUqVUdu/2+ONrEsjoXeBMhGo+9MMedLBnEiDY fhBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=VK8QqAfD; 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 w15si13842019qkj.63.2021.06.29.12.42.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:42: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=fail header.i=@linaro.org header.s=google header.b=VK8QqAfD; 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]:38556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJdH-0006ru-N8 for patch@linaro.org; Tue, 29 Jun 2021 15:42:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwD-0003xH-Vz for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:26 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:46886) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwA-0002wu-TR for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:25 -0400 Received: by mail-pj1-x102f.google.com with SMTP id b5-20020a17090a9905b029016fc06f6c5bso3081661pjp.5 for ; Tue, 29 Jun 2021 11:58:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nkUwvYz/H7E5G0Q9SrKLVPmT+1u2d8aWX4+EJ+0VG1o=; b=VK8QqAfDxNWf3pwj17kQSMHzB0I7Pr/P3JtXMyAUmY68wabdQvi1VaZ5PB88BWAM9P R0ylYoV8SyOHXxWxnZwuwgBaymk4VAebLb1jC45wSzlD8pZG05g+yJLvAue6gu30hU8E b7cqxiG/x3LEl4IYpsCyRXw0n1EfpI/AZHJBvSkL7dxhcsSrzCye+JmV4DPbavqmvr3v uBsYt8Orq1hPKRdGvXk45QfClFgmAP2XPHRk+46G92Fjfxbi3CqAPX2ZZ0FR3iV71oya 2f+O+rOBe0fYomBRBlqrzQrgkHeDz5izUTDaZPBIszBrH20KOas7+OYicFvy0c8eHX1N EtdA== 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=nkUwvYz/H7E5G0Q9SrKLVPmT+1u2d8aWX4+EJ+0VG1o=; b=Xy+nLWApB6NbatgW91qSFzlepZtSM0wbDHfhQ7bmP7QTwnc52f35r8fPvkVIlRQxAG f0GoLkpHZF+NfRhmd8fuF6xGavp31OLbPtrJhP2LPdGOQDjMgCD0cPDoNyknUwWFB+Ao En0tu5D/fe+EnoRjFOtzME42+ovFEWm9g5y8wk7LMVmXAWGti2fhgMZ0vE6KvVDg/WrZ KCZAky2EsR6kqSMkM8esHVn689C730bHMLp49TqSFchjM7I/QQ6p5HzuPYkhYDVtjJ1j QeLMMOOTxXUrWomL2vRRANVHKidA7GBoUX3rNfwjJsUfo/sp+kLpahIzZlY5l0tg2+Ah 1QiA== X-Gm-Message-State: AOAM5325xpCiJetO4ve5yO14QLomZRZ4niyGPe7ZNVAqpJ0KihxIVeMP veiijcWPY4+qt8x/B3W9w+qQeL/rFm+PMA== X-Received: by 2002:a17:902:c602:b029:127:a3a2:4951 with SMTP id r2-20020a170902c602b0290127a3a24951mr25460046plr.65.1624993101477; Tue, 29 Jun 2021 11:58:21 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 40/63] tcg/ppc: Split out tcg_out_ext{8,16,32}s Date: Tue, 29 Jun 2021 11:54:32 -0700 Message-Id: <20210629185455.3131172-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?b?YXVkw6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We will shortly require these in other context; make the expansion as clear as possible. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) -- 2.25.1 diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 795701442b..aa35ff8250 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -738,6 +738,21 @@ static inline void tcg_out_rlw(TCGContext *s, int op, TCGReg ra, TCGReg rs, tcg_out32(s, op | RA(ra) | RS(rs) | SH(sh) | MB(mb) | ME(me)); } +static inline void tcg_out_ext8s(TCGContext *s, TCGReg dst, TCGReg src) +{ + tcg_out32(s, EXTSB | RA(dst) | RS(src)); +} + +static inline void tcg_out_ext16s(TCGContext *s, TCGReg dst, TCGReg src) +{ + tcg_out32(s, EXTSH | RA(dst) | RS(src)); +} + +static inline void tcg_out_ext32s(TCGContext *s, TCGReg dst, TCGReg src) +{ + tcg_out32(s, EXTSW | RA(dst) | RS(src)); +} + static inline void tcg_out_ext32u(TCGContext *s, TCGReg dst, TCGReg src) { tcg_out_rld(s, RLDICL, dst, src, 0, 32); @@ -2322,7 +2337,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const int const_args[TCG_MAX_OP_ARGS]) { TCGArg a0, a1, a2; - int c; switch (opc) { case INDEX_op_exit_tb: @@ -2390,7 +2404,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, case INDEX_op_ld8s_i32: case INDEX_op_ld8s_i64: tcg_out_mem_long(s, LBZ, LBZX, args[0], args[1], args[2]); - tcg_out32(s, EXTSB | RS(args[0]) | RA(args[0])); + tcg_out_ext8s(s, args[0], args[0]); break; case INDEX_op_ld16u_i32: case INDEX_op_ld16u_i64: @@ -2728,18 +2742,15 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, case INDEX_op_ext8s_i32: case INDEX_op_ext8s_i64: - c = EXTSB; - goto gen_ext; + tcg_out_ext8s(s, args[0], args[1]); + break; case INDEX_op_ext16s_i32: case INDEX_op_ext16s_i64: - c = EXTSH; - goto gen_ext; + tcg_out_ext16s(s, args[0], args[1]); + break; case INDEX_op_ext_i32_i64: case INDEX_op_ext32s_i64: - c = EXTSW; - goto gen_ext; - gen_ext: - tcg_out32(s, c | RS(args[1]) | RA(args[0])); + tcg_out_ext32s(s, args[0], args[1]); break; case INDEX_op_extu_i32_i64: tcg_out_ext32u(s, args[0], args[1]); From patchwork Tue Jun 29 18:54:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468355 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5262785jao; Tue, 29 Jun 2021 12:45:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDP3n3Aq6bjAwsgr0NQXzlPHQ6xdGyEB1V8Cb9ZoPgwxFJy0qtSAYB7EedqdM3BzoyA2gm X-Received: by 2002:a05:6102:21b3:: with SMTP id i19mr26505652vsb.41.1624995952039; Tue, 29 Jun 2021 12:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995952; cv=none; d=google.com; s=arc-20160816; b=f0/opRLxjMKO9hqko3l8gBIOZS0SAvzHNhffuSK6zVI8Vpo02h7g4FombPeezhiIDP BiWHXI1y2N5A0YNDoGMoT44kAoosjheaL+hnfVcY/C61qcjFxCO5BcmsISMC9J4WbCFh pIMUvz0kcmqvDrk7E11Y1YbHxv84GWPE9hb3cUcsJ5HQ7Eql3wYdKNehCbH9PmIjQRcY djNz1wPUu3MJLNtOvvmUw/u91zohaQUFQ3xp5CGSAziffpw4xPLRIVZRiTkZP3dOuKRh bEJzj45UB/8DW0UKRj/LpjJ4EsNIfhcafqvweBKaXmC+Ho0k1g3+P1dYF8i2HiWkV4bW i7oQ== 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=fXrizxcUnvvf6PXr7Yc72AhaPXA1gSYgiDq85iqI09c=; b=e1tsEqacxmOu2DHpVZ7Hrzc5nSV8hgaPejumURnaT01ee+aNC0jhQiXmVSf0/LFnrA DYzout3JctMZPuS6z6pR4VRoEelEoDTGTkN4suRExUX7T9d1ZKv/sFAAQkYREV9lQ7go dATGUM3A/fwy5r7OC885SinRDpeK1F7U475KcEM4H2tTB6o/twboCdYt9ucOTjGWUsnV viL0t65MRsTibJxI/52tPAHY4AIiFUHyPEgmelYo4MNLIy0M43EPqGk5EbrlK21pH1Kr WvtxoHo8RBrF2quXqlLBxDa2DYpqJ15Mudp3r9di6cSjg+DIBE+Exzh5LI16jPTvbudI Dh1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eXW4preP; 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 p23si10336387vsm.394.2021.06.29.12.45.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:45:52 -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=eXW4preP; 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]:47336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJg7-0004R5-6Y for patch@linaro.org; Tue, 29 Jun 2021 15:45:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwH-0003yj-Hj for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:30 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:54204) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwC-0002xZ-7r for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:29 -0400 Received: by mail-pj1-x1036.google.com with SMTP id q91so142980pjk.3 for ; Tue, 29 Jun 2021 11:58:23 -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=fXrizxcUnvvf6PXr7Yc72AhaPXA1gSYgiDq85iqI09c=; b=eXW4prePy3Lf1Se7IA+P5zotkPGKPaWBvHrZhZO8vxGR8al4hnb6+3HBfnuQURsG7X OBhdjyoQMFuOGV5zq76NGKHbwiwUvvLPKzJv1L/PT5zbXGrTok4GPvZxgIhoJSwAv17L 9byE/q4MTgWtlmYDjLqaEGDcHcvCjxGJh/KgQ9r01HpimWuwCb4oRaUhrcSNdVtckHub OIjel75mtskoI5nC8sC+jnOtCgGPZpsCDqJNN111nP9qX1w1baNJBO1LdeltPQe1ir7N j6bp5iy3PHvXbY1XVsrekl45Ms1FMVgtqR56sTGdjsfymH/GBt1bZyJIW3G0tvCTyF0D QrKg== 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=fXrizxcUnvvf6PXr7Yc72AhaPXA1gSYgiDq85iqI09c=; b=bn/bAQVv/bA820j4KWUqzMGdhkCTE+A+GM+r9Yj3LT2rA/Q7+3WOphBpf83G0sZpVO HtLwDL8VUIUOwqV3nxSdmzXTL/BcFZJ5ecvw5UG1axb4FPAGqRC5iMSchElIaNl4/5Qn 4nKsXS+spYQCNrk7W2wAHOQe2FgFNJ5ZTz2rDmdgzNc9RfHprHF9+VQdPgHstaGi9ZK6 Vso6e+V032+9NxSy7+DOjIdhFSf2uslVjcfofEdD17gR+kvttocuORFlEse5q9xlPJ0X /aC+n+GUU2Y9kry8pHXNxEdY1T48BwHuHz3kUhIxsuGECjI8y0Y6qa1qPIpoFRqQ5lQV 0LwQ== X-Gm-Message-State: AOAM532Y9O8uCpGd0ZJNSH09bXDglgNX+PXX9AHe0I4NatXEm+/hBrob 6aIueu0flu/CwAad9oIEZRXfytSNx7HS8A== X-Received: by 2002:a17:902:e548:b029:124:5738:cd9b with SMTP id n8-20020a170902e548b02901245738cd9bmr28555466plf.37.1624993102375; Tue, 29 Jun 2021 11:58:22 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 41/63] tcg/ppc: Split out tcg_out_sari{32,64} Date: Tue, 29 Jun 2021 11:54:33 -0700 Message-Id: <20210629185455.3131172-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We will shortly require sari in other context; split out both for cleanliness sake. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index aa35ff8250..50347182d7 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -768,6 +768,12 @@ static inline void tcg_out_shli64(TCGContext *s, TCGReg dst, TCGReg src, int c) tcg_out_rld(s, RLDICR, dst, src, c, 63 - c); } +static inline void tcg_out_sari32(TCGContext *s, TCGReg dst, TCGReg src, int c) +{ + /* Limit immediate shift count lest we create an illegal insn. */ + tcg_out32(s, SRAWI | RA(dst) | RS(src) | SH(c & 31)); +} + static inline void tcg_out_shri32(TCGContext *s, TCGReg dst, TCGReg src, int c) { tcg_out_rlw(s, RLWINM, dst, src, 32 - c, c, 31); @@ -778,6 +784,11 @@ static inline void tcg_out_shri64(TCGContext *s, TCGReg dst, TCGReg src, int c) tcg_out_rld(s, RLDICL, dst, src, 64 - c, c); } +static inline void tcg_out_sari64(TCGContext *s, TCGReg dst, TCGReg src, int c) +{ + tcg_out32(s, SRADI | RA(dst) | RS(src) | SH(c & 0x1f) | ((c >> 4) & 2)); +} + /* Emit a move into ret of arg, if it can be done in one insn. */ static bool tcg_out_movi_one(TCGContext *s, TCGReg ret, tcg_target_long arg) { @@ -2601,8 +2612,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, break; case INDEX_op_sar_i32: if (const_args[2]) { - /* Limit immediate shift count lest we create an illegal insn. */ - tcg_out32(s, SRAWI | RS(args[1]) | RA(args[0]) | SH(args[2] & 31)); + tcg_out_sari32(s, args[0], args[1], args[2]); } else { tcg_out32(s, SRAW | SAB(args[1], args[0], args[2])); } @@ -2690,8 +2700,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, break; case INDEX_op_sar_i64: if (const_args[2]) { - int sh = SH(args[2] & 0x1f) | (((args[2] >> 5) & 1) << 1); - tcg_out32(s, SRADI | RA(args[0]) | RS(args[1]) | sh); + tcg_out_sari64(s, args[0], args[1], args[2]); } else { tcg_out32(s, SRAD | SAB(args[1], args[0], args[2])); } From patchwork Tue Jun 29 18:54:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468358 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5264935jao; Tue, 29 Jun 2021 12:49:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpr70LoTPfAUfbiO6JXcRJPdyGR1YpDZc+pi3E+/4XjngVst73wVoT4tBHMS8M7gphVyvN X-Received: by 2002:a67:e9c5:: with SMTP id q5mr17807533vso.4.1624996167934; Tue, 29 Jun 2021 12:49:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996167; cv=none; d=google.com; s=arc-20160816; b=nt8tWZmtWqtO5SWcmBYDrS+IQAyUEHIQNJDR5QiwFfyuVyA3vu++x4Bxv12Vm2to7q Z7NrB+DxkUxvOWi5oaJc3m1sE73VF7jKk2V0KrVjHqILaFUWNXUAoImkmbC7AZatfEvO d0VRgznN1WJD3C2zD79Vujn4Pqr0vyLQJwaXbHSxqIja5oTwUcagJkkaqDXDuFCijx9L /2WD8kajVl77hLM7RLimXgxHJoW84GPQEK401KWc71yf2Qf603CrDrXIrwSkfw45Sy9j jfB14n7USUkN9rehTB2hKuxhsN08+8ljnpBwlqm1vflGOh7SU/iQ7yklk59XTeZM1DbR AoHg== 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=+KG72/HkSkkW/EnHZzWfX4mj5faPrZ7wY+xxoD2yGxc=; b=YxZxwLVO+VVtSWK/7IlINLlR+2j+oi1u7RhZWc9+rgbxnmsv1T5VYwxk51CiTmyfeL 0/X4lRBGInhtEWv52itiIimHD7BYrBvA6iw874i4Fh6fu2EZ+45Lt7I7w2Oa67xwK0dz 3HXJtv1csJr58X+klARYeBhVWSXTWiFN0l0qLK3+teykUnpFxTj9R5ZJI9SvFFkMhbUs OSaDv06d2SWdWtskINY0ikzuwOiv7elEJg1bBU5ckzRjDef00XVy35tNHW1ZWtinuiCm S+Ta6Us6WW9PCqxlnenLImu9ZN4DOxyi3TwzZfaeRvk5o5AD+DFdzr57BpQ34YxPF+T4 j/bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="G859DM/L"; 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 x18si15822452vsr.302.2021.06.29.12.49.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:49:27 -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="G859DM/L"; 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]:55974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJjb-0001xG-CK for patch@linaro.org; Tue, 29 Jun 2021 15:49:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwN-00040v-0H for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:36 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:42876) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwC-0002xi-8g for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:32 -0400 Received: by mail-pj1-x1030.google.com with SMTP id ce18-20020a17090aff12b0290170a3e3eb07so3093332pjb.1 for ; Tue, 29 Jun 2021 11:58:23 -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=+KG72/HkSkkW/EnHZzWfX4mj5faPrZ7wY+xxoD2yGxc=; b=G859DM/LoMEcQliF0zGqf5jbuXDOtmfhbHTmy+XTD4xYMX7GhJPNtkD2eedpX3u2tl 0lz7mG63WWrzSMmIb/+Fs2bQtIG9R/ym9yfU5awy3ebS8sygS6+2h28HWlp0+SO1J4P5 PUyuCk2f24d8kk8glVqEAPj7T8xoKbNtR7vf9uyMYpz0sUbGygi/PF9mRnshr2d3BTKM QMsOLrPdPjNclyt+nXFKi04gU0K4+DZtVe+YNeX4t0va1MJReq86hg0NF6rYoJrCS45W l6FyHPAkliO2z8J8Ql82IaidHlzi4WKwWFwxueDpcOJjbKGzjPAwfb6r/Wt0H8cHr98U Cu6w== 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=+KG72/HkSkkW/EnHZzWfX4mj5faPrZ7wY+xxoD2yGxc=; b=mHvNa1HSS8hBbMLmCy38b2c0RvGz6VGiDQVmg4LyVzppkFcvbbnWbaGtfwBHBDxffD YeQWJltt6SuPGDzQ/TyVFiuo1cJrtUOl2YOW1fX4CHRK0Cmwq4n6SL7SvooxazHGe2iI 01sp9oKrsC8AjdmbEfqZHPeYkOkkXBB1zdTUiopFVnF7tOWA843yyOS07hT2jbOTQgIQ WqN+Qx7u4wJIbNVTM/4x67ID2xBRIbWbylAy3NAwVGoIFy1hKxp7OKhASmA2V94hPPvL vtEzW/5x7hSuhV0L2AFbPpxAAXOkDJi336Tw5kEGn2UV2En/sjUhRFWmps2lMoGNBxU6 rodw== X-Gm-Message-State: AOAM530yP/0r/D1LACL0Ymw19xhjxPMBYXPVSnrk18eayaIx8fj5sLiS krvGGLsYTyiU+fn/LeG+pJP0pSaZKuwNNg== X-Received: by 2002:a17:90a:a607:: with SMTP id c7mr35657392pjq.199.1624993103032; Tue, 29 Jun 2021 11:58:23 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 42/63] tcg/ppc: Split out tcg_out_bswap16 Date: Tue, 29 Jun 2021 11:54:34 -0700 Message-Id: <20210629185455.3131172-43-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" With the use of a suitable temporary, we can use the same algorithm when src overlaps dst. The result is the same number of instructions either way. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) -- 2.25.1 diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 50347182d7..ad46ce32ca 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -789,6 +789,24 @@ static inline void tcg_out_sari64(TCGContext *s, TCGReg dst, TCGReg src, int c) tcg_out32(s, SRADI | RA(dst) | RS(src) | SH(c & 0x1f) | ((c >> 4) & 2)); } +static void tcg_out_bswap16(TCGContext *s, TCGReg dst, TCGReg src) +{ + TCGReg tmp = dst == src ? TCG_REG_R0 : dst; + + /* + * In the following, + * dep(a, b, m) -> (a & ~m) | (b & m) + * + * Begin with: src = xxxxabcd + */ + /* tmp = rol32(src, 24) & 0x000000ff = 0000000c */ + tcg_out_rlw(s, RLWINM, tmp, src, 24, 24, 31); + /* tmp = dep(tmp, rol32(src, 8), 0x0000ff00) = 000000dc */ + tcg_out_rlw(s, RLWIMI, tmp, src, 8, 16, 23); + + tcg_out_mov(s, TCG_TYPE_REG, dst, tmp); +} + /* Emit a move into ret of arg, if it can be done in one insn. */ static bool tcg_out_movi_one(TCGContext *s, TCGReg ret, tcg_target_long arg) { @@ -2779,21 +2797,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, case INDEX_op_bswap16_i32: case INDEX_op_bswap16_i64: - a0 = args[0], a1 = args[1]; - /* a1 = abcd */ - if (a0 != a1) { - /* a0 = (a1 r<< 24) & 0xff # 000c */ - tcg_out_rlw(s, RLWINM, a0, a1, 24, 24, 31); - /* a0 = (a0 & ~0xff00) | (a1 r<< 8) & 0xff00 # 00dc */ - tcg_out_rlw(s, RLWIMI, a0, a1, 8, 16, 23); - } else { - /* r0 = (a1 r<< 8) & 0xff00 # 00d0 */ - tcg_out_rlw(s, RLWINM, TCG_REG_R0, a1, 8, 16, 23); - /* a0 = (a1 r<< 24) & 0xff # 000c */ - tcg_out_rlw(s, RLWINM, a0, a1, 24, 24, 31); - /* a0 = a0 | r0 # 00dc */ - tcg_out32(s, OR | SAB(TCG_REG_R0, a0, a0)); - } + tcg_out_bswap16(s, args[0], args[1]); break; case INDEX_op_bswap32_i32: From patchwork Tue Jun 29 18:54:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468334 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5252638jao; Tue, 29 Jun 2021 12:28:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjoqf5fgUuUkFmrSdeCm6rEhGIpB8DAOEt8wl3gx6cR1X/v1c2k9/ZNudsDMhYkesXcWhL X-Received: by 2002:a25:7089:: with SMTP id l131mr41694109ybc.1.1624994938326; Tue, 29 Jun 2021 12:28:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994938; cv=none; d=google.com; s=arc-20160816; b=tX/3gw18wcspBzEwVZBeBERmcAea0mHMQ5ocz5KeevRlN3CJ7Vr3gIdw1eRpaTu9Vf CnkR7Ogc7a8V6CVlnfCi3jSpfu+JjDuUHutya18rqkO2H6Pec4L4DvQtEEWOxrD7uGWZ 0x4rSKCqQOBbhZrdVvOIL21MxcNpaN0b1LrNGoFvAZZ6je6d8g6Swo9+4AzSisi7Zlmn knWwNmF48fNxQjQt9Ubrp9hFj9KiQTAcO5vkPcEj4vopBba6SpQPQ/FUXp6hpuLVGK39 3kyLvRhFxVKUGl99E+lkV0DfAWC/vtpy5WbkjFPaxBWgHbLlNeQ2XUEtTqzwlHQL+6bG FU2w== 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=geg8YV4vkZJiwMubrDP+L2xIQBW7poD/N+KgWkQ7RQQ=; b=wqmhha2ETHm8PFgai0q0cy4OXZj8S/GHY9NHHV/as+el3ImvLiX3DjJnLNvbFBmpuG CWId/RgUjFnkebrPm3zrTJc7bVsS1PD4SpuYPMALF2eLFvBp4+9YcCKKbxOb6w7mzcox C3h71JxEfu6Socvn0lMcv/OjNBM9DDl/Ov2qkuqacag30AQN4Lnn7pyl4LiKDXP9jd9W 8afkwb815+mwLzY/i1CoIGxqV9fPwS+jtv/yItyr1ehHdgrhNFRQwWcXJKIpEfESA88z mIGlNCFBb4r40f1hm1z1keamWy7eJxGRgWI7H4PedIEtUm63dlipB99loJcUSk1nB8eP LWVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w5neFRv8; 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 z1si17257745ybj.455.2021.06.29.12.28.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:28:58 -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=w5neFRv8; 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]:48272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJPl-0007pz-Pv for patch@linaro.org; Tue, 29 Jun 2021 15:28:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwO-00041S-Sd for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:38 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:39868) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwD-0002xv-OT for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:36 -0400 Received: by mail-pl1-x634.google.com with SMTP id d1so37356plg.6 for ; Tue, 29 Jun 2021 11:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=geg8YV4vkZJiwMubrDP+L2xIQBW7poD/N+KgWkQ7RQQ=; b=w5neFRv8BuwUC6mqB1YSyUowxF1dgD25fXXl0uyPWM9F1/yOyqpyn9A6xCwsv/UW7X oU8MpLqM3xIFJd88C4i3JjPcpGPIePCSwkRJ0zg7O5RH1ETPtvoDYKoLDiHpU3AvyNnZ 1IwUB8hhTrKtnmon2URReGTUBAHSVTdPb5wQwnpjrcYGTxyf+XLNEj6xP1c/H4efxAuF csD3rMolq6caXAh0wot4eKDIc+OCUl7IUexAG51bwz0mSee5qe5NpCyppFkkl8v2xc/p QdLIosDAFoVjW+XOmyj00YAsp3SImrquPGEiqiWIgbRlCto6VLC2DkTLSu9Lryt1VmEc g4VA== 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=geg8YV4vkZJiwMubrDP+L2xIQBW7poD/N+KgWkQ7RQQ=; b=exu/8fZjbCuHBWytoKqvBA7HDs5YSH3R6H/nLjLPrF/cBC+smjTgk+hggif7IIximD o72qSKAuMrlUGp2i2p/l29PkwlJ+ruKvmvVMxgMRoolkcS/9ZMCAhCgmySXzIPBassDj n7VKAfo4GjIorsP5iU6pa2toUEBV4KQamGA259o+1MWWAG5Ad+gpfgeUQy69snG2Qntx C4OfhF7bNWG+YLRLtkdBz2AvodKMiXdVIkDrVA81PYt/aNlGpl95hoEg+UymGKU+i+s6 TZveGWQ3nn24DdxLY5TMvDh0syfZWkqzmc9t+1RzH1WSz4r/7oNXazW4Xv3ni4ntwCGR 1G0w== X-Gm-Message-State: AOAM531e+XI8aVsdeFzMPYFuOMsypk2my1YtqeMfTsb/cYvs8ByRB/mw 3IJsfspWqwjr9N9crLimA6roGn88Guz3ig== X-Received: by 2002:a17:902:bd96:b029:129:d5d:668b with SMTP id q22-20020a170902bd96b02901290d5d668bmr1763126pls.5.1624993103718; Tue, 29 Jun 2021 11:58:23 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 43/63] tcg/ppc: Split out tcg_out_bswap32 Date: Tue, 29 Jun 2021 11:54:35 -0700 Message-Id: <20210629185455.3131172-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) -- 2.25.1 diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index ad46ce32ca..28b8671cba 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -807,6 +807,27 @@ static void tcg_out_bswap16(TCGContext *s, TCGReg dst, TCGReg src) tcg_out_mov(s, TCG_TYPE_REG, dst, tmp); } +static void tcg_out_bswap32(TCGContext *s, TCGReg dst, TCGReg src) +{ + TCGReg tmp = dst == src ? TCG_REG_R0 : dst; + + /* + * Stolen from gcc's builtin_bswap32. + * In the following, + * dep(a, b, m) -> (a & ~m) | (b & m) + * + * Begin with: src = xxxxabcd + */ + /* tmp = rol32(src, 8) & 0xffffffff = 0000bcda */ + tcg_out_rlw(s, RLWINM, tmp, src, 8, 0, 31); + /* tmp = dep(tmp, rol32(src, 24), 0xff000000) = 0000dcda */ + tcg_out_rlw(s, RLWIMI, tmp, src, 24, 0, 7); + /* tmp = dep(tmp, rol32(src, 24), 0x0000ff00) = 0000dcba */ + tcg_out_rlw(s, RLWIMI, tmp, src, 24, 16, 23); + + tcg_out_mov(s, TCG_TYPE_REG, dst, tmp); +} + /* Emit a move into ret of arg, if it can be done in one insn. */ static bool tcg_out_movi_one(TCGContext *s, TCGReg ret, tcg_target_long arg) { @@ -2799,24 +2820,9 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, case INDEX_op_bswap16_i64: tcg_out_bswap16(s, args[0], args[1]); break; - case INDEX_op_bswap32_i32: case INDEX_op_bswap32_i64: - /* Stolen from gcc's builtin_bswap32 */ - a1 = args[1]; - a0 = args[0] == a1 ? TCG_REG_R0 : args[0]; - - /* a1 = args[1] # abcd */ - /* a0 = rotate_left (a1, 8) # bcda */ - tcg_out_rlw(s, RLWINM, a0, a1, 8, 0, 31); - /* a0 = (a0 & ~0xff000000) | ((a1 r<< 24) & 0xff000000) # dcda */ - tcg_out_rlw(s, RLWIMI, a0, a1, 24, 0, 7); - /* a0 = (a0 & ~0x0000ff00) | ((a1 r<< 24) & 0x0000ff00) # dcba */ - tcg_out_rlw(s, RLWIMI, a0, a1, 24, 16, 23); - - if (a0 == TCG_REG_R0) { - tcg_out_mov(s, TCG_TYPE_REG, args[0], a0); - } + tcg_out_bswap32(s, args[0], args[1]); break; case INDEX_op_bswap64_i64: From patchwork Tue Jun 29 18:54:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468361 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5266641jao; Tue, 29 Jun 2021 12:52:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymLgAVDSZ8zt2Q0Kbx/QIFSGAD2JHFWeyCJgHg3/L5jsSBYNyDxOSVi42twAu4InqizWep X-Received: by 2002:a25:f504:: with SMTP id a4mr38379811ybe.170.1624996330900; Tue, 29 Jun 2021 12:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996330; cv=none; d=google.com; s=arc-20160816; b=c6oJKWms1zPQIeD1kb9kvS/C+ODERlZ01WXQIww+HUwq0YE6MdJtKVYhjxk/16ixAu Z7ySjhlx6MSO90MBnXiQR6USiSMTOF/d8dbilHJhaRdytjxvBUE6x7ReYlEH8UVlNORS bk8NJXj50CBwv6WAn08E8m5cu/0c67jEXAfipR986s4xf5vIWA2FIaWLdpNqEuc75ooT GZe5aXMGq48eGQQv36splbb+119iwTm5Bqp21JHsV78LNGmq4PFJh22dFX67pF+REFxP /GZmbdLu942Qhs1crDIXYbradhdBtMZBCMcxbkh2jl1t6ybe6xhpXwBvajYlRwCijMBd jy5w== 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=znXqyANfADmzCCKcOL9UkCkEB0KOFuEYMH60SU5HgB4=; b=hw+2RuV6x/05aGIaTN0K6u71Ets8yngrpvsVaysEYDB673UPu+HVN6ylceZR5gKuTa 9SugvVRoRJPBSgiQt26eDIC06nrJaaP8pDzHhFPsspFUi6sVya2OnHeHwsRL/Dfxg15f 0GuXGO3aJuvGcOS29KnQzL5ruZvGhWmOmn+SvrcMskPo1RHdVfEMbWJTTRyVezc2Vj3C WpAR0+YcH+BFEu+QqKVIAkKQNHK+jxjIwOpw3+tKl8E9FseHP428X6Yso3tQ/T03xmWb kILD/v6imwSgoPT56Qe2hnNxV/12Xj4wvzWen3clNlI/4oA6pFuLbe/tKoyTcgQ9a7/J oBzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vNOV8a/y"; 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 v5si18188854ybm.396.2021.06.29.12.52.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:52:10 -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="vNOV8a/y"; 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]:34440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJmE-0006ab-AR for patch@linaro.org; Tue, 29 Jun 2021 15:52:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39664) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwQ-00041o-Ff for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:38 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:44913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwD-0002y0-OT for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:38 -0400 Received: by mail-pj1-x102e.google.com with SMTP id p4-20020a17090a9304b029016f3020d867so3085556pjo.3 for ; Tue, 29 Jun 2021 11:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=znXqyANfADmzCCKcOL9UkCkEB0KOFuEYMH60SU5HgB4=; b=vNOV8a/yi6eF686/WEQ5ay1dw+fDKoDET9uth6jpbGO+8R4vWn00YWm5HYSzPGgmOB /p2SrRj1rRQAw2By3ZV+5rAI9mamVPnEqxdQicqaygXBsqvTCNbQjTCZWmN7klwInqzd SNsntcEou2Tssv8tJqbqDP72HyyX7BKoTfQIY4Itr/HqLwbgq2kuhMR6fFffVJuoOgUz 1qy+klt5E4ocWPhPFdydV/X1UeMNTpsUeP54Cxd1sDQlQs8/JezjLRUMF18Xfbejxrj1 irFvm4foOklcTV8zi9FT0oZG/R1CCW06wNhxsmEqjkmUao5qZqNvsGp2QMYk81i1w1Ft QkrA== 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=znXqyANfADmzCCKcOL9UkCkEB0KOFuEYMH60SU5HgB4=; b=O8L3pGt007Z71jDTD6Neot6C/akDppUdg2JX8vurN+pXwMRjp2gQ4aV1lGV9iiFI2/ T7VVwjrOe4+ifZJuh5L2Q/Slvd5CeCQvUcdy8MDFMALiEEAfED6hbPJFk2v+Pt4FtUUI 0piaunpnZzEPeIenIJRH+UlEhUerEWLxY++l7HNgkrcVDowIf0nhRO8QmAKB4cAKd8YY NzP66EDff92JO+j7WXrahW2V6t250FUt5AE0AhSggTvr9jCpn4oQd4vtmEf2DArPNe79 +7hM1/1CSgDTu/5tGy7ylTU/qm1S9WX2MglkJaO+mcaQFMxaDsaeh7sKUAN1HXnyUaCy 1OuQ== X-Gm-Message-State: AOAM530fUl+xinqPfcmGUNEanW0kr/FdOFExmiqMHcDPrJXyEF4iXAmW FxuHYsI+Tj3FJN8P/QbHrLicbgPeBcgC3Q== X-Received: by 2002:a17:90a:4e0b:: with SMTP id n11mr35599378pjh.155.1624993104196; Tue, 29 Jun 2021 11:58:24 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 44/63] tcg/ppc: Split out tcg_out_bswap64 Date: Tue, 29 Jun 2021 11:54:36 -0700 Message-Id: <20210629185455.3131172-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 64 +++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 30 deletions(-) -- 2.25.1 diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 28b8671cba..da6d10722e 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -828,6 +828,39 @@ static void tcg_out_bswap32(TCGContext *s, TCGReg dst, TCGReg src) tcg_out_mov(s, TCG_TYPE_REG, dst, tmp); } +static void tcg_out_bswap64(TCGContext *s, TCGReg dst, TCGReg src) +{ + TCGReg t0 = dst == src ? TCG_REG_R0 : dst; + TCGReg t1 = dst == src ? dst : TCG_REG_R0; + + /* + * In the following, + * dep(a, b, m) -> (a & ~m) | (b & m) + * + * Begin with: src = abcdefgh + */ + /* t0 = rol32(src, 8) & 0xffffffff = 0000fghe */ + tcg_out_rlw(s, RLWINM, t0, src, 8, 0, 31); + /* t0 = dep(t0, rol32(src, 24), 0xff000000) = 0000hghe */ + tcg_out_rlw(s, RLWIMI, t0, src, 24, 0, 7); + /* t0 = dep(t0, rol32(src, 24), 0x0000ff00) = 0000hgfe */ + tcg_out_rlw(s, RLWIMI, t0, src, 24, 16, 23); + + /* t0 = rol64(t0, 32) = hgfe0000 */ + tcg_out_rld(s, RLDICL, t0, t0, 32, 0); + /* t1 = rol64(src, 32) = efghabcd */ + tcg_out_rld(s, RLDICL, t1, src, 32, 0); + + /* t0 = dep(t0, rol32(t1, 24), 0xffffffff) = hgfebcda */ + tcg_out_rlw(s, RLWIMI, t0, t1, 8, 0, 31); + /* t0 = dep(t0, rol32(t1, 24), 0xff000000) = hgfedcda */ + tcg_out_rlw(s, RLWIMI, t0, t1, 24, 0, 7); + /* t0 = dep(t0, rol32(t1, 24), 0x0000ff00) = hgfedcba */ + tcg_out_rlw(s, RLWIMI, t0, t1, 24, 16, 23); + + tcg_out_mov(s, TCG_TYPE_REG, dst, t0); +} + /* Emit a move into ret of arg, if it can be done in one insn. */ static bool tcg_out_movi_one(TCGContext *s, TCGReg ret, tcg_target_long arg) { @@ -2824,37 +2857,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, case INDEX_op_bswap32_i64: tcg_out_bswap32(s, args[0], args[1]); break; - case INDEX_op_bswap64_i64: - a0 = args[0], a1 = args[1], a2 = TCG_REG_R0; - if (a0 == a1) { - a0 = TCG_REG_R0; - a2 = a1; - } - - /* a1 = # abcd efgh */ - /* a0 = rl32(a1, 8) # 0000 fghe */ - tcg_out_rlw(s, RLWINM, a0, a1, 8, 0, 31); - /* a0 = dep(a0, rl32(a1, 24), 0xff000000) # 0000 hghe */ - tcg_out_rlw(s, RLWIMI, a0, a1, 24, 0, 7); - /* a0 = dep(a0, rl32(a1, 24), 0x0000ff00) # 0000 hgfe */ - tcg_out_rlw(s, RLWIMI, a0, a1, 24, 16, 23); - - /* a0 = rl64(a0, 32) # hgfe 0000 */ - /* a2 = rl64(a1, 32) # efgh abcd */ - tcg_out_rld(s, RLDICL, a0, a0, 32, 0); - tcg_out_rld(s, RLDICL, a2, a1, 32, 0); - - /* a0 = dep(a0, rl32(a2, 8), 0xffffffff) # hgfe bcda */ - tcg_out_rlw(s, RLWIMI, a0, a2, 8, 0, 31); - /* a0 = dep(a0, rl32(a2, 24), 0xff000000) # hgfe dcda */ - tcg_out_rlw(s, RLWIMI, a0, a2, 24, 0, 7); - /* a0 = dep(a0, rl32(a2, 24), 0x0000ff00) # hgfe dcba */ - tcg_out_rlw(s, RLWIMI, a0, a2, 24, 16, 23); - - if (a0 == 0) { - tcg_out_mov(s, TCG_TYPE_REG, args[0], a0); - } + tcg_out_bswap64(s, args[0], args[1]); break; case INDEX_op_deposit_i32: From patchwork Tue Jun 29 18:54:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468362 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5266928jao; Tue, 29 Jun 2021 12:52:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdMQMOAf56Y9E7KFEUVj/XMT40/cBme9ldJlBVL0GQVfdr6CIOeBQdV0RCiJPyJZYdrM1H X-Received: by 2002:ac8:6a06:: with SMTP id t6mr18281044qtr.188.1624996361695; Tue, 29 Jun 2021 12:52:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996361; cv=none; d=google.com; s=arc-20160816; b=quCSI6dz4dox+vmyyG+DZAK6LKBE6fjig83VXqJckR5sDh6d/2Lj3fkPA7MCf1x//V qkEIBbCkG9Psw1pATC0vYuZbWkEYvsq1WBV2qmYQdzBlx/6yik7nOJVPXy8z+X3zUtKN GpVLWnn6OXrCXcVPWApoAhrslQ2jXZZPQ11I6PZhTHqfxVPETWjbbsgsvZ8NTm1kuRGb Ao7xryVyxapKqeOXQ3K+fxbRMO/1L+CuAs6b1FfsxrrBK5lcjvR/1PI2SOMzpdIdgRk3 3Q+3CWNSHfKbHFLwHh67hZ2bpDdzvsfZbPyySrbXrTIospMfIaOfETL01s2+Neyi9Lp/ zLDQ== 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=7msiHj3qRqDXmXMBT7iQkL/E88P+bjdwsV5vRLWQzo8=; b=O9JvCY7bHuEPn0t7o0I2RH9qSQ2Y0bno+/iQ3blHNHmfoMA6Uf9uM39NmgmmsWn/Wk CO9rBNpjfaFPS196or2MfQeOn02NzNxD2zjUzEIYbhxzIHHJy3AdM8lUchV0oj3cAu3S t8aBhPEHh+k25HF7TmGM6N1lD0qPbVVRk42KUWkHnW5iZV0tLmeTd1pZoiqgaVfTuH5J jhE5UYXWrbTGzeD/JcFcC0J6WENQha+DgmjWCyo2IW37cDVVoAfExe+blQ5b4GPJcQXl 0omHkNFjovech9g+/U5vGExrywXKQAuZ4oT0di5tZSdxFoDWRt2kKc3eFWQAMz5Ze8Oo QeWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nI2tZx+i; 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 k7si5321375qkj.28.2021.06.29.12.52.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:52: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=nI2tZx+i; 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]:36820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJmj-0008Cd-4K for patch@linaro.org; Tue, 29 Jun 2021 15:52:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwO-00041d-Si for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:38 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:46061) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwE-0002yc-3j for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:36 -0400 Received: by mail-pl1-x634.google.com with SMTP id i4so24508plt.12 for ; Tue, 29 Jun 2021 11:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7msiHj3qRqDXmXMBT7iQkL/E88P+bjdwsV5vRLWQzo8=; b=nI2tZx+ioZFycQqVGcyE8pgy2N7DHk0YH45MXKU3YlVGFPzcMm4InWi4aoRUTTHxCt 2KFigbT/90RGi6z/lakIy7Zq+CZD2niJxFonV3kgPyZ4+yGfaLJkUE9ZXgtCC5O9HhGQ +x+5lx0zyyE/BkHc2veE52SNErYLuZGkDGfWgSeFfngIcNivItWNNuuXKjDYOW0FXC+Z 4pBr4rZBV7dSOrFIlytYIfO1gnKVapW5+xBdCF03c1ViZNRuZJALfHd698r3Yk/7SZyt YpUYrYtDvvlLeS4QjvIRK1REnoY4ZxQ2lechmYJ4PX/t9dLYBDMEBenf9O8bwIy3DOtL oHFA== 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=7msiHj3qRqDXmXMBT7iQkL/E88P+bjdwsV5vRLWQzo8=; b=dbYoY/JiiOKkDE1e8NC0O2lbVOfpnHs8Al6l5+ZSezKilZvnL2BiO1i5QG2d7gO0uS f34TYLW9wE1DTo2kwoWPFWBBDNrizjEDUkx3WZ3YYz7u/ZsqbEUlewDEcJZa8yRCDKYm UJXyDIT4ChQmkzddhCGV359zF7iJUq9+CqFSBflSTvVK4+pHEU+hv/IbvIUGYPVYuSgl ZJUdskGgNGQtCtqG03gx1LoS2GmCILfTFoKK0PfSPLoZbjU68Jy9pqPG6FvUGtoIzc9Q sRLDnYruJ0MOiENWNnZAvM4lfGL3NSABo64VYuPs+D36I9/6Tz35fWf7YKSGWRqpp7lK OjzA== X-Gm-Message-State: AOAM533Ac0rG4fKaMab7oW/c/vCz/z+mSMmVG4JP62e6oWZtDbJEy883 5VzGZFFrRImtITEoARnO4H1WBA1R3uISnQ== X-Received: by 2002:a17:902:e850:b029:127:a2ed:9924 with SMTP id t16-20020a170902e850b0290127a2ed9924mr25259103plg.57.1624993104866; Tue, 29 Jun 2021 11:58:24 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 45/63] tcg/ppc: Support bswap flags Date: Tue, 29 Jun 2021 11:54:37 -0700 Message-Id: <20210629185455.3131172-46-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For INDEX_op_bswap32_i32, pass 0 for flags: input not zero-extended, output does not need extension within the host 64-bit register. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index da6d10722e..33f0139519 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -789,7 +789,7 @@ static inline void tcg_out_sari64(TCGContext *s, TCGReg dst, TCGReg src, int c) tcg_out32(s, SRADI | RA(dst) | RS(src) | SH(c & 0x1f) | ((c >> 4) & 2)); } -static void tcg_out_bswap16(TCGContext *s, TCGReg dst, TCGReg src) +static void tcg_out_bswap16(TCGContext *s, TCGReg dst, TCGReg src, int flags) { TCGReg tmp = dst == src ? TCG_REG_R0 : dst; @@ -804,10 +804,14 @@ static void tcg_out_bswap16(TCGContext *s, TCGReg dst, TCGReg src) /* tmp = dep(tmp, rol32(src, 8), 0x0000ff00) = 000000dc */ tcg_out_rlw(s, RLWIMI, tmp, src, 8, 16, 23); - tcg_out_mov(s, TCG_TYPE_REG, dst, tmp); + if (flags & TCG_BSWAP_OS) { + tcg_out_ext16s(s, dst, tmp); + } else { + tcg_out_mov(s, TCG_TYPE_REG, dst, tmp); + } } -static void tcg_out_bswap32(TCGContext *s, TCGReg dst, TCGReg src) +static void tcg_out_bswap32(TCGContext *s, TCGReg dst, TCGReg src, int flags) { TCGReg tmp = dst == src ? TCG_REG_R0 : dst; @@ -825,7 +829,11 @@ static void tcg_out_bswap32(TCGContext *s, TCGReg dst, TCGReg src) /* tmp = dep(tmp, rol32(src, 24), 0x0000ff00) = 0000dcba */ tcg_out_rlw(s, RLWIMI, tmp, src, 24, 16, 23); - tcg_out_mov(s, TCG_TYPE_REG, dst, tmp); + if (flags & TCG_BSWAP_OS) { + tcg_out_ext32s(s, dst, tmp); + } else { + tcg_out_mov(s, TCG_TYPE_REG, dst, tmp); + } } static void tcg_out_bswap64(TCGContext *s, TCGReg dst, TCGReg src) @@ -2851,11 +2859,13 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, case INDEX_op_bswap16_i32: case INDEX_op_bswap16_i64: - tcg_out_bswap16(s, args[0], args[1]); + tcg_out_bswap16(s, args[0], args[1], args[2]); break; case INDEX_op_bswap32_i32: + tcg_out_bswap32(s, args[0], args[1], 0); + break; case INDEX_op_bswap32_i64: - tcg_out_bswap32(s, args[0], args[1]); + tcg_out_bswap32(s, args[0], args[1], args[2]); break; case INDEX_op_bswap64_i64: tcg_out_bswap64(s, args[0], args[1]); From patchwork Tue Jun 29 18:54:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468367 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5268364jao; Tue, 29 Jun 2021 12:55:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzU1KtKGsMl6jxlXxJ2RkQWMu15zaO57BlKddGgpS7fZevf9tfhA1pv7mDXr+xq8RJcDHNs X-Received: by 2002:a25:a4a5:: with SMTP id g34mr24701048ybi.473.1624996524136; Tue, 29 Jun 2021 12:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996524; cv=none; d=google.com; s=arc-20160816; b=ftr0GwiYTf8APLSTW7Ogbo73dhgNzZtNnkPkdFdibn3Xszd0vhfUaaN3x14H9VPCRh JHFeEpVTE7XyAur1AntwBrFG9i/60aCsDFB4XWlTrFzJmK87mfsZeL4jdNJvsdKEijBm bO9EVPvI1mR9lkiC4LR8vKoUWqJTpos0d7dQuwmEf7bjNWs2g53j8YzQo3LE0od9QrOg uy+YeXnUk1bEtXcBE6Cd/cmPbxFOvR0+ie5o1OHzakcRa0SiATwDoOvrbtqI6mRIlp1y d9/u4s7tu3sXO0hi3lc/gXK92ny4v8b0SFxMc1R+sC0xtqqd9oPwFDveUeB0RjgrYgnI lYcQ== 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=/wNqQIrhEpVyoEqJCER7tLRV/SXmN4s4drjfWv5Csp4=; b=rp0um77GeEfOWbhFOLxfjG0pTAMff3aNCw3zT4UbiBAjrHYJQoFylf/eqc4fxxgqZS NaaKrq1/66ASJcqFLCuHu1o7xiDpUTTetAwHmM7hhLE9CcdionfmcsMygTbWgYR8IZPf 4Z2xtr6mbCLLF60FcZBB8YNXI0Tf0NOQ7CSyHVIjl5Lq6ItWBRM8k7naZ/qObT7/A9DC AkNvr7pJD8tdTDpoRUcnHDRXK2PLtZQNoh0tRjN+ux2hc3loa9vPbzbag5aGbKJXDqnu G1OrYzgPnsXE7NTFFLmDlRiLtCHcBHIaQApD7wBIxwS6eWdSdf2GUzxiBoHhIN7ohKEI J2vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T3XA5rKB; 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 t1si17712143ybf.22.2021.06.29.12.55.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:55:24 -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=T3XA5rKB; 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]:47530 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJpL-0006wV-7J for patch@linaro.org; Tue, 29 Jun 2021 15:55:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwU-000447-Kb for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:43 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:52099) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwF-0002ym-Gx for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:42 -0400 Received: by mail-pj1-x1033.google.com with SMTP id n11so158147pjo.1 for ; Tue, 29 Jun 2021 11:58:26 -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=/wNqQIrhEpVyoEqJCER7tLRV/SXmN4s4drjfWv5Csp4=; b=T3XA5rKBDBl9+CIQ2lB1WkmRrRN6PjJqA/5xY8fo7YRgpanrPLRrpdP8zZfMr2AYlY II6vz53kavMdXsCfDkaG9khaSy7U95zipnLHUVa69thkktzPXmNi1R32QKgShoMgo1f9 pzRr6yL//Kwyz49KLfoejKzeFUrf9I058pJDfTzEFKpkisKeoiNbF1bhWpjKU3nRBG2T sMZt9qUWrgSv/UeEQDY1o3ho4ED3hI3nXxQSrNDHw0mT3D1P2tj+lN/ClbM6v3uZIVE5 awlSP77070iDgjLpd9gOaJtL1vzNyL6b/cyvefDn7UpDHizCc1Z1uAWnWmok1q9prui/ 9luA== 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=/wNqQIrhEpVyoEqJCER7tLRV/SXmN4s4drjfWv5Csp4=; b=b1RzJCKeb+4XIyHkLk2Ra86aIVgZ37IOImB/U/S9och3MuEy34xErrjjmpjOxcWtEM i2d6lAopgqi38RKYtpBEP9xBUvwCQaYBQ2KCmtchbeIjMjL56BL7sElOOLUmQQR3WR4E HE2bGMS1V5L8q83aTcVTMctNWNmsOq6mj/yXp8BuOW3JaKQCoUdnuHG7ye+j0loYjq3N 3P4oD3Wq9Ksh1hA406g19KvlZZMv6NpVgx9ZTXfjWXoJgsOKTUur7eZxYLo7NX72VuMC ZRYPPE3lf+meFZiMNuFcbiLAyQ/wNqQ0VuhQLL4b/pQiHmv2a++WKPsbcC4fDpDQGtXI S1/w== X-Gm-Message-State: AOAM533Xbue6Vq8y15VZwzkaPbVLX/smhtc02pmDdk1EnmIceAf2TgZ8 3tiNOHEydfdm0RUZww3JozC9XqF28zPxLg== X-Received: by 2002:a17:90a:eb11:: with SMTP id j17mr10016602pjz.177.1624993105757; Tue, 29 Jun 2021 11:58:25 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 46/63] tcg/ppc: Use power10 byte-reverse instructions Date: Tue, 29 Jun 2021 11:54:38 -0700 Message-Id: <20210629185455.3131172-47-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) -- 2.25.1 diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 33f0139519..e0f4665213 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -413,6 +413,10 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) #define SRAD XO31(794) #define SRADI XO31(413<<1) +#define BRH XO31(219) +#define BRW XO31(155) +#define BRD XO31(187) + #define TW XO31( 4) #define TRAP (TW | TO(31)) @@ -748,6 +752,11 @@ static inline void tcg_out_ext16s(TCGContext *s, TCGReg dst, TCGReg src) tcg_out32(s, EXTSH | RA(dst) | RS(src)); } +static inline void tcg_out_ext16u(TCGContext *s, TCGReg dst, TCGReg src) +{ + tcg_out32(s, ANDI | SAI(src, dst, 0xffff)); +} + static inline void tcg_out_ext32s(TCGContext *s, TCGReg dst, TCGReg src) { tcg_out32(s, EXTSW | RA(dst) | RS(src)); @@ -793,6 +802,16 @@ static void tcg_out_bswap16(TCGContext *s, TCGReg dst, TCGReg src, int flags) { TCGReg tmp = dst == src ? TCG_REG_R0 : dst; + if (have_isa_3_10) { + tcg_out32(s, BRH | RA(dst) | RS(src)); + if (flags & TCG_BSWAP_OS) { + tcg_out_ext16s(s, dst, dst); + } else if ((flags & (TCG_BSWAP_IZ | TCG_BSWAP_OZ)) == TCG_BSWAP_OZ) { + tcg_out_ext16u(s, dst, dst); + } + return; + } + /* * In the following, * dep(a, b, m) -> (a & ~m) | (b & m) @@ -815,6 +834,16 @@ static void tcg_out_bswap32(TCGContext *s, TCGReg dst, TCGReg src, int flags) { TCGReg tmp = dst == src ? TCG_REG_R0 : dst; + if (have_isa_3_10) { + tcg_out32(s, BRW | RA(dst) | RS(src)); + if (flags & TCG_BSWAP_OS) { + tcg_out_ext32s(s, dst, dst); + } else if ((flags & (TCG_BSWAP_IZ | TCG_BSWAP_OZ)) == TCG_BSWAP_OZ) { + tcg_out_ext32u(s, dst, dst); + } + return; + } + /* * Stolen from gcc's builtin_bswap32. * In the following, @@ -841,6 +870,11 @@ static void tcg_out_bswap64(TCGContext *s, TCGReg dst, TCGReg src) TCGReg t0 = dst == src ? TCG_REG_R0 : dst; TCGReg t1 = dst == src ? dst : TCG_REG_R0; + if (have_isa_3_10) { + tcg_out32(s, BRD | RA(dst) | RS(src)); + return; + } + /* * In the following, * dep(a, b, m) -> (a & ~m) | (b & m) From patchwork Tue Jun 29 18:54:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468365 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5267831jao; Tue, 29 Jun 2021 12:54:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDTA8MQ2OC5Ld0PWILDzC3JGbNcYhcCKQtHCPkvtU+UdsqBM3omo+5w/HxqMqMfX799v43 X-Received: by 2002:a37:8747:: with SMTP id j68mr33492005qkd.165.1624996466561; Tue, 29 Jun 2021 12:54:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996466; cv=none; d=google.com; s=arc-20160816; b=g6b3GbdZwvU6e9XK87JjCc2zBffZIuJRpe79IlUNZEAS8nRFWDnGIIrOhYGovSAtyx fwdsQRX8NjBPmUChrsJ2/d1T8On/1rvMMC2CKMs6eMCqvtsJYsHBaexDIsdxwknE1Mfm Hcx+VuINGNJf1Z5zv9XjIU3wAuLNZZRQnEysqkvW0zCldUlIm9ujK9OPOcwlhw1ID0mx 2Vj5PCUO9OkPavgBed0rrAWD0pS1Eu/pqtz/jQpHYdTJ9mP/R4RXHrmk2E4n/OESV4Bo PnRLleF//DBZBQAaz3dj82JdgNiROIM8EY/kCtw12/ZwNKO9dZy6yauH0a4eNTltCIMu aM3Q== 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=q38h6dtquTVJ+FlY8+y6d1PvihW63oSAgr0zeRiMB4s=; b=zNw0+0bqaovpoSHDjo9yHizyuZGqUdrybla4AR+72PPbf5nSNRNfC29Fbg15cwB1cx Vta8ju0T2UnacLHW3Uuie28I/TD43GgJ03nJuRV/zwdsgKcFPFBSG1EtNo122Jni8vMn G5RHaBut334NzIgycfU/X7VDlJvYdoJA5+bLkONkwdrntaQsWJoPqpNkqeAsCk/N7hCt qWMncmDRYRMk8bLvJTmo0qMHXpPuDcrUUbhuEvT2DnI2EtHrLpXyj1t8lQTS7mnDzGKq T/Q9Vh2zGFSMzT/kGwclyVa4WqiOawYwY9MVethI5G8g1IZRqjbTTtMk8eIeoVyvaftv 2JYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nf4i6+uD; 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 143si16307784qkk.90.2021.06.29.12.54.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:54: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=Nf4i6+uD; 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]:43298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJoP-000480-VF for patch@linaro.org; Tue, 29 Jun 2021 15:54:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwQ-00041p-IB for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:40 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:40917) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwH-0002zE-8a for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:38 -0400 Received: by mail-pl1-x631.google.com with SMTP id m17so39828plx.7 for ; Tue, 29 Jun 2021 11:58: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=q38h6dtquTVJ+FlY8+y6d1PvihW63oSAgr0zeRiMB4s=; b=Nf4i6+uDEyOy0dbFkTC29NvGNi6XBKyZT0IPSOlrmtHobo5Wkyrp4rsh3DolTKnJok BVmUtPx750QAZQFh1N13WWa+ySPXnrD+KKE9rxEyXZ5ftYnWcm3Oyr+7OuWSQPGcwS7C bC//FLP+1azqZHi8xaO5p0A53HFaM3F6ykuvT8OYm+KYkDzkCxgXAy87tircG4Aq/7jX /F/ti/ehcmMQ3EhAPn0/hy63pkV1rGxELZ1JJZMDRgeldcfNnXNXwRjo85MD3c9PicfX yjBGcT2flabqYk2iJdHjoqjYvAy5jfELdUhtwyualShpGuM9QAlS+jG8DlQSw06hfdoJ Gyxg== 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=q38h6dtquTVJ+FlY8+y6d1PvihW63oSAgr0zeRiMB4s=; b=p2UZfjfiP95oNCyPm3gYuwyPrLYX3QmTHwioyKe2UQ7yYu40HjYoDJmoEmo7uEA4Ay 71x1bA1zQ4LcA9KQZFteur1VNdqRUXESp2Ezy4ll89zCjYULqWIJqc01uC5LAaPZx/My 8Kguf9Iv79b0AEHmQz9jr4ajNSMbVkuvYZ3zHOdpKzodkTevfutKAJAPqWDZqZ0ho6M6 HlO5pwZQsO/SqDr9mF42662ToCUgJlHCp8bzf2+fqF840Ltiv05dJpF3To2L7fH9LRda GEjawZIjavDkBpvuDWFdxJ0AZhdNu6Qvcr9REHFsfJAJOhxXoq19YnvqU2zM2PQSkq2G nPhA== X-Gm-Message-State: AOAM530FTQ3hIfuuQtO9PtzbzTXiZ6dUXnegQVFkFhb65EFjj0OsmIRk OWM9iwpV/SgEdTVQmKXI+5KcYPqLzVHx7g== X-Received: by 2002:a17:90a:9205:: with SMTP id m5mr327093pjo.172.1624993106503; Tue, 29 Jun 2021 11:58:26 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 47/63] tcg/s390: Support bswap flags Date: Tue, 29 Jun 2021 11:54:39 -0700 Message-Id: <20210629185455.3131172-48-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For INDEX_op_bswap16_i64, use 64-bit instructions so that we can easily provide the extension to 64-bits. Drop the special case, previously used, where the input is already zero-extended -- the minor code size savings is not worth the complication. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/s390/tcg-target.c.inc | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/tcg/s390/tcg-target.c.inc b/tcg/s390/tcg-target.c.inc index 5fe073f09a..b82cf19f09 100644 --- a/tcg/s390/tcg-target.c.inc +++ b/tcg/s390/tcg-target.c.inc @@ -1951,15 +1951,37 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, tgen_ext16u(s, TCG_TYPE_I32, args[0], args[1]); break; - OP_32_64(bswap16): - /* The TCG bswap definition requires bits 0-47 already be zero. - Thus we don't need the G-type insns to implement bswap16_i64. */ - tcg_out_insn(s, RRE, LRVR, args[0], args[1]); - tcg_out_sh32(s, RS_SRL, args[0], TCG_REG_NONE, 16); + case INDEX_op_bswap16_i32: + a0 = args[0], a1 = args[1], a2 = args[2]; + tcg_out_insn(s, RRE, LRVR, a0, a1); + if (a2 & TCG_BSWAP_OS) { + tcg_out_sh32(s, RS_SRA, a0, TCG_REG_NONE, 16); + } else { + tcg_out_sh32(s, RS_SRL, a0, TCG_REG_NONE, 16); + } break; - OP_32_64(bswap32): + case INDEX_op_bswap16_i64: + a0 = args[0], a1 = args[1], a2 = args[2]; + tcg_out_insn(s, RRE, LRVGR, a0, a1); + if (a2 & TCG_BSWAP_OS) { + tcg_out_sh64(s, RSY_SRAG, a0, a0, TCG_REG_NONE, 48); + } else { + tcg_out_sh64(s, RSY_SRLG, a0, a0, TCG_REG_NONE, 48); + } + break; + + case INDEX_op_bswap32_i32: tcg_out_insn(s, RRE, LRVR, args[0], args[1]); break; + case INDEX_op_bswap32_i64: + a0 = args[0], a1 = args[1], a2 = args[2]; + tcg_out_insn(s, RRE, LRVR, a0, a1); + if (a2 & TCG_BSWAP_OS) { + tgen_ext32s(s, a0, a0); + } else if ((a2 & (TCG_BSWAP_IZ | TCG_BSWAP_OZ)) == TCG_BSWAP_OZ) { + tgen_ext32u(s, a0, a0); + } + break; case INDEX_op_add2_i32: if (const_args[4]) { From patchwork Tue Jun 29 18:54:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468369 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5269500jao; Tue, 29 Jun 2021 12:57:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9SIhC5kwNG1Qyec/RCsZ5JNFSxsANnGphWWh86tsuZocesaJCCMu6Vxgaiu4DmQsyqfBG X-Received: by 2002:a5d:80cf:: with SMTP id h15mr5202107ior.30.1624996625073; Tue, 29 Jun 2021 12:57:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996625; cv=none; d=google.com; s=arc-20160816; b=N9WGxP1mQ9vi3ANGIEC4iKXcRFVdu/G+D4flqRmS9V3vXnv4W8uDfN/PhZUhLoy4F7 EpVcqm/+F0LKEuZzkkauVcR2nNrx0RDTTP/yKLJUdrTgRwshD3U9jc4nYylXCFzzXzyY l+MyTG2QJ4z8MD464tfWlqsw25D52eSPJoqhjRBziQZyfaZ4sBsF9SrMxz1zoDtVsu65 5LlkL+SIXx/gqoKl+CKL8G7QrtwF9Xjjxyhvxmf4DdiHyM0KO7u2SKn1IZvrdT7RcKB6 q59UAQDnNH39ucW2rSV8gyfQtIwMndsoXYEp8OpLreHxdrDWsyW2S8Md2H1mQ622UzVG DK4A== 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=VBYbGg81Birrf/k2AeUwnxNTFGHz8b41b75J9mAcXO8=; b=iFPJwagcnE3YlthVAeDWZmZ7wEk3dvgigd++a+Yo+BTX34l/mkzstLHSZKqPabnT0y om78fm0dzlEN5CvELaV+kAlH/uDHw0w+VKhtJlzxx6Rxj63LjhNSmqFsY6vDI1vtoHFt RkOpEzdicxTSRaD1o6SOmMs11FbBx32Evry4Bwq8cRBQ3y5vKQpHX2MAgdKpdoFqLICY gpAigbGiwdPgfPlpcR7ICrzS8l4DmAmODC6tZd/BOHwf0SGHLcT9eDhLB3NQLjflbQL3 5dCOqUEcy88+c95Go6+2rJbO3G0WgklqWeGMdMCE+QUhxAlTeiw64twkCp4wCWTBnpjr CQmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZphXCKvd; 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 e11si8957389iov.20.2021.06.29.12.57.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:57: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=ZphXCKvd; 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]:51304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJqy-0001C6-GE for patch@linaro.org; Tue, 29 Jun 2021 15:57:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwS-00043H-NA for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:41 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:33533) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwJ-0002zo-0k for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:40 -0400 Received: by mail-pl1-x631.google.com with SMTP id f11so74081plg.0 for ; Tue, 29 Jun 2021 11:58:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VBYbGg81Birrf/k2AeUwnxNTFGHz8b41b75J9mAcXO8=; b=ZphXCKvdoHS9BKxLsIMTfaJVU4yAfnMrDFaqXvUkzvK3EmiLfXMT+0cDgD9KbPlwSz A0HGyA84cKWHrt4hVVm87nNJfzMRWynSNhxxPVsc544CNWbQVoB1Mqozx7qLOeV7Vkwl FjuV8SWW9BisT5FO9+vvA/ZyIl+k1EliR8kc83Y1YakLNi/BO3TA2z8DTshIjx4eINDo sLas0Km9gYAw9sUE91R+LRdIahdpj0FmRZRxoxIjWvd+mmhZv2R/FAOf9QY2jn+BcDYu IqORXJlmTBtPiz8aiM2YHC/DjfVnKQO2oI4AfDyAzfCJkDm3Dc6r7udiz1v3kkx5xTWI TvuQ== 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=VBYbGg81Birrf/k2AeUwnxNTFGHz8b41b75J9mAcXO8=; b=XpaYDMx9Vd/jyHEgtjN7o0GH8ZEhVksEcA4mOFhONJEjaKPQ3K7DnhJM6iEsbjxm2F 5acl8gUlfh091CwEyCHPgO5duzN0hDH+oyenxyy2VIq02YmUnN/6cybvstSYnH3DZdeG NZo0lWaFiuwM1NzNNGGc8rTAcNwQUrLCxLzDnFTDwTodzs2B4ENeugtDWWfZipETXxio qgQwjAB9do1yTJPuzmOMLelja+EZG9tL8ZBh9jWKyE3yaPPkDgRiTIAar77TC1AkXnYC OCypJ/He2q0jdAKHuQTN7BqSrCxFjOisbHOLaZxW8Eu0yFHb8z5IEObpOgbDm+0CSvkE 7nWw== X-Gm-Message-State: AOAM531PqO+B2ElmD0/GAowp+S7UW86aShRvMKgOkZ2jehqFU+z6K5xQ CM6U5lwQDOvYshnvhJN7JUp6+e9IzhLm6g== X-Received: by 2002:a17:90b:38c3:: with SMTP id nn3mr335193pjb.92.1624993107332; Tue, 29 Jun 2021 11:58:27 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 48/63] tcg/mips: Support bswap flags in tcg_out_bswap16 Date: Tue, 29 Jun 2021 11:54:40 -0700 Message-Id: <20210629185455.3131172-49-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Merge tcg_out_bswap16 and tcg_out_bswap16s. Use the flags in the internal uses for loads and stores. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/mips/tcg-target.c.inc | 63 +++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 33 deletions(-) -- 2.25.1 diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index 5944448b2a..a9f9f527f6 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -540,39 +540,37 @@ static void tcg_out_movi(TCGContext *s, TCGType type, } } -static inline void tcg_out_bswap16(TCGContext *s, TCGReg ret, TCGReg arg) +static void tcg_out_bswap16(TCGContext *s, TCGReg ret, TCGReg arg, int flags) { + /* ret and arg can't be register tmp0 */ + tcg_debug_assert(ret != TCG_TMP0); + tcg_debug_assert(arg != TCG_TMP0); + + /* With arg = abcd: */ if (use_mips32r2_instructions) { - tcg_out_opc_reg(s, OPC_WSBH, ret, 0, arg); - } else { - /* ret and arg can't be register at */ - if (ret == TCG_TMP0 || arg == TCG_TMP0) { - tcg_abort(); + tcg_out_opc_reg(s, OPC_WSBH, ret, 0, arg); /* badc */ + if (flags & TCG_BSWAP_OS) { + tcg_out_opc_reg(s, OPC_SEH, ret, 0, ret); /* ssdc */ + } else if ((flags & (TCG_BSWAP_IZ | TCG_BSWAP_OZ)) == TCG_BSWAP_OZ) { + tcg_out_opc_imm(s, OPC_ANDI, ret, ret, 0xffff); /* 00dc */ } - - tcg_out_opc_sa(s, OPC_SRL, TCG_TMP0, arg, 8); - tcg_out_opc_sa(s, OPC_SLL, ret, arg, 8); - tcg_out_opc_imm(s, OPC_ANDI, ret, ret, 0xff00); - tcg_out_opc_reg(s, OPC_OR, ret, ret, TCG_TMP0); + return; } -} -static inline void tcg_out_bswap16s(TCGContext *s, TCGReg ret, TCGReg arg) -{ - if (use_mips32r2_instructions) { - tcg_out_opc_reg(s, OPC_WSBH, ret, 0, arg); - tcg_out_opc_reg(s, OPC_SEH, ret, 0, ret); + tcg_out_opc_sa(s, OPC_SRL, TCG_TMP0, arg, 8); /* 0abc */ + if (!(flags & TCG_BSWAP_IZ)) { + tcg_out_opc_imm(s, OPC_ANDI, TCG_TMP0, TCG_TMP0, 0x00ff); /* 000c */ + } + if (flags & TCG_BSWAP_OS) { + tcg_out_opc_sa(s, OPC_SLL, ret, arg, 24); /* d000 */ + tcg_out_opc_sa(s, OPC_SRA, ret, ret, 16); /* ssd0 */ } else { - /* ret and arg can't be register at */ - if (ret == TCG_TMP0 || arg == TCG_TMP0) { - tcg_abort(); + tcg_out_opc_sa(s, OPC_SLL, ret, arg, 8); /* bcd0 */ + if (flags & TCG_BSWAP_OZ) { + tcg_out_opc_imm(s, OPC_ANDI, ret, ret, 0xff00); /* 00d0 */ } - - tcg_out_opc_sa(s, OPC_SRL, TCG_TMP0, arg, 8); - tcg_out_opc_sa(s, OPC_SLL, ret, arg, 24); - tcg_out_opc_sa(s, OPC_SRA, ret, ret, 16); - tcg_out_opc_reg(s, OPC_OR, ret, ret, TCG_TMP0); } + tcg_out_opc_reg(s, OPC_OR, ret, ret, TCG_TMP0); /* ssdc */ } static void tcg_out_bswap_subr(TCGContext *s, const tcg_insn_unit *sub) @@ -1367,14 +1365,14 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg lo, TCGReg hi, break; case MO_UW | MO_BSWAP: tcg_out_opc_imm(s, OPC_LHU, TCG_TMP1, base, 0); - tcg_out_bswap16(s, lo, TCG_TMP1); + tcg_out_bswap16(s, lo, TCG_TMP1, TCG_BSWAP_IZ | TCG_BSWAP_OZ); break; case MO_UW: tcg_out_opc_imm(s, OPC_LHU, lo, base, 0); break; case MO_SW | MO_BSWAP: tcg_out_opc_imm(s, OPC_LHU, TCG_TMP1, base, 0); - tcg_out_bswap16s(s, lo, TCG_TMP1); + tcg_out_bswap16(s, lo, TCG_TMP1, TCG_BSWAP_IZ | TCG_BSWAP_OS); break; case MO_SW: tcg_out_opc_imm(s, OPC_LH, lo, base, 0); @@ -1514,8 +1512,7 @@ static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg lo, TCGReg hi, break; case MO_16 | MO_BSWAP: - tcg_out_opc_imm(s, OPC_ANDI, TCG_TMP1, lo, 0xffff); - tcg_out_bswap16(s, TCG_TMP1, TCG_TMP1); + tcg_out_bswap16(s, TCG_TMP1, lo, 0); lo = TCG_TMP1; /* FALLTHRU */ case MO_16: @@ -1933,10 +1930,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, case INDEX_op_not_i64: i1 = OPC_NOR; goto do_unary; - case INDEX_op_bswap16_i32: - case INDEX_op_bswap16_i64: - i1 = OPC_WSBH; - goto do_unary; case INDEX_op_ext8s_i32: case INDEX_op_ext8s_i64: i1 = OPC_SEB; @@ -1948,6 +1941,10 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_out_opc_reg(s, i1, a0, TCG_REG_ZERO, a1); break; + case INDEX_op_bswap16_i32: + case INDEX_op_bswap16_i64: + tcg_out_bswap16(s, a0, a1, a2); + break; case INDEX_op_bswap32_i32: tcg_out_bswap32(s, a0, a1); break; From patchwork Tue Jun 29 18:54:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468364 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5267163jao; Tue, 29 Jun 2021 12:53:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3j2XQXMmf9zpDUHAZ/ReJOHtKvzeny8helbu/X7dWMd1uXSZ+PQbg+ddjsFf78VMfdmCp X-Received: by 2002:a05:620a:5ef:: with SMTP id z15mr31518780qkg.147.1624996387872; Tue, 29 Jun 2021 12:53:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996387; cv=none; d=google.com; s=arc-20160816; b=my7rSeODWa2pwl2dEBp3ao1ZzjmkWuh7aJ17hWzWLyQLh/MjrdO+EZsq+H1jmjoaSy 3XmUvVeiZ9vcNob6PXqxMTjLxtaOBvPaLhIhlB5NZvlVBelnijJbEaurEwySQt+ZTvEc BWNsro64jfVQ/HkXqG5x/v85qVP/TS0FcQBkHqgripURdqOueax1rTleC2zGqfJZYqRq dJ+nihl05PXw32JyINC2OC2E2B+hPhJKRbEquU1zFLqaFA8AVuGW5/a/IgsWUuiT7FTU pEMfgOCJVvoQ+zAHA6SHAZ0/BfNupQ6PEE3S41chMSEj5nd0iw1fXc3q72GFQvwQmFwy P+4A== 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=5GjlKcFtUOLo4ZBmg8lM1encCtfhP3Rvv45Irrywiqg=; b=Hngec12GXkGGSyGILvkd2USVEj6NyyfKkr8hTcV6pDzOWWfwv2b9PLgZWatHsgY/Vt Ni29y84EFa+HPwzgxjdjeS1hedqXuhD1SRtWIB4UpZdg3ghK04lgtjLUG6CzsnLKQlpe KXzg6KKj/tuB4DDowjnzMeIrl0+a0NgZ1CuS8jC5Y/qZrmxnb0z24fTOhK7UAyVBGepv f8ynLMnGmtpdPiHFKOYUy2XH814w00Js1KZr7gdjI60WEnl0YgJt7ODQJ/4T2z1XzViT XlEvzPhvIsuSRrhryqfou/Z3Q9E5B8wMnkixEbXWHfMnTc5O2qdJa9mbr71ozOA71d6A AD1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=et54Nylp; 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 h2si5570663qtu.39.2021.06.29.12.53.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:53: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=et54Nylp; 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]:41008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJn9-0002Zq-9M for patch@linaro.org; Tue, 29 Jun 2021 15:53:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwT-00043b-Cl for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:42 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:34360) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwK-0002zs-Pw for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:41 -0400 Received: by mail-pf1-x42c.google.com with SMTP id i6so132276pfq.1 for ; Tue, 29 Jun 2021 11:58: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=5GjlKcFtUOLo4ZBmg8lM1encCtfhP3Rvv45Irrywiqg=; b=et54Nylpa39ECeEAt9TlV7zeaIKDNMlWPF+zOgQp8u0AVtA8Cf2JurxOYnH0lRoSOd 19ObGeyOvTd6u9juuqz0kNVI90nT4x4XRW6mofjvBVW/Yj5f0H+EO/pyAF6fXkwsJmNy ukkBnkuiOzO9rTUt/VoVXMMNgON2+N5PJAVbg2xn7ezkLH7gUZ8lFPTljt2C216DHNNX paXjY43B4R0+ocIw2BQrLhow/kkTN6XRp+ZzDxJPcqHon+ygEWrCPBSRzkSzsNgQFVhK JnAdA1e4lsZ2EjuWYc2s5LJyR4jAe+Zd+wL60x3JFPzVy1Mi/cyQNuLy85X8rTTl03/M fwTA== 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=5GjlKcFtUOLo4ZBmg8lM1encCtfhP3Rvv45Irrywiqg=; b=T+RRYQkyJuBSQA7kLT9FFCa3nH9ZqoU17/MOLjfEspioRTYNVdy24sa8eoptzskWfw hFIBf2Q31uhhryMQ9ntkyrXTeJASomTW3RGC2VzwanU5R7WAqG9zNfoVgZrIlGsBBDX1 RihHhGKjERwXFcZmRErVeGfHCQpAC3KCebliwjNMFypP5jVhOXLUJDnaPdKzJZVDpx8Y LYqs8sVS0zN4hkc+BIcUFG27GipnKNXqjQR4pNqOeAjG0/q8HF53uTf12I6PExTkxpDk 36Vu5wgICSpMSo+aoScTrHfgA9MdCNdDaxbu3s8c4ybJWouqZtmcyvoZoY3w9d3LaP9p fd9w== X-Gm-Message-State: AOAM530cN9+moSl2bBahzynvZBDEhy0UyIgQ6fvLBeCKbQawNFbeQi2l 6/vGxlXdAR2u38RReq6qK1nWZ/tSYyDY5w== X-Received: by 2002:a62:5e04:0:b029:2ea:a8dc:25d3 with SMTP id s4-20020a625e040000b02902eaa8dc25d3mr31561852pfb.6.1624993109867; Tue, 29 Jun 2021 11:58:29 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 49/63] tcg/mips: Support bswap flags in tcg_out_bswap32 Date: Tue, 29 Jun 2021 11:54:41 -0700 Message-Id: <20210629185455.3131172-50-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Merge tcg_out_bswap32 and tcg_out_bswap32s. Use the flags in the internal uses for loads and stores. For mips32r2 bswap32 with zero-extension, standardize on WSBH+ROTR+DEXT. This is the same number of insns as the previous DSBH+DSHD+DSRL but fits in better with the flags check. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/mips/tcg-target.c.inc | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) -- 2.25.1 diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index a9f9f527f6..bf0eb84e2d 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -579,27 +579,20 @@ static void tcg_out_bswap_subr(TCGContext *s, const tcg_insn_unit *sub) tcg_debug_assert(ok); } -static void tcg_out_bswap32(TCGContext *s, TCGReg ret, TCGReg arg) +static void tcg_out_bswap32(TCGContext *s, TCGReg ret, TCGReg arg, int flags) { if (use_mips32r2_instructions) { tcg_out_opc_reg(s, OPC_WSBH, ret, 0, arg); tcg_out_opc_sa(s, OPC_ROTR, ret, ret, 16); + if (flags & TCG_BSWAP_OZ) { + tcg_out_opc_bf(s, OPC_DEXT, ret, ret, 31, 0); + } } else { - tcg_out_bswap_subr(s, bswap32_addr); - /* delay slot -- never omit the insn, like tcg_out_mov might. */ - tcg_out_opc_reg(s, OPC_OR, TCG_TMP0, arg, TCG_REG_ZERO); - tcg_out_mov(s, TCG_TYPE_I32, ret, TCG_TMP3); - } -} - -static void tcg_out_bswap32u(TCGContext *s, TCGReg ret, TCGReg arg) -{ - if (use_mips32r2_instructions) { - tcg_out_opc_reg(s, OPC_DSBH, ret, 0, arg); - tcg_out_opc_reg(s, OPC_DSHD, ret, 0, ret); - tcg_out_dsrl(s, ret, ret, 32); - } else { - tcg_out_bswap_subr(s, bswap32u_addr); + if (flags & TCG_BSWAP_OZ) { + tcg_out_bswap_subr(s, bswap32u_addr); + } else { + tcg_out_bswap_subr(s, bswap32_addr); + } /* delay slot -- never omit the insn, like tcg_out_mov might. */ tcg_out_opc_reg(s, OPC_OR, TCG_TMP0, arg, TCG_REG_ZERO); tcg_out_mov(s, TCG_TYPE_I32, ret, TCG_TMP3); @@ -1381,7 +1374,7 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg lo, TCGReg hi, if (TCG_TARGET_REG_BITS == 64 && is_64) { if (use_mips32r2_instructions) { tcg_out_opc_imm(s, OPC_LWU, lo, base, 0); - tcg_out_bswap32u(s, lo, lo); + tcg_out_bswap32(s, lo, lo, TCG_BSWAP_IZ | TCG_BSWAP_OZ); } else { tcg_out_bswap_subr(s, bswap32u_addr); /* delay slot */ @@ -1394,7 +1387,7 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg lo, TCGReg hi, case MO_SL | MO_BSWAP: if (use_mips32r2_instructions) { tcg_out_opc_imm(s, OPC_LW, lo, base, 0); - tcg_out_bswap32(s, lo, lo); + tcg_out_bswap32(s, lo, lo, 0); } else { tcg_out_bswap_subr(s, bswap32_addr); /* delay slot */ @@ -1520,7 +1513,7 @@ static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg lo, TCGReg hi, break; case MO_32 | MO_BSWAP: - tcg_out_bswap32(s, TCG_TMP3, lo); + tcg_out_bswap32(s, TCG_TMP3, lo, 0); lo = TCG_TMP3; /* FALLTHRU */ case MO_32: @@ -1539,9 +1532,9 @@ static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg lo, TCGReg hi, tcg_out_opc_imm(s, OPC_SW, TCG_TMP0, base, 0); tcg_out_opc_imm(s, OPC_SW, TCG_TMP1, base, 4); } else { - tcg_out_bswap32(s, TCG_TMP3, MIPS_BE ? lo : hi); + tcg_out_bswap32(s, TCG_TMP3, MIPS_BE ? lo : hi, 0); tcg_out_opc_imm(s, OPC_SW, TCG_TMP3, base, 0); - tcg_out_bswap32(s, TCG_TMP3, MIPS_BE ? hi : lo); + tcg_out_bswap32(s, TCG_TMP3, MIPS_BE ? hi : lo, 0); tcg_out_opc_imm(s, OPC_SW, TCG_TMP3, base, 4); } break; @@ -1946,10 +1939,10 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_out_bswap16(s, a0, a1, a2); break; case INDEX_op_bswap32_i32: - tcg_out_bswap32(s, a0, a1); + tcg_out_bswap32(s, a0, a1, 0); break; case INDEX_op_bswap32_i64: - tcg_out_bswap32u(s, a0, a1); + tcg_out_bswap32(s, a0, a1, a2); break; case INDEX_op_bswap64_i64: tcg_out_bswap64(s, a0, a1); From patchwork Tue Jun 29 18:54:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468370 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5270065jao; Tue, 29 Jun 2021 12:58:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmPP3F92jIFdLfUEMs8/UdpUop1vn3wuT0/l55vEoapPUQuB3IIzO1I0BbPvw7UEwPBmkg X-Received: by 2002:a25:ac9a:: with SMTP id x26mr23066891ybi.161.1624996681694; Tue, 29 Jun 2021 12:58:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996681; cv=none; d=google.com; s=arc-20160816; b=qXDd4ac12pqZzOYGr7Rigb2Ve89tVcHPFlYUKDSJ5cHbmve9y138StdWxVgpVkkSvk dAsnIGY2v+uTjfURghj7ptrYT3zOg4mY3cSdviEwOvQFlh2mC022kWJOErXEFr3YCkLB Y0dL0lb+Wb6MfjEp5zIaJbeOEZMJ7Ey4hkMKFDSmCW6wtTnmC5JYzXhed/58JLEVT4jM kq0xDmlihnjkASaoV9/hJElL5+tQYENy60jIGtr2YOHGwbw7l3adVOEDEjS+RBU2MXbZ TpHe/lnQ6M0mXc5Masx5ttzVBMGvyA6FMsIRdkzQf2tExKm44y+uHelSDURpYQ9JZN7K j1dg== 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=/npoOom83BV+ZhnOrJwhtUPiftxFqKz5+wNoXW0RQ8w=; b=gEzjLo+jQQno4cVl7UsDvaoocQQL2nwGFBEO5sSYCfrYVZwMUaiEik+PZBpIA/u3hM Q1/Xe+rxj56FpS2grhb4poukvYrdq91ntnj7QV8K206PULLOEqzWoZn3r01tKN5uH+hr MQzk0lTiEBguy2YyHLVltA9mXyw+BS3KaH0+G9f1PNGF+pxgBQX3UYx/CjKr/YL/6zZE pZ9QOekiMoGn92e0emzudjqLpdX4I21JPOiRmMarbUCQ1sd4/GeEaOeMAczATQNHCjcv TjXGP9tHcPfV5/2LYA6PYnl/5cPFeF+3z5LmKYVeA5yphU64RkZv9m/4Cl34cE+i9EJ2 +RIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TXpjedbH; 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 m130si15973783ybc.321.2021.06.29.12.58.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:58: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=TXpjedbH; 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]:54166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJrt-000362-4S for patch@linaro.org; Tue, 29 Jun 2021 15:58:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwb-00046l-2e for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:50 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:36394) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwK-0002zy-Rl for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:48 -0400 Received: by mail-pf1-x42b.google.com with SMTP id 21so119958pfp.3 for ; Tue, 29 Jun 2021 11:58: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=/npoOom83BV+ZhnOrJwhtUPiftxFqKz5+wNoXW0RQ8w=; b=TXpjedbHiYbADufJtqaWRQFYzcCb4zI7ER2uNitrp38ZjK57k4FTr1q6Tqf1EB8xmc h2mNTf1fr0dYZp7aMx64qJ5/VAcFfP7n3KnqhGySyQtmywCr3umqlMxXfLmo7Lvq24v+ yCsmRjKj8VuxjVVqFJfZvsydTyUiSg+vunMxPkyF8tehi9SABb70qbDVW6YINGxPmDcL REoaFvERZVs5/yypbSL/6VqHItgnyksOi+hxx0KvO/hxo1nxWwAQTizW0D8apj0cxD3W Va8FmcyrhEmjp+9s2wtU4mBY3wNuFwpcWsMZ8oCCQLdxc12yK2rLgHjGA75WDcDP7Cx8 ebkQ== 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=/npoOom83BV+ZhnOrJwhtUPiftxFqKz5+wNoXW0RQ8w=; b=BSTuWFYXyjLDZBCHeVUGtHmL1KJ4CJJ3yVu2tTxpHA6lb9s6uzo87uFtdKfMsjMSb5 zLxkRtg9jIBsufICGW80bD7yzqXIweWoWCRE/SpI81MuV0wiSZyCWOI47ePWh1p7oQcW 18PtAs1zRYHDWBZpywXqay19u6gLJpSy/qFiOuZp863tjIAsI66MMfFNWXov3KWhTEBC bbqomqropJYIogU3E8okSluIPCbMPv5Wm0MA2O9TdupcdckZsdPgUE0WX6KeezfDDRmH ozT1n3QCUmhB2xz7tJdAoGwGIXBxfLWYYf6j7CFqBko4XKnyWBaREdlG8oSzM+2gLkQj nceg== X-Gm-Message-State: AOAM5332KWqlFotDsT2A/0IbLkzyLkHtMR0ikkQPLftbV5QZlcXOcThq jQ7wtRWufXIMmZR9+97iPhnu95GNqlnHuA== X-Received: by 2002:a65:4c4d:: with SMTP id l13mr29333603pgr.114.1624993110492; Tue, 29 Jun 2021 11:58:30 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 50/63] tcg/tci: Support bswap flags Date: Tue, 29 Jun 2021 11:54:42 -0700 Message-Id: <20210629185455.3131172-51-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The existing interpreter zero-extends, ignoring high bits. Simply add a separate sign-extension opcode if required. Ensure that the interpreter supports ext16s when bswap16 is enabled. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/tci.c | 3 ++- tcg/tci/tcg-target.c.inc | 23 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/tcg/tci.c b/tcg/tci.c index 71689d4a40..b672c7cae5 100644 --- a/tcg/tci.c +++ b/tcg/tci.c @@ -808,7 +808,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, regs[r0] = (int8_t)regs[r1]; break; #endif -#if TCG_TARGET_HAS_ext16s_i32 || TCG_TARGET_HAS_ext16s_i64 +#if TCG_TARGET_HAS_ext16s_i32 || TCG_TARGET_HAS_ext16s_i64 || \ + TCG_TARGET_HAS_bswap16_i32 || TCG_TARGET_HAS_bswap16_i64 CASE_32_64(ext16s) tci_args_rr(insn, &r0, &r1); regs[r0] = (int16_t)regs[r1]; diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc index 9651e7a8f1..0cb16aaa81 100644 --- a/tcg/tci/tcg-target.c.inc +++ b/tcg/tci/tcg-target.c.inc @@ -597,6 +597,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS]) { + TCGOpcode exts; + switch (opc) { case INDEX_op_exit_tb: tcg_out_op_p(s, opc, (void *)args[0]); @@ -710,13 +712,28 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, CASE_64(ext32u) /* Optional (TCG_TARGET_HAS_ext32u_i64). */ CASE_64(ext_i32) CASE_64(extu_i32) - CASE_32_64(bswap16) /* Optional (TCG_TARGET_HAS_bswap16_*). */ - CASE_32_64(bswap32) /* Optional (TCG_TARGET_HAS_bswap32_*). */ - CASE_64(bswap64) /* Optional (TCG_TARGET_HAS_bswap64_i64). */ CASE_32_64(ctpop) /* Optional (TCG_TARGET_HAS_ctpop_*). */ + case INDEX_op_bswap32_i32: /* Optional (TCG_TARGET_HAS_bswap32_i32). */ + case INDEX_op_bswap64_i64: /* Optional (TCG_TARGET_HAS_bswap64_i64). */ tcg_out_op_rr(s, opc, args[0], args[1]); break; + case INDEX_op_bswap16_i32: /* Optional (TCG_TARGET_HAS_bswap16_i32). */ + exts = INDEX_op_ext16s_i32; + goto do_bswap; + case INDEX_op_bswap16_i64: /* Optional (TCG_TARGET_HAS_bswap16_i64). */ + exts = INDEX_op_ext16s_i64; + goto do_bswap; + case INDEX_op_bswap32_i64: /* Optional (TCG_TARGET_HAS_bswap32_i64). */ + exts = INDEX_op_ext32s_i64; + do_bswap: + /* The base tci bswaps zero-extend, and ignore high bits. */ + tcg_out_op_rr(s, opc, args[0], args[1]); + if (args[2] & TCG_BSWAP_OS) { + tcg_out_op_rr(s, exts, args[0], args[0]); + } + break; + CASE_32_64(add2) CASE_32_64(sub2) tcg_out_op_rrrrrr(s, opc, args[0], args[1], args[2], From patchwork Tue Jun 29 18:54:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468338 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5254578jao; Tue, 29 Jun 2021 12:32:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyI+3NUuWSwcdmeM/c5XHYrYcf8NtCiDhhaBr9MIfCRVeLQ7VtSl63yxzbChO0C0xH1aSwq X-Received: by 2002:a25:e68e:: with SMTP id d136mr13251995ybh.120.1624995125375; Tue, 29 Jun 2021 12:32:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995125; cv=none; d=google.com; s=arc-20160816; b=kR7qOQhk91979TbRkqlvcffQkZ5804M/eY6d5TJuwF0EpFLK26Jxnh+UqPG5Wpn+I6 hwDuIh9LJxy0b6Q41DAJTiX6Pl5Tzgah5MVCU+WK6O40EYYHXz4dfBSQdZOggRCdhlTn So4dtR5tVhuGxPMCb+WgoJKNCKfQzb5GK1WPvG3yQaESCzS5xTgkNhq8ryJjqP668YEb 0NB+Y5SQOJFaRSdfxw1kVLe7sTEPv7FTSpWulZArcGlHMHML7QtD8XTts9DWSaNR+Ij3 V/ZklLn/phFQFB71rbqubhAkv7fLd+1un/gg9geOhakXu/DtT/tdY31xpZrUpK7Is0WS Vy6A== 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=r6z5etdTT2JEFWUbs+95xLr9toUzAo+pdbx3zMIT52I=; b=rRqalffM7xgwOkZrcZ16ZZfsMX5+Yr9fkDSRht+rPnB6bIOwjTPwDarNALisFWWSnR eRsmZS5b9251Tp+db6QEHWtgL9J6go+sEWSGSBgd5Ou4jTczvRllxo/fRKRoVK1D+2n4 eci4GlShnjIH+hZXtJEtenCX6pdZkDCrZ9zOrPTCsEgWiIzFQVlapSk47dSZKAwclCfM Dkm98kuCCpFisZp2uvaIIA09S2O8wztLj4Za7pkm5Q9DbYc4ViQg3u6txFiPn4MMH6Ad m/lSoNepweOID1mjxom1TZFKVPjrl7w0qK87Q+/o0bOK/5GxdjxsA2f91UunREInc2Od 77Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q56kToAO; 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 v125si178817ybv.86.2021.06.29.12.32.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:32: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=q56kToAO; 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]:55812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJSm-0004nI-P9 for patch@linaro.org; Tue, 29 Jun 2021 15:32:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwY-00045t-Ea for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:47 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:46769) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwM-00030K-NB for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:46 -0400 Received: by mail-pl1-x632.google.com with SMTP id c15so21770pls.13 for ; Tue, 29 Jun 2021 11:58: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=r6z5etdTT2JEFWUbs+95xLr9toUzAo+pdbx3zMIT52I=; b=q56kToAOfVmr8IjoXyg3FeJOoSAuSDPX/psFzzrlpLc9Lowj60QOSLSNSxdvWOhNFy dyZNC3e1cRbFGZrWAypFQhaEqAO4dFGpaNCJLhRurSCVKFfHv6ltQw87PPoneBE46fmV YOK5qD2yZIsOAIXpeHmmgmvyU7z6gUQYTd7cNhXkPuFpTuXMtmspyLkh9k9aK9uWFnfV skfWhkV8nPS1mhNxYUpRQHu6rOVqidOhULsmo0D6j6CR/ET4Pq34z877PUmktuKo25LR QIJFAalI08wQZVlt+DKwnD0Sw7t8mdrMNkGh329io3trF5/YbT0ps4XmfQDWvSiqOv0H 5BPg== 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=r6z5etdTT2JEFWUbs+95xLr9toUzAo+pdbx3zMIT52I=; b=gKPusYAfNdlN1sxO/t255FmDHwF5pO5pYbvW52V2ofabrRpyWevyLwcgHo1EFpvYuH 8EGusw3nbLhxo+FFhmWg6Po4B6a1scVDVTmX62O6CVJkx9pyiBh/YIkhQ01IBKVF+kN6 AY6OyWWvF7pQM4nD1Y6K9Pvu/FXXbUstaqCmSLK9w5JIoBf2fgdNzsoiyU85Hpu0I9yc 98284LatXB3+P+NP4qSORnhJK/ajemuAQYvFEU7v8BEb6DgX7WJsgHX7SAbycxc4aM5O HNqkcocPsUr7V9Hy5EGQZIGL9Z6/6wUsReZ/mI4nEjm15g3bLL3uo/El7Z0Tkzcaw+dn hqkQ== X-Gm-Message-State: AOAM531lDFRZlJnPeA1+d58gpNz7zeY5qI0kcEXCVXBrD0a9Ilw7J4CH J57A/X9gY1KbGZD0iGL6y+9TpOrrRkq1Kw== X-Received: by 2002:a17:902:f1d3:b029:128:b8db:24dc with SMTP id e19-20020a170902f1d3b0290128b8db24dcmr17543235plc.47.1624993111114; Tue, 29 Jun 2021 11:58:31 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 51/63] tcg: Handle new bswap flags during optimize Date: Tue, 29 Jun 2021 11:54:43 -0700 Message-Id: <20210629185455.3131172-52-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Notice when the input is known to be zero-extended and force the TCG_BSWAP_IZ flag on. Honor the TCG_BSWAP_OS bit during constant folding. Propagate the input to the output mask. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/optimize.c | 56 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 5 deletions(-) -- 2.25.1 diff --git a/tcg/optimize.c b/tcg/optimize.c index 211a4209a0..9876ac52a8 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -355,10 +355,12 @@ static uint64_t do_constant_folding_2(TCGOpcode op, uint64_t x, uint64_t y) return (uint16_t)x; CASE_OP_32_64(bswap16): - return bswap16(x); + x = bswap16(x); + return y & TCG_BSWAP_OS ? (int16_t)x : x; CASE_OP_32_64(bswap32): - return bswap32(x); + x = bswap32(x); + return y & TCG_BSWAP_OS ? (int32_t)x : x; case INDEX_op_bswap64_i64: return bswap64(x); @@ -1029,6 +1031,42 @@ void tcg_optimize(TCGContext *s) } break; + CASE_OP_32_64(bswap16): + mask = arg_info(op->args[1])->mask; + if (mask <= 0xffff) { + op->args[2] |= TCG_BSWAP_IZ; + } + mask = bswap16(mask); + switch (op->args[2] & (TCG_BSWAP_OZ | TCG_BSWAP_OS)) { + case TCG_BSWAP_OZ: + break; + case TCG_BSWAP_OS: + mask = (int16_t)mask; + break; + default: /* undefined high bits */ + mask |= MAKE_64BIT_MASK(16, 48); + break; + } + break; + + case INDEX_op_bswap32_i64: + mask = arg_info(op->args[1])->mask; + if (mask <= 0xffffffffu) { + op->args[2] |= TCG_BSWAP_IZ; + } + mask = bswap32(mask); + switch (op->args[2] & (TCG_BSWAP_OZ | TCG_BSWAP_OS)) { + case TCG_BSWAP_OZ: + break; + case TCG_BSWAP_OS: + mask = (int32_t)mask; + break; + default: /* undefined high bits */ + mask |= MAKE_64BIT_MASK(32, 32); + break; + } + break; + default: break; } @@ -1135,9 +1173,6 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64(ext16s): CASE_OP_32_64(ext16u): CASE_OP_32_64(ctpop): - CASE_OP_32_64(bswap16): - CASE_OP_32_64(bswap32): - case INDEX_op_bswap64_i64: case INDEX_op_ext32s_i64: case INDEX_op_ext32u_i64: case INDEX_op_ext_i32_i64: @@ -1151,6 +1186,17 @@ void tcg_optimize(TCGContext *s) } goto do_default; + CASE_OP_32_64(bswap16): + CASE_OP_32_64(bswap32): + case INDEX_op_bswap64_i64: + if (arg_is_const(op->args[1])) { + tmp = do_constant_folding(opc, arg_info(op->args[1])->val, + op->args[2]); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); + break; + } + goto do_default; + CASE_OP_32_64(add): CASE_OP_32_64(sub): CASE_OP_32_64(mul): From patchwork Tue Jun 29 18:54:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468374 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5271461jao; Tue, 29 Jun 2021 13:00:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCUBiVltrrK7h2zNVMU3vdtP1dpqdF6jk7OOnLXBM55DgKineXwc/xPaIjsXnB1cb0uATl X-Received: by 2002:a25:ed0d:: with SMTP id k13mr41168126ybh.439.1624996822125; Tue, 29 Jun 2021 13:00:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996822; cv=none; d=google.com; s=arc-20160816; b=UM78J6if/Kk6kdGNdOe79NAPO4bkEPu/RjcOuioQELvnwWqW3Y9f68Qy9SSWqENo9y QNqTEujNBm496f+EHGjbl/LJ2ya8NOhG/FFGqJI5Yr9V6CdZMTcSoYLdirz+rKfaV7Qv 9iaBFhRJy9YFYp9rp1mgJGCNxwB+Z/mDp/DxjjZ1uc3vrT4x+P8b8xxx6QGceL9v1U9z +8MoLk4xdoyASYunqsicFbtAAC2PazKFTpE1weWO4FqJrQDqrR9GbMrrH7IBxJwrYyYw ynYcDEDhsB0bDg80ed2Yq2RrSuwkPRFZPdsDfRyAGzBIndc5bpzqPxIXKyj8LFlBnY9z sK7A== 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=7QBkRANAOfLzzSC3Z55NnJNLsqAzfJHlMxp4hl0kylM=; b=a9b/vdO/E0yVDUs+FKbrvfgq4Y1aahNq5yaN7B4osG8/YSmyzzblu616Ep+gPkBoo0 hOf5Y46oguf4Qhc6U+m5Q2beMdKCg0EgkhVsnOAWwTcCerVGvR3VCMujJy3lhDbidzYG jSm2EV41gpTblmxrojjS+8WDCOdkqWFq3qDGMum3qySEorLZJnGZwy0XsRG4MSCl0U2X gmdM5tL46AZKBT0r/TfvAh4S1/qq9Of8B1Sy2Kzafc47SuCjqgdjDeXFNYMw4QYJO6+Y VlWNS1GUfoWISdxU+sz+a1tI9YNBovLDTS+3KTM/eTJ4JBSkfYh1Moz0tTVRXDCouOE6 18Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sARrkReO; 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 k16si16961814ybp.113.2021.06.29.13.00.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 13:00:22 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sARrkReO; 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]:34810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJu9-0000eD-GV for patch@linaro.org; Tue, 29 Jun 2021 16:00:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwg-0004Av-6Q for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:54 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:37495) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwM-00030o-PH for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:53 -0400 Received: by mail-pf1-x42d.google.com with SMTP id s137so115814pfc.4 for ; Tue, 29 Jun 2021 11:58: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=7QBkRANAOfLzzSC3Z55NnJNLsqAzfJHlMxp4hl0kylM=; b=sARrkReOy7FIPKZmubZyaBLBSx2f4LQQuM2no0W6fC3AfrS/Xz+L6nRQxj0b4uzf1k p1z7fRPDuZisDkZNysoskuZij/LH6LxoTg37IFsPb1+zL/277dFKL4s4Lwx5U3TFfXj1 vQ/LlwjeFzM+SqHMN9t5WgN4ksK9erS0iz7ON/ld4rXaBe2frL2+Nj0WpUoUDogcDddt y6brLF39fp/MCjXNInL75JXCXwwjnRiZQvDu71taeFNy7yafcbP9ovPJWp1AYnADbpPr 8ySXp/qd+RnO4efCIHPoOCNUAVvjg+AE5ZdipuZOpFmWsybsg4kPjvZV4iulX4qIjGls UBEg== 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=7QBkRANAOfLzzSC3Z55NnJNLsqAzfJHlMxp4hl0kylM=; b=g1LF0BUTJzFn4OZpUwarU/VwSz7vTWOLfSPE2PSTY7cW0omAUKgaH5inrIhkFEAXd2 mquD+thAxItCN7ez+kUo340w333JSHMHnOjPR7bMlhbkaHtcIFiMz2MoXVJxE3KtMKeH uWeCqyHTRMA+WudFOtsUZQ6H+M7rTmzLLmgDLaXh2C3KYtDLLZ1lAe+4z8U93ZaFb8cm XE5rSutLwajRLTm5uX9H4yL6yfyi1fLp/iWxQEyJxYlcpCr12Qw8Fv01YY+sBiXEBvco pprk3iUzUDHREbn4Vs1KTKlZ8TaNLqxEIBGmk9qXkVMYx6ux1RyqAgQW0Xpzf3P6KuVT l7CQ== X-Gm-Message-State: AOAM531THs7MXMck0n/6mIE1a2y4sK6oFbWKu+upS4fZ4JaTa9eVgTeL rGi2vvHFsfHteO0lBovTJl0p6AH2aWPxyQ== X-Received: by 2002:a63:445b:: with SMTP id t27mr29873975pgk.413.1624993112044; Tue, 29 Jun 2021 11:58:32 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 52/63] tcg: Add flags argument to tcg_gen_bswap16_*, tcg_gen_bswap32_i64 Date: Tue, 29 Jun 2021 11:54:44 -0700 Message-Id: <20210629185455.3131172-53-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?b?YXVkw6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Implement the new semantics in the fallback expansion. Change all callers to supply the flags that keep the semantics unchanged locally. Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/tcg/tcg-op.h | 8 +-- target/arm/translate-a64.c | 12 ++-- target/arm/translate.c | 2 +- target/i386/tcg/translate.c | 2 +- target/mips/tcg/mxu_translate.c | 2 +- target/s390x/translate.c | 4 +- target/sh4/translate.c | 2 +- tcg/tcg-op.c | 121 ++++++++++++++++++++++---------- 8 files changed, 99 insertions(+), 54 deletions(-) -- 2.25.1 diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 1a2ae93758..2a654f350c 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -330,7 +330,7 @@ void tcg_gen_ext8s_i32(TCGv_i32 ret, TCGv_i32 arg); void tcg_gen_ext16s_i32(TCGv_i32 ret, TCGv_i32 arg); void tcg_gen_ext8u_i32(TCGv_i32 ret, TCGv_i32 arg); void tcg_gen_ext16u_i32(TCGv_i32 ret, TCGv_i32 arg); -void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg); +void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg, int flags); void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg); void tcg_gen_smin_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2); void tcg_gen_smax_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2); @@ -528,8 +528,8 @@ void tcg_gen_ext32s_i64(TCGv_i64 ret, TCGv_i64 arg); void tcg_gen_ext8u_i64(TCGv_i64 ret, TCGv_i64 arg); void tcg_gen_ext16u_i64(TCGv_i64 ret, TCGv_i64 arg); void tcg_gen_ext32u_i64(TCGv_i64 ret, TCGv_i64 arg); -void tcg_gen_bswap16_i64(TCGv_i64 ret, TCGv_i64 arg); -void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg); +void tcg_gen_bswap16_i64(TCGv_i64 ret, TCGv_i64 arg, int flags); +void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg, int flags); void tcg_gen_bswap64_i64(TCGv_i64 ret, TCGv_i64 arg); void tcg_gen_smin_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); void tcg_gen_smax_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); @@ -1192,7 +1192,7 @@ void tcg_gen_stl_vec(TCGv_vec r, TCGv_ptr base, TCGArg offset, TCGType t); #define tcg_gen_ext32u_tl tcg_gen_mov_i32 #define tcg_gen_ext32s_tl tcg_gen_mov_i32 #define tcg_gen_bswap16_tl tcg_gen_bswap16_i32 -#define tcg_gen_bswap32_tl tcg_gen_bswap32_i32 +#define tcg_gen_bswap32_tl(D, S, F) tcg_gen_bswap32_i32(D, S) #define tcg_gen_bswap_tl tcg_gen_bswap32_i32 #define tcg_gen_concat_tl_i64 tcg_gen_concat_i32_i64 #define tcg_gen_extr_i64_tl tcg_gen_extr_i64_i32 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 7f74d0e81a..f2641a37ba 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -5437,15 +5437,15 @@ static void handle_rev32(DisasContext *s, unsigned int sf, /* bswap32_i64 requires zero high word */ tcg_gen_ext32u_i64(tcg_tmp, tcg_rn); - tcg_gen_bswap32_i64(tcg_rd, tcg_tmp); + tcg_gen_bswap32_i64(tcg_rd, tcg_tmp, TCG_BSWAP_IZ | TCG_BSWAP_OZ); tcg_gen_shri_i64(tcg_tmp, tcg_rn, 32); - tcg_gen_bswap32_i64(tcg_tmp, tcg_tmp); + tcg_gen_bswap32_i64(tcg_tmp, tcg_tmp, TCG_BSWAP_IZ | TCG_BSWAP_OZ); tcg_gen_concat32_i64(tcg_rd, tcg_rd, tcg_tmp); tcg_temp_free_i64(tcg_tmp); } else { tcg_gen_ext32u_i64(tcg_rd, cpu_reg(s, rn)); - tcg_gen_bswap32_i64(tcg_rd, tcg_rd); + tcg_gen_bswap32_i64(tcg_rd, tcg_rd, TCG_BSWAP_IZ | TCG_BSWAP_OZ); } } @@ -12453,10 +12453,12 @@ static void handle_rev(DisasContext *s, int opcode, bool u, read_vec_element(s, tcg_tmp, rn, i, grp_size); switch (grp_size) { case MO_16: - tcg_gen_bswap16_i64(tcg_tmp, tcg_tmp); + tcg_gen_bswap16_i64(tcg_tmp, tcg_tmp, + TCG_BSWAP_IZ | TCG_BSWAP_OZ); break; case MO_32: - tcg_gen_bswap32_i64(tcg_tmp, tcg_tmp); + tcg_gen_bswap32_i64(tcg_tmp, tcg_tmp, + TCG_BSWAP_IZ | TCG_BSWAP_OZ); break; case MO_64: tcg_gen_bswap64_i64(tcg_tmp, tcg_tmp); diff --git a/target/arm/translate.c b/target/arm/translate.c index 9e2cca7707..669b0be578 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -355,7 +355,7 @@ void gen_rev16(TCGv_i32 dest, TCGv_i32 var) static void gen_revsh(TCGv_i32 dest, TCGv_i32 var) { tcg_gen_ext16u_i32(var, var); - tcg_gen_bswap16_i32(var, var); + tcg_gen_bswap16_i32(var, var, TCG_BSWAP_IZ | TCG_BSWAP_OZ); tcg_gen_ext16s_i32(dest, var); } diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index a7f5c0c8f2..e8a9dcd21a 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -7203,7 +7203,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) { gen_op_mov_v_reg(s, MO_32, s->T0, reg); tcg_gen_ext32u_tl(s->T0, s->T0); - tcg_gen_bswap32_tl(s->T0, s->T0); + tcg_gen_bswap32_tl(s->T0, s->T0, TCG_BSWAP_IZ | TCG_BSWAP_OZ); gen_op_mov_reg_v(s, MO_32, reg, s->T0); } break; diff --git a/target/mips/tcg/mxu_translate.c b/target/mips/tcg/mxu_translate.c index 963d4ba8b1..3f35e46399 100644 --- a/target/mips/tcg/mxu_translate.c +++ b/target/mips/tcg/mxu_translate.c @@ -861,7 +861,7 @@ static void gen_mxu_s32ldd_s32lddr(DisasContext *ctx) if (sel == 1) { /* S32LDDR */ - tcg_gen_bswap32_tl(t1, t1); + tcg_gen_bswap32_tl(t1, t1, TCG_BSWAP_IZ | TCG_BSWAP_OZ); } gen_store_mxu_gpr(t1, XRa); diff --git a/target/s390x/translate.c b/target/s390x/translate.c index e243624d2a..03dab9f350 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3939,13 +3939,13 @@ static DisasJumpType op_rosbg(DisasContext *s, DisasOps *o) static DisasJumpType op_rev16(DisasContext *s, DisasOps *o) { - tcg_gen_bswap16_i64(o->out, o->in2); + tcg_gen_bswap16_i64(o->out, o->in2, TCG_BSWAP_IZ | TCG_BSWAP_OZ); return DISAS_NEXT; } static DisasJumpType op_rev32(DisasContext *s, DisasOps *o) { - tcg_gen_bswap32_i64(o->out, o->in2); + tcg_gen_bswap32_i64(o->out, o->in2, TCG_BSWAP_IZ | TCG_BSWAP_OZ); return DISAS_NEXT; } diff --git a/target/sh4/translate.c b/target/sh4/translate.c index 9312790623..147219759b 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -677,7 +677,7 @@ static void _decode_opc(DisasContext * ctx) { TCGv low = tcg_temp_new(); tcg_gen_ext16u_i32(low, REG(B7_4)); - tcg_gen_bswap16_i32(low, low); + tcg_gen_bswap16_i32(low, low, TCG_BSWAP_IZ | TCG_BSWAP_OZ); tcg_gen_deposit_i32(REG(B11_8), REG(B7_4), low, 0, 16); tcg_temp_free(low); } diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index dc65577e2f..949cbf2f03 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -1001,20 +1001,35 @@ void tcg_gen_ext16u_i32(TCGv_i32 ret, TCGv_i32 arg) } } -/* Note: we assume the two high bytes are set to zero */ -void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg) +void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg, int flags) { + /* Only one extension flag may be present. */ + tcg_debug_assert(!(flags & TCG_BSWAP_OS) || !(flags & TCG_BSWAP_OZ)); + if (TCG_TARGET_HAS_bswap16_i32) { - tcg_gen_op3i_i32(INDEX_op_bswap16_i32, ret, arg, - TCG_BSWAP_IZ | TCG_BSWAP_OZ); + tcg_gen_op3i_i32(INDEX_op_bswap16_i32, ret, arg, flags); } else { TCGv_i32 t0 = tcg_temp_new_i32(); + TCGv_i32 t1 = tcg_temp_new_i32(); - tcg_gen_ext8u_i32(t0, arg); - tcg_gen_shli_i32(t0, t0, 8); - tcg_gen_shri_i32(ret, arg, 8); - tcg_gen_or_i32(ret, ret, t0); + tcg_gen_shri_i32(t0, arg, 8); + if (!(flags & TCG_BSWAP_IZ)) { + tcg_gen_ext8u_i32(t0, t0); + } + + if (flags & TCG_BSWAP_OS) { + tcg_gen_shli_i32(t1, arg, 24); + tcg_gen_sari_i32(t1, t1, 16); + } else if (flags & TCG_BSWAP_OZ) { + tcg_gen_ext8u_i32(t1, arg); + tcg_gen_shli_i32(t1, t1, 8); + } else { + tcg_gen_shli_i32(t1, arg, 8); + } + + tcg_gen_or_i32(ret, t0, t1); tcg_temp_free_i32(t0); + tcg_temp_free_i32(t1); } } @@ -1655,51 +1670,79 @@ void tcg_gen_ext32u_i64(TCGv_i64 ret, TCGv_i64 arg) } } -/* Note: we assume the six high bytes are set to zero */ -void tcg_gen_bswap16_i64(TCGv_i64 ret, TCGv_i64 arg) +void tcg_gen_bswap16_i64(TCGv_i64 ret, TCGv_i64 arg, int flags) { + /* Only one extension flag may be present. */ + tcg_debug_assert(!(flags & TCG_BSWAP_OS) || !(flags & TCG_BSWAP_OZ)); + if (TCG_TARGET_REG_BITS == 32) { - tcg_gen_bswap16_i32(TCGV_LOW(ret), TCGV_LOW(arg)); - tcg_gen_movi_i32(TCGV_HIGH(ret), 0); + tcg_gen_bswap16_i32(TCGV_LOW(ret), TCGV_LOW(arg), flags); + if (flags & TCG_BSWAP_OS) { + tcg_gen_sari_i32(TCGV_HIGH(ret), TCGV_LOW(ret), 31); + } else { + tcg_gen_movi_i32(TCGV_HIGH(ret), 0); + } } else if (TCG_TARGET_HAS_bswap16_i64) { - tcg_gen_op3i_i64(INDEX_op_bswap16_i64, ret, arg, - TCG_BSWAP_IZ | TCG_BSWAP_OZ); + tcg_gen_op3i_i64(INDEX_op_bswap16_i64, ret, arg, flags); } else { TCGv_i64 t0 = tcg_temp_new_i64(); + TCGv_i64 t1 = tcg_temp_new_i64(); - tcg_gen_ext8u_i64(t0, arg); - tcg_gen_shli_i64(t0, t0, 8); - tcg_gen_shri_i64(ret, arg, 8); - tcg_gen_or_i64(ret, ret, t0); + tcg_gen_shri_i64(t0, arg, 8); + if (!(flags & TCG_BSWAP_IZ)) { + tcg_gen_ext8u_i64(t0, t0); + } + + if (flags & TCG_BSWAP_OS) { + tcg_gen_shli_i64(t1, arg, 56); + tcg_gen_sari_i64(t1, t1, 48); + } else if (flags & TCG_BSWAP_OZ) { + tcg_gen_ext8u_i64(t1, arg); + tcg_gen_shli_i64(t1, t1, 8); + } else { + tcg_gen_shli_i64(t1, arg, 8); + } + + tcg_gen_or_i64(ret, t0, t1); tcg_temp_free_i64(t0); + tcg_temp_free_i64(t1); } } -/* Note: we assume the four high bytes are set to zero */ -void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg) +void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg, int flags) { + /* Only one extension flag may be present. */ + tcg_debug_assert(!(flags & TCG_BSWAP_OS) || !(flags & TCG_BSWAP_OZ)); + if (TCG_TARGET_REG_BITS == 32) { tcg_gen_bswap32_i32(TCGV_LOW(ret), TCGV_LOW(arg)); - tcg_gen_movi_i32(TCGV_HIGH(ret), 0); + if (flags & TCG_BSWAP_OS) { + tcg_gen_sari_i32(TCGV_HIGH(ret), TCGV_LOW(ret), 31); + } else { + tcg_gen_movi_i32(TCGV_HIGH(ret), 0); + } } else if (TCG_TARGET_HAS_bswap32_i64) { - tcg_gen_op3i_i64(INDEX_op_bswap32_i64, ret, arg, - TCG_BSWAP_IZ | TCG_BSWAP_OZ); + tcg_gen_op3i_i64(INDEX_op_bswap32_i64, ret, arg, flags); } else { TCGv_i64 t0 = tcg_temp_new_i64(); TCGv_i64 t1 = tcg_temp_new_i64(); TCGv_i64 t2 = tcg_constant_i64(0x00ff00ff); - /* arg = ....abcd */ - tcg_gen_shri_i64(t0, arg, 8); /* t0 = .....abc */ - tcg_gen_and_i64(t1, arg, t2); /* t1 = .....b.d */ - tcg_gen_and_i64(t0, t0, t2); /* t0 = .....a.c */ - tcg_gen_shli_i64(t1, t1, 8); /* t1 = ....b.d. */ - tcg_gen_or_i64(ret, t0, t1); /* ret = ....badc */ + /* arg = xxxxabcd */ + tcg_gen_shri_i64(t0, arg, 8); /* t0 = .xxxxabc */ + tcg_gen_and_i64(t1, arg, t2); /* t1 = .....b.d */ + tcg_gen_and_i64(t0, t0, t2); /* t0 = .....a.c */ + tcg_gen_shli_i64(t1, t1, 8); /* t1 = ....b.d. */ + tcg_gen_or_i64(ret, t0, t1); /* ret = ....badc */ - tcg_gen_shli_i64(t1, ret, 48); /* t1 = dc...... */ - tcg_gen_shri_i64(t0, ret, 16); /* t0 = ......ba */ - tcg_gen_shri_i64(t1, t1, 32); /* t1 = ....dc.. */ - tcg_gen_or_i64(ret, t0, t1); /* ret = ....dcba */ + tcg_gen_shli_i64(t1, ret, 48); /* t1 = dc...... */ + tcg_gen_shri_i64(t0, ret, 16); /* t0 = ......ba */ + if (flags & TCG_BSWAP_OS) { + tcg_gen_sari_i64(t1, t1, 32); /* t1 = ssssdc.. */ + } else { + tcg_gen_shri_i64(t1, t1, 32); /* t1 = ....dc.. */ + } + tcg_gen_or_i64(ret, t0, t1); /* ret = ssssdcba */ tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); @@ -2846,7 +2889,7 @@ void tcg_gen_qemu_ld_i32(TCGv_i32 val, TCGv addr, TCGArg idx, MemOp memop) if ((orig_memop ^ memop) & MO_BSWAP) { switch (orig_memop & MO_SIZE) { case MO_16: - tcg_gen_bswap16_i32(val, val); + tcg_gen_bswap16_i32(val, val, TCG_BSWAP_IZ | TCG_BSWAP_OZ); if (orig_memop & MO_SIGN) { tcg_gen_ext16s_i32(val, val); } @@ -2874,7 +2917,7 @@ void tcg_gen_qemu_st_i32(TCGv_i32 val, TCGv addr, TCGArg idx, MemOp memop) switch (memop & MO_SIZE) { case MO_16: tcg_gen_ext16u_i32(swap, val); - tcg_gen_bswap16_i32(swap, swap); + tcg_gen_bswap16_i32(swap, swap, TCG_BSWAP_IZ | TCG_BSWAP_OZ); break; case MO_32: tcg_gen_bswap32_i32(swap, val); @@ -2935,13 +2978,13 @@ void tcg_gen_qemu_ld_i64(TCGv_i64 val, TCGv addr, TCGArg idx, MemOp memop) if ((orig_memop ^ memop) & MO_BSWAP) { switch (orig_memop & MO_SIZE) { case MO_16: - tcg_gen_bswap16_i64(val, val); + tcg_gen_bswap16_i64(val, val, TCG_BSWAP_IZ | TCG_BSWAP_OZ); if (orig_memop & MO_SIGN) { tcg_gen_ext16s_i64(val, val); } break; case MO_32: - tcg_gen_bswap32_i64(val, val); + tcg_gen_bswap32_i64(val, val, TCG_BSWAP_IZ | TCG_BSWAP_OZ); if (orig_memop & MO_SIGN) { tcg_gen_ext32s_i64(val, val); } @@ -2975,11 +3018,11 @@ void tcg_gen_qemu_st_i64(TCGv_i64 val, TCGv addr, TCGArg idx, MemOp memop) switch (memop & MO_SIZE) { case MO_16: tcg_gen_ext16u_i64(swap, val); - tcg_gen_bswap16_i64(swap, swap); + tcg_gen_bswap16_i64(swap, swap, TCG_BSWAP_IZ | TCG_BSWAP_OZ); break; case MO_32: tcg_gen_ext32u_i64(swap, val); - tcg_gen_bswap32_i64(swap, swap); + tcg_gen_bswap32_i64(swap, swap, TCG_BSWAP_IZ | TCG_BSWAP_OZ); break; case MO_64: tcg_gen_bswap64_i64(swap, val); From patchwork Tue Jun 29 18:54:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468371 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5270104jao; Tue, 29 Jun 2021 12:58:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8HH4POW51Isg0/Gt37nd9WmH33doPA+yd3FjfqP/QqXN1L67IXUY6JgFsTmXJHJC3lGDh X-Received: by 2002:a25:cccb:: with SMTP id l194mr38341565ybf.310.1624996685648; Tue, 29 Jun 2021 12:58:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996685; cv=none; d=google.com; s=arc-20160816; b=NJ5hmG4RmPQpuDvNL5ifpKNeloIuwyW7Zd4+SxJx/INS5v9JodF/JpzmMkHionZkxV wvXditcyXV6ZpwOgzct8NbZdnktQRKx13he9A4xvRY0Yuje/j0RJ3Zs3zgv12FLPwJC4 +fR3b/P9bXpazOnG+vaFVsGGm8KEduGQAnA/Aaz5sWDx5zH55x2RuHifFzT+7j5J4eJ4 kBD9yvTSXIpW44rYaQdeX90oGj+x/Rn2Y3eTdxjH+sqIlwAUSx9MI/U8qE79MEdEE6Z/ EzEZk/DUPWJzAqyf1Zgvk8bVDRBfe/YVyBNCU5sXMPhapF8GmLkiiklYyvk+ozcuJbbq Vmcw== 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=eqcIH7qyxMLCC/xbyp4OcZdnc1e2Y1iNmkzCM4CoVhg=; b=EYxmpdZyi4y7lcnCd/Y2+zfxbzWoPXLMoud0YKwCQcTLTA/1IVLmJPpHCGYa4HNUeR nl6x+jyD/mQLKfcJCJxAirYEDVNsR9WRoIqm3G9oQcQKyB7txRSQFg/V7MjR99TvlcK3 rkKBFD2jZ8kT407w53cbXplY5/MtdzMwqR7NXSNdujC+odKl9vYFcTV1zRlVr/GMWpyc CPtWIKKwJ+fab7PFbe+WmRbG7Q2q9E9l1FRAHIYBgMU20nuByC+TUB44vcr0dhIz6Jql 7AxudduDn9DiiFivBBIUQAcZjnj/Tl03BTJT54m/rOYJdei+UEhKK05RG6mAOfJTlpYz YgyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WlBo8Bo8; 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 c127si20083932yba.286.2021.06.29.12.58.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:58: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=WlBo8Bo8; 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]:56438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJrx-0004e4-58 for patch@linaro.org; Tue, 29 Jun 2021 15:58:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwf-0004AC-Jk for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:53 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:35575) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwM-00030x-PP for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:52 -0400 Received: by mail-pj1-x1033.google.com with SMTP id pf4-20020a17090b1d84b029016f6699c3f2so2609222pjb.0 for ; Tue, 29 Jun 2021 11:58: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=eqcIH7qyxMLCC/xbyp4OcZdnc1e2Y1iNmkzCM4CoVhg=; b=WlBo8Bo8YXuU9RjQWy4jkn+1reyL52IKjAopoye4YTadviBhzeYh4LO4s6YtmyeziD JC1WM6aixncYYqDhWUDAQ4EZnt9i3nJ9foXgfpeit2tAZp8piX0UlCNSSlwhy8EJLwdC QThbiPv6F0RwO/TFnsTGqBYDsx5q0FIs9AqQsSXuEfk9AYrXX/9YAAeVvwenpQvmuf4p p0jKgsoPDYovtc7XP8genmR8FlB+fgV3CY0mBWWe3uOJPmV/6aOnkLn3/+hL8M9O6ZX5 omqI80fv/H8L1Vk1VM3xGIkR3XZVkDj1ap4F/gUFNKT+0vHEHwI0yAtoFwl9wh9CVyuS ZuJA== 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=eqcIH7qyxMLCC/xbyp4OcZdnc1e2Y1iNmkzCM4CoVhg=; b=Eze5nQajjO3hqG05LrNUlZxQ2ThdX5XBTP2vvMK6a4sp5zG+DaNB/hV7x7pHVxmchz vH8Z/7y3OaqCFo/PFnOaFs79PYbf8Un2DhslraN2AoyuiR/B414BQSTMFhnLlGvOMZjA xQ5q9UAFlRtJsX2rJzrlYJw4aphMaoT7pqLhfKHGRowrNoRY9EKyXi7POvep2E1hhLVB /QcA7Z+SztwesFj4YpShDrH7PAKb356iqtZT35yH2o3hNOVjtzs6wUJh0dizx/iQtUL5 222v0bI4aRFrWPLDuxeSvAJ3cgUtk6GJLF9BsLTXqmVZvninR0qNz2J7AGJgnQ3jYyTS fbzA== X-Gm-Message-State: AOAM533uVu6tKduSjI3a/P8Zy5Ud8hFDIcGF4RawQ6YJL9wvYDAG8S3v VBoxoI2RnBQro9pr9QMqgC3zhm74G1F7YA== X-Received: by 2002:a17:902:bd03:b029:11c:d504:c1ce with SMTP id p3-20020a170902bd03b029011cd504c1cemr28841666pls.7.1624993112813; Tue, 29 Jun 2021 11:58:32 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 53/63] tcg: Make use of bswap flags in tcg_gen_qemu_ld_* Date: Tue, 29 Jun 2021 11:54:45 -0700 Message-Id: <20210629185455.3131172-54-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?b?YXVkw6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We can perform any required sign-extension via TCG_BSWAP_OS. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/tcg-op.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) -- 2.25.1 diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 949cbf2f03..0eac2d1969 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -2876,7 +2876,7 @@ void tcg_gen_qemu_ld_i32(TCGv_i32 val, TCGv addr, TCGArg idx, MemOp memop) orig_memop = memop; if (!TCG_TARGET_HAS_MEMORY_BSWAP && (memop & MO_BSWAP)) { memop &= ~MO_BSWAP; - /* The bswap primitive requires zero-extended input. */ + /* The bswap primitive benefits from zero-extended input. */ if ((memop & MO_SSIZE) == MO_SW) { memop &= ~MO_SIGN; } @@ -2889,10 +2889,9 @@ void tcg_gen_qemu_ld_i32(TCGv_i32 val, TCGv addr, TCGArg idx, MemOp memop) if ((orig_memop ^ memop) & MO_BSWAP) { switch (orig_memop & MO_SIZE) { case MO_16: - tcg_gen_bswap16_i32(val, val, TCG_BSWAP_IZ | TCG_BSWAP_OZ); - if (orig_memop & MO_SIGN) { - tcg_gen_ext16s_i32(val, val); - } + tcg_gen_bswap16_i32(val, val, (orig_memop & MO_SIGN + ? TCG_BSWAP_IZ | TCG_BSWAP_OS + : TCG_BSWAP_IZ | TCG_BSWAP_OZ)); break; case MO_32: tcg_gen_bswap32_i32(val, val); @@ -2965,7 +2964,7 @@ void tcg_gen_qemu_ld_i64(TCGv_i64 val, TCGv addr, TCGArg idx, MemOp memop) orig_memop = memop; if (!TCG_TARGET_HAS_MEMORY_BSWAP && (memop & MO_BSWAP)) { memop &= ~MO_BSWAP; - /* The bswap primitive requires zero-extended input. */ + /* The bswap primitive benefits from zero-extended input. */ if ((memop & MO_SIGN) && (memop & MO_SIZE) < MO_64) { memop &= ~MO_SIGN; } @@ -2976,18 +2975,15 @@ void tcg_gen_qemu_ld_i64(TCGv_i64 val, TCGv addr, TCGArg idx, MemOp memop) plugin_gen_mem_callbacks(addr, info); if ((orig_memop ^ memop) & MO_BSWAP) { + int flags = (orig_memop & MO_SIGN + ? TCG_BSWAP_IZ | TCG_BSWAP_OS + : TCG_BSWAP_IZ | TCG_BSWAP_OZ); switch (orig_memop & MO_SIZE) { case MO_16: - tcg_gen_bswap16_i64(val, val, TCG_BSWAP_IZ | TCG_BSWAP_OZ); - if (orig_memop & MO_SIGN) { - tcg_gen_ext16s_i64(val, val); - } + tcg_gen_bswap16_i64(val, val, flags); break; case MO_32: - tcg_gen_bswap32_i64(val, val, TCG_BSWAP_IZ | TCG_BSWAP_OZ); - if (orig_memop & MO_SIGN) { - tcg_gen_ext32s_i64(val, val); - } + tcg_gen_bswap32_i64(val, val, flags); break; case MO_64: tcg_gen_bswap64_i64(val, val); From patchwork Tue Jun 29 18:54:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468368 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5268949jao; Tue, 29 Jun 2021 12:56:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHcgu0bwpm1OrFc4nYDXXBHyJOvxZCqiThOCfEJdIFkgOVzXZfhZIg8lSwD6j6wIq/xeUQ X-Received: by 2002:a25:b299:: with SMTP id k25mr44553957ybj.250.1624996570537; Tue, 29 Jun 2021 12:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996570; cv=none; d=google.com; s=arc-20160816; b=IDzwcXZNvspDoQRml6d/IzTkNgoeDsAFigwbB5r6JOPAtk06D8kBheGEndLq/0WX+A ZL+pgmoc6MDbkEUIT6JecW6X4JFDiB76CL4fso5z6kCcyGPY+xq17mFTlG13Gs6NNe1b 5m4aqKmtSIe2IVSZTsOutFfZXvOP/oddTnaXwuI4Yrm68xpsyQqAK4HSRXS9AmQ6TbVD YXSqfqsTLYdjso3cN0pVRAS1xwleA5bihiY2Qq/tmDcJLEYeEBcs738zM8CI317jiBu+ ndIT/KiMLVj5OURV8hU2OeDBpzS/ZVJpYAVEbaWYqEivMwK0SwzmFUJQoC3XoS2LSeLu 7bqQ== 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=hFW7/uteqhUz14as6VIJ+oMkuxFCaj8xI5hXiJ/YKgI=; b=W4rYexZx44Iw1zynEgO79vjoZ5wbWMvxPyt4YROVLufB9lHmlf0jtoSbpDJTGAp7/y NJWGdbKaASUOrkDz7vYLKpiLDAKml/7o73T9GlpZidfEb7VN+ArCMbtoOfNjOJabUx6s T2OMmJRLdP3BfSEgXx9K3gLEHjrNqNbQLk/gjA2dlzkuzw2M0itdcxovKYPchcogaMN7 LsZ1+9uEbhdHGhZNRC2Mz59s7gVR34vMTCZ+kOyRL/fDTnmqiVz8qK8UqNPVRcBvqHwr Erl8PLGk2h159z+Jbfzjo2QwbxEnlEhUl9IK3MBHKi+MWV7xH0apQf9DukyXfEtZCrDZ ZutQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=virIVCiS; 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 a18si989689ybr.265.2021.06.29.12.56.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:56:10 -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=virIVCiS; 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]:49904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJq5-0000CW-UR for patch@linaro.org; Tue, 29 Jun 2021 15:56:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwa-00046j-L2 for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:49 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:36454) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwM-000311-PI for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:48 -0400 Received: by mail-pg1-x529.google.com with SMTP id e33so19394111pgm.3 for ; Tue, 29 Jun 2021 11:58:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hFW7/uteqhUz14as6VIJ+oMkuxFCaj8xI5hXiJ/YKgI=; b=virIVCiSf9HZsnkxybrt81iJ0t+cCFwLF6U4jJduMC7aX3SS3zNb0pvRKN58xs32By pfT9jf+Fy3rO4IA+4WeE0sqiBVITZI3BcnDbXUnA2B63Q0MpQZSD9FJ29zPKTgsFTKk5 Zspw6SVk2FinI/Do8PFzvUZN4uznQlpSPdePqaytRz7jEAiZMPolT8Dn8G+xv4pDigdL Z3kh5L+LaOhCNOb2KfI8d4D+770Q0cpNCAHOUcUD/ckizrsEqLrcO+C12+UdriN3I/RM YJ2Gq3nVF3RYHvzhF+w5jUo+Ds/IwkeDoZoFRnUqovsBp7Ewkrqs83RDDC3C7kow1T1c uXtw== 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=hFW7/uteqhUz14as6VIJ+oMkuxFCaj8xI5hXiJ/YKgI=; b=sWx+nsLiIhRXqzqvovmg4n4PTZ3BOCaGIA8GjAo64Gk56VOjQCnpavpQd6HTPfzllm Oi8FxGL19FwNuitPLmLxWCD36ak42ekfK/NzFOiwQ8J7qhFzWKqEEmj2M6LNEn+odtkW l/I7Ijxd3C5YI8BzjxvKvH2z4sOOuDSxcFKEYrc2YCMK3qVGEyPxTOZpSjBJyuIw8IMY uEZlxiaFCelKo3uvkNS0tXQ24q3nJ/QdruqKreVlRtEEL/lLf4Kz7HSPLP8yoTr2BZRl 6HsMXcLWpZhoErCBH+1p9+EgmHpN1om7A9RWs0T0NvoYrOhNNu1IbpcrKlUM0kihw6na LSVg== X-Gm-Message-State: AOAM532B27ZEuUdfKq6D03mQ386/2c3cmVZIcoxI8dqoWOHAInSLh+3+ usSaRJ12ke1FUAbTGDMFYKPNqNTlNct0IA== X-Received: by 2002:a62:14d4:0:b029:307:1c6a:ae7d with SMTP id 203-20020a6214d40000b02903071c6aae7dmr31450062pfu.78.1624993113360; Tue, 29 Jun 2021 11:58:33 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 54/63] tcg: Make use of bswap flags in tcg_gen_qemu_st_* Date: Tue, 29 Jun 2021 11:54:46 -0700 Message-Id: <20210629185455.3131172-55-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" By removing TCG_BSWAP_IZ we indicate that the input is not zero-extended, and thus can remove an explicit extend. By removing TCG_BSWAP_OZ, we allow the implementation to leave high bits set, which will be ignored by the store. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/tcg-op.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 0eac2d1969..44d711c0fc 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -2915,8 +2915,7 @@ void tcg_gen_qemu_st_i32(TCGv_i32 val, TCGv addr, TCGArg idx, MemOp memop) swap = tcg_temp_new_i32(); switch (memop & MO_SIZE) { case MO_16: - tcg_gen_ext16u_i32(swap, val); - tcg_gen_bswap16_i32(swap, swap, TCG_BSWAP_IZ | TCG_BSWAP_OZ); + tcg_gen_bswap16_i32(swap, val, 0); break; case MO_32: tcg_gen_bswap32_i32(swap, val); @@ -3013,12 +3012,10 @@ void tcg_gen_qemu_st_i64(TCGv_i64 val, TCGv addr, TCGArg idx, MemOp memop) swap = tcg_temp_new_i64(); switch (memop & MO_SIZE) { case MO_16: - tcg_gen_ext16u_i64(swap, val); - tcg_gen_bswap16_i64(swap, swap, TCG_BSWAP_IZ | TCG_BSWAP_OZ); + tcg_gen_bswap16_i64(swap, val, 0); break; case MO_32: - tcg_gen_ext32u_i64(swap, val); - tcg_gen_bswap32_i64(swap, swap, TCG_BSWAP_IZ | TCG_BSWAP_OZ); + tcg_gen_bswap32_i64(swap, val, 0); break; case MO_64: tcg_gen_bswap64_i64(swap, val); From patchwork Tue Jun 29 18:54:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468376 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5273065jao; Tue, 29 Jun 2021 13:02:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwf3lnleldnHgXegFKqPGOuRIZ6Q+tuVMyrojiOYVv6t+1aluVQtK1X4JaxKxjrErJC+Bzt X-Received: by 2002:a05:6402:1345:: with SMTP id y5mr42479677edw.206.1624996932529; Tue, 29 Jun 2021 13:02:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996932; cv=none; d=google.com; s=arc-20160816; b=KUDq7jcLrPxTGGeYutOmPVJzJz2VqVRiAW1rlhZaPPPrWhA6MLyRMepw89lY34tBtL d8Akm8J5h9Fv0rI0AZ7dFSNvutk6y8JssEwzMnIx0CXQvA3651WJeSnM1eBEH9xCmDzM Dka3GBHaSlGn8sFs/4BoPcS7kPnkRUe5H7QkdKaJ43wPCgVR+6ZdAXZJhG7BnKoaupAt gDoz2qlGFNk0e0JwSIC72/t+PEYCm9YQ3aRCeXHxeE6lxNWyOSyeCpxQUP7IfHhyX61L T+mKlnINvQUoUTC06LoOJEy4aWSMsDZTA3R8Jj/AjIQfd3/dAGYzXAhPy15FA429XtTy h30g== 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=jZ+vu44B3MA2rQDPHlYV5+XUBqzkPAnWuZi1J6wYDao=; b=1JrRoNHQ0ivKREvhiYYIPF2O7CQzXWR4Mui5KG9QETikW15ZddrezUCkjmUvO82XJL +I6bzSWMcnyewz+/L0Wsx/XujQ7NZ+Pnurt+2ZZo8+ZN7Jl3CkJc2tDnFJ6qrm1SMV00 HQ0odWzMRZCnOoNshrykybE+KGrLa5bIUNzRLmZCQGs+fFWNtNbtNEXSQE0ry5GK6bjc 1G7VliVf6PbIFauJgDSjmyRK+OKMxn7hF1Gm8cjrwYD7qlKwUXhkK7z6WcjrLoiD8v9m lM4h9dmoj6I9Pcln3ll0liG5c7YyB3mx4o7Bft5AymEMCcGm9DU315bbxc7Y3DKu5kie QAhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rvyU8Ojp; 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 j3si18317445ejj.448.2021.06.29.13.02.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 13:02: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=rvyU8Ojp; 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]:41254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJvv-00055f-Dw for patch@linaro.org; Tue, 29 Jun 2021 16:02:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwi-0004Eq-TT for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:57 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:41759) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwN-000319-4s for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:56 -0400 Received: by mail-pf1-x429.google.com with SMTP id c5so98436pfv.8 for ; Tue, 29 Jun 2021 11:58:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jZ+vu44B3MA2rQDPHlYV5+XUBqzkPAnWuZi1J6wYDao=; b=rvyU8OjpPX4X/aVIwFeQqNdHSgafL6hYrbmAE6RWeXr9WevwvbPyz256JA9V1MmuSs G71H33uxFPm+QayrxepfWhTPdfnHfdR8HWVCrWwK5g6MGNEfDp0TQFxRoRPwGHS+R2Z2 N8LC54CZlmc/D9KBc93ay8FUfvZorAGIySUnwc/vvBntatlxB7Ic/FEpay+6lmArqVLp wSU7PjAj7njf/dQL6qVF5T/zdBrBHYKPT3foAHkh9TYyYYtFJePhVMD0tFBl5dsfbcyU Bo6DxBPg01C2YktQuG5jMGyNrbziIMbE21XerqtFLmsJCam4mp+8tyop94+NSBeWnPWO U9Rg== 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=jZ+vu44B3MA2rQDPHlYV5+XUBqzkPAnWuZi1J6wYDao=; b=nAKYs+iQJVPOEB3iZmdG6ICgGKSyWIrWtYIL7qYOJd+BplDQebXyWTFNn+OlWKXqJj Nqb8iYErlTa2aKw/fiYyFeCdeciXZdXvGgre64TeQYcDOgiuC2fJkkT8j3aq529PM8gX AlXTsf3LD10jSe/78cOCnPFwZGwkf2AvFoObtgYcnYxTAdPENnodCxr/FhRFBtpaCe79 P9X4AlNBEWlrbrneEMygUzLGkN516zdlSAmLX5X+83CGFBo5SUMhsWsGPDKL1aCPd4/8 yrFGmmbDFhBayDkgh/yLZlxi0dgLIbY3URDNzp9uISGbWwZ5BIGIHjPP94x+FmYb2WNX XplA== X-Gm-Message-State: AOAM53244x9O2dbro2ECZTq1cqWmpviLY5Dggb2YnZlyJY5D2uWfs3PA Gep3beV8Bba93jks/+9glH36sxspedjtZw== X-Received: by 2002:a63:6781:: with SMTP id b123mr25280686pgc.397.1624993113980; Tue, 29 Jun 2021 11:58:33 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 55/63] target/arm: Improve REV32 Date: Tue, 29 Jun 2021 11:54:47 -0700 Message-Id: <20210629185455.3131172-56-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?b?YXVkw6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For the sf version, we are performing two 32-bit bswaps in either half of the register. This is equivalent to performing one 64-bit bswap followed by a rotate. For the non-sf version, we can remove TCG_BSWAP_IZ and the preceding zero-extension. Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) -- 2.25.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index f2641a37ba..304fd3d370 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -5430,22 +5430,13 @@ static void handle_rev32(DisasContext *s, unsigned int sf, unsigned int rn, unsigned int rd) { TCGv_i64 tcg_rd = cpu_reg(s, rd); + TCGv_i64 tcg_rn = cpu_reg(s, rn); if (sf) { - TCGv_i64 tcg_tmp = tcg_temp_new_i64(); - TCGv_i64 tcg_rn = read_cpu_reg(s, rn, sf); - - /* bswap32_i64 requires zero high word */ - tcg_gen_ext32u_i64(tcg_tmp, tcg_rn); - tcg_gen_bswap32_i64(tcg_rd, tcg_tmp, TCG_BSWAP_IZ | TCG_BSWAP_OZ); - tcg_gen_shri_i64(tcg_tmp, tcg_rn, 32); - tcg_gen_bswap32_i64(tcg_tmp, tcg_tmp, TCG_BSWAP_IZ | TCG_BSWAP_OZ); - tcg_gen_concat32_i64(tcg_rd, tcg_rd, tcg_tmp); - - tcg_temp_free_i64(tcg_tmp); + tcg_gen_bswap64_i64(tcg_rd, tcg_rn); + tcg_gen_rotri_i64(tcg_rd, tcg_rd, 32); } else { - tcg_gen_ext32u_i64(tcg_rd, cpu_reg(s, rn)); - tcg_gen_bswap32_i64(tcg_rd, tcg_rd, TCG_BSWAP_IZ | TCG_BSWAP_OZ); + tcg_gen_bswap32_i64(tcg_rd, tcg_rn, TCG_BSWAP_OZ); } } From patchwork Tue Jun 29 18:54:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468378 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5274982jao; Tue, 29 Jun 2021 13:04:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1j3Jl1uoROu9ePU/3i30ESIoLHwNVg70LkLA0G/7zLwrHqTMauapnW2f9CSt0tGy5F8Xx X-Received: by 2002:a25:c9c7:: with SMTP id z190mr40340604ybf.21.1624997054971; Tue, 29 Jun 2021 13:04:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624997054; cv=none; d=google.com; s=arc-20160816; b=Smndz1Ffiy4/nPtGzK5uGlRgvT+N0ULpxwL3neu8WkHqsvJ5xz8vGFUfCUgOCZ/cXO tmsVVibhw8l1hcDi4lemg0W0zjyt9uQo5YcH8pl9f6rhrbv0pG4CSzhLAHFJw+ENFlTw jj9pk8ahgCboO7jkzz5KeQmRRh8xoF/AxTUJftrlRYplFldIhweeRXI9TxZDdnwfiWkR iY1SkjHnJ9P19urOEL4IS3AydB2Gt0J2gxoX/60tLSySqQTUnBkysBpW8ST95ihYnhC2 5UtixIMLSbEWWIpq2v1gVUo+6nf5ji5g2sWVAMXUA4eDR3SWGp+s5/e5pdB1ANmRmF2h 5lnQ== 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=Y/anbb6DPNvIO8E9zByeUSadBR7zd/opSVuaQ6a6eP4=; b=LV8dxWy2dq/WNcfyVZh8+UhQczWCBR2ENHb1seZMkIFG1Jpbflitqro+fPt+cpslZf kWE2F1GFBA25WJD0yk0xbB/zHzBCaz5hAIMiBhjccIVTzn3Ns8u0v38U18ggGccwWAgN EhAFWzJPMLZYuaZLXdOWcEl8awcg1d/DVzFClhVeOY/DKu+pxNn/RY0lgt+H/ToPTI0Y eNZXAmvQJKFYXivIXGiOaT8uYucX+O61aYdJ+e99fGBjyaXUCSJEympdlXsajxMX6uY4 QZ5t1k1lGb+SVG8HfggM2uSiSU0ckhsTa+nimAqpKQe0BSszR/DRiSDI6SSU4biClOA5 9RJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BzmcQhDa; 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 y11si4017663ybp.82.2021.06.29.13.04.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 13:04:14 -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=BzmcQhDa; 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]:47678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJxt-0000xB-Us for patch@linaro.org; Tue, 29 Jun 2021 16:04:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwl-0004JE-2c for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:59 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:40501) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwO-00031Z-K0 for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:58 -0400 Received: by mail-pg1-x536.google.com with SMTP id g22so1104524pgl.7 for ; Tue, 29 Jun 2021 11:58: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=Y/anbb6DPNvIO8E9zByeUSadBR7zd/opSVuaQ6a6eP4=; b=BzmcQhDaQ52jEGbZRotnM66CCSOsQTiSBKGl+eB4MFyPhLE8n30V9QSbs3E6Mp9yu9 M+uliDyM5iXLfEiqdcaRaq4x1ffL5+sJkCTFLjAFSE7kBi9jjjyRiPe5xh3eqY+faAdF RpL+M6fZ/rZpW+YyvqLJRs/671nf26E0rLyoFhC5f8wHkPHfS3g5da0QmJJ3cudl6dqh kHjp0t3E/SLg5K1WiecFZJqVusHb9o0FAp3KfT9ztApyVsckUt/52bZaUzh5m8V4+/KM LaDuEj3njsnQXEKe6UrMt/0wUwgLowhwmYQOy5H0X8YGPCF2UZXgBumgfF9fqkPPct4p nKoQ== 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=Y/anbb6DPNvIO8E9zByeUSadBR7zd/opSVuaQ6a6eP4=; b=hFeJdBwUgL5wobQ9C2ZACRbXtcGOLMGJ+ujIiGz926cZq2QZ2gS0L4drUCxLC26dkO KIa+05Z/P3klXHUkpWeZRgr6PDnERY/yY9h/sX/8y8mTK+Hiz3gcFOzMXWS1+4Dbdw/+ vy/vnTQeqaC5ldbAg/4hFWv93yZlXMjiOApSHJHlOC7E7RYUoaCHEU6rZg9pLVvVLznQ PZfJ1hZnZEPZGy3ymi3JQfWmGcnQ72ciUjff1CTc21pjVQaOim6lsPnTIBC8tHtf39t+ 4To7tI3/k/Lq+ctqptNoWU65tC2Vy57vtt6pIVRzkbCaDOgi2qhI9IAJYwtcZoUYBPDF NEmQ== X-Gm-Message-State: AOAM5328ZF/9tiexS8cwvU3Pd0C3ZhiUBQqVTn/UpU3Ymbm3Mof6sYci YLeXXAyqtjQf2lpxmPfbGotVPpY5o92ydQ== X-Received: by 2002:a62:150c:0:b029:30d:fe79:c343 with SMTP id 12-20020a62150c0000b029030dfe79c343mr6580239pfv.29.1624993114955; Tue, 29 Jun 2021 11:58:34 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 56/63] target/arm: Improve vector REV Date: Tue, 29 Jun 2021 11:54:48 -0700 Message-Id: <20210629185455.3131172-57-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?b?YXVkw6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We can eliminate the requirement for a zero-extended output, because the following store will ignore any garbage high bits. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 304fd3d370..1a40e49db7 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -12444,12 +12444,10 @@ static void handle_rev(DisasContext *s, int opcode, bool u, read_vec_element(s, tcg_tmp, rn, i, grp_size); switch (grp_size) { case MO_16: - tcg_gen_bswap16_i64(tcg_tmp, tcg_tmp, - TCG_BSWAP_IZ | TCG_BSWAP_OZ); + tcg_gen_bswap16_i64(tcg_tmp, tcg_tmp, TCG_BSWAP_IZ); break; case MO_32: - tcg_gen_bswap32_i64(tcg_tmp, tcg_tmp, - TCG_BSWAP_IZ | TCG_BSWAP_OZ); + tcg_gen_bswap32_i64(tcg_tmp, tcg_tmp, TCG_BSWAP_IZ); break; case MO_64: tcg_gen_bswap64_i64(tcg_tmp, tcg_tmp); From patchwork Tue Jun 29 18:54:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468340 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5255507jao; Tue, 29 Jun 2021 12:33:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5zFD0Qn6p8IrbQErFld2uIU+RZuEnD73QWTrj/uT0A6CF2+h9UHzymfUE2742GtBm/iWz X-Received: by 2002:a05:6122:2bb:: with SMTP id 27mr22176884vkq.3.1624995213457; Tue, 29 Jun 2021 12:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995213; cv=none; d=google.com; s=arc-20160816; b=aMhuqHuwm/Sff+JSpvgrewVHvJtc6XSilwXr0bWpWYZ8W9b1FwL5bMlzJXhnGBaMvx 62eMCUMQ0OPwdQucSFHNuPcY9ki48azEpT/ojGVX2iWR19md1k1hqdNpukazZiu+o4UG wRAKfneeI3X/ZvyOHjl9o6aeQXe5uac1IoUofQJuxwhAIssqDKuSjOon9ZsemaqrLkIX epS3YQ6BDFGt722YW5sbI/xwinFNSike6yRXcJfkfzScXH44JD1mQE+cTRbuMEAknyet dxNgjeh+9JEy4kkGdOW1ckqd9jrvn2yym+RMeiPY3t4j54ebiVjwNJVuGEblyF/9SFcA 9xzg== 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=ziCUNw7iMfXxhXUy1AbaM+Ca/hJ3SGJZ/ldvQFuxiE8=; b=JuhB61ecz9n+vjBCv8kKR/j3C/2vmQgXcoiEvkB//LGZKeVG6qJdPoMgFhMjsGFkNd ScMPRUtELZpRlncW1+h5yw72j9pSrxSS2AbBwyrtwhl35c8wclPN2jURS6cN9nOBdU2X 59mm0qeiscN0ttdzJapwUeyVhI5g1QLUuBrZ2kencsweAd6Lo5w0qS05css4O6e7cqTT u7+16NbbGCilPV7I+1Vh6YSuFf8lKx6TjQwwMUU+/dP+8iBsDUU5TfBDa6LRK+tqMtXq 4Ot65Bp14JMe/OxoQLDNO4hTS47u4G5E2dushyePj64ZuRxHjxfbV41BA/JsPJ0JS0Gd tJqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BrGLnNAb; 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 d22si12872649vsp.304.2021.06.29.12.33.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:33: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=BrGLnNAb; 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]:34756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJUC-0001NM-Rx for patch@linaro.org; Tue, 29 Jun 2021 15:33:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39792) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwe-0004A4-9f for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:53 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:39694) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwP-00031u-Ja for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:52 -0400 Received: by mail-pj1-x1032.google.com with SMTP id in17-20020a17090b4391b0290170ba0ec7fcso2266518pjb.4 for ; Tue, 29 Jun 2021 11:58: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=ziCUNw7iMfXxhXUy1AbaM+Ca/hJ3SGJZ/ldvQFuxiE8=; b=BrGLnNAb/Jj8veNGBmHqKQ+e/DVuU1bjAm8bnfpeN2r06visn9CZ6OqfrNV3FtJZi0 xIoRUWHsSPXDl02BD/H1MEPq+0xdvCDiXTiRbFXLARrPo55j+exgbtje4xV9zMiABA7z hOG2b5x3W7XTAsppnVFU6d5nCGu8VUo6YshOtZN8ulsFzJjfEBMfukNTUk2gvdYINLau qGDK5fryaDTIy4ZJktqRt2YJvos7G4OAul8RzydIA81eG0mc3JMJV4KNTcedOKpusEbZ ND7MkszDVgXxfCdY+E44RVADY8VhhreWoTz5vZGSj2qzXEGkPV70bjZknSVlLMzoIbL/ rQxg== 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=ziCUNw7iMfXxhXUy1AbaM+Ca/hJ3SGJZ/ldvQFuxiE8=; b=OEjuU7b8Iievz7FXkzoCLcCM4/dvPPYrUoIREplY39JBG1Ikw3I/uZTPLQ5eHCEJLA Ig5exUsvyWqf4Cg1AZZN955N0WUthW5xXNsHumEEawoM9EjdwP0YSbyZMXZt/CRLH46M onL99HM3a3bwfA3HvRfLnNyQQC2Oq0VCGZIRS0OPw95REySXt1vwwyujUlnVOTfQA4qF TAL66J26evbYbcRfnQo8Rym38VwYQLqKCYPUXX/9tNeGp2sr35C5YNrbjWJolbm2f7rr thjQ9+vRIKzrLT2Cc1HPT/w9DFHe23Vg+Ge6KEVxxB30ADfgV+3rSoGXoq/2rEFSuQTV 5OuQ== X-Gm-Message-State: AOAM532ed0TLg3aA8HbElwheIASRzvkVNsVRSVE3uOZMLbk8/cLUfoZa PAIGYjxOwgKUskxMJR8F3waybv51+S5ctQ== X-Received: by 2002:a17:90a:f290:: with SMTP id fs16mr313256pjb.202.1624993115558; Tue, 29 Jun 2021 11:58:35 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 57/63] target/arm: Improve REVSH Date: Tue, 29 Jun 2021 11:54:49 -0700 Message-Id: <20210629185455.3131172-58-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?b?YXVkw6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The new bswap flags can implement the semantics exactly. Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/translate.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.25.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index 669b0be578..a0c6cfa902 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -354,9 +354,7 @@ void gen_rev16(TCGv_i32 dest, TCGv_i32 var) /* Byteswap low halfword and sign extend. */ static void gen_revsh(TCGv_i32 dest, TCGv_i32 var) { - tcg_gen_ext16u_i32(var, var); - tcg_gen_bswap16_i32(var, var, TCG_BSWAP_IZ | TCG_BSWAP_OZ); - tcg_gen_ext16s_i32(dest, var); + tcg_gen_bswap16_i32(var, var, TCG_BSWAP_OS); } /* Dual 16-bit add. Result placed in t0 and t1 is marked as dead. From patchwork Tue Jun 29 18:54:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468372 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5270636jao; Tue, 29 Jun 2021 12:59:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeF5V8uW7xyMIwjR/OjJN1ln87hfhuRCPV5zVRXdl4B1TjPsUD12kCaWIsyYkc+I71m+4M X-Received: by 2002:a25:744c:: with SMTP id p73mr18757720ybc.201.1624996739915; Tue, 29 Jun 2021 12:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996739; cv=none; d=google.com; s=arc-20160816; b=T+/E4gt2VxWXMNn3XSkgZEaeL4cK7/3t0cis5VjA2qplyz3l1mxXGCqWJw9uL+meIf Q6lvp3ME6Wd4wJws3YOkHFLxfBzvkYK7/AYzRj57wSWT2VW48ZbJzatYhb+ahXTuZOsG gnqs2D4RXbSAwzdnFUNHP0ROF1Ll6iXuuQMKVdPa+pzPubaaHv2mN8SzbUL1gBGeS17/ eXpk+jBF8erEjpvjUKhgZPrLa377SRhzWbf0HLIwC/3cipzZVE7lPEstz8NwTSIzy6dL cwB1REb7WceA/GI8IQwzO40TMTMGg9yBaXIzsvKMEVvi5VCrLWxWXymC+yZYn4BohULL nwbQ== 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=uxQeR//xqY+LsX6pm6SBoWME/fdGKFQJm9ucGcJi4j0=; b=RoAcm6QMjUnLxKLCxHUOlw9/9bH49m2l6GdYnDfjlW+LYP59AAzlh4xohseoNoXJT/ oGiW7oVlVvmMBZaGUekCatMQ+rL+YE2VGwBA8/pfK4DuwsarRfI0rwVMarBLA8nueA8l gZopgqICwbZFx7+qY1tk94tqC8H1kdTkYKj19RMAAT5oaRVhTH8W9OaXy8aP1uOsgDg5 nRG846jUhz4eon92lCpJ8lLvQ5Iw65ipGiSGe7nd4lBG77nasvQsYyuz859yPOmSXIO6 ZMZShAau+7cWJQFdn3/RGzquc8vHSzXWV+RselGyVDoTpodWw4ioINTTw53G8sFUzwjY Whsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GMTTfxkL; 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 d206si7867378ybh.409.2021.06.29.12.58.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:58: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=GMTTfxkL; 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]:57822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJsp-0005bx-Ak for patch@linaro.org; Tue, 29 Jun 2021 15:58:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39876) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwl-0004LE-UJ for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:59:00 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:34363) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwQ-000323-8G for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:59 -0400 Received: by mail-pf1-x42e.google.com with SMTP id i6so132539pfq.1 for ; Tue, 29 Jun 2021 11:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uxQeR//xqY+LsX6pm6SBoWME/fdGKFQJm9ucGcJi4j0=; b=GMTTfxkLRL/Xcfw/UxsY5I7tjyyEb6w00T2iSBQHB61yBy5y3T42kOKVgDr0fm5MjA B/GNkCvbHTerURCAQYAHVGVjOdK9yTosEuUseocW9ERcISokittlOd2nXOIBQBtzErqE 6fOOd4/fOh8VrFe7SGgB0IYQoBZJr/cxvTTfjgkrUyCfOyMWzxoPEGxZMxGpXCg300PX CWGydEDKd7hW0or+8xNbaTF+0XH2RzCy/jp160BDs8lKRCdy3EJJbWZvpnOlyAx04OIy XAki4Se76AdCGNjpO5hy6Le6wovwbyHg9EhtiT8MVWD49PLpBRBdrWp3pBEW1brTzFlG RgyA== 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=uxQeR//xqY+LsX6pm6SBoWME/fdGKFQJm9ucGcJi4j0=; b=jw9RYdRgv68WqQnaldBGDjMchfwKg42zCLrLWNWUsdto7V99gdB9to3upDpwDP3THs ug0U+T8aHS2L7/1je45kKTd6/AdYAXlwrnzXUOsBggl3ZmbOk2+71xoKJU/54CiH9+Gn +DyuWHsmzJR9uJVeQyVodGRjGZ363i0CeiNHRCvFDAEq/oAUXvRJLL6QcnbFZTKScq3P ACuSXxF4dBMNS/AFnLBs01AV8MKUovczLAGu1hcotMm6t0SNTuynER8cD78HeHznZ9Ua yUEYVj+v4kSjzImKljZ99znDBzzhwEGLrKpNwSL4dczI/8d8AsljwbMYMTapHOGXYRz1 h2Sw== X-Gm-Message-State: AOAM53292bdoTho/WuFKqDU3MN8fIi9jIyNOhzdHDimdaE9xKkvlJ0Wq qMswZePvJjklfXvKtWf/P8Mx4loIcA8Rlw== X-Received: by 2002:a65:6441:: with SMTP id s1mr7155970pgv.214.1624993116416; Tue, 29 Jun 2021 11:58:36 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 58/63] target/i386: Improve bswap translation Date: Tue, 29 Jun 2021 11:54:50 -0700 Message-Id: <20210629185455.3131172-59-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use a break instead of an ifdefed else. There's no need to move the values through s->T0. Remove TCG_BSWAP_IZ and the preceding zero-extension. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) -- 2.25.1 diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index e8a9dcd21a..b21873ed23 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -7195,17 +7195,11 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) reg = (b & 7) | REX_B(s); #ifdef TARGET_X86_64 if (dflag == MO_64) { - gen_op_mov_v_reg(s, MO_64, s->T0, reg); - tcg_gen_bswap64_i64(s->T0, s->T0); - gen_op_mov_reg_v(s, MO_64, reg, s->T0); - } else -#endif - { - gen_op_mov_v_reg(s, MO_32, s->T0, reg); - tcg_gen_ext32u_tl(s->T0, s->T0); - tcg_gen_bswap32_tl(s->T0, s->T0, TCG_BSWAP_IZ | TCG_BSWAP_OZ); - gen_op_mov_reg_v(s, MO_32, reg, s->T0); + tcg_gen_bswap64_i64(cpu_regs[reg], cpu_regs[reg]); + break; } +#endif + tcg_gen_bswap32_tl(cpu_regs[reg], cpu_regs[reg], TCG_BSWAP_OZ); break; case 0xd6: /* salc */ if (CODE64(s)) From patchwork Tue Jun 29 18:54:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468377 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5273794jao; Tue, 29 Jun 2021 13:02:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+6duhJXorF7C60UfaIsbki3alm9QRMAwcK7QiOA4DsSi78FzesdkrTJGzz9zHMRByxlqM X-Received: by 2002:aa7:c891:: with SMTP id p17mr29380195eds.225.1624996974270; Tue, 29 Jun 2021 13:02:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996974; cv=none; d=google.com; s=arc-20160816; b=qSz75SC1jyLwgv7ZmDIlHJ1qAUi+OGrn3+Fr0OeUtm54JW53T6+YCz/s/TkG06b4Oo erfdUBzp37jM4uQLs+nf0qd0GaM8bTQM+ZWQe3QHJJi+ZOubFRQltzrjr/7y0QXfWVOf UkOsnumpms0GI96nSsFe11lnWPTw8+HjCgyDqKNLZ/RwK3Ue0cwSE3aoqwWFRJUjhgbh PC5ncR2U8mTN+XXshwYEFPUhQhVzpb7zUqQsj/KsO74ZM0/3R9O3kngnUXhD9L0H8mKF VaynMgz1U+Sb21+OaHo26dtaUIU07xTQTvq6QJAjcd1IU3mhTdV3jqEgrOTVJeCBSk13 9P2A== 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=rDcd1B4hkbSouihbsC6aTM+tsQYAgRbIHXLOVbVbwkg=; b=lRutTaRQTK7yPQQ5bezGBCMFRj72qXgrzPpQxqKvgXi3wT/UZmqMqowGuvXqXUWSc1 uN7OhaNJAlS/XFpHmL+ZLGUDUHDxIfK8T2DXMjwXmXon8I/EiyDnwzn8KnbDHOTQP3BY rSG+05cD/y3HdDpqJZ9XhzPKSyVyPeAfDaqDnGaSwt55Vf/9tiWTR9g7HlF8urIN9/6a tbwKWO/Wb3aKopH27Pgtxa0YVnoi6FopBvqHLSDVeflIWlnwS/jXeAatzb3DyYxFHmrx UsYp428kQJaOwGxcqLINj571eJF4z5aa26zTMuFCe0wcs/3E0R/z3s2rUz0ONZMQ1Ex3 fTrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KkK8dyUE; 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 eo21si19312750ejc.27.2021.06.29.13.02.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 13:02: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=KkK8dyUE; 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]:41640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJwb-0005LG-9H for patch@linaro.org; Tue, 29 Jun 2021 16:02:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwh-0004Cb-Ex for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:55 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:35568) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwQ-00032B-9O for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:55 -0400 Received: by mail-pf1-x432.google.com with SMTP id d12so124765pfj.2 for ; Tue, 29 Jun 2021 11:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rDcd1B4hkbSouihbsC6aTM+tsQYAgRbIHXLOVbVbwkg=; b=KkK8dyUEPIAeXRm9JrzMNFk0vyLNaY53s+YVi06N1M3DQ6JcjgyplU/ppLBx7D28Ad 2zY7ISWu621SYpnkBtKExq3MAgWe3P56Kh7U4wM+JW8Gc6x7OSe/EkB4ih/xtX+hIbGB jvVS76aXudR97+eaC83ow9MDt3hEYPQQA070Px9xE7WcuY5c6pGNNcIK2IOm+7bk/q7q KHK1ROvo2emKr7uPCOIaEXCp8zTs1brU5hWqpOBlYcXs6E6c1pLN6bhmT3iNFnJXU2sA 4TvLX3thlVDIDIpVV0Mjxss0hSnn9ofFTLKYe/nGV8D9pAooMytZUA1Oy2hwGcErmj2E cOUg== 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=rDcd1B4hkbSouihbsC6aTM+tsQYAgRbIHXLOVbVbwkg=; b=GiVoboM0vvcK8zaYOK8IGCq+xYGKUDsv4L2tyuc1zPYLqctggvQvDO7CcCZ68V/beR iboSKF1iEkGz3GiZCL+kh+12laEwNVVDPRl8p5g3kI2UxzRsPh1lR3PvbmSG/CbeKxDu qcbGY5DeYAyKBbzm1c1eDkcEgVTLcsNHJWhYel1cCE1bR79MItwj3nsx2QHRMCU3kH6f Mf0V+ew9eCFnIDzbh6e2pdqHWJe/SAcOSOknmMmAdScRePlK6vDiawNfU55Xj8dFfehZ K2X+s8cY9ersRsD+xgIF8cw/0JEn5lpTVlKly0YTYdlYg8r/gHsGrDTKNqZFRNG3lv8g 7Leg== X-Gm-Message-State: AOAM531pm0M5a8VgReLu+s8BHcQbTpY5OZ5LAcLcM5Lg3v3cBe+AtvpP EZi9I9JgjKVuzHk8IiwbIJD9wnvbb7NFXw== X-Received: by 2002:a63:b60c:: with SMTP id j12mr30050381pgf.393.1624993117061; Tue, 29 Jun 2021 11:58:37 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 59/63] target/sh4: Improve swap.b translation Date: Tue, 29 Jun 2021 11:54:51 -0700 Message-Id: <20210629185455.3131172-60-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Remove TCG_BSWAP_IZ and the preceding zero-extension. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/sh4/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.25.1 diff --git a/target/sh4/translate.c b/target/sh4/translate.c index 147219759b..4dcfff81f6 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -676,8 +676,7 @@ static void _decode_opc(DisasContext * ctx) case 0x6008: /* swap.b Rm,Rn */ { TCGv low = tcg_temp_new(); - tcg_gen_ext16u_i32(low, REG(B7_4)); - tcg_gen_bswap16_i32(low, low, TCG_BSWAP_IZ | TCG_BSWAP_OZ); + tcg_gen_bswap16_i32(low, REG(B7_4), 0); tcg_gen_deposit_i32(REG(B11_8), REG(B7_4), low, 0, 16); tcg_temp_free(low); } From patchwork Tue Jun 29 18:54:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468373 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5270991jao; Tue, 29 Jun 2021 12:59:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyK0/TQ7rAPW9o2fNWj6IAoRDsNsorUCkDLfCh9CTQ0m1iZHb33m6VUR8VyRl3R/equ530e X-Received: by 2002:a25:ad4c:: with SMTP id l12mr3318849ybe.421.1624996779219; Tue, 29 Jun 2021 12:59:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996779; cv=none; d=google.com; s=arc-20160816; b=Hbl4ifEdPkWTKFMJcxbXO/9UguzMpBbWZUDfqlStzB+c0aoKE8HrouxuPWGm1UMAig 2fWrhv9YrUkrN8GSyukIUUbVh1dHHfa5OcJmG97j6Quu7A8zIAtZlaGakPEt5dFOTqgh gOgamSHMWdBKS6Z1gjYbxYFsYGM3Oaeg83fW1nvKXd5gz+LP71PE4RVB+9pRpF+giECm plTcOCR12obkgdTJSVmjJuYxwNTC89Hp7nmTTDozbumbhl5O7+nMLoOLpb3Aji+7oygY FSfO4hsuMDHXwBYtu95pmktT5Dlk4NUNBVxTHxAXGoSFHg0lge2vJ2fMx8ycZQvqUrpi E5Rg== 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=JvueqUJG6jJaFwqgDWte995LKM+oGyntlGLt3se6n5Y=; b=wdPIsVpw9Uot3ZiIuA5oEGkOs6icIYkYYHg5NgCmiBtvf34pXmKxiGWdp6B65TZnlM 7Dt+iErtEf9K1s0/JSHRVCpA1qeVhJQmLfYJs66GxyWhr1N5DXOqSbkthRvjulDH96lR D5Z5/CcZFyNYbjGNujXdGqOKUAl1L3DCEX1INvPDpe20iWSFtX6VNPA88pgsJ/z0mNVL uS6nJh0ZLeR2NQKsXB0BrNXRM9gOgyJe+H8BVP2qnYDbicIbZTb72udhXvGWTP43C7k5 IreGACpfHYxpNyf/BwH854oFTpI9+jH8VEVRhl9TaAYjN1QHii5saklQEXEux+k/C44g mNUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rYaUnwty; 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 u14si17416526ybc.422.2021.06.29.12.59.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:59: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=rYaUnwty; 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]:34654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJtS-0000Y3-LH for patch@linaro.org; Tue, 29 Jun 2021 15:59:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwi-0004DU-7a for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:56 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:40457) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwR-00032I-P5 for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:55 -0400 Received: by mail-pf1-x434.google.com with SMTP id q192so102053pfc.7 for ; Tue, 29 Jun 2021 11:58: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=JvueqUJG6jJaFwqgDWte995LKM+oGyntlGLt3se6n5Y=; b=rYaUnwtyPhjBw/WnaNQLr2lpm+2OApP8V1RWh5qX8Ch3guQ5scFt3Qqog7Ka/55+Yq jphZJr2cdrtED6KoInGUxhzghefWKBQA1CsxLpBCninv1g82wJ3YzGjNz3RcJPypHJIQ ocJecs2S7DZEYT7qTBj8L1NqppDDrcGpqXizDb6Z2S32eyu4Q1JOtctGzirLmnrrsLgz MoqbRAcKlW6kcZgTCL9y/ehKC0xCYOTjYwXkC2pFZIUW/97T7nOIKXfDAliYbfd5I0v2 97U3VkRwh6pMC8/qAPffyX6WS1hevFAxTvDqjCvjgetGJzJHt+flniD8TBABVHaIfMRR Ozfg== 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=JvueqUJG6jJaFwqgDWte995LKM+oGyntlGLt3se6n5Y=; b=XV9Wa80us8CS7tCqxEoPgLEf9PQM/kowpmyYKzp7y7who8gEK79way/ABc/pWWafvI BN255Hc171JyVQh+Vev3/BqYzlJbjrNkU1Q4AZgwNsu3ro0mRFIdELa5q5CWKPVJDLgC HkOLOflrTvnFN5bklBSFnZc4rSO6WzlIAWDrxAPx/BBCli0sb/75w4T6t3OnKDhB3IQx qjXj2xm3VIMCav9GO8iTGQgBfFLG1iC9n42xnpMkRP9gQ0FcUYkX42NtQczzSNu89OCL sq+t1IkIaCBrlmg/oioohvMO6F/wos1JGIjPiza2aY4McOm+7/uU6FGMEtiFEr63JH+5 EjpA== X-Gm-Message-State: AOAM530rDP6ligQlOoeEY9FX4LrN+Y17wkkd/9WDsFj0t96LYHZSIIky 0JroGn7I7ksY4Nrb8CwYZVpDYJhd8tImxQ== X-Received: by 2002:a05:6a00:2145:b029:30b:127:e0a3 with SMTP id o5-20020a056a002145b029030b0127e0a3mr16845437pfk.34.1624993117771; Tue, 29 Jun 2021 11:58:37 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 60/63] target/mips: Fix gen_mxu_s32ldd_s32lddr Date: Tue, 29 Jun 2021 11:54:52 -0700 Message-Id: <20210629185455.3131172-61-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" There were two bugs here: (1) the required endianness was not present in the MemOp, and (2) we were not providing a zero-extended input to the bswap as semantics required. The best fix is to fold the bswap into the memory operation, producing the desired result directly. Acked-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/mips/tcg/mxu_translate.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) -- 2.25.1 diff --git a/target/mips/tcg/mxu_translate.c b/target/mips/tcg/mxu_translate.c index 3f35e46399..f52244e1b2 100644 --- a/target/mips/tcg/mxu_translate.c +++ b/target/mips/tcg/mxu_translate.c @@ -857,12 +857,8 @@ static void gen_mxu_s32ldd_s32lddr(DisasContext *ctx) tcg_gen_ori_tl(t1, t1, 0xFFFFF000); } tcg_gen_add_tl(t1, t0, t1); - tcg_gen_qemu_ld_tl(t1, t1, ctx->mem_idx, MO_SL); + tcg_gen_qemu_ld_tl(t1, t1, ctx->mem_idx, MO_TESL ^ (sel * MO_BSWAP)); - if (sel == 1) { - /* S32LDDR */ - tcg_gen_bswap32_tl(t1, t1, TCG_BSWAP_IZ | TCG_BSWAP_OZ); - } gen_store_mxu_gpr(t1, XRa); tcg_temp_free(t0); From patchwork Tue Jun 29 18:54:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468379 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5277139jao; Tue, 29 Jun 2021 13:07:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoJ41/Cuw9nvk3bIKluAJPmx9FvomCwsWvmJSk+eywm+zl1Y0mw+x4ta4hS9NBKT53OaHU X-Received: by 2002:a25:df82:: with SMTP id w124mr41665672ybg.425.1624997225219; Tue, 29 Jun 2021 13:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624997225; cv=none; d=google.com; s=arc-20160816; b=FHRezjz12zKYzbXE8+P3qQ+12YElMvRMA9gttN1fgxbBj/P65WfnqyXSbebd50Qusb 15gmzlzsrhxgmXl5w2EDDq2iV/Y2/4Ap5fixph8Kwt27tGT3qX1pec94iJUu1Pm0I4yF fsxvNLqJLxbXXlAJUAz7E+yMb0I6rIwonLw/PPNFazpUsiAF+Uqk+cNFpHlvnDHB2anN zIJdqLMgPj1DwpzOPEN4c1+jfqHfGy4dKqtr7KHk6VL0wIb+xFmM5KdeYmOXQjo4ztjp VDYJpsor3u2KMpRxvXJW5Hl1s2rPJZl1YiWrOln4uOYklenk8kiPRzQBy4O4d6Qc3ra4 45tg== 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=cDgi4mUmbBNogW7MaanU634ulEKHQqUXgCKwp+rRBiM=; b=cJwYCRQNQfuP4cW+zhKnDqK1oBivXP9oSQ8q4jLmRo4HYgV9EOTKiVMoWWeYDHc11R En3ye7oMDK5DY6ad/2Gqpg8O1RLOD+p71uKtfZDKU0Gk44cjjeOkBlnx9gcFPVcPtscg Vky0CGSPRdRBLL/sNl/ALg61g0zNsNwuxqyZxQ9pGU9oh0WLxtySHLWY/d+qTQN9d+dP QKIxSPSkesh9xvybO1IiT+rkd6Mgirzhus+Lg3GRNZv/FZWTso0tiq3YnnuFuFw+I2pR OCDH+jP9FCkbGAdHPvVv4OIWdzfn6JtIt1gAEOq9MW6KOVXCTj5umfHlAXndU7tUL0I7 FNvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ax0ZFM5a; 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 e194si1867268yba.139.2021.06.29.13.07.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 13:07: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=ax0ZFM5a; 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]:54504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyK0e-0005Zm-La for patch@linaro.org; Tue, 29 Jun 2021 16:07:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwp-0004SU-TH for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:59:03 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:44917) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwR-000334-SJ for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:59:03 -0400 Received: by mail-pj1-x1031.google.com with SMTP id p4-20020a17090a9304b029016f3020d867so3085943pjo.3 for ; Tue, 29 Jun 2021 11:58:39 -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=cDgi4mUmbBNogW7MaanU634ulEKHQqUXgCKwp+rRBiM=; b=ax0ZFM5aNiz+jP+Y8mMjDafdO8/bsB/Zm4mInlGwXrIoq4NgTbUxFsuLrRX97ZV3hb qiBy6bo1kSH7GU1omyx/ZS0sc9PY+RLa3Pkyizl6w7ph9+OxRjyePc2rNchewHHaIfP6 NsUzmu9beQojJNfrdyKu0UVf70jdQ5I7GY0sDXWlO/JzfIC7E0cQ0lG0oDeslKHR1jJG m1vVJAdLP1beHSwoPJtFa45YAY6CjBDPa2ymdaaEPpH68X09lIFDvhrKJ8LNLHto3U+1 bGUjwbimUBNs/M6TRKXc4MOwv9y3TKGr/3ZkK2EtrKwnGBF+FVmNcc+hCJwsfalOMFvg d/JA== 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=cDgi4mUmbBNogW7MaanU634ulEKHQqUXgCKwp+rRBiM=; b=XaA5wQW6l6ATs27GSozKFHq3dnPNrPoPvQH1MFkbC1TMwfphM1fbemfn1Yx37hONe5 RDsxNhQfy5IR1Zesx6tlOB0+yXZS2db6ddhRjHx8SsQE2GI1hGK83RYRh8jAOBdodrw4 sr6PO22DIiae2zAyk+dK4al88bxjod7Uecbad+BGS8WTzqXQ8VYe7J3bQu/xjkUGNdjp fJqoWyGWKktlaU5FDq/k6AEdRJrOC3o9eZdARfAdWqpmQu9xKC8qQKLytru1Rg//lQ6u 7GxvamxFXe0nNWlSvUrxFE/Jsf4q4DakqMJlQ+arXrb/t04eKetPYCXINi0fs4NyODAQ xPGw== X-Gm-Message-State: AOAM532FvSrtAAyaQFwI2yQxsjO8MFZUVOxQu6/krVpyv1D5Tit+s+/O eEJt+ts52DAY7+T/duwm8THFKdyP102Axw== X-Received: by 2002:a17:902:728d:b029:113:23:c65f with SMTP id d13-20020a170902728db02901130023c65fmr28449229pll.23.1624993118550; Tue, 29 Jun 2021 11:58:38 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 61/63] tcg/arm: Unset TCG_TARGET_HAS_MEMORY_BSWAP Date: Tue, 29 Jun 2021 11:54:53 -0700 Message-Id: <20210629185455.3131172-62-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Now that the middle-end can replicate the same tricks as tcg/arm used for optimizing bswap for signed loads and for stores, do not pretend to have these memory ops in the backend. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.h | 2 +- tcg/arm/tcg-target.c.inc | 214 ++++++++++++++------------------------- 2 files changed, 77 insertions(+), 139 deletions(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index 57fd0c0c74..95fcef33bc 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -174,7 +174,7 @@ extern bool use_neon_instructions; #define TCG_TARGET_HAS_cmpsel_vec 0 #define TCG_TARGET_DEFAULT_MO (0) -#define TCG_TARGET_HAS_MEMORY_BSWAP 1 +#define TCG_TARGET_HAS_MEMORY_BSWAP 0 /* not defined -- call should be eliminated at compile time */ void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t, uintptr_t); diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 73e0455511..7a761a602e 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -1393,34 +1393,38 @@ static void tcg_out_vldst(TCGContext *s, ARMInsn insn, /* helper signature: helper_ret_ld_mmu(CPUState *env, target_ulong addr, * int mmu_idx, uintptr_t ra) */ -static void * const qemu_ld_helpers[16] = { +static void * const qemu_ld_helpers[8] = { [MO_UB] = helper_ret_ldub_mmu, [MO_SB] = helper_ret_ldsb_mmu, - - [MO_LEUW] = helper_le_lduw_mmu, - [MO_LEUL] = helper_le_ldul_mmu, - [MO_LEQ] = helper_le_ldq_mmu, - [MO_LESW] = helper_le_ldsw_mmu, - [MO_LESL] = helper_le_ldul_mmu, - - [MO_BEUW] = helper_be_lduw_mmu, - [MO_BEUL] = helper_be_ldul_mmu, - [MO_BEQ] = helper_be_ldq_mmu, - [MO_BESW] = helper_be_ldsw_mmu, - [MO_BESL] = helper_be_ldul_mmu, +#ifdef HOST_WORDS_BIGENDIAN + [MO_UW] = helper_be_lduw_mmu, + [MO_UL] = helper_be_ldul_mmu, + [MO_Q] = helper_be_ldq_mmu, + [MO_SW] = helper_be_ldsw_mmu, + [MO_SL] = helper_be_ldul_mmu, +#else + [MO_UW] = helper_le_lduw_mmu, + [MO_UL] = helper_le_ldul_mmu, + [MO_Q] = helper_le_ldq_mmu, + [MO_SW] = helper_le_ldsw_mmu, + [MO_SL] = helper_le_ldul_mmu, +#endif }; /* helper signature: helper_ret_st_mmu(CPUState *env, target_ulong addr, * uintxx_t val, int mmu_idx, uintptr_t ra) */ -static void * const qemu_st_helpers[16] = { - [MO_UB] = helper_ret_stb_mmu, - [MO_LEUW] = helper_le_stw_mmu, - [MO_LEUL] = helper_le_stl_mmu, - [MO_LEQ] = helper_le_stq_mmu, - [MO_BEUW] = helper_be_stw_mmu, - [MO_BEUL] = helper_be_stl_mmu, - [MO_BEQ] = helper_be_stq_mmu, +static void * const qemu_st_helpers[4] = { + [MO_8] = helper_ret_stb_mmu, +#ifdef HOST_WORDS_BIGENDIAN + [MO_16] = helper_be_stw_mmu, + [MO_32] = helper_be_stl_mmu, + [MO_64] = helper_be_stq_mmu, +#else + [MO_16] = helper_le_stw_mmu, + [MO_32] = helper_le_stl_mmu, + [MO_64] = helper_le_stq_mmu, +#endif }; /* Helper routines for marshalling helper function arguments into @@ -1625,9 +1629,9 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *lb) icache usage. For pre-armv6, use the signed helpers since we do not have a single insn sign-extend. */ if (use_armv6_instructions) { - func = qemu_ld_helpers[opc & (MO_BSWAP | MO_SIZE)]; + func = qemu_ld_helpers[opc & MO_SIZE]; } else { - func = qemu_ld_helpers[opc & (MO_BSWAP | MO_SSIZE)]; + func = qemu_ld_helpers[opc & MO_SSIZE]; if (opc & MO_SIGN) { opc = MO_UL; } @@ -1705,7 +1709,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *lb) argreg = tcg_out_arg_reg32(s, argreg, TCG_REG_R14); /* Tail-call to the helper, which will return to the fast path. */ - tcg_out_goto(s, COND_AL, qemu_st_helpers[opc & (MO_BSWAP | MO_SIZE)]); + tcg_out_goto(s, COND_AL, qemu_st_helpers[opc & MO_SIZE]); return true; } #endif /* SOFTMMU */ @@ -1714,7 +1718,8 @@ static inline void tcg_out_qemu_ld_index(TCGContext *s, MemOp opc, TCGReg datalo, TCGReg datahi, TCGReg addrlo, TCGReg addend) { - MemOp bswap = opc & MO_BSWAP; + /* Byte swapping is left to middle-end expansion. */ + tcg_debug_assert((opc & MO_BSWAP) == 0); switch (opc & MO_SSIZE) { case MO_UB: @@ -1725,51 +1730,30 @@ static inline void tcg_out_qemu_ld_index(TCGContext *s, MemOp opc, break; case MO_UW: tcg_out_ld16u_r(s, COND_AL, datalo, addrlo, addend); - if (bswap) { - tcg_out_bswap16(s, COND_AL, datalo, datalo, - TCG_BSWAP_IZ | TCG_BSWAP_OZ); - } break; case MO_SW: - if (bswap) { - tcg_out_ld16u_r(s, COND_AL, datalo, addrlo, addend); - tcg_out_bswap16(s, COND_AL, datalo, datalo, - TCG_BSWAP_IZ | TCG_BSWAP_OS); - } else { - tcg_out_ld16s_r(s, COND_AL, datalo, addrlo, addend); - } + tcg_out_ld16s_r(s, COND_AL, datalo, addrlo, addend); break; case MO_UL: - default: tcg_out_ld32_r(s, COND_AL, datalo, addrlo, addend); - if (bswap) { - tcg_out_bswap32(s, COND_AL, datalo, datalo); - } break; case MO_Q: - { - TCGReg dl = (bswap ? datahi : datalo); - TCGReg dh = (bswap ? datalo : datahi); - - /* Avoid ldrd for user-only emulation, to handle unaligned. */ - if (USING_SOFTMMU && use_armv6_instructions - && (dl & 1) == 0 && dh == dl + 1) { - tcg_out_ldrd_r(s, COND_AL, dl, addrlo, addend); - } else if (dl != addend) { - tcg_out_ld32_rwb(s, COND_AL, dl, addend, addrlo); - tcg_out_ld32_12(s, COND_AL, dh, addend, 4); - } else { - tcg_out_dat_reg(s, COND_AL, ARITH_ADD, TCG_REG_TMP, - addend, addrlo, SHIFT_IMM_LSL(0)); - tcg_out_ld32_12(s, COND_AL, dl, TCG_REG_TMP, 0); - tcg_out_ld32_12(s, COND_AL, dh, TCG_REG_TMP, 4); - } - if (bswap) { - tcg_out_bswap32(s, COND_AL, dl, dl); - tcg_out_bswap32(s, COND_AL, dh, dh); - } + /* Avoid ldrd for user-only emulation, to handle unaligned. */ + if (USING_SOFTMMU && use_armv6_instructions + && (datalo & 1) == 0 && datahi == datalo + 1) { + tcg_out_ldrd_r(s, COND_AL, datalo, addrlo, addend); + } else if (datalo != addend) { + tcg_out_ld32_rwb(s, COND_AL, datalo, addend, addrlo); + tcg_out_ld32_12(s, COND_AL, datahi, addend, 4); + } else { + tcg_out_dat_reg(s, COND_AL, ARITH_ADD, TCG_REG_TMP, + addend, addrlo, SHIFT_IMM_LSL(0)); + tcg_out_ld32_12(s, COND_AL, datalo, TCG_REG_TMP, 0); + tcg_out_ld32_12(s, COND_AL, datahi, TCG_REG_TMP, 4); } break; + default: + g_assert_not_reached(); } } @@ -1777,7 +1761,8 @@ static inline void tcg_out_qemu_ld_direct(TCGContext *s, MemOp opc, TCGReg datalo, TCGReg datahi, TCGReg addrlo) { - MemOp bswap = opc & MO_BSWAP; + /* Byte swapping is left to middle-end expansion. */ + tcg_debug_assert((opc & MO_BSWAP) == 0); switch (opc & MO_SSIZE) { case MO_UB: @@ -1788,49 +1773,28 @@ static inline void tcg_out_qemu_ld_direct(TCGContext *s, MemOp opc, break; case MO_UW: tcg_out_ld16u_8(s, COND_AL, datalo, addrlo, 0); - if (bswap) { - tcg_out_bswap16(s, COND_AL, datalo, datalo, - TCG_BSWAP_IZ | TCG_BSWAP_OZ); - } break; case MO_SW: - if (bswap) { - tcg_out_ld16u_8(s, COND_AL, datalo, addrlo, 0); - tcg_out_bswap16(s, COND_AL, datalo, datalo, - TCG_BSWAP_IZ | TCG_BSWAP_OS); - } else { - tcg_out_ld16s_8(s, COND_AL, datalo, addrlo, 0); - } + tcg_out_ld16s_8(s, COND_AL, datalo, addrlo, 0); break; case MO_UL: - default: tcg_out_ld32_12(s, COND_AL, datalo, addrlo, 0); - if (bswap) { - tcg_out_bswap32(s, COND_AL, datalo, datalo); - } break; case MO_Q: - { - TCGReg dl = (bswap ? datahi : datalo); - TCGReg dh = (bswap ? datalo : datahi); - - /* Avoid ldrd for user-only emulation, to handle unaligned. */ - if (USING_SOFTMMU && use_armv6_instructions - && (dl & 1) == 0 && dh == dl + 1) { - tcg_out_ldrd_8(s, COND_AL, dl, addrlo, 0); - } else if (dl == addrlo) { - tcg_out_ld32_12(s, COND_AL, dh, addrlo, bswap ? 0 : 4); - tcg_out_ld32_12(s, COND_AL, dl, addrlo, bswap ? 4 : 0); - } else { - tcg_out_ld32_12(s, COND_AL, dl, addrlo, bswap ? 4 : 0); - tcg_out_ld32_12(s, COND_AL, dh, addrlo, bswap ? 0 : 4); - } - if (bswap) { - tcg_out_bswap32(s, COND_AL, dl, dl); - tcg_out_bswap32(s, COND_AL, dh, dh); - } + /* Avoid ldrd for user-only emulation, to handle unaligned. */ + if (USING_SOFTMMU && use_armv6_instructions + && (datalo & 1) == 0 && datahi == datalo + 1) { + tcg_out_ldrd_8(s, COND_AL, datalo, addrlo, 0); + } else if (datalo == addrlo) { + tcg_out_ld32_12(s, COND_AL, datahi, addrlo, 4); + tcg_out_ld32_12(s, COND_AL, datalo, addrlo, 0); + } else { + tcg_out_ld32_12(s, COND_AL, datalo, addrlo, 0); + tcg_out_ld32_12(s, COND_AL, datahi, addrlo, 4); } break; + default: + g_assert_not_reached(); } } @@ -1879,44 +1843,31 @@ static inline void tcg_out_qemu_st_index(TCGContext *s, int cond, MemOp opc, TCGReg datalo, TCGReg datahi, TCGReg addrlo, TCGReg addend) { - MemOp bswap = opc & MO_BSWAP; + /* Byte swapping is left to middle-end expansion. */ + tcg_debug_assert((opc & MO_BSWAP) == 0); switch (opc & MO_SIZE) { case MO_8: tcg_out_st8_r(s, cond, datalo, addrlo, addend); break; case MO_16: - if (bswap) { - tcg_out_bswap16(s, cond, TCG_REG_R0, datalo, 0); - tcg_out_st16_r(s, cond, TCG_REG_R0, addrlo, addend); - } else { - tcg_out_st16_r(s, cond, datalo, addrlo, addend); - } + tcg_out_st16_r(s, cond, datalo, addrlo, addend); break; case MO_32: - default: - if (bswap) { - tcg_out_bswap32(s, cond, TCG_REG_R0, datalo); - tcg_out_st32_r(s, cond, TCG_REG_R0, addrlo, addend); - } else { - tcg_out_st32_r(s, cond, datalo, addrlo, addend); - } + tcg_out_st32_r(s, cond, datalo, addrlo, addend); break; case MO_64: /* Avoid strd for user-only emulation, to handle unaligned. */ - if (bswap) { - tcg_out_bswap32(s, cond, TCG_REG_R0, datahi); - tcg_out_st32_rwb(s, cond, TCG_REG_R0, addend, addrlo); - tcg_out_bswap32(s, cond, TCG_REG_R0, datalo); - tcg_out_st32_12(s, cond, TCG_REG_R0, addend, 4); - } else if (USING_SOFTMMU && use_armv6_instructions - && (datalo & 1) == 0 && datahi == datalo + 1) { + if (USING_SOFTMMU && use_armv6_instructions + && (datalo & 1) == 0 && datahi == datalo + 1) { tcg_out_strd_r(s, cond, datalo, addrlo, addend); } else { tcg_out_st32_rwb(s, cond, datalo, addend, addrlo); tcg_out_st32_12(s, cond, datahi, addend, 4); } break; + default: + g_assert_not_reached(); } } @@ -1924,44 +1875,31 @@ static inline void tcg_out_qemu_st_direct(TCGContext *s, MemOp opc, TCGReg datalo, TCGReg datahi, TCGReg addrlo) { - MemOp bswap = opc & MO_BSWAP; + /* Byte swapping is left to middle-end expansion. */ + tcg_debug_assert((opc & MO_BSWAP) == 0); switch (opc & MO_SIZE) { case MO_8: tcg_out_st8_12(s, COND_AL, datalo, addrlo, 0); break; case MO_16: - if (bswap) { - tcg_out_bswap16(s, COND_AL, TCG_REG_R0, datalo, 0); - tcg_out_st16_8(s, COND_AL, TCG_REG_R0, addrlo, 0); - } else { - tcg_out_st16_8(s, COND_AL, datalo, addrlo, 0); - } + tcg_out_st16_8(s, COND_AL, datalo, addrlo, 0); break; case MO_32: - default: - if (bswap) { - tcg_out_bswap32(s, COND_AL, TCG_REG_R0, datalo); - tcg_out_st32_12(s, COND_AL, TCG_REG_R0, addrlo, 0); - } else { - tcg_out_st32_12(s, COND_AL, datalo, addrlo, 0); - } + tcg_out_st32_12(s, COND_AL, datalo, addrlo, 0); break; case MO_64: /* Avoid strd for user-only emulation, to handle unaligned. */ - if (bswap) { - tcg_out_bswap32(s, COND_AL, TCG_REG_R0, datahi); - tcg_out_st32_12(s, COND_AL, TCG_REG_R0, addrlo, 0); - tcg_out_bswap32(s, COND_AL, TCG_REG_R0, datalo); - tcg_out_st32_12(s, COND_AL, TCG_REG_R0, addrlo, 4); - } else if (USING_SOFTMMU && use_armv6_instructions - && (datalo & 1) == 0 && datahi == datalo + 1) { + if (USING_SOFTMMU && use_armv6_instructions + && (datalo & 1) == 0 && datahi == datalo + 1) { tcg_out_strd_8(s, COND_AL, datalo, addrlo, 0); } else { tcg_out_st32_12(s, COND_AL, datalo, addrlo, 0); tcg_out_st32_12(s, COND_AL, datahi, addrlo, 4); } break; + default: + g_assert_not_reached(); } } From patchwork Tue Jun 29 18:54:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468375 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5271958jao; Tue, 29 Jun 2021 13:00:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwe1U2EZ51Z3WFHFR5cnChty4f1DlDcW2uxtyUrnjLLQFuhWA5ClZWuBNdcZ07S2CVtIcFx X-Received: by 2002:ab0:647:: with SMTP id f65mr28673608uaf.4.1624996857667; Tue, 29 Jun 2021 13:00:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996857; cv=none; d=google.com; s=arc-20160816; b=GKIyNKnnhdh9kHH0tR9jomFpJUy1/cEsUIPIXzG1a/1GdFOmn4uXe7Xi9+rNZ/wMRW n4/6blP27vcGGBVaEQoFq7C38nEdPLT3HcKoOuDr1zM6GRrVu1TFP4rNTzQIgggL85xR u9m/2AUvwtLVcaltERyuUyK7QVOMjC6Xs/EFx8mBWSw5VQA7EaW2YrQiQ/XpgfuucAA3 UQ9oMpp4wQRD/n/ghj7IPsliNt7LwhcueNIgA7nT9kviLAols7lmA3ZCdX0k7IZG2LiY fJKvTUtE6AR+Y15TQR+oTSByPk2RIqnthbXfrINxvKbGmLiHp7iMIPIMxFs4PvISQqSj F+9Q== 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=EydeQGxVqAw6guu1qAKY5r1uSI5ierWJDBSf5PcuhzI=; b=Q2cjShCFWSlv6iJxs93BGvi/oeul8Fw13QEA0MaJePvb8aviV0k2jZQZIngBHUzSoD KGQPEDCLapRGlQWYr99eVxa19MDJ1hGoiPbU22u4R60Au2rUp8yR+IRBesgZJk8/4Wzm ZCIlmcLe20iyX+hwm64VqRhlhGnxnDhnRpVvu6WQFX9r+FBlfrOMtWSa0gROxb6GSdVY US6lASEtqqfs8TUwhKRzc7H0pLU/jH3LT3AR5FwO+HS5E+QJGMnW8A2qgWZM/jZpl99w bQYle655tfhLx0+hFWbFU0Us79Vp0S6NyBXStO00H7BNSbkadEjA9RdUS3Sh08bvukG0 WKjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dxHNddND; 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 z7si12718965vse.327.2021.06.29.13.00.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 13:00:57 -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=dxHNddND; 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]:35956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJuj-0001Ol-1J for patch@linaro.org; Tue, 29 Jun 2021 16:00:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwn-0004NT-8y for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:59:01 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:40459) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwS-00033P-Dt for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:59:01 -0400 Received: by mail-pf1-x436.google.com with SMTP id q192so102118pfc.7 for ; Tue, 29 Jun 2021 11:58:39 -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=EydeQGxVqAw6guu1qAKY5r1uSI5ierWJDBSf5PcuhzI=; b=dxHNddNDocDeO6bsiaAiA4vqIv29BP0eSmlNJ5lBIUKfpyNB0y1B0+tkAybg1GFfTH 1fQiGinTMheA2TD/vMs3OMf1PRIrSBSFDNQknDa7bvIOhhkSXx6YUY2lOnMSztHDneCf 8ACR+Y5LTxF8HXzChZJ9uwh7UFUlA5KAckh7SE1zyORoVXpghi1o/gC7DxZ9iyo5FDVt fzxXdwC7ojnLbcEpf1PUy/HRgd8XOfdDy9uFRuX25FMyt/S8zVMNr4Ug5e6leDmYYvwB 5R1570eeNkvME1EDCBV+66r+lphGBXnipym6elZA7zCCldQBT2p7x6pRK0fSWaAbOV+/ ZUSw== 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=EydeQGxVqAw6guu1qAKY5r1uSI5ierWJDBSf5PcuhzI=; b=fQt70yP25KSSElWXowLYONw2An0BvPnM6+1V8n9JtKjPwMaeP7vM0w6vI0tb8WTtFX QUrGpVQdFxXHMJLQ80fGqwGe0sIK8xlja8sMo0My5E86iLFul85n7T6gCksWLE0VZu24 axyDf+XSSqrbJDCYb1Dip5MveVRHJ8ml7clYyJi+ZdRBjU8z0GOxOJw8pbNPfxj2dWiM bZjYnilQA837KPbXbp+fvHvSwTRW+O5R7AlknQeXbkuDKIOEH1MT9rvzhUMkuGJTRhsf v07Vxz9IfPmPoC87vsLo8XWxnFLiUMeVRBcX4MJB3QFH3emlFi1f8gWJ5/tG5Yn9DycM z1EQ== X-Gm-Message-State: AOAM532yC3fDJl1sIeBaXv6GBqE8iz8Xvbe2ar5sktiNqt6UuuhPopVE E3WJ0lT3pl8iCLoX6TOvgHoL1fv2Pp7P6Q== X-Received: by 2002:a63:f751:: with SMTP id f17mr23531272pgk.373.1624993119111; Tue, 29 Jun 2021 11:58:39 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 62/63] tcg/aarch64: Unset TCG_TARGET_HAS_MEMORY_BSWAP Date: Tue, 29 Jun 2021 11:54:54 -0700 Message-Id: <20210629185455.3131172-63-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The memory bswap support in the aarch64 backend merely dates from a time when it was required. There is nothing special about the backend support that could not have been provided by the middle-end even prior to the introduction of the bswap flags. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.h | 2 +- tcg/aarch64/tcg-target.c.inc | 87 +++++++++++++----------------------- 2 files changed, 32 insertions(+), 57 deletions(-) -- 2.25.1 diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index ef55f7c185..551baf8da3 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -148,7 +148,7 @@ typedef enum { #define TCG_TARGET_HAS_cmpsel_vec 0 #define TCG_TARGET_DEFAULT_MO (0) -#define TCG_TARGET_HAS_MEMORY_BSWAP 1 +#define TCG_TARGET_HAS_MEMORY_BSWAP 0 void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t, uintptr_t); diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 72aa7e0e74..5924977b42 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -1547,28 +1547,34 @@ static void tcg_out_cltz(TCGContext *s, TCGType ext, TCGReg d, /* helper signature: helper_ret_ld_mmu(CPUState *env, target_ulong addr, * TCGMemOpIdx oi, uintptr_t ra) */ -static void * const qemu_ld_helpers[16] = { - [MO_UB] = helper_ret_ldub_mmu, - [MO_LEUW] = helper_le_lduw_mmu, - [MO_LEUL] = helper_le_ldul_mmu, - [MO_LEQ] = helper_le_ldq_mmu, - [MO_BEUW] = helper_be_lduw_mmu, - [MO_BEUL] = helper_be_ldul_mmu, - [MO_BEQ] = helper_be_ldq_mmu, +static void * const qemu_ld_helpers[4] = { + [MO_8] = helper_ret_ldub_mmu, +#ifdef HOST_WORDS_BIGENDIAN + [MO_16] = helper_be_lduw_mmu, + [MO_32] = helper_be_ldul_mmu, + [MO_64] = helper_be_ldq_mmu, +#else + [MO_16] = helper_le_lduw_mmu, + [MO_32] = helper_le_ldul_mmu, + [MO_64] = helper_le_ldq_mmu, +#endif }; /* helper signature: helper_ret_st_mmu(CPUState *env, target_ulong addr, * uintxx_t val, TCGMemOpIdx oi, * uintptr_t ra) */ -static void * const qemu_st_helpers[16] = { - [MO_UB] = helper_ret_stb_mmu, - [MO_LEUW] = helper_le_stw_mmu, - [MO_LEUL] = helper_le_stl_mmu, - [MO_LEQ] = helper_le_stq_mmu, - [MO_BEUW] = helper_be_stw_mmu, - [MO_BEUL] = helper_be_stl_mmu, - [MO_BEQ] = helper_be_stq_mmu, +static void * const qemu_st_helpers[4] = { + [MO_8] = helper_ret_stb_mmu, +#ifdef HOST_WORDS_BIGENDIAN + [MO_16] = helper_be_stw_mmu, + [MO_32] = helper_be_stl_mmu, + [MO_64] = helper_be_stq_mmu, +#else + [MO_16] = helper_le_stw_mmu, + [MO_32] = helper_le_stl_mmu, + [MO_64] = helper_le_stq_mmu, +#endif }; static inline void tcg_out_adr(TCGContext *s, TCGReg rd, const void *target) @@ -1592,7 +1598,7 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *lb) tcg_out_mov(s, TARGET_LONG_BITS == 64, TCG_REG_X1, lb->addrlo_reg); tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_X2, oi); tcg_out_adr(s, TCG_REG_X3, lb->raddr); - tcg_out_call(s, qemu_ld_helpers[opc & (MO_BSWAP | MO_SIZE)]); + tcg_out_call(s, qemu_ld_helpers[opc & MO_SIZE]); if (opc & MO_SIGN) { tcg_out_sxt(s, lb->type, size, lb->datalo_reg, TCG_REG_X0); } else { @@ -1618,7 +1624,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *lb) tcg_out_mov(s, size == MO_64, TCG_REG_X2, lb->datalo_reg); tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_X3, oi); tcg_out_adr(s, TCG_REG_X4, lb->raddr); - tcg_out_call(s, qemu_st_helpers[opc & (MO_BSWAP | MO_SIZE)]); + tcg_out_call(s, qemu_st_helpers[opc & MO_SIZE]); tcg_out_goto(s, lb->raddr); return true; } @@ -1714,7 +1720,8 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, MemOp memop, TCGType ext, TCGReg data_r, TCGReg addr_r, TCGType otype, TCGReg off_r) { - const MemOp bswap = memop & MO_BSWAP; + /* Byte swapping is left to middle-end expansion. */ + tcg_debug_assert((memop & MO_BSWAP) == 0); switch (memop & MO_SSIZE) { case MO_UB: @@ -1726,40 +1733,19 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, MemOp memop, TCGType ext, break; case MO_UW: tcg_out_ldst_r(s, I3312_LDRH, data_r, addr_r, otype, off_r); - if (bswap) { - tcg_out_rev(s, TCG_TYPE_I32, MO_16, data_r, data_r); - } break; case MO_SW: - if (bswap) { - tcg_out_ldst_r(s, I3312_LDRH, data_r, addr_r, otype, off_r); - tcg_out_rev(s, TCG_TYPE_I32, MO_16, data_r, data_r); - tcg_out_sxt(s, ext, MO_16, data_r, data_r); - } else { - tcg_out_ldst_r(s, (ext ? I3312_LDRSHX : I3312_LDRSHW), - data_r, addr_r, otype, off_r); - } + tcg_out_ldst_r(s, (ext ? I3312_LDRSHX : I3312_LDRSHW), + data_r, addr_r, otype, off_r); break; case MO_UL: tcg_out_ldst_r(s, I3312_LDRW, data_r, addr_r, otype, off_r); - if (bswap) { - tcg_out_rev(s, TCG_TYPE_I32, MO_32, data_r, data_r); - } break; case MO_SL: - if (bswap) { - tcg_out_ldst_r(s, I3312_LDRW, data_r, addr_r, otype, off_r); - tcg_out_rev(s, TCG_TYPE_I32, MO_32, data_r, data_r); - tcg_out_sxt(s, TCG_TYPE_I64, MO_32, data_r, data_r); - } else { - tcg_out_ldst_r(s, I3312_LDRSWX, data_r, addr_r, otype, off_r); - } + tcg_out_ldst_r(s, I3312_LDRSWX, data_r, addr_r, otype, off_r); break; case MO_Q: tcg_out_ldst_r(s, I3312_LDRX, data_r, addr_r, otype, off_r); - if (bswap) { - tcg_out_rev(s, TCG_TYPE_I64, MO_64, data_r, data_r); - } break; default: tcg_abort(); @@ -1770,31 +1756,20 @@ static void tcg_out_qemu_st_direct(TCGContext *s, MemOp memop, TCGReg data_r, TCGReg addr_r, TCGType otype, TCGReg off_r) { - const MemOp bswap = memop & MO_BSWAP; + /* Byte swapping is left to middle-end expansion. */ + tcg_debug_assert((memop & MO_BSWAP) == 0); switch (memop & MO_SIZE) { case MO_8: tcg_out_ldst_r(s, I3312_STRB, data_r, addr_r, otype, off_r); break; case MO_16: - if (bswap && data_r != TCG_REG_XZR) { - tcg_out_rev(s, TCG_TYPE_I32, MO_16, TCG_REG_TMP, data_r); - data_r = TCG_REG_TMP; - } tcg_out_ldst_r(s, I3312_STRH, data_r, addr_r, otype, off_r); break; case MO_32: - if (bswap && data_r != TCG_REG_XZR) { - tcg_out_rev(s, TCG_TYPE_I32, MO_32, TCG_REG_TMP, data_r); - data_r = TCG_REG_TMP; - } tcg_out_ldst_r(s, I3312_STRW, data_r, addr_r, otype, off_r); break; case MO_64: - if (bswap && data_r != TCG_REG_XZR) { - tcg_out_rev(s, TCG_TYPE_I64, MO_64, TCG_REG_TMP, data_r); - data_r = TCG_REG_TMP; - } tcg_out_ldst_r(s, I3312_STRX, data_r, addr_r, otype, off_r); break; default: From patchwork Tue Jun 29 18:54:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468343 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5257335jao; Tue, 29 Jun 2021 12:36:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBWTTU66DVWPEjLEjFBsZ0jRl724yrBXCVL2p4bkozL8G6S1x3KvpJ1NtqHifnbl3j2F9y X-Received: by 2002:a25:8b12:: with SMTP id i18mr38324907ybl.162.1624995380846; Tue, 29 Jun 2021 12:36:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995380; cv=none; d=google.com; s=arc-20160816; b=nTFYqPSY5beI+7AQD9nTahmyHULAlaHvbVC81zhEfqsptoXsxyKvWgeL+hGnmglqMc QKjA6pdzC+XcUtkqQpQlIpKGg2ABLNNaOk0ZCZHLvZF2sW8i7O3U+c1l11xIOIUGQ0Ib UZORtoIFKAB19a6qgvU2/o9loKYZtRve5OVGQfwsT+DIp+LdwN7JPivT0Db4FlHZstnn 3i19ME4i4d7rh0ZqKR/Pm7k4QlJWRFhs8aQPh7Wm94XdF62WJLzaRPFssXkvoFNXMIm6 8Z4LLq5ve4jzfJhV88ChUssHwJBlyAOZw7noXTbLtLJDb8AeNxHU7KsoUIasBiWGDaEt FE5A== 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=gGg4VMcdZ5rhfpaP9NuMbgcNxZ47zeyC7JQnFmoSmmk=; b=ycV235mb7hHP6+D+qe2D1lSTHSx2xyS/Jb27cA5aIjYP/XfsyS9fHKYK9JYfQzySws iDkXwBue130GUHUNZ5wosOvhOaQqEdtphE73/tsRpB5B6bobYC7iv0JxV3WSprpuAvnz VSfwM/yGLGV4qaPFaVKAD1NfMbB75NDmEd4CfhaVd2PIissHJGLOS7ay+NHaM3P9DBs7 b/ZqNB45g9iZNDQKs+/kq2cEtz3q/nG6w9UGgDq/hXQ/DN3f8Ak5nMKtJSoDyf7UASHc MnWAbehSVxnc6VQ3b4sHCkA1CT3VMbZnjrQLgCJ9HrwTONDw4x8HeUp53R2dFmX3HxWM 0YDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dLYUDXdf; 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 l7si2837967ybt.336.2021.06.29.12.36.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:36:20 -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=dLYUDXdf; 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]:42342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJWu-0006f7-4a for patch@linaro.org; Tue, 29 Jun 2021 15:36:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwl-0004JR-2k for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:59 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:46062) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwT-000345-67 for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:58 -0400 Received: by mail-pl1-x634.google.com with SMTP id i4so24834plt.12 for ; Tue, 29 Jun 2021 11:58: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=gGg4VMcdZ5rhfpaP9NuMbgcNxZ47zeyC7JQnFmoSmmk=; b=dLYUDXdf0ws/tBwTOExLWMVQMtTG+svLnICiTQmeT4gSIpSHixW4oc6VlBb/9pRz6z Cx1xpoj5PKxzYszSMJXQh5m5Ueh2W8We/78HOlIigVtdv7audH4I+KKu9iwjYGULPfpU XaqGxVWBNVKBHbiLKmIssfsC8xn9K5J9LB2IRkx3Ej/rmRBx/TjKhMhCvYYFT4gl8PKw J78tfhDSibmt3Ib+kOOEISnnEOkI5KQMxMfcVqNMjZbFG0+8Ce//ltZrVSacoO5f1RcE DJXnaOOurr7CMAh8Bja9hEAAoZ5usvOnW/awvOa+wLEOjTKO/An2gyTwc9561LtKFkQi 5gAg== 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=gGg4VMcdZ5rhfpaP9NuMbgcNxZ47zeyC7JQnFmoSmmk=; b=PaldBWXKhsMexNEq8Fs/sQ9j9fwxoXpmAv2yPEeKYL6vEUpjNaoEqWyp395x/aeMHF 6yPpqatELipsRDyKJUDky1i+aqYG12ZJQJgoW60y0AQpDcZlyWWqz3wZmIOQFLgPBHRI 1jFjzaIHUeM7DNayBv+hkVMtLvdS2d9biPNX8FzzAelmNDOwDZH7whGqPisQNubWXg6J E60P3rLU/lWn1XDt1bnURziJAGVyQv0fUMp5RMqeXsoeHObGtEKoSGNsVTPXKs44Zz+Y a/9uLsW2A4412jIvxPxVgx1V5cArGmGYmMXpq2MGPpqTaKQj2G6ecJd2gapGjEBryUJU L9yg== X-Gm-Message-State: AOAM532xl9agdJRr6Gi0L8a3r8EOAR7mDfUAhtX9sGfoD9tcJz5pnCe6 Nmemd/iJQq3gfJqzhV+zMASC2h5la/U5AA== X-Received: by 2002:a17:902:7c18:b029:117:e575:473e with SMTP id x24-20020a1709027c18b0290117e575473emr29054929pll.37.1624993120065; Tue, 29 Jun 2021 11:58:40 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 63/63] tcg/riscv: Remove MO_BSWAP handling Date: Tue, 29 Jun 2021 11:54:55 -0700 Message-Id: <20210629185455.3131172-64-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair Francis Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" TCG_TARGET_HAS_MEMORY_BSWAP is already unset for this backend, which means that MO_BSWAP be handled by the middle-end and will never be seen by the backend. Thus the indexes used with qemu_{ld,st}_helpers will always be zero. Tidy the comments and asserts in tcg_out_qemu_{ld,st}_direct. It is not that we do not handle bswap "yet", but never will. Acked-by: Alistair Francis Signed-off-by: Richard Henderson --- tcg/riscv/tcg-target.c.inc | 64 ++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 31 deletions(-) -- 2.25.1 diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index da7eecafc5..c16f96b401 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -852,37 +852,43 @@ static void tcg_out_mb(TCGContext *s, TCGArg a0) /* helper signature: helper_ret_ld_mmu(CPUState *env, target_ulong addr, * TCGMemOpIdx oi, uintptr_t ra) */ -static void * const qemu_ld_helpers[16] = { - [MO_UB] = helper_ret_ldub_mmu, - [MO_SB] = helper_ret_ldsb_mmu, - [MO_LEUW] = helper_le_lduw_mmu, - [MO_LESW] = helper_le_ldsw_mmu, - [MO_LEUL] = helper_le_ldul_mmu, +static void * const qemu_ld_helpers[8] = { + [MO_UB] = helper_ret_ldub_mmu, + [MO_SB] = helper_ret_ldsb_mmu, +#ifdef HOST_WORDS_BIGENDIAN + [MO_UW] = helper_be_lduw_mmu, + [MO_SW] = helper_be_ldsw_mmu, + [MO_UL] = helper_be_ldul_mmu, #if TCG_TARGET_REG_BITS == 64 - [MO_LESL] = helper_le_ldsl_mmu, + [MO_SL] = helper_be_ldsl_mmu, #endif - [MO_LEQ] = helper_le_ldq_mmu, - [MO_BEUW] = helper_be_lduw_mmu, - [MO_BESW] = helper_be_ldsw_mmu, - [MO_BEUL] = helper_be_ldul_mmu, + [MO_Q] = helper_be_ldq_mmu, +#else + [MO_UW] = helper_le_lduw_mmu, + [MO_SW] = helper_le_ldsw_mmu, + [MO_UL] = helper_le_ldul_mmu, #if TCG_TARGET_REG_BITS == 64 - [MO_BESL] = helper_be_ldsl_mmu, + [MO_SL] = helper_le_ldsl_mmu, +#endif + [MO_Q] = helper_le_ldq_mmu, #endif - [MO_BEQ] = helper_be_ldq_mmu, }; /* helper signature: helper_ret_st_mmu(CPUState *env, target_ulong addr, * uintxx_t val, TCGMemOpIdx oi, * uintptr_t ra) */ -static void * const qemu_st_helpers[16] = { - [MO_UB] = helper_ret_stb_mmu, - [MO_LEUW] = helper_le_stw_mmu, - [MO_LEUL] = helper_le_stl_mmu, - [MO_LEQ] = helper_le_stq_mmu, - [MO_BEUW] = helper_be_stw_mmu, - [MO_BEUL] = helper_be_stl_mmu, - [MO_BEQ] = helper_be_stq_mmu, +static void * const qemu_st_helpers[4] = { + [MO_8] = helper_ret_stb_mmu, +#ifdef HOST_WORDS_BIGENDIAN + [MO_16] = helper_be_stw_mmu, + [MO_32] = helper_be_stl_mmu, + [MO_64] = helper_be_stq_mmu, +#else + [MO_16] = helper_le_stw_mmu, + [MO_32] = helper_le_stl_mmu, + [MO_64] = helper_le_stq_mmu, +#endif }; /* We don't support oversize guests */ @@ -997,7 +1003,7 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l) tcg_out_movi(s, TCG_TYPE_PTR, a2, oi); tcg_out_movi(s, TCG_TYPE_PTR, a3, (tcg_target_long)l->raddr); - tcg_out_call(s, qemu_ld_helpers[opc & (MO_BSWAP | MO_SSIZE)]); + tcg_out_call(s, qemu_ld_helpers[opc & MO_SSIZE]); tcg_out_mov(s, (opc & MO_SIZE) == MO_64, l->datalo_reg, a0); tcg_out_goto(s, l->raddr); @@ -1042,7 +1048,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) tcg_out_movi(s, TCG_TYPE_PTR, a3, oi); tcg_out_movi(s, TCG_TYPE_PTR, a4, (tcg_target_long)l->raddr); - tcg_out_call(s, qemu_st_helpers[opc & (MO_BSWAP | MO_SSIZE)]); + tcg_out_call(s, qemu_st_helpers[opc & MO_SIZE]); tcg_out_goto(s, l->raddr); return true; @@ -1052,10 +1058,8 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg lo, TCGReg hi, TCGReg base, MemOp opc, bool is_64) { - const MemOp bswap = opc & MO_BSWAP; - - /* We don't yet handle byteswapping, assert */ - g_assert(!bswap); + /* Byte swapping is left to middle-end expansion. */ + tcg_debug_assert((opc & MO_BSWAP) == 0); switch (opc & (MO_SSIZE)) { case MO_UB: @@ -1139,10 +1143,8 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is_64) static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg lo, TCGReg hi, TCGReg base, MemOp opc) { - const MemOp bswap = opc & MO_BSWAP; - - /* We don't yet handle byteswapping, assert */ - g_assert(!bswap); + /* Byte swapping is left to middle-end expansion. */ + tcg_debug_assert((opc & MO_BSWAP) == 0); switch (opc & (MO_SSIZE)) { case MO_8: