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