From patchwork Tue Jul 3 05:57:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 140902 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp775082ljj; Mon, 2 Jul 2018 23:14:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe0wtwk02fJKHYkHENxIOgMQ/NmGGvnjQM8wIDt2ApZIbCFEuO3jjJHK3GmYPelpJIBNagT X-Received: by 2002:ac8:5393:: with SMTP id x19-v6mr25315164qtp.402.1530598472632; Mon, 02 Jul 2018 23:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530598472; cv=none; d=google.com; s=arc-20160816; b=MawlpOLtgNkEnH7j1LZRPn93YmFZ1hLGvnQ2kfCcjqHoswcavf07cu2oOwk8XR3tWo kFCzaxuE9r7lrCN+lUhzH8IF9YxXT1LJckMOJJ5MGpxPJ7xInDSSml1t3Mufq30i6KRu i0BQmFaC5JtNqd7yGLp6QjelDJSA9W7Al62TDu8QrDf21+Ub1tLuiPAOdEGDwUozcS9a 1vZ6AVQfUMP+uyUY7dHQFp5ohvUvUgTFcFl6NBnGr1qLuDYNyXRXZSO5y4oqQ6ATSDls y6r+vJ5mHBkwckz8Yw+4xsn3u2ql8Xnam1yEVetptXwXdrd7JyyVGlHmnn4bK1j0wuPA uAUA== 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=BrMzsLYVwDH9ITY8PASiQlCZHKk4XnJt079Q788CcCo=; b=fyshBuLI2FIVr94Oq/ZqijkPeEVzvKOFWIXdpZifdT2Mumg1LT7l+TyXs1uR6HVp44 lMQvTAwyUtLjyRyCHZYU8K9nfvbt4IcF4soJFWFmhXQZPj35pBLDlyB0P/oFvQIV57ye hvZ3kGKxtGuskKWn1/nemiciw6UNGLBUj0QeXSbuiN1vvfMSCI/ZR4e0vVOWdxH5iccE CNInWtwc31xz772Scq8a5AK0dc38hcru93eX/whNaQKCWqihEEmKMZIPgO0UpEVof8Dn FPvVvF3Ms4lKxHGNIwDCx03unCIgLwLMezktuePRKc7AqlLpPDzsOL0ostA9kyF17+iC qlbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gibson.dropbear.id.au header.s=201602 header.b=RBsaun2t; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id z124-v6si387733qke.27.2018.07.02.23.14.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 02 Jul 2018 23:14:32 -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=@gibson.dropbear.id.au header.s=201602 header.b=RBsaun2t; 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" Received: from localhost ([::1]:38011 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faEa7-0006ol-Ut for patch@linaro.org; Tue, 03 Jul 2018 02:14:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faEKZ-0002uj-Ro for qemu-devel@nongnu.org; Tue, 03 Jul 2018 01:58:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1faEKV-00070i-5P for qemu-devel@nongnu.org; Tue, 03 Jul 2018 01:58:27 -0400 Received: from ozlabs.org ([203.11.71.1]:54425) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1faEKU-0006y7-Mf; Tue, 03 Jul 2018 01:58:23 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41KYMC0K50z9sBk; Tue, 3 Jul 2018 15:58:13 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1530597495; bh=K5siGL/TPnZ2c+RHbEMCenbhb5lOhB7Qo5pf7b3L9wc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RBsaun2ttV6N3/Wk63rulA7YCyb1Za+/H7KwAyQX7I7npmBuLPbq26ejLsR1+mzBG Ca8Azu3LfePn/qwWwNhw9e7witpdVJBe7ZB2h7oYddf5hgPi1y2VTFOKg6nTaopZgz 85lXz6/TJsaHeAfgLtz2DB9tXEaSmjZd9N8OTjyA= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 3 Jul 2018 15:57:50 +1000 Message-Id: <20180703055804.13449-22-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180703055804.13449-1-david@gibson.dropbear.id.au> References: <20180703055804.13449-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 21/35] target/ppc: Use atomic min/max helpers 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: qemu-devel@nongnu.org, Richard Henderson , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson These operations were previously unimplemented for ppc. Signed-off-by: Richard Henderson Signed-off-by: David Gibson --- target/ppc/translate.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/target/ppc/translate.c b/target/ppc/translate.c index c2a28be6d7..79285b6698 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -3102,13 +3102,21 @@ static void gen_ld_atomic(DisasContext *ctx, TCGMemOp memop) case 3: /* Fetch and 'and' */ tcg_gen_atomic_fetch_and_tl(dst, EA, src, ctx->mem_idx, memop); break; - case 8: /* Swap */ - tcg_gen_atomic_xchg_tl(dst, EA, src, ctx->mem_idx, memop); - break; case 4: /* Fetch and max unsigned */ + tcg_gen_atomic_fetch_umax_tl(dst, EA, src, ctx->mem_idx, memop); + break; case 5: /* Fetch and max signed */ + tcg_gen_atomic_fetch_smax_tl(dst, EA, src, ctx->mem_idx, memop); + break; case 6: /* Fetch and min unsigned */ + tcg_gen_atomic_fetch_umin_tl(dst, EA, src, ctx->mem_idx, memop); + break; case 7: /* Fetch and min signed */ + tcg_gen_atomic_fetch_smin_tl(dst, EA, src, ctx->mem_idx, memop); + break; + case 8: /* Swap */ + tcg_gen_atomic_xchg_tl(dst, EA, src, ctx->mem_idx, memop); + break; case 16: /* compare and swap not equal */ case 24: /* Fetch and increment bounded */ case 25: /* Fetch and increment equal */ @@ -3159,9 +3167,17 @@ static void gen_st_atomic(DisasContext *ctx, TCGMemOp memop) tcg_gen_atomic_and_fetch_tl(discard, EA, src, ctx->mem_idx, memop); break; case 4: /* Store max unsigned */ + tcg_gen_atomic_umax_fetch_tl(discard, EA, src, ctx->mem_idx, memop); + break; case 5: /* Store max signed */ + tcg_gen_atomic_smax_fetch_tl(discard, EA, src, ctx->mem_idx, memop); + break; case 6: /* Store min unsigned */ + tcg_gen_atomic_umin_fetch_tl(discard, EA, src, ctx->mem_idx, memop); + break; case 7: /* Store min signed */ + tcg_gen_atomic_smin_fetch_tl(discard, EA, src, ctx->mem_idx, memop); + break; case 24: /* Store twin */ gen_invalid(ctx); break;