From nobody Sun Feb 8 14:53:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1605005962; cv=none; d=zohomail.com; s=zohoarc; b=lJMONThIRWNRxB86dejbB8x0svjCxeGO/9FSO28xd9fYFcYrofVG2+HWcHspD7sc48UaNDwh/EUv6qzvrDBE4EmiPOkhIdHMIQ9Qt1nzU4woW8XcQLWw1ELCoPXIZTm8ZsovhT0/o8akm8KYdeVVzWKdziu/ImWSMfMWmkLUBj0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605005962; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4mDJE2ZKgDk5LfxW8ALd7hpN+PQvRWr/geM6EPNC0uM=; b=DqTbW2KgNG6X+uLDx06nBtYoUfoWh3i9FkCMsfGClVcdoP6FnxtXgUYH5FfmJhMpV0PhP/HgwfjGHIbmrjs+BG/Pg71SYEDVkqtP4XFFvzJ/IJFfp88TmmUbgB4jCsJsp7ToeR09KQXIESBGzUEQ/CkIJJ2yURfoxe2HT8YDQNI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1605005962747226.5578717034789; Tue, 10 Nov 2020 02:59:22 -0800 (PST) Received: from localhost ([::1]:37688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcRMv-0001Jx-GD for importer@patchew.org; Tue, 10 Nov 2020 05:59:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41156) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcRJD-0005IZ-61; Tue, 10 Nov 2020 05:55:31 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:39055) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kcRJA-00077S-VZ; Tue, 10 Nov 2020 05:55:30 -0500 Received: by mail-wm1-x342.google.com with SMTP id s13so2542621wmh.4; Tue, 10 Nov 2020 02:55:28 -0800 (PST) Received: from localhost.localdomain ([151.33.227.77]) by smtp.gmail.com with ESMTPSA id x6sm2567891wmc.48.2020.11.10.02.55.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 02:55:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4mDJE2ZKgDk5LfxW8ALd7hpN+PQvRWr/geM6EPNC0uM=; b=VO7olcL39DoBxfcIZLaihPTqQlVZAF7y1ZXJd3GBkoCoDJpPNjdgO14418XRv9dKxQ jyIO36F9PIPmHqE6P5DxynbK9UGrwT0ppNJyS4xouQ//AOdRz5EVb1rfs6pQk7S3/9lu FRB0jDu3vxvBnhOvDx3IgR+sb7sjo6sszkwAXU4g/OI5M8d43MlXGM8Zjk/8gfmHj1H2 q2PdB7Cji0I6IEA3u+KLROY7t+JSr0y73uTflnMXTU7qm7DACiAeaZiaI5dmuA8p138U UJpp7mrBprnV3T+HnQRkKFzxHStNPSj3pPUgYkovRGWypaL9ygl/BQHSkS0bvJUjjR1X OU+g== 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:mime-version:content-transfer-encoding; bh=4mDJE2ZKgDk5LfxW8ALd7hpN+PQvRWr/geM6EPNC0uM=; b=IU9LXNP69f5BiH624oGKXlchGq4ZncqcOezXdM5hPySflFkXx3+zfQR2ct5Vby3RhH vR+iin+feiBxv8GjJXBXp6/WCCsk4knmjnzixRaxQdFq6KuKhsxSWty24D8pDWtMFn8N PUl5DAbXBV1SRAy1Oj+84pQrwYw6S/GEnE5rzoQC9jPPXFPbegg2j2wkxjigPN4PU3pJ Zc4P1e09C4C5rk4kKRfv5+EQTT6Y0FBzjYe75suL/2rcs6k8gntA3s+aUougOHM6CA+V N374Kl4QyhkZ2oqxJg+MbekhQuig0u50C2QuchwUb8PSWsy6y03S+jw03pPR0jHtxuJX 6MOw== X-Gm-Message-State: AOAM5305+HAllftoWmsFhLub+iGUVcuRe2NBXGJFyeL8PmTsfGN1e+i3 xoN8NAwV/1yADVAEHK+TPBG73V6z3IkcUw== X-Google-Smtp-Source: ABdhPJwLSEsGQPG7DCrnJ0cq60wnxOb4rCYjY/ilPiBTXsGHtgL/4L7GhzFsSi5iPQ/2HGcRiHImcQ== X-Received: by 2002:a1c:4d4:: with SMTP id 203mr4173614wme.153.1605005726900; Tue, 10 Nov 2020 02:55:26 -0800 (PST) From: LemonBoy To: qemu-devel@nongnu.org Subject: [PATCH v2 2/4] ppc/translate: Turn the helper macros into functions Date: Tue, 10 Nov 2020 11:53:19 +0100 Message-Id: <20201110105321.25889-3-thatlemon@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201110105321.25889-1-thatlemon@gmail.com> References: <20201110105321.25889-1-thatlemon@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::342; envelope-from=thatlemon@gmail.com; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, FREEMAIL_FROM=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: LemonBoy , richard.henderson@linaro.org, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Suggested-by: Richard Henderson Signed-off-by: Giuseppe Musacchio Reviewed-by: Richard Henderson --- target/ppc/fpu_helper.c | 220 +++++++++++++++++++++------------------- 1 file changed, 118 insertions(+), 102 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index b07ff66375..c74c080c17 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -2467,113 +2467,129 @@ void helper_xscmpexpqp(CPUPPCState *env, uint32_t= opcode, do_float_check_status(env, GETPC()); } =20 -#define VSX_SCALAR_CMP(op, ordered) \ -void helper_##op(CPUPPCState *env, uint32_t opcode, \ - ppc_vsr_t *xa, ppc_vsr_t *xb) \ -{ \ - uint32_t cc =3D 0; = \ - bool vxsnan_flag =3D false, vxvc_flag =3D false; = \ - \ - helper_reset_fpstatus(env); \ - \ - if (float64_is_signaling_nan(xa->VsrD(0), &env->fp_status) || \ - float64_is_signaling_nan(xb->VsrD(0), &env->fp_status)) { \ - vxsnan_flag =3D true; = \ - if (fpscr_ve =3D=3D 0 && ordered) { = \ - vxvc_flag =3D true; = \ - } \ - } else if (float64_is_quiet_nan(xa->VsrD(0), &env->fp_status) || \ - float64_is_quiet_nan(xb->VsrD(0), &env->fp_status)) { \ - if (ordered) { \ - vxvc_flag =3D true; = \ - } \ - } \ - if (vxsnan_flag) { \ - float_invalid_op_vxsnan(env, GETPC()); \ - } \ - if (vxvc_flag) { \ - float_invalid_op_vxvc(env, 0, GETPC()); \ - } \ - \ - switch (float64_compare(xa->VsrD(0), xb->VsrD(0), &env->fp_status)) {\ - case float_relation_less: \ - cc |=3D CRF_LT; = \ - break; \ - case float_relation_equal: \ - cc |=3D CRF_EQ; = \ - break; \ - case float_relation_greater: \ - cc |=3D CRF_GT; = \ - break; \ - case float_relation_unordered: \ - cc |=3D CRF_SO; = \ - break; \ - } \ - \ - env->fpscr &=3D ~FP_FPCC; = \ - env->fpscr |=3D cc << FPSCR_FPCC; = \ - env->crf[BF(opcode)] =3D cc; = \ - \ - do_float_check_status(env, GETPC()); \ +static inline void do_scalar_cmp(CPUPPCState *env, ppc_vsr_t *xa, ppc_vsr_= t *xb, + int crf_idx, bool ordered) +{ + uint32_t cc =3D 0; + bool vxsnan_flag =3D false, vxvc_flag =3D false; + + helper_reset_fpstatus(env); + + if (float64_is_signaling_nan(xa->VsrD(0), &env->fp_status) || + float64_is_signaling_nan(xb->VsrD(0), &env->fp_status)) { + vxsnan_flag =3D true; + if (fpscr_ve =3D=3D 0 && ordered) { + vxvc_flag =3D true; + } + } else if (float64_is_quiet_nan(xa->VsrD(0), &env->fp_status) || + float64_is_quiet_nan(xb->VsrD(0), &env->fp_status)) { + if (ordered) { + vxvc_flag =3D true; + } + } + if (vxsnan_flag) { + float_invalid_op_vxsnan(env, GETPC()); + } + if (vxvc_flag) { + float_invalid_op_vxvc(env, 0, GETPC()); + } + + switch (float64_compare(xa->VsrD(0), xb->VsrD(0), &env->fp_status)) { + case float_relation_less: + cc |=3D CRF_LT; + break; + case float_relation_equal: + cc |=3D CRF_EQ; + break; + case float_relation_greater: + cc |=3D CRF_GT; + break; + case float_relation_unordered: + cc |=3D CRF_SO; + break; + } + + env->fpscr &=3D ~FP_FPCC; + env->fpscr |=3D cc << FPSCR_FPCC; + env->crf[crf_idx] =3D cc; + + do_float_check_status(env, GETPC()); +} + +void helper_xscmpodp(CPUPPCState *env, uint32_t opcode, ppc_vsr_t *xa, + ppc_vsr_t *xb) +{ + do_scalar_cmp(env, xa, xb, BF(opcode), true); +} + +void helper_xscmpudp(CPUPPCState *env, uint32_t opcode, ppc_vsr_t *xa, + ppc_vsr_t *xb) +{ + do_scalar_cmp(env, xa, xb, BF(opcode), false); } =20 -VSX_SCALAR_CMP(xscmpodp, 1) -VSX_SCALAR_CMP(xscmpudp, 0) +static inline void do_scalar_cmpq(CPUPPCState *env, ppc_vsr_t *xa, + ppc_vsr_t *xb, int crf_idx, bool ordered) +{ + uint32_t cc =3D 0; + bool vxsnan_flag =3D false, vxvc_flag =3D false; + + helper_reset_fpstatus(env); + + if (float128_is_signaling_nan(xa->f128, &env->fp_status) || + float128_is_signaling_nan(xb->f128, &env->fp_status)) { + vxsnan_flag =3D true; + cc =3D CRF_SO; + if (fpscr_ve =3D=3D 0 && ordered) { + vxvc_flag =3D true; + } + } else if (float128_is_quiet_nan(xa->f128, &env->fp_status) || + float128_is_quiet_nan(xb->f128, &env->fp_status)) { + cc =3D CRF_SO; + if (ordered) { + vxvc_flag =3D true; + } + } + if (vxsnan_flag) { + float_invalid_op_vxsnan(env, GETPC()); + } + if (vxvc_flag) { + float_invalid_op_vxvc(env, 0, GETPC()); + } + + switch (float128_compare(xa->f128, xb->f128, &env->fp_status)) { + case float_relation_less: + cc |=3D CRF_LT; + break; + case float_relation_equal: + cc |=3D CRF_EQ; + break; + case float_relation_greater: + cc |=3D CRF_GT; + break; + case float_relation_unordered: + cc |=3D CRF_SO; + break; + } =20 -#define VSX_SCALAR_CMPQ(op, ordered) \ -void helper_##op(CPUPPCState *env, uint32_t opcode, \ - ppc_vsr_t *xa, ppc_vsr_t *xb) \ -{ \ - uint32_t cc =3D 0; \ - bool vxsnan_flag =3D false, vxvc_flag =3D false; = \ - \ - helper_reset_fpstatus(env); \ - \ - if (float128_is_signaling_nan(xa->f128, &env->fp_status) || \ - float128_is_signaling_nan(xb->f128, &env->fp_status)) { \ - vxsnan_flag =3D true; \ - cc =3D CRF_SO; \ - if (fpscr_ve =3D=3D 0 && ordered) { = \ - vxvc_flag =3D true; \ - } \ - } else if (float128_is_quiet_nan(xa->f128, &env->fp_status) || \ - float128_is_quiet_nan(xb->f128, &env->fp_status)) { \ - cc =3D CRF_SO; \ - if (ordered) { \ - vxvc_flag =3D true; \ - } \ - } \ - if (vxsnan_flag) { \ - float_invalid_op_vxsnan(env, GETPC()); \ - } \ - if (vxvc_flag) { \ - float_invalid_op_vxvc(env, 0, GETPC()); \ - } \ - \ - switch (float128_compare(xa->f128, xb->f128, &env->fp_status)) { \ - case float_relation_less: \ - cc |=3D CRF_LT; \ - break; \ - case float_relation_equal: \ - cc |=3D CRF_EQ; \ - break; \ - case float_relation_greater: \ - cc |=3D CRF_GT; \ - break; \ - case float_relation_unordered: \ - cc |=3D CRF_SO; \ - break; \ - } \ - \ - env->fpscr &=3D ~FP_FPCC; \ - env->fpscr |=3D cc << FPSCR_FPCC; \ - env->crf[BF(opcode)] =3D cc; \ - \ - do_float_check_status(env, GETPC()); \ + env->fpscr &=3D ~FP_FPCC; + env->fpscr |=3D cc << FPSCR_FPCC; + env->crf[crf_idx] =3D cc; + + do_float_check_status(env, GETPC()); +} + +void helper_xscmpoqp(CPUPPCState *env, uint32_t opcode, ppc_vsr_t *xa, + ppc_vsr_t *xb) +{ + do_scalar_cmpq(env, xa, xb, BF(opcode), true); } =20 -VSX_SCALAR_CMPQ(xscmpoqp, 1) -VSX_SCALAR_CMPQ(xscmpuqp, 0) +void helper_xscmpuqp(CPUPPCState *env, uint32_t opcode, ppc_vsr_t *xa, + ppc_vsr_t *xb) +{ + do_scalar_cmpq(env, xa, xb, BF(opcode), false); +} =20 /* * VSX_MAX_MIN - VSX floating point maximum/minimum --=20 2.27.0