From patchwork Tue Aug 8 03:11:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 711556 Delivered-To: patch@linaro.org Received: by 2002:a05:6359:d30:b0:129:c516:61db with SMTP id gp48csp1915386rwb; Mon, 7 Aug 2023 20:14:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHYsN+tvqpfuYXN/5+QBeIXHSGqCZ5B9mUisjM7ZnnDMzJq7oqwxzu0XogMVynUEl9lfJr X-Received: by 2002:a0c:aa42:0:b0:62d:ee5a:514b with SMTP id e2-20020a0caa42000000b0062dee5a514bmr10079379qvb.11.1691464465650; Mon, 07 Aug 2023 20:14:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691464465; cv=none; d=google.com; s=arc-20160816; b=OqE5gKS1OfMs61hz1R12z9uR662KMZEfo0oxmgUyu1CRqPWQ+zBvmCTk8fnNcvBxkK z6T8xznoe4kx1hCR+7EH7q8HMuzrRnc0uE9yALYyylFbsIc7asWxBUchcc9V8pTqOwSn UpGxPV2pNj8x+vPT35KVnnHLpaCd4R4+lWQZ7lFPrwVhI3koXIrZL24V/6folP2TIvOO 2bQHHJNkxE6rcVfBbHORyYI+kBzGYLyIxrt//Ow8vxVzneSZY007e+bUJqzCt3ARw5p5 POTtdS5NDYGke5YHNpH7+B8dzVVoQr+Heg7IypRc2XJ48thiQn58wpSnM3r4OV7OyFLf AFbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=nSqKhjdDiCtip+BntZ0GsTzaBi/Ae7dOmQKXIzVgS5E=; fh=hqs26moy805PsHbwd88lUczy2QdlfF59ojSMxj/DeWg=; b=Wzuj3g4WWYSC6ZvabIJPND32q5+HiMX2EiUO006mSdPWIPtt/0NsFiy5EGuv5YeLqh hQKC4FyRkeSBuo/DeXCnuk7wjYjNYT3QInJIiCCtqDwZdn8UcJlmBulUEILMwTWQHY6T 4eCWSkeBlx6T6sJfbJRk8H9baO814Qu9cfm4RGE60lHf3Lr8CyQQApWcSXiUXdnl03yN FZO9suzV8yn9t2VX8ZOJhgbc+w+DYdJlPPPsTi4NBNxOZKqp/Orxu0C8aYsYP0s9MSRa RvVFE1VzG4dimqePiVeP/KiUxx8zbwEladxAeIFIxBKs9TveHiiL6/vtW/Mb+6Y9FQwE sIKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hMUILeGM; 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 a1-20020a0ca981000000b0063cf80f83c4si5475170qvb.585.2023.08.07.20.14.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Aug 2023 20:14:25 -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=hMUILeGM; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qTD94-0001uR-04; Mon, 07 Aug 2023 23:12:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qTD8i-00011e-EE for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:12:08 -0400 Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qTD8V-0000EJ-Qm for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:12:08 -0400 Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-56c7eb17945so3104472eaf.2 for ; Mon, 07 Aug 2023 20:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691464314; x=1692069114; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nSqKhjdDiCtip+BntZ0GsTzaBi/Ae7dOmQKXIzVgS5E=; b=hMUILeGMl+8U5fyDztjvIHibyiPrSe14KuhkaR+0ovQimWBUPyqTHzfNiqglC8kHgK b0lzYwBbleV4yGtUmvF9/3pFhEsv/0RgSoy6yUAcX0erRzNdYUHSxtFbDYTItaUFV2fe Xf0oXtUuuYmFJas0LxeVufF1RZpMpjR2ksl9xG8Nt48W5GfSHVhTxkBUX14ZGY1fQb09 IvOMJvekXF43YNg86Y2k+pxMrk6Bi0PNnk4LxfWUDactJsl0/o9mBOfTnbNNjBu6fV/A 6Hgoi13AdPEb8rzP8o1ITYpEUzRjQ8nzgCOKRSkmyUhKmbrcqiW4I6xzDT2KeB90GUrj Z2Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691464314; x=1692069114; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nSqKhjdDiCtip+BntZ0GsTzaBi/Ae7dOmQKXIzVgS5E=; b=e6Ac6aX4Oz88YykM6nkTuLgApxAMCLrA9Gp2X8H3hGQYIWBW9j+vMqtkbeVktwKbTm ufmBINHXMsXftrXyX5HuQeB5YtYWvfh5cfyzDGn9UUvTSM7fzPmYMt2YizEX9UCE5tTh SE7ix7+SEbXYBqlG59l//28PduFBTZmILMfG/+KMdhsF0zvkgZIu6ToGEfttJU2Tk+v0 Dq4JK9Cin5DClm8UtX0agzaSeqZNSoWHiPqIlNkyIr6S1THOYtOMCYUmObP5oI13Q3Ot TyJG/zdEMG2fDpbC0d4Axz6GOi9Uq0bsAUwYOrJrEotviRffUNkrEAKqbwlViotNYFZj KLKQ== X-Gm-Message-State: AOJu0YwLalXMPuk7W01FETJWQHd7hLaijYY8G8Xq9JDJYfW9E2sGBF3g wbeHZ3V82gGFXlxDJXic0YBDQ83raPoT7orS/yM= X-Received: by 2002:a54:458f:0:b0:3a7:9666:2a60 with SMTP id z15-20020a54458f000000b003a796662a60mr5709506oib.51.1691464314498; Mon, 07 Aug 2023 20:11:54 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:e306:567a:e0a1:341]) by smtp.gmail.com with ESMTPSA id g64-20020a636b43000000b0055bf96b11d9sm5639087pgc.89.2023.08.07.20.11.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 20:11:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org Subject: [PATCH 11/24] tcg/ppc: Use the Set Boolean Extension Date: Mon, 7 Aug 2023 20:11:30 -0700 Message-Id: <20230808031143.50925-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808031143.50925-1-richard.henderson@linaro.org> References: <20230808031143.50925-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c31; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc31.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 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, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The SETBC family of instructions requires exactly two insns for all comparisions, saving 0-3 insns per (neg)setcond. Signed-off-by: Richard Henderson Reviewed-by: Daniel Henrique Barboza Tested-by: Nicholas Piggin --- tcg/ppc/tcg-target.c.inc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 10448aa0e6..090f11e71c 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -447,6 +447,11 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) #define TW XO31( 4) #define TRAP (TW | TO(31)) +#define SETBC XO31(384) /* v3.10 */ +#define SETBCR XO31(416) /* v3.10 */ +#define SETNBC XO31(448) /* v3.10 */ +#define SETNBCR XO31(480) /* v3.10 */ + #define NOP ORI /* ori 0,0,0 */ #define LVX XO31(103) @@ -1624,6 +1629,23 @@ static void tcg_out_setcond(TCGContext *s, TCGType type, TCGCond cond, arg2 = (uint32_t)arg2; } + /* With SETBC/SETBCR, we can always implement with 2 insns. */ + if (have_isa_3_10) { + tcg_insn_unit bi, opc; + + tcg_out_cmp(s, cond, arg1, arg2, const_arg2, 7, type); + + /* Re-use tcg_to_bc for BI and BO_COND_{TRUE,FALSE}. */ + bi = tcg_to_bc[cond] & (0x1f << 16); + if (tcg_to_bc[cond] & BO(8)) { + opc = neg ? SETNBC : SETBC; + } else { + opc = neg ? SETNBCR : SETBCR; + } + tcg_out32(s, opc | RT(arg0) | bi); + return; + } + /* Handle common and trivial cases before handling anything else. */ if (arg2 == 0) { switch (cond) {