From patchwork Fri Dec 2 06:51:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 630240 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp742695pvb; Thu, 1 Dec 2022 22:58:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf4iMtCiWR6NeqBMl6VEd1BcNe6tFjBYHila63sPQCUoI4jHFKhWjJOQECKHMWM9mFiAh7JV X-Received: by 2002:a05:620a:d41:b0:6fb:38cd:adee with SMTP id o1-20020a05620a0d4100b006fb38cdadeemr63276059qkl.703.1669964287525; Thu, 01 Dec 2022 22:58:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669964287; cv=none; d=google.com; s=arc-20160816; b=hzJImIj12yixq2vBQpXPpTb3BDfJBtch8YJmwUtkXYuPzNQiv4jt3RhqNYswtlrmu+ eeU8eawudfu54w04XA+b3/yIigNAOq2VWWht3rVFEZ5W08i0xh8d2nDcKD7vNr2Hq+TJ y+fcxFzrT/YaVpV64MXb/i5euPi+JIl9gXF6N8XDBaFzZ6wGWAEDfvF05kAI73HJesEz MM6QodH4eqlF3lmvvKIlE7F7JwP3hhRjkXrddjIF9BTVzZ+wAF5KoDByjqO5/f3Xz3Qk KWsEtuM9VYyYn8ZTA7ZYfUc4/VtpeHg/X+t0DxeXnxRc6Lg/cLfGur26bDMvOgMrcHRd PRoQ== 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=Lh58nWvDudjSuhn3rm5AM+63H/4nwM3lp5/LtDDXIfE=; b=D82G5FBCsZyhxCMxGln+7WQVxRoHLyoWly47Keburgg8hzZA41pEvxUHrPQnnB8LWf vnCZuMGtnxglMJg4faVl2lnvP/1l0aONNSWI1T7XaE+2sxOoYe8mkVS3nOc9WAixq+XF 9G/VqB04UQr2mTHT3JGp1qiLU0S31bRy5kTtB2VzF5/ps4QAc2ty1DqDj1qhwi3xOpE3 r1VI4ndapG9JKEklPK7Ok6UbHTFtB5XtS7JObbs/kQri0j+4GqoZwxByHt1wQrkxlfrT Rl8EVZerGmHOQd0HMNlipwLZCUaa+KK4Q1udHN9BzYGcjm+sBaXLDS1TFizzhBBIEyZB cHRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kD7xCOPT; 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 d6-20020a05620a158600b006f9ff8a8905si3321501qkk.424.2022.12.01.22.58.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Dec 2022 22:58:07 -0800 (PST) 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=kD7xCOPT; 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 1p0zuD-0007cK-B8; Fri, 02 Dec 2022 01:52:17 -0500 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 1p0zuC-0007bZ-AP for qemu-devel@nongnu.org; Fri, 02 Dec 2022 01:52:16 -0500 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p0zuA-0003jG-MV for qemu-devel@nongnu.org; Fri, 02 Dec 2022 01:52:16 -0500 Received: by mail-pj1-x102c.google.com with SMTP id t11-20020a17090a024b00b0021932afece4so7446734pje.5 for ; Thu, 01 Dec 2022 22:52:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=Lh58nWvDudjSuhn3rm5AM+63H/4nwM3lp5/LtDDXIfE=; b=kD7xCOPTpQFWlssr3hvJtXzO/QEkTaqtF7CXHF7KMriEL9fnKIg15FEdqovFAIcumH PKVnjBaBOfUkEfE8v5XBgiGsbyxl4Ixx1Ja0xu2r6pJiFVURT8qgNRVS7+g1zgLv6Bl1 8yh90XdI8fjobYA6hywnGfBgBH62SgXLBOffF2h55RFF7wSpz4IxwoqVCsW7f8p/Dw0d F+r0N81XjuDnKIGrqbaXjtK/ojT2Z/oMqtN3JlV+maEEfIYND8tgbyDyedPs43jnALM0 W8j+wwlp9gWMMKKyVNQNQw9ZEPKJeI/drC9/ldm6rYk29MmIfqywgpb9rUQbLIWP3Oae dvTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Lh58nWvDudjSuhn3rm5AM+63H/4nwM3lp5/LtDDXIfE=; b=de0tyYTVFJWiHwMIyeZjQNnm0PAFhQVRbbmIKrxYoMDzDMYu1dk0YrDP8nBNA5iCmg yGALjwKZru+OEwHDAPWJg8ZKhFvgWzIoz+nqig/DzsPxCSVnORL1VQTDSHsX74zCjE8D Wijeog4VFNicZbRS8uRCE539qZbRNLgx4LjR2025O9cXR11S3mVwDeb9DXbUi1teT69+ prO5dPc0nqnRWQu5uRnAxPlVjU1oweO8De+/djLDL6VYh9/DzS0qaWPIOSUdyyB4z//e 5bE1HUL6+FUhszWmsmD4muV3OZz7s6kPTQArn1PjQZKllSCZt96O2qKsyhZTzFqeXhS+ LH4w== X-Gm-Message-State: ANoB5pmJeK8gBIWzVM5dBVoB5oH2mGgtb1VwuHVam7Y7kmc2dzdFUrrC 0SrzfUU4dxztvBNBm5l1ie0Tpzi3++USCQOc X-Received: by 2002:a17:90a:dd82:b0:212:fdb1:720b with SMTP id l2-20020a17090add8200b00212fdb1720bmr80782887pjv.66.1669963933342; Thu, 01 Dec 2022 22:52:13 -0800 (PST) Received: from stoup.. ([2602:47:d48a:1201:e3cc:2e37:17d4:f1d5]) by smtp.gmail.com with ESMTPSA id q61-20020a17090a17c300b00218d894fac3sm6056649pja.3.2022.12.01.22.52.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 22:52:12 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v3 12/13] tcg/s390x: Use tgen_movcond_int in tgen_clz Date: Thu, 1 Dec 2022 22:51:59 -0800 Message-Id: <20221202065200.224537-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221202065200.224537-1-richard.henderson@linaro.org> References: <20221202065200.224537-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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.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 Reuse code from movcond to conditionally copy a2 to dest, based on the condition codes produced by FLOGR. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target-con-set.h | 1 + tcg/s390x/tcg-target.c.inc | 26 +++++++++++--------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/tcg/s390x/tcg-target-con-set.h b/tcg/s390x/tcg-target-con-set.h index 86cdc248f2..cfc0d405b3 100644 --- a/tcg/s390x/tcg-target-con-set.h +++ b/tcg/s390x/tcg-target-con-set.h @@ -24,6 +24,7 @@ C_O1_I2(r, 0, rI) C_O1_I2(r, 0, rJ) C_O1_I2(r, r, r) C_O1_I2(r, r, ri) +C_O1_I2(r, r, rI) C_O1_I2(r, r, rJ) C_O1_I2(r, rZ, r) C_O1_I2(v, v, r) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 1e4947b598..23cbb10168 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -1557,21 +1557,15 @@ static void tgen_clz(TCGContext *s, TCGReg dest, TCGReg a1, if (a2const && a2 == 64) { tcg_out_mov(s, TCG_TYPE_I64, dest, TCG_REG_R0); - } else { - if (a2const) { - tcg_out_movi(s, TCG_TYPE_I64, dest, a2); - } else { - tcg_out_mov(s, TCG_TYPE_I64, dest, a2); - } - if (HAVE_FACILITY(LOAD_ON_COND)) { - /* Emit: if (one bit found) dest = r0. */ - tcg_out_insn(s, RRFc, LOCGR, dest, TCG_REG_R0, 2); - } else { - /* Emit: if (no one bit found) goto over; dest = r0; over: */ - tcg_out_insn(s, RI, BRC, 8, (4 + 4) >> 1); - tcg_out_insn(s, RRE, LGR, dest, TCG_REG_R0); - } + return; } + + /* + * Conditions from FLOGR are: + * 2 -> one bit found + * 8 -> no one bit found + */ + tgen_movcond_int(s, TCG_TYPE_I64, dest, a2, a2const, TCG_REG_R0, 8, 2); } static void tgen_deposit(TCGContext *s, TCGReg dest, TCGReg src, @@ -3224,11 +3218,13 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_rotl_i64: case INDEX_op_rotr_i32: case INDEX_op_rotr_i64: - case INDEX_op_clz_i64: case INDEX_op_setcond_i32: case INDEX_op_setcond_i64: return C_O1_I2(r, r, ri); + case INDEX_op_clz_i64: + return C_O1_I2(r, r, rI); + case INDEX_op_sub_i32: case INDEX_op_sub_i64: case INDEX_op_and_i32: