From patchwork Fri Dec 14 03:19:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 153738 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1610162ljp; Thu, 13 Dec 2018 19:46:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/VW9yB1YAy3KpBrObY/ylW2wlYHwcDrsr7aldVejLsUo9I+SjfAk4w30xisljiLZj1jedio X-Received: by 2002:ac8:366a:: with SMTP id n39mr1249380qtb.133.1544759166428; Thu, 13 Dec 2018 19:46:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544759166; cv=none; d=google.com; s=arc-20160816; b=IpYvQnyhOoOOOo6GC6ofYaXbn3voMJ5peo4mWScfD8VmFi6yFJNZycez6eJkm5ZOzO hwUSlxfM6MDN7C+r1CwaNmhDUKvUjKWMVFmfDuEbPVh7PRfj6FfmYj/iEa1z2TtsveoS ECHziVUz1j9lzS579ODMXMMbuaa1onN6aHcc5x0/jsAf2ihii+86wxpH4eoHY9OfK3nU xKwz7yfrN897koP8PWtA/LeCzdneYqHcUH3O7apwQM8sWiq0RGL7PL/RNBNwSAjOpq+G izQt+n2Me/tDJcWiF+GAHOKoLp/ZvAm8LLSh+5BMlg469oWkOZxSBuwDOaWCqF5Kr/WC I/Mg== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=tusyFviTXg3Z07DzPNMpcS9w3/27t1wRBGHj82A/Eoc=; b=EHpnTZC1hkPBZWLRTcmp5tMXBrReOILls8K5SwK+W2pSRp5x65f/Jjz6w/qrYLTAva NNoXh8mQNaKuxcOXKi1AyJrxjjikNMP0Ua4/qeeE+UsUGGKZXcW2otm3xqh3zj57Sfps 2wDuR1aWlwwGsDKUuAj7Wp2uVYds9NP3O6Vd53hRyxcyTQnYa6TJqcC3a0gGRj+mVAI6 t7WUD90Cht2yHR1eWnOHZwdW4vsemtOiAG7/y9/0Tz/9Ls1euGtpDNd38VgPnjY9JRga wWyAvbl3wehmYuIhPg6KEEmZfT5ymcw0Vpt82vMHyEDOG9H/i5VPJNV5Zw2hagT0TrjS zumQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YXsINChI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id z3si1245652qtj.337.2018.12.13.19.46.06 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 13 Dec 2018 19:46:06 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YXsINChI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:59194 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXeQO-0003WC-Ec for patch@linaro.org; Thu, 13 Dec 2018 22:46:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXe1D-0006Hv-Bj for qemu-devel@nongnu.org; Thu, 13 Dec 2018 22:20:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXe1C-0007iy-9w for qemu-devel@nongnu.org; Thu, 13 Dec 2018 22:20:03 -0500 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]:36807) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXe1B-0007Po-W2 for qemu-devel@nongnu.org; Thu, 13 Dec 2018 22:20:02 -0500 Received: by mail-ot1-x330.google.com with SMTP id k98so4130455otk.3 for ; Thu, 13 Dec 2018 19:19:55 -0800 (PST) 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; bh=tusyFviTXg3Z07DzPNMpcS9w3/27t1wRBGHj82A/Eoc=; b=YXsINChI7wUAtV2yh7yOIbcbvOU+ITA76Pb8fE3ADFZDNSeo78IXlwBtC3K67Ot8WE tIFnS+HF3q+ANT6/re0WWMEHHzfYGN6uWoPCMsdkmg5VpKElglB3qbkuSvKXLxaUCAtM D4swzQ2VsP5Ga2V/zbGIYdvzqNQtCTZhtm9zo= 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; bh=tusyFviTXg3Z07DzPNMpcS9w3/27t1wRBGHj82A/Eoc=; b=H8iUx0L0F3w3iYtkS02uguSkod6uagJyY+rUKkitncBzEheLbWibPMzxDqM4EuYKDi 5WPHUWGsPYJD+kuVDURvRtme21Hk3RQavEjFMc9tN9bCWtpOd/F5+BZYLGCSl9TsTsqg qbZPu0QCkXPiv0T2F6rVaTrU4L9zwk4LBIWMt81CyenXNnXdOXvpSolovKJc03JZkSh+ 8cPlWQa/Ee7ORjd6WMrHCUmPI3FFa1KBtWLmmfkFSX32CNv4iotW4Lev7h7X2C3a5eHj fYOoTYNh4i2A/PmX6YagfxHTGNWAiZGgDQXXrGq1W9Np8UZ5oGgyqcRSWNaQs0rfbTwl hRQQ== X-Gm-Message-State: AA+aEWYapO7QwiMOmUNaReBippsOrAwCGTCRVxFrZdqM6ZhJtf9uRfcQ 812lXqD8d9KuFOsSKD+36z1LuGie8frqeA== X-Received: by 2002:a9d:77d4:: with SMTP id w20mr957442otl.196.1544757594343; Thu, 13 Dec 2018 19:19:54 -0800 (PST) Received: from cloudburst.twiddle.net ([187.217.227.243]) by smtp.gmail.com with ESMTPSA id g138sm2367537oib.26.2018.12.13.19.19.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Dec 2018 19:19:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 13 Dec 2018 21:19:16 -0600 Message-Id: <20181214031923.29527-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181214031923.29527-1-richard.henderson@linaro.org> References: <20181214031923.29527-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::330 Subject: [Qemu-devel] [PULL 25/32] tcg/optimize: Optimize bswap X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Somehow we forgot these operations, once upon a time. This will allow immediate stores to have their bswap optimized away. Signed-off-by: Richard Henderson --- tcg/optimize.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.17.2 diff --git a/tcg/optimize.c b/tcg/optimize.c index 5dbe11c3c8..6b98ec13e6 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -353,6 +353,15 @@ static TCGArg do_constant_folding_2(TCGOpcode op, TCGArg x, TCGArg y) CASE_OP_32_64(ext16u): return (uint16_t)x; + CASE_OP_32_64(bswap16): + return bswap16(x); + + CASE_OP_32_64(bswap32): + return bswap32(x); + + case INDEX_op_bswap64_i64: + return bswap64(x); + case INDEX_op_ext_i32_i64: case INDEX_op_ext32s_i64: return (int32_t)x; @@ -1105,6 +1114,9 @@ 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: