From patchwork Fri Apr 27 00:26:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 134549 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp103798lji; Thu, 26 Apr 2018 17:49:34 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqyAlcmwTepeBdqhxaD/W+fodOK0JbablosAdswi2C8Psm11kFFAB4WBsJ7bIG10fuVdkjB X-Received: by 2002:ac8:1204:: with SMTP id x4-v6mr227868qti.35.1524790173884; Thu, 26 Apr 2018 17:49:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524790173; cv=none; d=google.com; s=arc-20160816; b=xjU23LIt06q5/wNAszfLfHPe4cl4k50YaJdKTZd3lgPnxDQW5EqVhX27UBHKVgrbSY B7P/wQEdP+LGAmP6jNB3edQ80V42rtoyyIBgywC86PI90vedstL4TrYRQ27s6aiE0QPP 7NevAhDcS+x1z0ZvCjW442lMY2ToWQmFgPM2WmKItg9wIwFfZ+vrEBQw8gL98xngGNpT P/agPdqEZclcsRr1OpkNocApGkjkiALKWK9NCwCwud7jBXxy1NJMl8Gj+qrPZs+6ELbO 5PDLJ+VtBMethCJAj2aWFujJmKXTti2CdLsWZ/tomb8/+u6Md1nDyNGa2m7uFBUmzTeQ +QiQ== 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:arc-authentication-results; bh=AK0p4SpyvZ3J/I+GdUe6KW90oSn4gSKkgLtPrMjVrLk=; b=h1XeTgTMn9jBE4rAxO0/jYPYw1gt1+RdIe/5J4p+XoHj/l1empGCjZk8VviCNhic2+ yJyBlpSFocG0kG4Cql9pfUlZvHoK4FhXI2LDxgkOjCpFRTGPUuCfcOqtag4quhcLap4k p38ZHNpV1wV4Spz7aqQa4ipGqgg6jfC3vQzW+CtaUvdwNBXrmNB7mmYDpCE2TQCWB0fh gukP21etDjQK5+M+OFngM9UJDhJ6oW5gGmnDXu3j5I1ahM5z9kILbGut9pqgJ2hrU/ZO TVmMAfi20hTtVUMogEZQzezlTcCv9wqWr73UukOpI7yjExFDzDiocYDUZu+ZsyKN+gTo qtzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Q7tGKSCO; 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 m10-v6si124108qth.328.2018.04.26.17.49.33 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 26 Apr 2018 17:49:33 -0700 (PDT) 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=Q7tGKSCO; 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]:45224 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBrZt-00030g-DW for patch@linaro.org; Thu, 26 Apr 2018 20:49:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBrEB-000200-P2 for qemu-devel@nongnu.org; Thu, 26 Apr 2018 20:27:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fBrEA-0004SY-P8 for qemu-devel@nongnu.org; Thu, 26 Apr 2018 20:27:07 -0400 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:36462) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fBrEA-0004SG-JZ for qemu-devel@nongnu.org; Thu, 26 Apr 2018 20:27:06 -0400 Received: by mail-pg0-x241.google.com with SMTP id i6-v6so152510pgv.3 for ; Thu, 26 Apr 2018 17:27: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; bh=AK0p4SpyvZ3J/I+GdUe6KW90oSn4gSKkgLtPrMjVrLk=; b=Q7tGKSCOHhY7X8Msutm3H4PZBcM3r0r8/vpBaAJCB1NG5F951Kth5pDQtXPlcpDuVg HFitHinDoGjgbUoUk4em/0v7zAnmieYAj84/5NrRqtg/LDYvp7M0tU3bKvwvKa2DjzSX Xnr/2e+HiHE67YBGUb8FgKhKcaO1OasJsrvN4= 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=AK0p4SpyvZ3J/I+GdUe6KW90oSn4gSKkgLtPrMjVrLk=; b=QFfP2rOl47u4uLPVU9UNk47moBs0Oz+h+L6GXKW6fonMXqcd2ckmRH7D+Vp2uamT2k 9F8trRjYqYUU/PKb5Qz7Gy1Pp5guM/AdPIbcp18nCqpmeKiQ0gEyQajl0JSm2qFCH7M1 wJdzBy18ILD8FpWkAqPK2k7F069d3fMq0HTdjn3vWeeZeAC2RQ/8YAw0H5Rq/jH8eYPD XWME56Xqw3jbqzJUiwc82vmT7E3NBr3vZlsRpMt8Ji2puPEAis1CLR8R5u5NTopIOhV0 N4IsineCOgOT+RlRtXnzuFoUKDZF+9DzwrS95HBMy6jUNIiLTZXvpoFqs2hWxcj6G4NP I2fA== X-Gm-Message-State: ALQs6tAtYZI61JVyJg8LgCGJyOL+2kjVj4q/lTYF+7+xfLoRfTcpn0VS wdv7RBouHCzBCmnMGDrHFtoKtSgohjE= X-Received: by 2002:a65:6301:: with SMTP id g1-v6mr153110pgv.307.1524788825391; Thu, 26 Apr 2018 17:27:05 -0700 (PDT) Received: from cloudburst.twiddle.net.com ([2605:e000:112b:41da:c94c:5ee7:de92:7d78]) by smtp.gmail.com with ESMTPSA id g76sm86338pfj.102.2018.04.26.17.27.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Apr 2018 17:27:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 26 Apr 2018 14:26:45 -1000 Message-Id: <20180427002651.28356-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180427002651.28356-1-richard.henderson@linaro.org> References: <20180427002651.28356-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::241 Subject: [Qemu-devel] [PATCH 3/9] target/xtensa: Use new min/max expanders 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: Max Filippov , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The generic expanders replace nearly identical code in the translator. Cc: Max Filippov Signed-off-by: Richard Henderson --- target/xtensa/translate.c | 50 +++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 17 deletions(-) -- 2.14.3 Acked-by: Max Filippov diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 4f6d03059f..bad5cdb009 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -1527,10 +1527,8 @@ static void translate_clamps(DisasContext *dc, const uint32_t arg[], TCGv_i32 tmp1 = tcg_const_i32(-1u << arg[2]); TCGv_i32 tmp2 = tcg_const_i32((1 << arg[2]) - 1); - tcg_gen_movcond_i32(TCG_COND_GT, tmp1, - cpu_R[arg[1]], tmp1, cpu_R[arg[1]], tmp1); - tcg_gen_movcond_i32(TCG_COND_LT, cpu_R[arg[0]], - tmp1, tmp2, tmp1, tmp2); + tcg_gen_smax_i32(tmp1, tmp1, cpu_R[arg[1]]); + tcg_gen_smin_i32(cpu_R[arg[0]], tmp1, tmp2); tcg_temp_free(tmp1); tcg_temp_free(tmp2); } @@ -1855,13 +1853,35 @@ static void translate_memw(DisasContext *dc, const uint32_t arg[], tcg_gen_mb(TCG_BAR_SC | TCG_MO_ALL); } -static void translate_minmax(DisasContext *dc, const uint32_t arg[], - const uint32_t par[]) +static void translate_smin(DisasContext *dc, const uint32_t arg[], + const uint32_t par[]) { if (gen_window_check3(dc, arg[0], arg[1], arg[2])) { - tcg_gen_movcond_i32(par[0], cpu_R[arg[0]], - cpu_R[arg[1]], cpu_R[arg[2]], - cpu_R[arg[1]], cpu_R[arg[2]]); + tcg_gen_smin_i32(cpu_R[arg[0]], cpu_R[arg[1]], cpu_R[arg[2]]); + } +} + +static void translate_umin(DisasContext *dc, const uint32_t arg[], + const uint32_t par[]) +{ + if (gen_window_check3(dc, arg[0], arg[1], arg[2])) { + tcg_gen_umin_i32(cpu_R[arg[0]], cpu_R[arg[1]], cpu_R[arg[2]]); + } +} + +static void translate_smax(DisasContext *dc, const uint32_t arg[], + const uint32_t par[]) +{ + if (gen_window_check3(dc, arg[0], arg[1], arg[2])) { + tcg_gen_smax_i32(cpu_R[arg[0]], cpu_R[arg[1]], cpu_R[arg[2]]); + } +} + +static void translate_umax(DisasContext *dc, const uint32_t arg[], + const uint32_t par[]) +{ + if (gen_window_check3(dc, arg[0], arg[1], arg[2])) { + tcg_gen_umax_i32(cpu_R[arg[0]], cpu_R[arg[1]], cpu_R[arg[2]]); } } @@ -2984,23 +3004,19 @@ static const XtensaOpcodeOps core_ops[] = { .par = (const uint32_t[]){TCG_COND_NE}, }, { .name = "max", - .translate = translate_minmax, - .par = (const uint32_t[]){TCG_COND_GE}, + .translate = translate_smax, }, { .name = "maxu", - .translate = translate_minmax, - .par = (const uint32_t[]){TCG_COND_GEU}, + .translate = translate_umax, }, { .name = "memw", .translate = translate_memw, }, { .name = "min", - .translate = translate_minmax, - .par = (const uint32_t[]){TCG_COND_LT}, + .translate = translate_smin, }, { .name = "minu", - .translate = translate_minmax, - .par = (const uint32_t[]){TCG_COND_LTU}, + .translate = translate_umin, }, { .name = "mov", .translate = translate_mov,