From nobody Tue May 21 10:02:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655804822; cv=none; d=zohomail.com; s=zohoarc; b=d0ftwA//XlQxrg8WxXURO3bznCc8KXnHTyyia59v0KcOW1wk7xzPqtae7nUxkY3TMHjcM44wqjj8HTNRzjMLEbuLi2pwWXTvszgKO/oCvUP9v4s91QmuDskCNGVoaurvZLktcg8SN7RJ0KtcyrsrHpmp/hgzAkrUa8ykOqxNPyM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655804822; 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=5oF3ZxrdLxJnDLEJTp838Mko4uONefYWsE38B6sxYYI=; b=YVOgzRZz1PwGvd+cDVuvD8/71Obz/g/EGKB7yp06E5cSMvkdKPXkarLCxfUeDnj9KZ8kQ2t2swYRu2GjLzWZUTeo4I/5ftL6HdVCc6d0pjciurk8L53KncL6EgQ/b8o+CfFSWDiweWGm6MoKw9HmadGlOXg5FW2l7Ri/XqaoOq8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655804822304921.0717844748291; Tue, 21 Jun 2022 02:47:02 -0700 (PDT) Received: from localhost ([::1]:55864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3aTM-00022H-8s for importer@patchew.org; Tue, 21 Jun 2022 05:47:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3aQf-0007Qk-84; Tue, 21 Jun 2022 05:44:13 -0400 Received: from mail-oi1-x22f.google.com ([2607:f8b0:4864:20::22f]:44758) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3aQd-0007Lc-H1; Tue, 21 Jun 2022 05:44:12 -0400 Received: by mail-oi1-x22f.google.com with SMTP id h65so15954926oia.11; Tue, 21 Jun 2022 02:44:10 -0700 (PDT) Received: from balboa.ibmuc.com ([187.34.29.129]) by smtp.gmail.com with ESMTPSA id z9-20020a9d7a49000000b0061020865f1asm7555119otm.50.2022.06.21.02.44.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 02:44:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5oF3ZxrdLxJnDLEJTp838Mko4uONefYWsE38B6sxYYI=; b=XMOB2zXnk7KNiGSiVmcKvbs5UQKrYGRDLBGnpm8MSQBAo/fTjwDE9TkcdzAKgsc1kj 2D/zAAzmPgyiBRqPs8/6FFVwNGrDL+3DtNDoyWeC3ldDm8rybVO51r2KCmwDI8YV5USA fjCrbY1sapZvytyOH8laERZSM041rpoKku3aJWBuo/kbqtwDyRTDQqwvVDVpXiTcJb8N 6Eg+YesYLxyTk3xjWc02PnNSXWR0J+ZaLe9kNqKbyfU8V1El7OKtzWFOxdBjE+MjIzHO SELSbr/hORE0BbF7UwuypJqx3/eMhvlhpd30BuyTrRDIk4sYT6zOejDVNc/BTnadORmg 5naw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5oF3ZxrdLxJnDLEJTp838Mko4uONefYWsE38B6sxYYI=; b=WbXd4hwQsAfPygo6EZJUFr8jeOc7Cf0oxry1ujjF9DTJFGnLUwbAP+RZfK1btbtDX9 08FYDifZtg6OdH0jRgSzsMnolhX+7mFlt++e+0vwjnC79zX+CKSjbRJBwpgyGY+NyZxX LdQRPsEJHzn1+p3OXNm6ccPOD58lHVIKffngESgWnnQtANfS7C1lc+/T3acuRuYjJfNp BZgzsg/UMI9p0oihtOq01qrjTKoJLIjFOwAb6OYD9yNgmjB4JfVaTF2T7Tyq0ILSteFS eMZwBjnub+RPWNbCCrLM2G4Os+6n5R1y23SiRFkfNwpN+w4zqyoJs8Rl69jcaXZUPU1v ZRSg== X-Gm-Message-State: AJIora/GZHLA0AqcNUo+THy30kHUO4KU7wbMbEpXBJwhZNAdQFNXhQSD fcyTuYcv6PmgXJtBO/qtLLLOhE/WOtt4KA== X-Google-Smtp-Source: AGRyM1syD/CKs7peruujV/ZNqUb1wPeXyS/jcyOe5OwJXF3JndB/HWOI9BCzZ3USY5LTWLDNoI/Xeg== X-Received: by 2002:a05:6808:1a0c:b0:32f:6a3b:5164 with SMTP id bk12-20020a0568081a0c00b0032f6a3b5164mr13752197oib.227.1655804648510; Tue, 21 Jun 2022 02:44:08 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, "Lucas Mateus Castro (alqotel)" Subject: [PULL 01/15] target/ppc: Implemented vector divide instructions Date: Tue, 21 Jun 2022 06:43:46 -0300 Message-Id: <20220621094400.122800-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621094400.122800-1-danielhb413@gmail.com> References: <20220621094400.122800-1-danielhb413@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=2607:f8b0:4864:20::22f; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x22f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655804823327100001 Content-Type: text/plain; charset="utf-8" From: "Lucas Mateus Castro (alqotel)" Implement the following PowerISA v3.1 instructions: vdivsw: Vector Divide Signed Word vdivuw: Vector Divide Unsigned Word vdivsd: Vector Divide Signed Doubleword vdivud: Vector Divide Unsigned Doubleword Signed-off-by: Lucas Mateus Castro (alqotel) Reviewed-by: Richard Henderson Message-Id: <20220525134954.85056-2-lucas.araujo@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/insn32.decode | 7 +++ target/ppc/translate/vmx-impl.c.inc | 85 +++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index 18a94fa3b5..6df405e398 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -786,3 +786,10 @@ XVF64GERPP 111011 ... -- .... 0 ..... 00111010 ..= - @XX3_at xa=3D%xx_xa_pair XVF64GERPN 111011 ... -- .... 0 ..... 10111010 ..- @XX3_at xa=3D%xx_= xa_pair XVF64GERNP 111011 ... -- .... 0 ..... 01111010 ..- @XX3_at xa=3D%xx_= xa_pair XVF64GERNN 111011 ... -- .... 0 ..... 11111010 ..- @XX3_at xa=3D%xx_= xa_pair + +## Vector Division Instructions + +VDIVSW 000100 ..... ..... ..... 00110001011 @VX +VDIVUW 000100 ..... ..... ..... 00010001011 @VX +VDIVSD 000100 ..... ..... ..... 00111001011 @VX +VDIVUD 000100 ..... ..... ..... 00011001011 @VX diff --git a/target/ppc/translate/vmx-impl.c.inc b/target/ppc/translate/vmx= -impl.c.inc index d7524c3204..4c0b1a32ec 100644 --- a/target/ppc/translate/vmx-impl.c.inc +++ b/target/ppc/translate/vmx-impl.c.inc @@ -3238,6 +3238,91 @@ TRANS(VMULHSD, do_vx_mulh, true , do_vx_vmulhd_i64) TRANS(VMULHUW, do_vx_mulh, false, do_vx_vmulhw_i64) TRANS(VMULHUD, do_vx_mulh, false, do_vx_vmulhd_i64) =20 +static bool do_vdiv_vmod(DisasContext *ctx, arg_VX *a, const int vece, + void (*func_32)(TCGv_i32 t, TCGv_i32 a, TCGv_i32 = b), + void (*func_64)(TCGv_i64 t, TCGv_i64 a, TCGv_i64 = b)) +{ + const GVecGen3 op =3D { + .fni4 =3D func_32, + .fni8 =3D func_64, + .vece =3D vece + }; + + REQUIRE_VECTOR(ctx); + + tcg_gen_gvec_3(avr_full_offset(a->vrt), avr_full_offset(a->vra), + avr_full_offset(a->vrb), 16, 16, &op); + + return true; +} + +#define DIVU32(NAME, DIV) \ +static void NAME(TCGv_i32 t, TCGv_i32 a, TCGv_i32 b) \ +{ \ + TCGv_i32 zero =3D tcg_constant_i32(0); \ + TCGv_i32 one =3D tcg_constant_i32(1); \ + tcg_gen_movcond_i32(TCG_COND_EQ, b, b, zero, one, b); \ + DIV(t, a, b); \ +} + +#define DIVS32(NAME, DIV) \ +static void NAME(TCGv_i32 t, TCGv_i32 a, TCGv_i32 b) \ +{ \ + TCGv_i32 t0 =3D tcg_temp_new_i32(); \ + TCGv_i32 t1 =3D tcg_temp_new_i32(); \ + tcg_gen_setcondi_i32(TCG_COND_EQ, t0, a, INT32_MIN); \ + tcg_gen_setcondi_i32(TCG_COND_EQ, t1, b, -1); \ + tcg_gen_and_i32(t0, t0, t1); \ + tcg_gen_setcondi_i32(TCG_COND_EQ, t1, b, 0); \ + tcg_gen_or_i32(t0, t0, t1); \ + tcg_gen_movi_i32(t1, 0); \ + tcg_gen_movcond_i32(TCG_COND_NE, b, t0, t1, t0, b); \ + DIV(t, a, b); \ + tcg_temp_free_i32(t0); \ + tcg_temp_free_i32(t1); \ +} + +#define DIVU64(NAME, DIV) \ +static void NAME(TCGv_i64 t, TCGv_i64 a, TCGv_i64 b) \ +{ \ + TCGv_i64 zero =3D tcg_constant_i64(0); \ + TCGv_i64 one =3D tcg_constant_i64(1); \ + tcg_gen_movcond_i64(TCG_COND_EQ, b, b, zero, one, b); \ + DIV(t, a, b); \ +} + +#define DIVS64(NAME, DIV) \ +static void NAME(TCGv_i64 t, TCGv_i64 a, TCGv_i64 b) \ +{ \ + TCGv_i64 t0 =3D tcg_temp_new_i64(); \ + TCGv_i64 t1 =3D tcg_temp_new_i64(); \ + tcg_gen_setcondi_i64(TCG_COND_EQ, t0, a, INT64_MIN); \ + tcg_gen_setcondi_i64(TCG_COND_EQ, t1, b, -1); \ + tcg_gen_and_i64(t0, t0, t1); \ + tcg_gen_setcondi_i64(TCG_COND_EQ, t1, b, 0); \ + tcg_gen_or_i64(t0, t0, t1); \ + tcg_gen_movi_i64(t1, 0); \ + tcg_gen_movcond_i64(TCG_COND_NE, b, t0, t1, t0, b); \ + DIV(t, a, b); \ + tcg_temp_free_i64(t0); \ + tcg_temp_free_i64(t1); \ +} + +DIVS32(do_divsw, tcg_gen_div_i32) +DIVU32(do_divuw, tcg_gen_divu_i32) +DIVS64(do_divsd, tcg_gen_div_i64) +DIVU64(do_divud, tcg_gen_divu_i64) + +TRANS_FLAGS2(ISA310, VDIVSW, do_vdiv_vmod, MO_32, do_divsw, NULL) +TRANS_FLAGS2(ISA310, VDIVUW, do_vdiv_vmod, MO_32, do_divuw, NULL) +TRANS_FLAGS2(ISA310, VDIVSD, do_vdiv_vmod, MO_64, NULL, do_divsd) +TRANS_FLAGS2(ISA310, VDIVUD, do_vdiv_vmod, MO_64, NULL, do_divud) + +#undef DIVS32 +#undef DIVU32 +#undef DIVS64 +#undef DIVU64 + #undef GEN_VR_LDX #undef GEN_VR_STX #undef GEN_VR_LVE --=20 2.36.1 From nobody Tue May 21 10:02:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655805133; cv=none; d=zohomail.com; s=zohoarc; b=jTSVxnjd3NRzZ+yiRS7B/Z+Zb01QAqLbuys3BHIRj0O9B22M2bLNY262xOO7Y4PsKplLnwUoAg3we7MHKIya1LodEabKr+AE9gJYY1Dkxe/l+JrcrwmQlpn8MgDK6U2fOioZtop+x7Zwe/YihJ9OMGYmyOpydSXGRYWs/hNdlwM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655805133; 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=VGrU/66nhnRlMdpQWIYgIzyzKeLNIFZKefQjC8mDfUM=; b=C9XcPQlbzaxSzA49e717pHXEJZ1N5kbzPrqywDunMI5WL5lMQd9LsD5o1upz1c5YWe0esPVrXFs1ZVLJoJsv9pMe9YyzSnUvotVdoyk/v1LWu+G//rdoRjvPfXCjpZ10uruxjan7nbYJYjusTYr3kZUifVgeRencQnbbV7zm3Bc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655805133740824.3031383366676; Tue, 21 Jun 2022 02:52:13 -0700 (PDT) Received: from localhost ([::1]:42080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3aYO-0003QJ-5J for importer@patchew.org; Tue, 21 Jun 2022 05:52:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43240) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3aQg-0007Sf-It; Tue, 21 Jun 2022 05:44:14 -0400 Received: from mail-oa1-x2b.google.com ([2001:4860:4864:20::2b]:33535) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3aQe-0007Ll-Kv; Tue, 21 Jun 2022 05:44:14 -0400 Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-101d2e81bceso8873521fac.0; Tue, 21 Jun 2022 02:44:11 -0700 (PDT) Received: from balboa.ibmuc.com ([187.34.29.129]) by smtp.gmail.com with ESMTPSA id z9-20020a9d7a49000000b0061020865f1asm7555119otm.50.2022.06.21.02.44.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 02:44:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VGrU/66nhnRlMdpQWIYgIzyzKeLNIFZKefQjC8mDfUM=; b=cvs/74UEG6V5RnMKBx5C9A+SFRqHNIWyLWEUN3aq/iAd1zyk0BvmX3FvsSz0W3+/AG 6p+U1Uhf4Zr6tMYOvO4wlVRkK1itIku014EXxHLx79n/CWkBUdKtWwndCpEAUW0BDXav hR7XW+QyvIJ+UsRixV7QYtp6PE9w+9Bk5XcYL8DafYp3hRM7u+J4TWynZWcJqDOFjE4n iG86V9AujLBLJQZj8CgXqslKEC2B3wK9fQqwGINpY99ql1QbCzMN1UkG+ZydpX2MGseB 9An6qv9mYc4qji4VnWcOf8RFQH9YaikonIYOfZgNYFLin+7X2HLABU7oh4vzu/MUQTeH c9rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VGrU/66nhnRlMdpQWIYgIzyzKeLNIFZKefQjC8mDfUM=; b=fP/xEN7io1BTF+bTjiIOtfLp82BqKaQhusjccp0f9Zl70t6CB9WBQvX/1FSAUio7Mh XMxHCL3jaGShYToL2oRum495xOZN+TnAy2mh7cMfpX487wWHfSqcZ1Crqs3/4w516YsP nPhshDcMaDQ+bVPaCBkcCgzmTR+iJ6+Kx7tjM1l+N04EfCmxWE0QKKgAblUHTqI6UXm8 fBlU7qvZaRcFfqnGrOwjRb0S+kGb1ugFSkGAQMVa8qoTk+w8OBU0C5vX0AhE6WCNexcV VJgxFv6m36DvAGfKVHDjTStfuKvcVLEsi40oamdifEY06ksVj0KnIRRi21SHlwW49RgC ztdQ== X-Gm-Message-State: AJIora87PwcRoty7URytaIqp9Ru6IBvCFTROtCU8nW2ts/5txyqgP4AL gKJ+Gv+IIx7DzZql45y6DdVpTvHVKLo0YA== X-Google-Smtp-Source: AGRyM1tYyuzcPoih0+8u71YVVPz14QzS2+ZqHiTTnN087XeY2jxx0a9aPo/spVdoGiwIfZQQz3Svyw== X-Received: by 2002:a05:6870:5b81:b0:101:b256:b7d with SMTP id em1-20020a0568705b8100b00101b2560b7dmr10943608oab.198.1655804650923; Tue, 21 Jun 2022 02:44:10 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, "Lucas Mateus Castro (alqotel)" Subject: [PULL 02/15] target/ppc: Implemented vector divide quadword Date: Tue, 21 Jun 2022 06:43:47 -0300 Message-Id: <20220621094400.122800-3-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621094400.122800-1-danielhb413@gmail.com> References: <20220621094400.122800-1-danielhb413@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=2001:4860:4864:20::2b; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x2b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655805134907100001 Content-Type: text/plain; charset="utf-8" From: "Lucas Mateus Castro (alqotel)" Implement the following PowerISA v3.1 instructions: vdivsq: Vector Divide Signed Quadword vdivuq: Vector Divide Unsigned Quadword Signed-off-by: Lucas Mateus Castro (alqotel) Reviewed-by: Richard Henderson Message-Id: <20220525134954.85056-3-lucas.araujo@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/helper.h | 2 ++ target/ppc/insn32.decode | 2 ++ target/ppc/int_helper.c | 21 +++++++++++++++++++++ target/ppc/translate/vmx-impl.c.inc | 2 ++ 4 files changed, 27 insertions(+) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 6233e28d85..9f33e589e0 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -175,6 +175,8 @@ DEF_HELPER_FLAGS_3(VMULOSW, TCG_CALL_NO_RWG, void, avr,= avr, avr) DEF_HELPER_FLAGS_3(VMULOUB, TCG_CALL_NO_RWG, void, avr, avr, avr) DEF_HELPER_FLAGS_3(VMULOUH, TCG_CALL_NO_RWG, void, avr, avr, avr) DEF_HELPER_FLAGS_3(VMULOUW, TCG_CALL_NO_RWG, void, avr, avr, avr) +DEF_HELPER_FLAGS_3(VDIVSQ, TCG_CALL_NO_RWG, void, avr, avr, avr) +DEF_HELPER_FLAGS_3(VDIVUQ, TCG_CALL_NO_RWG, void, avr, avr, avr) DEF_HELPER_FLAGS_3(vslo, TCG_CALL_NO_RWG, void, avr, avr, avr) DEF_HELPER_FLAGS_3(vsro, TCG_CALL_NO_RWG, void, avr, avr, avr) DEF_HELPER_FLAGS_3(vsrv, TCG_CALL_NO_RWG, void, avr, avr, avr) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index 6df405e398..01bfde8c5e 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -793,3 +793,5 @@ VDIVSW 000100 ..... ..... ..... 00110001011 = @VX VDIVUW 000100 ..... ..... ..... 00010001011 @VX VDIVSD 000100 ..... ..... ..... 00111001011 @VX VDIVUD 000100 ..... ..... ..... 00011001011 @VX +VDIVSQ 000100 ..... ..... ..... 00100001011 @VX +VDIVUQ 000100 ..... ..... ..... 00000001011 @VX diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 105b626d1b..033718dc0e 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -1162,6 +1162,27 @@ void helper_XXPERMX(ppc_vsr_t *t, ppc_vsr_t *s0, ppc= _vsr_t *s1, ppc_vsr_t *pcv, *t =3D tmp; } =20 +void helper_VDIVSQ(ppc_avr_t *t, ppc_avr_t *a, ppc_avr_t *b) +{ + Int128 neg1 =3D int128_makes64(-1); + Int128 int128_min =3D int128_make128(0, INT64_MIN); + if (likely(int128_nz(b->s128) && + (int128_ne(a->s128, int128_min) || int128_ne(b->s128, neg1))= )) { + t->s128 =3D int128_divs(a->s128, b->s128); + } else { + t->s128 =3D a->s128; /* Undefined behavior */ + } +} + +void helper_VDIVUQ(ppc_avr_t *t, ppc_avr_t *a, ppc_avr_t *b) +{ + if (int128_nz(b->s128)) { + t->s128 =3D int128_divu(a->s128, b->s128); + } else { + t->s128 =3D a->s128; /* Undefined behavior */ + } +} + void helper_VPERM(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) { ppc_avr_t result; diff --git a/target/ppc/translate/vmx-impl.c.inc b/target/ppc/translate/vmx= -impl.c.inc index 4c0b1a32ec..22572e6a79 100644 --- a/target/ppc/translate/vmx-impl.c.inc +++ b/target/ppc/translate/vmx-impl.c.inc @@ -3317,6 +3317,8 @@ TRANS_FLAGS2(ISA310, VDIVSW, do_vdiv_vmod, MO_32, do_= divsw, NULL) TRANS_FLAGS2(ISA310, VDIVUW, do_vdiv_vmod, MO_32, do_divuw, NULL) TRANS_FLAGS2(ISA310, VDIVSD, do_vdiv_vmod, MO_64, NULL, do_divsd) TRANS_FLAGS2(ISA310, VDIVUD, do_vdiv_vmod, MO_64, NULL, do_divud) +TRANS_FLAGS2(ISA310, VDIVSQ, do_vx_helper, gen_helper_VDIVSQ) +TRANS_FLAGS2(ISA310, VDIVUQ, do_vx_helper, gen_helper_VDIVUQ) =20 #undef DIVS32 #undef DIVU32 --=20 2.36.1 From nobody Tue May 21 10:02:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655805314; cv=none; d=zohomail.com; s=zohoarc; b=c7qJ+rHE6IkEjeX0adeRM4PSQQoQXTqImPdYFN6v6GD8p/24TjeGP9WpuG0YAjrtNg00wZfQtLgzJl3cPnqJXwQpAgs6dQYgpT0d/Y9VIHPJLRyYwqJo8Dn7KE5hpXl9kpsRlH9ka9dnki1Mbu8+vdJJe/UZif4s8RONpqHPk/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655805314; 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=NnuoROyHKu2bv6b6bZ7glEpm6RtuZ7ViLbUXr26vFr0=; b=fh8et99URf7eM+8Pd1onbXgDe434qjnLEa1VdOZ4UCu6tXGNFCkfkJnKj6fsCBiDG/FiuGbE4yQ+TjoE/cG9rH1m4opDrIfskwYYbAX8JqS8EEFrymy3ziaNbWFfQ9mhOJiuT0EpKEhbppu5zg2Fc8MjHbFEJ1zBaZ3LjY96UTo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655805314102724.2672604600526; Tue, 21 Jun 2022 02:55:14 -0700 (PDT) Received: from localhost ([::1]:49026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3abI-0008AQ-Ga for importer@patchew.org; Tue, 21 Jun 2022 05:55:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3aQi-0007X9-Gu; Tue, 21 Jun 2022 05:44:16 -0400 Received: from mail-oa1-x34.google.com ([2001:4860:4864:20::34]:35688) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3aQg-0007MB-P2; Tue, 21 Jun 2022 05:44:16 -0400 Received: by mail-oa1-x34.google.com with SMTP id 586e51a60fabf-101d96fe0a5so8193214fac.2; Tue, 21 Jun 2022 02:44:14 -0700 (PDT) Received: from balboa.ibmuc.com ([187.34.29.129]) by smtp.gmail.com with ESMTPSA id z9-20020a9d7a49000000b0061020865f1asm7555119otm.50.2022.06.21.02.44.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 02:44:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NnuoROyHKu2bv6b6bZ7glEpm6RtuZ7ViLbUXr26vFr0=; b=C7h5SAQb3Erc1JJ/ehbqaO1IFgpItB3dxQAiqTcyj1jbf+Q9niE4lZXLlkaGZ1lqOu kyeapBlbq86x5A/gJ1w3w9kt+K71eBZiGUqfovQ50OhAhJ7AhgttfraJa+Cq8mJP9/+n EjIcYu1fN9JUf573vE5SPBpvoMnX7MtSScBqp3Ltw4aHjr+sKkkse9YtEW64K1EObhXw zZsghVZl7jtDLQWFg9b56gbHxDIxakKRZLXEU4fZRCQnwMqSJUbCLciuzq388aS9z8T0 iUFf2xxoo3zoe6yo5E70TF/a506hNR467Z4z3H9zFd1F+FcgLykaNPCAobWcG0EOUWsL DzCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NnuoROyHKu2bv6b6bZ7glEpm6RtuZ7ViLbUXr26vFr0=; b=DUeVv32FnY91V2MT4Ef0FMn/4Zt1i2N87G37qowzNGc+uUqigdfglsUY4awAGvWGtt vgj12ZfrPhB2Q3dzNwPGwojJCLFpvw/cIB/qiZmskAa1bYBcAnaxw2s/UDiKFZRJECA8 w2lvGBbWDCUIW71LXNLWGh9lr8ySzg+++YdlbRjwm6q70sV1b9NCftHHf1G5uxZ0HJ6B 04znqISOQjOMg2e2XYnaqTUKvTjJLKIWWcYa0qTtvxqO8Fp8O0C+iAWR8cHCLODCjOiW ECcjKZZKqrPuxTB4YGY3kIRDcPolJIDN/NR1s0PGUkNKf3ynJNqmOov1AHz5wNYT36KP kHjA== X-Gm-Message-State: AJIora/HxQivWMvjv3SYvGmxNSOqtwBvaqf2gHMQqrpjiMGzc0g/J3BK aBxMjnmVFqXGUrpkptT/8mPamiI8pAHaqA== X-Google-Smtp-Source: AGRyM1toDcngmxa6/jKXdQkNkG5Hax27h2BOS/jqhQOlJufHY/b34GdJGiRH+AIUm1Fm4ux8X2xV4Q== X-Received: by 2002:a05:6870:b605:b0:f3:375:fdba with SMTP id cm5-20020a056870b60500b000f30375fdbamr15346665oab.123.1655804653151; Tue, 21 Jun 2022 02:44:13 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, "Lucas Mateus Castro (alqotel)" Subject: [PULL 03/15] target/ppc: Implemented vector divide extended word Date: Tue, 21 Jun 2022 06:43:48 -0300 Message-Id: <20220621094400.122800-4-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621094400.122800-1-danielhb413@gmail.com> References: <20220621094400.122800-1-danielhb413@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=2001:4860:4864:20::34; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x34.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655805316196100001 Content-Type: text/plain; charset="utf-8" From: "Lucas Mateus Castro (alqotel)" Implement the following PowerISA v3.1 instructions: vdivesw: Vector Divide Extended Signed Word vdiveuw: Vector Divide Extended Unsigned Word Signed-off-by: Lucas Mateus Castro (alqotel) Reviewed-by: Richard Henderson Message-Id: <20220525134954.85056-4-lucas.araujo@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/insn32.decode | 3 ++ target/ppc/translate/vmx-impl.c.inc | 48 +++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index 01bfde8c5e..f6d2d4b257 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -795,3 +795,6 @@ VDIVSD 000100 ..... ..... ..... 00111001011 = @VX VDIVUD 000100 ..... ..... ..... 00011001011 @VX VDIVSQ 000100 ..... ..... ..... 00100001011 @VX VDIVUQ 000100 ..... ..... ..... 00000001011 @VX + +VDIVESW 000100 ..... ..... ..... 01110001011 @VX +VDIVEUW 000100 ..... ..... ..... 01010001011 @VX diff --git a/target/ppc/translate/vmx-impl.c.inc b/target/ppc/translate/vmx= -impl.c.inc index 22572e6a79..8c542bcb29 100644 --- a/target/ppc/translate/vmx-impl.c.inc +++ b/target/ppc/translate/vmx-impl.c.inc @@ -3320,6 +3320,54 @@ TRANS_FLAGS2(ISA310, VDIVUD, do_vdiv_vmod, MO_64, NU= LL, do_divud) TRANS_FLAGS2(ISA310, VDIVSQ, do_vx_helper, gen_helper_VDIVSQ) TRANS_FLAGS2(ISA310, VDIVUQ, do_vx_helper, gen_helper_VDIVUQ) =20 +static void do_dives_i32(TCGv_i32 t, TCGv_i32 a, TCGv_i32 b) +{ + TCGv_i64 val1, val2; + + val1 =3D tcg_temp_new_i64(); + val2 =3D tcg_temp_new_i64(); + + tcg_gen_ext_i32_i64(val1, a); + tcg_gen_ext_i32_i64(val2, b); + + /* (a << 32)/b */ + tcg_gen_shli_i64(val1, val1, 32); + tcg_gen_div_i64(val1, val1, val2); + + /* if quotient doesn't fit in 32 bits the result is undefined */ + tcg_gen_extrl_i64_i32(t, val1); + + tcg_temp_free_i64(val1); + tcg_temp_free_i64(val2); +} + +static void do_diveu_i32(TCGv_i32 t, TCGv_i32 a, TCGv_i32 b) +{ + TCGv_i64 val1, val2; + + val1 =3D tcg_temp_new_i64(); + val2 =3D tcg_temp_new_i64(); + + tcg_gen_extu_i32_i64(val1, a); + tcg_gen_extu_i32_i64(val2, b); + + /* (a << 32)/b */ + tcg_gen_shli_i64(val1, val1, 32); + tcg_gen_divu_i64(val1, val1, val2); + + /* if quotient doesn't fit in 32 bits the result is undefined */ + tcg_gen_extrl_i64_i32(t, val1); + + tcg_temp_free_i64(val1); + tcg_temp_free_i64(val2); +} + +DIVS32(do_divesw, do_dives_i32) +DIVU32(do_diveuw, do_diveu_i32) + +TRANS_FLAGS2(ISA310, VDIVESW, do_vdiv_vmod, MO_32, do_divesw, NULL) +TRANS_FLAGS2(ISA310, VDIVEUW, do_vdiv_vmod, MO_32, do_diveuw, NULL) + #undef DIVS32 #undef DIVU32 #undef DIVS64 --=20 2.36.1 From nobody Tue May 21 10:02:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655805042; cv=none; d=zohomail.com; s=zohoarc; b=Juxu+OPwM85Tcsf52IhVeDQxoieWQ6/1lsvTD7SnFCS+Dcmf1xV8Vutg6I6gMChi8Q/lI+07ts2dU14dwOZ0fZYDSPJJx7DRXMrZw1ytLJZXU5lXZT0TVPYJ2rFdmO2HaPNDqPf1uL18cTMAUDayxQOTRj1SEebxqjNi/FvwnH4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655805042; 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=Xw/traBkJK4WZrtB3Zd7lj1xKpe3oozUBGfzbgYPUGw=; b=ecF3jXRsTeP8RmUtRrfFMCoWIFblcyf6V2myL02ENzXpf7pj4GWsy5Ded7RSx121qAA4JgVeRYeFuwxGfYqjGhLgeC+YU8ScX5BXQ92pzletTO/957J8nuhSe20znGd5fFrJXm7vLun5Rbgs9TPWNlgf99aYNGw26acBeC29pCM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655805042186924.8100943468131; Tue, 21 Jun 2022 02:50:42 -0700 (PDT) Received: from localhost ([::1]:37112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3aWv-0008VW-0t for importer@patchew.org; Tue, 21 Jun 2022 05:50:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3aQp-0007dp-B9; Tue, 21 Jun 2022 05:44:23 -0400 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]:45022) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3aQj-0007MW-6I; Tue, 21 Jun 2022 05:44:19 -0400 Received: by mail-oo1-xc2c.google.com with SMTP id v33-20020a4a9764000000b0035f814bb06eso2594704ooi.11; Tue, 21 Jun 2022 02:44:16 -0700 (PDT) Received: from balboa.ibmuc.com ([187.34.29.129]) by smtp.gmail.com with ESMTPSA id z9-20020a9d7a49000000b0061020865f1asm7555119otm.50.2022.06.21.02.44.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 02:44:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Xw/traBkJK4WZrtB3Zd7lj1xKpe3oozUBGfzbgYPUGw=; b=ZdzfO1Z9kLGNLenUXdhCZMv48SNT+PtQYAbnQBh1rO6MGtiTTGt8+b9H8TahkUcvBi wB64xcsPdka2OczZS8n+gf5JdJFhGbJszGjglSOiYDI4OzLve6Hch/T4EGW4mOLVQTUq 5sE8chSd1VcLvegkNBeF434B72qexVN51s0IFCkoI6CfzAYaRFKXEB2E0MQTSlUv2umd DVdtAsifSpfP/NrGvBaVVwZ0p+hCTAR0aRX6dsjb5ObDwGsyrfrELfp8qVZboImUKQsF rtnTetPrSgvo4R8lP5icH3n4B4WcySaoaoBRW7fYdbkEuBvGoNE3bl3BUA8WZByXvw/0 wFIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Xw/traBkJK4WZrtB3Zd7lj1xKpe3oozUBGfzbgYPUGw=; b=RV+bq/V6c4s1r8xky166Yd+bjf2ldGreKm0y+MaB+2KzqvOIvL78awG6ynBTNSf7by gTJafEonK1naAdbddgIujbuwMiIJXTGzqHUhRSvLFwjVL4PZCVm8oTn//14PcNrzXF7W m4babmdE5JYuRHxm4sR9Y9en5867ZrtyJZUGMUYgNwH+DIA3Qa/qMGMHlYX0ThgiEZOm L234DjRmcJ97a8/QLWgQBK99pOCQGbK98vJeR1yhrDTQ2/9tmqV62IMdalFcUVhtXckb lGhbmI9NvAJfZP+CE8XX6kxu5swI/2FcDe8MaELSgqM6BnE8bymSpCinf5Um/h6rjZ+K fa6A== X-Gm-Message-State: AJIora85OCjaxu76SkS722mWPWTzhKoBCnkDUmw59t4VP09+fZUgCToa niglCa6JYOQew883lq/oUHlBbjYhZLBmWA== X-Google-Smtp-Source: AGRyM1se+nPf7BL1o+BSjTbRk+2KJSOzMw4sGnJLtF0pAk8FnsM3jJiNIe9mG6qA38ePXcELJSQt2Q== X-Received: by 2002:a05:6820:56:b0:41b:928a:406f with SMTP id v22-20020a056820005600b0041b928a406fmr10835064oob.56.1655804655522; Tue, 21 Jun 2022 02:44:15 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, "Lucas Mateus Castro (alqotel)" Subject: [PULL 04/15] host-utils: Implemented unsigned 256-by-128 division Date: Tue, 21 Jun 2022 06:43:49 -0300 Message-Id: <20220621094400.122800-5-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621094400.122800-1-danielhb413@gmail.com> References: <20220621094400.122800-1-danielhb413@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=2607:f8b0:4864:20::c2c; envelope-from=danielhb413@gmail.com; helo=mail-oo1-xc2c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655805043390100001 Content-Type: text/plain; charset="utf-8" From: "Lucas Mateus Castro (alqotel)" Based on already existing QEMU implementation, created an unsigned 256 bit by 128 bit division needed to implement the vector divide extended unsigned instruction from PowerISA3.1 Signed-off-by: Lucas Mateus Castro (alqotel) Reviewed-by: Richard Henderson Message-Id: <20220525134954.85056-5-lucas.araujo@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- include/qemu/host-utils.h | 2 + include/qemu/int128.h | 38 +++++++++++ util/host-utils.c | 129 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 169 insertions(+) diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index f19bd29105..9767af7573 100644 --- a/include/qemu/host-utils.h +++ b/include/qemu/host-utils.h @@ -32,6 +32,7 @@ =20 #include "qemu/compiler.h" #include "qemu/bswap.h" +#include "qemu/int128.h" =20 #ifdef CONFIG_INT128 static inline void mulu64(uint64_t *plow, uint64_t *phigh, @@ -849,4 +850,5 @@ static inline uint64_t udiv_qrnnd(uint64_t *r, uint64_t= n1, #endif } =20 +Int128 divu256(Int128 *plow, Int128 *phigh, Int128 divisor); #endif diff --git a/include/qemu/int128.h b/include/qemu/int128.h index ef71f56e3f..d2b76ca6ac 100644 --- a/include/qemu/int128.h +++ b/include/qemu/int128.h @@ -128,11 +128,21 @@ static inline bool int128_ge(Int128 a, Int128 b) return a >=3D b; } =20 +static inline bool int128_uge(Int128 a, Int128 b) +{ + return ((__uint128_t)a) >=3D ((__uint128_t)b); +} + static inline bool int128_lt(Int128 a, Int128 b) { return a < b; } =20 +static inline bool int128_ult(Int128 a, Int128 b) +{ + return (__uint128_t)a < (__uint128_t)b; +} + static inline bool int128_le(Int128 a, Int128 b) { return a <=3D b; @@ -177,6 +187,15 @@ static inline Int128 bswap128(Int128 a) #endif } =20 +static inline int clz128(Int128 a) +{ + if (a >> 64) { + return __builtin_clzll(a >> 64); + } else { + return (a) ? __builtin_clzll((uint64_t)a) + 64 : 128; + } +} + static inline Int128 int128_divu(Int128 a, Int128 b) { return (__uint128_t)a / (__uint128_t)b; @@ -373,11 +392,21 @@ static inline bool int128_ge(Int128 a, Int128 b) return a.hi > b.hi || (a.hi =3D=3D b.hi && a.lo >=3D b.lo); } =20 +static inline bool int128_uge(Int128 a, Int128 b) +{ + return (uint64_t)a.hi > (uint64_t)b.hi || (a.hi =3D=3D b.hi && a.lo >= =3D b.lo); +} + static inline bool int128_lt(Int128 a, Int128 b) { return !int128_ge(a, b); } =20 +static inline bool int128_ult(Int128 a, Int128 b) +{ + return !int128_uge(a, b); +} + static inline bool int128_le(Int128 a, Int128 b) { return int128_ge(b, a); @@ -418,6 +447,15 @@ static inline Int128 bswap128(Int128 a) return int128_make128(bswap64(a.hi), bswap64(a.lo)); } =20 +static inline int clz128(Int128 a) +{ + if (a.hi) { + return __builtin_clzll(a.hi); + } else { + return (a.lo) ? __builtin_clzll(a.lo) + 64 : 128; + } +} + Int128 int128_divu(Int128, Int128); Int128 int128_remu(Int128, Int128); Int128 int128_divs(Int128, Int128); diff --git a/util/host-utils.c b/util/host-utils.c index 96d5dc0bed..93dfb1b6ab 100644 --- a/util/host-utils.c +++ b/util/host-utils.c @@ -266,3 +266,132 @@ void ulshift(uint64_t *plow, uint64_t *phigh, int32_t= shift, bool *overflow) *plow =3D *plow << shift; } } + +/* + * Unsigned 256-by-128 division. + * Returns the remainder via r. + * Returns lower 128 bit of quotient. + * Needs a normalized divisor (most significant bit set to 1). + * + * Adapted from include/qemu/host-utils.h udiv_qrnnd, + * from the GNU Multi Precision Library - longlong.h __udiv_qrnnd + * (https://gmplib.org/repo/gmp/file/tip/longlong.h) + * + * Licensed under the GPLv2/LGPLv3 + */ +static Int128 udiv256_qrnnd(Int128 *r, Int128 n1, Int128 n0, Int128 d) +{ + Int128 d0, d1, q0, q1, r1, r0, m; + uint64_t mp0, mp1; + + d0 =3D int128_make64(int128_getlo(d)); + d1 =3D int128_make64(int128_gethi(d)); + + r1 =3D int128_remu(n1, d1); + q1 =3D int128_divu(n1, d1); + mp0 =3D int128_getlo(q1); + mp1 =3D int128_gethi(q1); + mulu128(&mp0, &mp1, int128_getlo(d0)); + m =3D int128_make128(mp0, mp1); + r1 =3D int128_make128(int128_gethi(n0), int128_getlo(r1)); + if (int128_ult(r1, m)) { + q1 =3D int128_sub(q1, int128_one()); + r1 =3D int128_add(r1, d); + if (int128_uge(r1, d)) { + if (int128_ult(r1, m)) { + q1 =3D int128_sub(q1, int128_one()); + r1 =3D int128_add(r1, d); + } + } + } + r1 =3D int128_sub(r1, m); + + r0 =3D int128_remu(r1, d1); + q0 =3D int128_divu(r1, d1); + mp0 =3D int128_getlo(q0); + mp1 =3D int128_gethi(q0); + mulu128(&mp0, &mp1, int128_getlo(d0)); + m =3D int128_make128(mp0, mp1); + r0 =3D int128_make128(int128_getlo(n0), int128_getlo(r0)); + if (int128_ult(r0, m)) { + q0 =3D int128_sub(q0, int128_one()); + r0 =3D int128_add(r0, d); + if (int128_uge(r0, d)) { + if (int128_ult(r0, m)) { + q0 =3D int128_sub(q0, int128_one()); + r0 =3D int128_add(r0, d); + } + } + } + r0 =3D int128_sub(r0, m); + + *r =3D r0; + return int128_or(int128_lshift(q1, 64), q0); +} + +/* + * Unsigned 256-by-128 division. + * Returns the remainder. + * Returns quotient via plow and phigh. + * Also returns the remainder via the function return value. + */ +Int128 divu256(Int128 *plow, Int128 *phigh, Int128 divisor) +{ + Int128 dhi =3D *phigh; + Int128 dlo =3D *plow; + Int128 rem, dhighest; + int sh; + + if (!int128_nz(divisor) || !int128_nz(dhi)) { + *plow =3D int128_divu(dlo, divisor); + *phigh =3D int128_zero(); + return int128_remu(dlo, divisor); + } else { + sh =3D clz128(divisor); + + if (int128_ult(dhi, divisor)) { + if (sh !=3D 0) { + /* normalize the divisor, shifting the dividend accordingl= y */ + divisor =3D int128_lshift(divisor, sh); + dhi =3D int128_or(int128_lshift(dhi, sh), + int128_urshift(dlo, (128 - sh))); + dlo =3D int128_lshift(dlo, sh); + } + + *phigh =3D int128_zero(); + *plow =3D udiv256_qrnnd(&rem, dhi, dlo, divisor); + } else { + if (sh !=3D 0) { + /* normalize the divisor, shifting the dividend accordingl= y */ + divisor =3D int128_lshift(divisor, sh); + dhighest =3D int128_rshift(dhi, (128 - sh)); + dhi =3D int128_or(int128_lshift(dhi, sh), + int128_urshift(dlo, (128 - sh))); + dlo =3D int128_lshift(dlo, sh); + + *phigh =3D udiv256_qrnnd(&dhi, dhighest, dhi, divisor); + } else { + /* + * dhi >=3D divisor + * Since the MSB of divisor is set (sh =3D=3D 0), + * (dhi - divisor) < divisor + * + * Thus, the high part of the quotient is 1, and we can + * calculate the low part with a single call to udiv_qrnnd + * after subtracting divisor from dhi + */ + dhi =3D int128_sub(dhi, divisor); + *phigh =3D int128_one(); + } + + *plow =3D udiv256_qrnnd(&rem, dhi, dlo, divisor); + } + + /* + * since the dividend/divisor might have been normalized, + * the remainder might also have to be shifted back + */ + rem =3D int128_urshift(rem, sh); + return rem; + } +} --=20 2.36.1 From nobody Tue May 21 10:02:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655804857; cv=none; d=zohomail.com; s=zohoarc; b=MWsJUT1UjnXCAcXrBH3sfe/0kHIvz9IavdcZlXTK+G9BaCUbs0uypKiWl9HfBEptAS0hpS2kLEup3b42RvMqSiCHRfm6vYKy5amLUjEnYDMOZFAW4Dd815ZGwNHgQQ5HXnU7HVmnsD9Bf3dZOjPXUx7gU7AqGMon/UvPm016rUg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655804857; 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=6RJDvDPS1MFWVDLMbLiQZhvWhw1KQ6ONZCt9Aye1gJ4=; b=CTUlBoI/9hPYM4eucsfztbAh7nwwbwbhskINjomHA1fpi5fMCulLYHtPFHq4j0IstylSPwJVYxxZc4aMu1HG6TJ6UfAu66GWPnQXHABeQHE455Db3d5473MuZCC88MGn+l3aP3chD3y4/tCQMmXKGCspOGk5vtdCo9N/TyezMos= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16558048571171013.702216458436; Tue, 21 Jun 2022 02:47:37 -0700 (PDT) Received: from localhost ([::1]:56664 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3aTv-0002Zq-NM for importer@patchew.org; Tue, 21 Jun 2022 05:47:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3aQr-0007hq-0P; Tue, 21 Jun 2022 05:44:25 -0400 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]:37400) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3aQp-0007Mk-DT; Tue, 21 Jun 2022 05:44:24 -0400 Received: by mail-ot1-x32b.google.com with SMTP id l9-20020a056830268900b006054381dd35so10274251otu.4; Tue, 21 Jun 2022 02:44:18 -0700 (PDT) Received: from balboa.ibmuc.com ([187.34.29.129]) by smtp.gmail.com with ESMTPSA id z9-20020a9d7a49000000b0061020865f1asm7555119otm.50.2022.06.21.02.44.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 02:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6RJDvDPS1MFWVDLMbLiQZhvWhw1KQ6ONZCt9Aye1gJ4=; b=Ixq26HJh6mBCFMIO4gDACSHS93xYtEgd+dMTTiEgtvKE6ajRYLGD2GyToFArOfDo7j JpjJpQMvK2qTP9t4MIfkz/9R1NDZiqrMP+m6iPycMbyN+5wCKti5OpHpItP5As3mk5iS SjX5h0YozvS3nhJXRBCtssGTahsZr+orQ1pYtUzaou389LyCpWbDjHjNLaZZv41uD9Cd KUnGbVPCEtireQzKIhYJLxGDzYi2byL+ot3U3jX6ag1WdbMAHbCs3Jr+6z1XR/wZLUtV 3O8jMlGnZbK8I+pQV2Rw3ZcuRiXW1ENtpzizQ1XsoX/KtkE7gahraxciN9N503jZPgJI WXtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6RJDvDPS1MFWVDLMbLiQZhvWhw1KQ6ONZCt9Aye1gJ4=; b=oHRKRJfVLMyPtzH+ZQGJyvGcrvgHq5eIEIJbXSSLjSUCZEi7liHaqu2n7ls5BvIlZa Mz8Q/a3q4cJMklYXzmUds/6uhsTO0NT+tFm5eC61E69+iCC6f9N/nWZ4pd1g9NEWBvno I8RfygNMosnhN2FgipzrDXwz0w0y74xI42V5EowMDatA8bnlq+Up2DxOjtCBukFoWm97 VLOTfPNUNv8cAiBeziiCGwl/8aaZY303d3KGb+AbIjeBlMSnWQaiYjdsO7uHY79X3MAJ JnfiI1AYK5+bu+oE82rVUd95oPAJxT0AbHngxf6xu2+bd8Rp7Qk/peER4ZJS0uMDsmlZ 6kuQ== X-Gm-Message-State: AJIora8ltJoVt8VHF1ZruDEm/1ELxzJe9Nt8mfFIrv4dLf5rT57Pnb4O 30H97rh3mYo9tfUGjD1X6w7ap90jfXdL5Q== X-Google-Smtp-Source: AGRyM1s6vsm7xscNGWu5Qfyxv/a1ij5LrTS1zBDSvGNv4UCclbm+vcTe9InWMZtQeUT/z0PTU/zqiA== X-Received: by 2002:a05:6830:1e3c:b0:60c:a24:d064 with SMTP id t28-20020a0568301e3c00b0060c0a24d064mr11293231otr.48.1655804657863; Tue, 21 Jun 2022 02:44:17 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, "Lucas Mateus Castro (alqotel)" Subject: [PULL 05/15] host-utils: Implemented signed 256-by-128 division Date: Tue, 21 Jun 2022 06:43:50 -0300 Message-Id: <20220621094400.122800-6-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621094400.122800-1-danielhb413@gmail.com> References: <20220621094400.122800-1-danielhb413@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=2607:f8b0:4864:20::32b; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x32b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655804859201100001 Content-Type: text/plain; charset="utf-8" From: "Lucas Mateus Castro (alqotel)" Based on already existing QEMU implementation created a signed 256 bit by 128 bit division needed to implement the vector divide extended signed quadword instruction from PowerISA 3.1 Signed-off-by: Lucas Mateus Castro (alqotel) Reviewed-by: Richard Henderson Message-Id: <20220525134954.85056-6-lucas.araujo@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- include/qemu/host-utils.h | 1 + util/host-utils.c | 51 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index 9767af7573..bc743f5e32 100644 --- a/include/qemu/host-utils.h +++ b/include/qemu/host-utils.h @@ -851,4 +851,5 @@ static inline uint64_t udiv_qrnnd(uint64_t *r, uint64_t= n1, } =20 Int128 divu256(Int128 *plow, Int128 *phigh, Int128 divisor); +Int128 divs256(Int128 *plow, Int128 *phigh, Int128 divisor); #endif diff --git a/util/host-utils.c b/util/host-utils.c index 93dfb1b6ab..fb91bcba82 100644 --- a/util/host-utils.c +++ b/util/host-utils.c @@ -395,3 +395,54 @@ Int128 divu256(Int128 *plow, Int128 *phigh, Int128 div= isor) return rem; } } + +/* + * Signed 256-by-128 division. + * Returns quotient via plow and phigh. + * Also returns the remainder via the function return value. + */ +Int128 divs256(Int128 *plow, Int128 *phigh, Int128 divisor) +{ + bool neg_quotient =3D false, neg_remainder =3D false; + Int128 unsig_hi =3D *phigh, unsig_lo =3D *plow; + Int128 rem; + + if (!int128_nonneg(*phigh)) { + neg_quotient =3D !neg_quotient; + neg_remainder =3D !neg_remainder; + + if (!int128_nz(unsig_lo)) { + unsig_hi =3D int128_neg(unsig_hi); + } else { + unsig_hi =3D int128_not(unsig_hi); + unsig_lo =3D int128_neg(unsig_lo); + } + } + + if (!int128_nonneg(divisor)) { + neg_quotient =3D !neg_quotient; + + divisor =3D int128_neg(divisor); + } + + rem =3D divu256(&unsig_lo, &unsig_hi, divisor); + + if (neg_quotient) { + if (!int128_nz(unsig_lo)) { + *phigh =3D int128_neg(unsig_hi); + *plow =3D int128_zero(); + } else { + *phigh =3D int128_not(unsig_hi); + *plow =3D int128_neg(unsig_lo); + } + } else { + *phigh =3D unsig_hi; + *plow =3D unsig_lo; + } + + if (neg_remainder) { + return int128_neg(rem); + } else { + return rem; + } +} --=20 2.36.1 From nobody Tue May 21 10:02:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655805202; cv=none; d=zohomail.com; s=zohoarc; b=C7cyum7/GEpE4UoYmS7l3Ubwo2rB/FnU0oUFxRUC9urAM540bLXZCAvd7Q2DQVtOvm/v4L+GLgHwd95JaBQzdQTzrcbz1YZD6hxp0NHAQygolqbwng+g8dDu6rjNCE4xjVdPDb6dQwdA+uLvmtGA0g3qDh6q/18dzKcYd2/fNlo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655805202; 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=Xv0EQkPs1+PTOr4msoUcihme/LmWUDVBAtgz7uWfQ70=; b=AXrHVsG6009ZeXFNSL7cVDiLb+kzIvQHkDcO2rEnSoQl2FOZk2QzIZCM+DHmqnl92OL5qyimJhwXl/DsXiziHP1m/mdJognebCQM6xT/P1cnlil2OULRjQDFQjY9Rh3HIlr45n8yZJeYd89KLt4So5tvH41Y1gy4zMbgxKFJOig= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655805202047935.1928378928158; Tue, 21 Jun 2022 02:53:22 -0700 (PDT) Received: from localhost ([::1]:45322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3aZU-0005e3-GF for importer@patchew.org; Tue, 21 Jun 2022 05:53:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43332) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3aQr-0007hv-4l; Tue, 21 Jun 2022 05:44:27 -0400 Received: from mail-oa1-x2b.google.com ([2001:4860:4864:20::2b]:33535) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3aQp-0007Ll-FK; Tue, 21 Jun 2022 05:44:24 -0400 Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-101d2e81bceso8873521fac.0; Tue, 21 Jun 2022 02:44:20 -0700 (PDT) Received: from balboa.ibmuc.com ([187.34.29.129]) by smtp.gmail.com with ESMTPSA id z9-20020a9d7a49000000b0061020865f1asm7555119otm.50.2022.06.21.02.44.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 02:44:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Xv0EQkPs1+PTOr4msoUcihme/LmWUDVBAtgz7uWfQ70=; b=huSPgLTE0vqNY3baMaiDqffr86vrA26bYXfwRLzxyWKSsVei83bXbvgigXBCMPcKy8 YRa9LhrrQ87JzCSgk8XtkBMg4VtCIXeoUEAmXnR5rgNLKDGz5WgXUxL/dUzf3gZn5/yU 9k+OT9nMtZ0kQNU5jlj0cChma25hibCnMgboV/Oqo6rMAyt2NgaN61SON84KUcq7Tcx/ eO0vEMcpi3JMF+bKs3xIfiaWLpdE0yVocaEo600A5fUMuTVy9kMrRqDhQnflnibOoUSW OrR8WZenn6Xi0ZG8XxkYdxmzFhl2NOc2Vhk9KoPCni5LnBw5LghPWE22LMp5kvqgusq0 KZFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Xv0EQkPs1+PTOr4msoUcihme/LmWUDVBAtgz7uWfQ70=; b=GXxXv77dFFjf7aKbyoNfHHXfJx16EutrbN+aOlWQBBmls2wYZnFgr7GkPWYqgnCoZz YeuMc0HszgS9oEXMkUuBXy4RIR6qu3nuPN6eUPkUyTAthon+kDV5iKdtb6EZj3+yn4qs UFBlpRHB283fvEoRV4JbPI8A/zN4nvYsmLOnDWSR4Ni4eHkh5y8bbZLuyYBV6QelIvHW u/09lGgFsj8ZJ0gb9yObLFljLLARyKKqZuOCdTAn+ZLR2c/XV8P376PbPIsF5wLS2x98 WR1wfUE3zdeGY+XTg9kRn25re1GWdnigaRiMpOd1l3I4JCkTWtbgdsuJ/sQsBiB+Keq7 vZlA== X-Gm-Message-State: AJIora9AtFRVNAZ1Ofd0+AhZsJmxDODDicsWUfmWW/+EYz8R6pLNSbQk PWQZO1dV7J0ZDgtKyARXdJJYtKuaBCQEFg== X-Google-Smtp-Source: AGRyM1tWCy7hsYXjEOtEmXDpglaAvA+qHxfMD/t9GHEKZRZgQ8TiGGlzQEa9ZlBoy4TwkVu+3iaqcg== X-Received: by 2002:a05:6870:32d5:b0:101:1935:f1d1 with SMTP id r21-20020a05687032d500b001011935f1d1mr14861867oac.111.1655804660203; Tue, 21 Jun 2022 02:44:20 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, "Lucas Mateus Castro (alqotel)" Subject: [PULL 06/15] target/ppc: Implemented remaining vector divide extended Date: Tue, 21 Jun 2022 06:43:51 -0300 Message-Id: <20220621094400.122800-7-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621094400.122800-1-danielhb413@gmail.com> References: <20220621094400.122800-1-danielhb413@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=2001:4860:4864:20::2b; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x2b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655805203125100001 Content-Type: text/plain; charset="utf-8" From: "Lucas Mateus Castro (alqotel)" Implement the following PowerISA v3.1 instructions: vdivesd: Vector Divide Extended Signed Doubleword vdiveud: Vector Divide Extended Unsigned Doubleword vdivesq: Vector Divide Extended Signed Quadword vdiveuq: Vector Divide Extended Unsigned Quadword Signed-off-by: Lucas Mateus Castro (alqotel) Reviewed-by: Richard Henderson Message-Id: <20220525134954.85056-7-lucas.araujo@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/helper.h | 4 ++ target/ppc/insn32.decode | 4 ++ target/ppc/int_helper.c | 64 +++++++++++++++++++++++++++++ target/ppc/translate/vmx-impl.c.inc | 4 ++ 4 files changed, 76 insertions(+) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 9f33e589e0..e7624300df 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -177,6 +177,10 @@ DEF_HELPER_FLAGS_3(VMULOUH, TCG_CALL_NO_RWG, void, avr= , avr, avr) DEF_HELPER_FLAGS_3(VMULOUW, TCG_CALL_NO_RWG, void, avr, avr, avr) DEF_HELPER_FLAGS_3(VDIVSQ, TCG_CALL_NO_RWG, void, avr, avr, avr) DEF_HELPER_FLAGS_3(VDIVUQ, TCG_CALL_NO_RWG, void, avr, avr, avr) +DEF_HELPER_FLAGS_3(VDIVESD, TCG_CALL_NO_RWG, void, avr, avr, avr) +DEF_HELPER_FLAGS_3(VDIVEUD, TCG_CALL_NO_RWG, void, avr, avr, avr) +DEF_HELPER_FLAGS_3(VDIVESQ, TCG_CALL_NO_RWG, void, avr, avr, avr) +DEF_HELPER_FLAGS_3(VDIVEUQ, TCG_CALL_NO_RWG, void, avr, avr, avr) DEF_HELPER_FLAGS_3(vslo, TCG_CALL_NO_RWG, void, avr, avr, avr) DEF_HELPER_FLAGS_3(vsro, TCG_CALL_NO_RWG, void, avr, avr, avr) DEF_HELPER_FLAGS_3(vsrv, TCG_CALL_NO_RWG, void, avr, avr, avr) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index f6d2d4b257..5b2d7824a0 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -798,3 +798,7 @@ VDIVUQ 000100 ..... ..... ..... 00000001011 = @VX =20 VDIVESW 000100 ..... ..... ..... 01110001011 @VX VDIVEUW 000100 ..... ..... ..... 01010001011 @VX +VDIVESD 000100 ..... ..... ..... 01111001011 @VX +VDIVEUD 000100 ..... ..... ..... 01011001011 @VX +VDIVESQ 000100 ..... ..... ..... 01100001011 @VX +VDIVEUQ 000100 ..... ..... ..... 01000001011 @VX diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 033718dc0e..42f0dcfc52 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -1183,6 +1183,70 @@ void helper_VDIVUQ(ppc_avr_t *t, ppc_avr_t *a, ppc_a= vr_t *b) } } =20 +void helper_VDIVESD(ppc_avr_t *t, ppc_avr_t *a, ppc_avr_t *b) +{ + int i; + int64_t high; + uint64_t low; + for (i =3D 0; i < 2; i++) { + high =3D a->s64[i]; + low =3D 0; + if (unlikely((high =3D=3D INT64_MIN && b->s64[i] =3D=3D -1) || !b-= >s64[i])) { + t->s64[i] =3D a->s64[i]; /* Undefined behavior */ + } else { + divs128(&low, &high, b->s64[i]); + t->s64[i] =3D low; + } + } +} + +void helper_VDIVEUD(ppc_avr_t *t, ppc_avr_t *a, ppc_avr_t *b) +{ + int i; + uint64_t high, low; + for (i =3D 0; i < 2; i++) { + high =3D a->u64[i]; + low =3D 0; + if (unlikely(!b->u64[i])) { + t->u64[i] =3D a->u64[i]; /* Undefined behavior */ + } else { + divu128(&low, &high, b->u64[i]); + t->u64[i] =3D low; + } + } +} + +void helper_VDIVESQ(ppc_avr_t *t, ppc_avr_t *a, ppc_avr_t *b) +{ + Int128 high, low; + Int128 int128_min =3D int128_make128(0, INT64_MIN); + Int128 neg1 =3D int128_makes64(-1); + + high =3D a->s128; + low =3D int128_zero(); + if (unlikely(!int128_nz(b->s128) || + (int128_eq(b->s128, neg1) && int128_eq(high, int128_min))= )) { + t->s128 =3D a->s128; /* Undefined behavior */ + } else { + divs256(&low, &high, b->s128); + t->s128 =3D low; + } +} + +void helper_VDIVEUQ(ppc_avr_t *t, ppc_avr_t *a, ppc_avr_t *b) +{ + Int128 high, low; + + high =3D a->s128; + low =3D int128_zero(); + if (unlikely(!int128_nz(b->s128))) { + t->s128 =3D a->s128; /* Undefined behavior */ + } else { + divu256(&low, &high, b->s128); + t->s128 =3D low; + } +} + void helper_VPERM(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) { ppc_avr_t result; diff --git a/target/ppc/translate/vmx-impl.c.inc b/target/ppc/translate/vmx= -impl.c.inc index 8c542bcb29..f00aa64bf9 100644 --- a/target/ppc/translate/vmx-impl.c.inc +++ b/target/ppc/translate/vmx-impl.c.inc @@ -3367,6 +3367,10 @@ DIVU32(do_diveuw, do_diveu_i32) =20 TRANS_FLAGS2(ISA310, VDIVESW, do_vdiv_vmod, MO_32, do_divesw, NULL) TRANS_FLAGS2(ISA310, VDIVEUW, do_vdiv_vmod, MO_32, do_diveuw, NULL) +TRANS_FLAGS2(ISA310, VDIVESD, do_vx_helper, gen_helper_VDIVESD) +TRANS_FLAGS2(ISA310, VDIVEUD, do_vx_helper, gen_helper_VDIVEUD) +TRANS_FLAGS2(ISA310, VDIVESQ, do_vx_helper, gen_helper_VDIVESQ) +TRANS_FLAGS2(ISA310, VDIVEUQ, do_vx_helper, gen_helper_VDIVEUQ) =20 #undef DIVS32 #undef DIVU32 --=20 2.36.1 From nobody Tue May 21 10:02:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655805489; cv=none; d=zohomail.com; s=zohoarc; b=jDNUsG/8pOifiB9VlhGE6ayLHpZQC4JDkcfc52+dscNnJLC8HPLqClXyvn/aHxdtZuntH0405LF3vwOlDfkn+5K4FbiNcS3EF4jnR18Ngq1QGWfyH8CckztxS6icBp5gVvUo3QP9Vwb+SxzlTgkBLcYz/3I1RhaZW0dMxbmNTLM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655805489; 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=qPWT3juBHtZ/QDmogkBLJLVVTuDNOQQhStTTzFMbikg=; b=d1qnwwtMeF3rjBVMnY7eHgIwP7NDhmkkegnuGwl79K20LYQPqKQ+NmGFUZiPGYwTj9fIQRFbnbbje2DYfc6eNdYQ7UtT7ikpXeokaT02RV96WaiDeX7zh4VmD84wBfhwEMOmPOaNQZ+rs/p6PtFGZeLuGZweRtr9uLezZTl87E0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655805489393715.9504716377646; Tue, 21 Jun 2022 02:58:09 -0700 (PDT) Received: from localhost ([::1]:54422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3ae8-0003YZ-AX for importer@patchew.org; Tue, 21 Jun 2022 05:58:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3aQs-0007iV-AX; Tue, 21 Jun 2022 05:44:27 -0400 Received: from mail-oa1-x34.google.com ([2001:4860:4864:20::34]:36807) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3aQq-0007N5-4e; Tue, 21 Jun 2022 05:44:26 -0400 Received: by mail-oa1-x34.google.com with SMTP id 586e51a60fabf-101ec2d6087so7202287fac.3; Tue, 21 Jun 2022 02:44:23 -0700 (PDT) Received: from balboa.ibmuc.com ([187.34.29.129]) by smtp.gmail.com with ESMTPSA id z9-20020a9d7a49000000b0061020865f1asm7555119otm.50.2022.06.21.02.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 02:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qPWT3juBHtZ/QDmogkBLJLVVTuDNOQQhStTTzFMbikg=; b=frQrqV8GVz6UrX1MfwEN7gd79LzIXcczuzL4zhPMG3UznEEdT694g9bVwhUWJd1Xin 5VPQop8qGXSLlUMYnAHyX9JUYXfQIM+RCHZhcoDLGlUGrrSxZd30U8g9u5tGYkEBB+aB alvOwDMIu6oUENyGcFHnZwVA/dUFBE2zMK4iZV6cUi8zRKt/C8lJsLMMEXh3949AuCdB LaRwShkEgKA7wcLxvApxn/bK469Y5wEToWMXA/yRgVzpYIhlPz0vohVwe5fKml3XgieX Ma2MS/wFSuH5h/uoB9q+0SAZM2PfTUvvqoMUEPtbCf4PviyJxrrLl2BJdDA7WsclsiDM zPYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qPWT3juBHtZ/QDmogkBLJLVVTuDNOQQhStTTzFMbikg=; b=UxKyQ15UY0hx/JX/xEE97KX2i8hgXvraxusVtofMWkGcUfJkvuDcBeyVTlnW8GOfUl Oh61VYmn+veJQlMH9CSH3B2K51YIIkJ1O64deMrrBWIphyOea0t3q/sFo+/3UDUr4dJe Jqa+hfHLGkbrOqyMaC6nOkPxI5EciGwa5wl8OOaBto8C4PoixcDD3jvRYV6oawm0K59W Nkk3S2Wp32nIDF3i5cmT5yYt1PA0j0pakw+egDgKWjHayRgoyz90Zspop3d9eBnLCj23 SbInAKWcgNzI78PH8R5mfDT2F494HU1hrIvtB+qDJSpPBeiUDq4AVFht759A1yh1i+Xa yUBg== X-Gm-Message-State: AJIora848DZElCugVCNog0tXr3K2p5ezvNJhBfSx1elmiZhE0oAMi7GC zL7uwTVfqA/dkhHQHwdMjoE4m+FL0ZDQ2Q== X-Google-Smtp-Source: AGRyM1vBtCJ8T3g1WnWOE0l5SVtu2FS0dazATeNtZ+5W/0zSG1CWSP5wwNC4v7DK4Jdb+ByRDTCpyQ== X-Received: by 2002:a05:6870:f597:b0:101:342:9722 with SMTP id eh23-20020a056870f59700b0010103429722mr14481240oab.54.1655804662452; Tue, 21 Jun 2022 02:44:22 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, "Lucas Mateus Castro (alqotel)" Subject: [PULL 07/15] target/ppc: Implemented vector module word/doubleword Date: Tue, 21 Jun 2022 06:43:52 -0300 Message-Id: <20220621094400.122800-8-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621094400.122800-1-danielhb413@gmail.com> References: <20220621094400.122800-1-danielhb413@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=2001:4860:4864:20::34; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x34.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655805491300100001 Content-Type: text/plain; charset="utf-8" From: "Lucas Mateus Castro (alqotel)" Implement the following PowerISA v3.1 instructions: vmodsw: Vector Modulo Signed Word vmoduw: Vector Modulo Unsigned Word vmodsd: Vector Modulo Signed Doubleword vmodud: Vector Modulo Unsigned Doubleword Signed-off-by: Lucas Mateus Castro (alqotel) Reviewed-by: Richard Henderson Message-Id: <20220525134954.85056-8-lucas.araujo@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/insn32.decode | 5 +++++ target/ppc/translate/vmx-impl.c.inc | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index 5b2d7824a0..75fa206b39 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -802,3 +802,8 @@ VDIVESD 000100 ..... ..... ..... 01111001011 = @VX VDIVEUD 000100 ..... ..... ..... 01011001011 @VX VDIVESQ 000100 ..... ..... ..... 01100001011 @VX VDIVEUQ 000100 ..... ..... ..... 01000001011 @VX + +VMODSW 000100 ..... ..... ..... 11110001011 @VX +VMODUW 000100 ..... ..... ..... 11010001011 @VX +VMODSD 000100 ..... ..... ..... 11111001011 @VX +VMODUD 000100 ..... ..... ..... 11011001011 @VX diff --git a/target/ppc/translate/vmx-impl.c.inc b/target/ppc/translate/vmx= -impl.c.inc index f00aa64bf9..78277fb018 100644 --- a/target/ppc/translate/vmx-impl.c.inc +++ b/target/ppc/translate/vmx-impl.c.inc @@ -3365,6 +3365,11 @@ static void do_diveu_i32(TCGv_i32 t, TCGv_i32 a, TCG= v_i32 b) DIVS32(do_divesw, do_dives_i32) DIVU32(do_diveuw, do_diveu_i32) =20 +DIVS32(do_modsw, tcg_gen_rem_i32) +DIVU32(do_moduw, tcg_gen_remu_i32) +DIVS64(do_modsd, tcg_gen_rem_i64) +DIVU64(do_modud, tcg_gen_remu_i64) + TRANS_FLAGS2(ISA310, VDIVESW, do_vdiv_vmod, MO_32, do_divesw, NULL) TRANS_FLAGS2(ISA310, VDIVEUW, do_vdiv_vmod, MO_32, do_diveuw, NULL) TRANS_FLAGS2(ISA310, VDIVESD, do_vx_helper, gen_helper_VDIVESD) @@ -3372,6 +3377,11 @@ TRANS_FLAGS2(ISA310, VDIVEUD, do_vx_helper, gen_help= er_VDIVEUD) TRANS_FLAGS2(ISA310, VDIVESQ, do_vx_helper, gen_helper_VDIVESQ) TRANS_FLAGS2(ISA310, VDIVEUQ, do_vx_helper, gen_helper_VDIVEUQ) =20 +TRANS_FLAGS2(ISA310, VMODSW, do_vdiv_vmod, MO_32, do_modsw , NULL) +TRANS_FLAGS2(ISA310, VMODUW, do_vdiv_vmod, MO_32, do_moduw, NULL) +TRANS_FLAGS2(ISA310, VMODSD, do_vdiv_vmod, MO_64, NULL, do_modsd) +TRANS_FLAGS2(ISA310, VMODUD, do_vdiv_vmod, MO_64, NULL, do_modud) + #undef DIVS32 #undef DIVU32 #undef DIVS64 --=20 2.36.1 From nobody Tue May 21 10:02:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655804896; cv=none; d=zohomail.com; s=zohoarc; b=IsxbZVvZoInDUOF3a0f0DqTTjAnsd/vh4mZWxqou/C3U7qjxOE/J8FBfw54DrpSdOkRTspNv/X/kbqOFw37S1VtSijup3c1bPumKTBRwORqOPs/rcDMt5Q32g3d7ohHIYn/Fo+rnjd+fGBWqN1XXwZVCgA771MdqMqihCfVKNQo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655804896; 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=QJmxT2IfCe25w3p6faQqmcfgtSmeyNtjvIQRoWdUbow=; b=lpyD0FLXoSiQQHBeRW76g9ka7CKyUiHzK3SX2vvYwmjQZPgelsqqRgx7vH5hTUjOrrrDeOSV4doOK3wcnqKHt7y8wbtlpd0LOHtGbTs4t5IJ8QK83ttfRQ1YBCroQLYjPsKmv6rib61+Ko0WC6Lytzi3//dKVRP+mn9fYx7tWWA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655804896174725.9930086705162; Tue, 21 Jun 2022 02:48:16 -0700 (PDT) Received: from localhost ([::1]:57944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3aUY-0003Sb-Ku for importer@patchew.org; Tue, 21 Jun 2022 05:48:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43358) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3aQu-0007jl-2f; Tue, 21 Jun 2022 05:44:29 -0400 Received: from mail-oi1-x22d.google.com ([2607:f8b0:4864:20::22d]:43742) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3aQs-0007Nj-6w; Tue, 21 Jun 2022 05:44:27 -0400 Received: by mail-oi1-x22d.google.com with SMTP id q11so16377118oih.10; Tue, 21 Jun 2022 02:44:25 -0700 (PDT) Received: from balboa.ibmuc.com ([187.34.29.129]) by smtp.gmail.com with ESMTPSA id z9-20020a9d7a49000000b0061020865f1asm7555119otm.50.2022.06.21.02.44.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 02:44:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QJmxT2IfCe25w3p6faQqmcfgtSmeyNtjvIQRoWdUbow=; b=A7qfG13vplFlhsJ57wb19gqSOsJGvPB1kea0SKSjOQ8WkW2HkMTLIAS1hcuESdg0j2 kRbYh4nTidKteid8YsZHr0IohOj5RYFcqSD1Flx91f5ML+eg+/pAw/xYjj+YpfqgdNdg wfExoGFAF9hPC2UzzskRgqgvewG2qVChMYUCPPtKL5PUhUThuq38+lvBlUSTSEWUdcqF nAl99qR5IEVYPP7Q12A5KMY+Le7a3BZ2DhSVWF9DXQT+aFzPQQcBm765uOi0QTWnzcKC dwfEyXiLkPlgKUjKdqa8p8/WwI/iJs53IWnB2OSGFsI2mg87etSGp8VjSd8VNTg+MLxB 6V3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QJmxT2IfCe25w3p6faQqmcfgtSmeyNtjvIQRoWdUbow=; b=QqK+c8tuoMfYxe1hy15A5Fh4TmMk5TU8lqpqqs7vkzGskvoqgelJzmPs/TYxpdzVt0 ZHoE7nQhOD7YLnUJejbEmz+ZvvDRsBy/Kt6U+6qFMQTztPtUPp0bj3MQUwGySgS6qbt4 SxhVuAhPgpZhv0gWJui4T6j+0BWbeHJwcM7I8l7VvR50d1CWe8AR6+b1mQptCVo3UcZE o9VwkhZxdlqePcOGp243DQmi8fn27NxKC3agOE+A9CwXFCTRrCAw0+bUbdnMbZ7cSH6F U1i8zm+E8Zl6fpcZiyoxPK4cXCk9AasJ8ZozWY8+c28S12l6BG0Q1qEZilYMPJ2RWXCV NPCw== X-Gm-Message-State: AOAM530YbA+RAWCimCMfzUk2xt+iJ5PJlLcYZHPxQo7j7/3EcK9edFjE +cjpFWQQVUHXS6AoJfGNp1qsThSXxT3Iww== X-Google-Smtp-Source: ABdhPJymV4FNTQu8iIJXxiTzxqcPeWHOajTFGG8HhMQLef4HH5WAxbTt7mo69jIn1plujweNEmbTNw== X-Received: by 2002:a05:6808:200d:b0:32e:e0c8:add8 with SMTP id q13-20020a056808200d00b0032ee0c8add8mr19453354oiw.35.1655804664606; Tue, 21 Jun 2022 02:44:24 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, "Lucas Mateus Castro (alqotel)" Subject: [PULL 08/15] target/ppc: Implemented vector module quadword Date: Tue, 21 Jun 2022 06:43:53 -0300 Message-Id: <20220621094400.122800-9-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621094400.122800-1-danielhb413@gmail.com> References: <20220621094400.122800-1-danielhb413@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=2607:f8b0:4864:20::22d; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x22d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655804897449100001 Content-Type: text/plain; charset="utf-8" From: "Lucas Mateus Castro (alqotel)" Implement the following PowerISA v3.1 instructions: vmodsq: Vector Modulo Signed Quadword vmoduq: Vector Modulo Unsigned Quadword Signed-off-by: Lucas Mateus Castro (alqotel) Reviewed-by: Richard Henderson Resolves: https://gitlab.com/qemu-project/qemu/-/issues/744 Message-Id: <20220525134954.85056-9-lucas.araujo@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/helper.h | 2 ++ target/ppc/insn32.decode | 2 ++ target/ppc/int_helper.c | 21 +++++++++++++++++++++ target/ppc/translate/vmx-impl.c.inc | 2 ++ 4 files changed, 27 insertions(+) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index e7624300df..d627cfe6ed 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -181,6 +181,8 @@ DEF_HELPER_FLAGS_3(VDIVESD, TCG_CALL_NO_RWG, void, avr,= avr, avr) DEF_HELPER_FLAGS_3(VDIVEUD, TCG_CALL_NO_RWG, void, avr, avr, avr) DEF_HELPER_FLAGS_3(VDIVESQ, TCG_CALL_NO_RWG, void, avr, avr, avr) DEF_HELPER_FLAGS_3(VDIVEUQ, TCG_CALL_NO_RWG, void, avr, avr, avr) +DEF_HELPER_FLAGS_3(VMODSQ, TCG_CALL_NO_RWG, void, avr, avr, avr) +DEF_HELPER_FLAGS_3(VMODUQ, TCG_CALL_NO_RWG, void, avr, avr, avr) DEF_HELPER_FLAGS_3(vslo, TCG_CALL_NO_RWG, void, avr, avr, avr) DEF_HELPER_FLAGS_3(vsro, TCG_CALL_NO_RWG, void, avr, avr, avr) DEF_HELPER_FLAGS_3(vsrv, TCG_CALL_NO_RWG, void, avr, avr, avr) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index 75fa206b39..6ea48d5163 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -807,3 +807,5 @@ VMODSW 000100 ..... ..... ..... 11110001011 = @VX VMODUW 000100 ..... ..... ..... 11010001011 @VX VMODSD 000100 ..... ..... ..... 11111001011 @VX VMODUD 000100 ..... ..... ..... 11011001011 @VX +VMODSQ 000100 ..... ..... ..... 11100001011 @VX +VMODUQ 000100 ..... ..... ..... 11000001011 @VX diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 42f0dcfc52..16357c0900 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -1247,6 +1247,27 @@ void helper_VDIVEUQ(ppc_avr_t *t, ppc_avr_t *a, ppc_= avr_t *b) } } =20 +void helper_VMODSQ(ppc_avr_t *t, ppc_avr_t *a, ppc_avr_t *b) +{ + Int128 neg1 =3D int128_makes64(-1); + Int128 int128_min =3D int128_make128(0, INT64_MIN); + if (likely(int128_nz(b->s128) && + (int128_ne(a->s128, int128_min) || int128_ne(b->s128, neg1))= )) { + t->s128 =3D int128_rems(a->s128, b->s128); + } else { + t->s128 =3D int128_zero(); /* Undefined behavior */ + } +} + +void helper_VMODUQ(ppc_avr_t *t, ppc_avr_t *a, ppc_avr_t *b) +{ + if (likely(int128_nz(b->s128))) { + t->s128 =3D int128_remu(a->s128, b->s128); + } else { + t->s128 =3D int128_zero(); /* Undefined behavior */ + } +} + void helper_VPERM(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) { ppc_avr_t result; diff --git a/target/ppc/translate/vmx-impl.c.inc b/target/ppc/translate/vmx= -impl.c.inc index 78277fb018..0b563bed37 100644 --- a/target/ppc/translate/vmx-impl.c.inc +++ b/target/ppc/translate/vmx-impl.c.inc @@ -3381,6 +3381,8 @@ TRANS_FLAGS2(ISA310, VMODSW, do_vdiv_vmod, MO_32, do_= modsw , NULL) TRANS_FLAGS2(ISA310, VMODUW, do_vdiv_vmod, MO_32, do_moduw, NULL) TRANS_FLAGS2(ISA310, VMODSD, do_vdiv_vmod, MO_64, NULL, do_modsd) TRANS_FLAGS2(ISA310, VMODUD, do_vdiv_vmod, MO_64, NULL, do_modud) +TRANS_FLAGS2(ISA310, VMODSQ, do_vx_helper, gen_helper_VMODSQ) +TRANS_FLAGS2(ISA310, VMODUQ, do_vx_helper, gen_helper_VMODUQ) =20 #undef DIVS32 #undef DIVU32 --=20 2.36.1 From nobody Tue May 21 10:02:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655805062; cv=none; d=zohomail.com; s=zohoarc; b=l4sQteJTVph2HSTz+DdrXcDsAw5u/xZEvasxYbnh2ZouKQyZH7fY1BlZsHbvNoNCUQKWoAZAyU5yFu0OEz8zHGh5/jIC9CqJ4T2R86AW3XQvIfFUDfnrs5bKhhPFq0HKZdxoB+QKPjCB64JCvQeFjVmgMhBZcHn6EFKH6OSOmMU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655805062; h=Content-Type: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=f3RRMoys7qX1NzX5bYgdLFUw70oXiZ53EQ8nVjhmz0U=; b=BGd+2evAuXdMI34bo8MPh3d4N0BJezGKepfOl112LEd7F7rMWYnuiOrNLyxPRKoxp0OKYAhb/oF1OLc6G/vFhCyuYBIeKAL2/jMxQXTHo3G3gcfOcYhhXsLbxbvGhRHQ5ndW5tdcOdUOpsY/K46RiiKk/XWxeEs5uuqHv/YElvM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655805062112338.28668197408365; Tue, 21 Jun 2022 02:51:02 -0700 (PDT) Received: from localhost ([::1]:38448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3aXE-0000zh-Tw for importer@patchew.org; Tue, 21 Jun 2022 05:51:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3aQx-0007m6-KL; Tue, 21 Jun 2022 05:44:33 -0400 Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]:40858) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3aQu-0007O5-MF; Tue, 21 Jun 2022 05:44:30 -0400 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-101cdfddfacso9532313fac.7; Tue, 21 Jun 2022 02:44:28 -0700 (PDT) Received: from balboa.ibmuc.com ([187.34.29.129]) by smtp.gmail.com with ESMTPSA id z9-20020a9d7a49000000b0061020865f1asm7555119otm.50.2022.06.21.02.44.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 02:44:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f3RRMoys7qX1NzX5bYgdLFUw70oXiZ53EQ8nVjhmz0U=; b=l1Ru2pBx7yQUuMREAppGw2u8pu+9x9mSckE6E7ZEIbi5Ge4Osu6Vw7py1hfWuWvTwz eZSedsMX5xZ3SAgWSsCqOpcqFW/h4iDrYNYwlYCHXu6leu7NNvXJYk9nPDTpqKzYg/N2 CZMvXSP86HPCy3mLziuQEituNdu4osT0kN739JAi9w4VpOzdOqcisyY/MHWJuzvYu5cO vvG8qafUOs4hQ8ebZtkDqQ3B16rlBk61HiAiHPBzX1ekt8/18gyb6xBqQYctwsb5ZGFD 6nP6saQ36YBaE9UlSYIHP6zB6NWXvOZIj/E+dbh+HtfqShQSNYwcELiiVROSsW9MRcFP duXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f3RRMoys7qX1NzX5bYgdLFUw70oXiZ53EQ8nVjhmz0U=; b=u9sgERqJKjsD1qXGFYS/bkLtll9sAaWkEMiZp9uQD30nLaCsVlzEar/omgzr2CMVJ0 +jMzXYHO7TBktiy/2NINhKLWGPLjVPBCaQhw9SZFeipvfF4xPqEewzMEyUr/56Dnt8cb L0RbU0qTmPafhgISJBa6xWN0dknvC0xHCIgO1Yex5Wmh8PPn5f0ZFA3HI/+5I6ayxQ51 qICcNWc75iz76IlvRM+5l+IVciM54EJWY7WeHM1xa03pqi6+7DkVt2OlkPp1lnGWoGVM NizjiY57S6e8+V/3KLaSLqdY20xG0WuyrVEJnngwUjn+vIGe9iPrGzfaenf+aw38fEzO 0ZQQ== X-Gm-Message-State: AJIora8z1O5dl0tE9UT/CO7kL7MZMIHZEiwIV9V/c0Icat9l+gz7RZoT m3GmcWb0THtxR8nmSJBdsZo9Ay2pMGxNzw== X-Google-Smtp-Source: AGRyM1v3cSVwaWIH6dp+qXY2oAYeaqKV4nbsFIPWQCMkJOhaw8sABrNtABtAieJBhr8k/wNiskDEPA== X-Received: by 2002:a05:6870:d350:b0:fe:1e87:ed13 with SMTP id h16-20020a056870d35000b000fe1e87ed13mr20210180oag.166.1655804667213; Tue, 21 Jun 2022 02:44:27 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, "Michael S. Tsirkin" , BALATON Zoltan , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 09/15] ppc: fix boot with sam460ex Date: Tue, 21 Jun 2022 06:43:54 -0300 Message-Id: <20220621094400.122800-10-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621094400.122800-1-danielhb413@gmail.com> References: <20220621094400.122800-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2001:4860:4864:20::29; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x29.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655805063719100001 From: "Michael S. Tsirkin" Recent changes to pcie_host corrected size of its internal region to match what it expects: only the low 28 bits are ever decoded. Previous code just ignored bit 29 (if size was 1 << 29) in the address which does not make much sense. We are now asserting on size > 1 << 28 instead, but PPC 4xx actually allows guest to configure different sizes, and some firmwares seem to set it to 1 << 29. This caused e.g. qemu-system-ppc -M sam460ex to exit with an assert when the guest writes a value to CFGMSK register when trying to map config space. This is done in the board firmware in ppc4xx_init_pcie_port() in roms/u-boot-sam460ex/arch/powerpc/cpu/ppc4xx/4xx_pcie.c It's not clear what the proper fix should be but for now let's force the size to 256MB, so anything outside the expected address range is ignored. Fixes: commit 1f1a7b2269 ("include/hw/pci/pcie_host: Correct PCIE_MMCFG_SIZ= E_MAX") Reviewed-by: BALATON Zoltan Tested-by: BALATON Zoltan Signed-off-by: Michael S. Tsirkin Acked-by: C=C3=A9dric Le Goater Message-Id: <20220526224229.95183-1-mst@redhat.com> [danielhb: changed commit msg as BALATON Zoltan suggested] Signed-off-by: Daniel Henrique Barboza --- hw/ppc/ppc440_uc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/ppc/ppc440_uc.c b/hw/ppc/ppc440_uc.c index 993e3ba955..a1ecf6dd1c 100644 --- a/hw/ppc/ppc440_uc.c +++ b/hw/ppc/ppc440_uc.c @@ -1180,6 +1180,14 @@ static void dcr_write_pcie(void *opaque, int dcrn, u= int32_t val) case PEGPL_CFGMSK: s->cfg_mask =3D val; size =3D ~(val & 0xfffffffe) + 1; + /* + * Firmware sets this register to E0000001. Why we are not sure, + * but the current guess is anything above PCIE_MMCFG_SIZE_MAX is + * ignored. + */ + if (size > PCIE_MMCFG_SIZE_MAX) { + size =3D PCIE_MMCFG_SIZE_MAX; + } pcie_host_mmcfg_update(PCIE_HOST_BRIDGE(s), val & 1, s->cfg_base, = size); break; case PEGPL_MSGBAH: --=20 2.36.1 From nobody Tue May 21 10:02:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655805441; cv=none; d=zohomail.com; s=zohoarc; b=FIIpKSQSyUF9ASZDeicQjYrioD9UUZeHuHJ44C/IoYa+23Zbvj4oYxQOXZg8RmxAxY+wGPl1DAvQgpvZB0IXHWGrXVqFyH5J8iOw0xY2CaM3b1OMMdHBpnOJw/3mu3Bqvjm/fpTLlzOz+OjOvtJWAS+x4qJIeKIKKhYtBnBr6nk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655805441; 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=V7yhW9LpMmKGzBXwAjsWvLaDaxNgxsE3wMeuD2ea0AU=; b=dUUoTjIDF4fBJrwA9KBGaUwqc/OhrMQgFpz8PjuwPsrwYkUulzaZEvleuN69NhDLNE3E7rgMN0B4v7ezCGRm3Ai6mtKR//5Luvj36BEe4U/zFko/N5tbEzKPd40xS2IuhtjW+PHDRjMbD8YQTCV3X4iDer5kE/prC+IHBk267aQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655805441083842.7118226542758; Tue, 21 Jun 2022 02:57:21 -0700 (PDT) Received: from localhost ([::1]:52124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3adL-0001ve-DV for importer@patchew.org; Tue, 21 Jun 2022 05:57:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3aQz-0007mz-DT; Tue, 21 Jun 2022 05:44:35 -0400 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]:33767) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3aQx-0007OO-W7; Tue, 21 Jun 2022 05:44:33 -0400 Received: by mail-oi1-x233.google.com with SMTP id s124so16459758oia.0; Tue, 21 Jun 2022 02:44:30 -0700 (PDT) Received: from balboa.ibmuc.com ([187.34.29.129]) by smtp.gmail.com with ESMTPSA id z9-20020a9d7a49000000b0061020865f1asm7555119otm.50.2022.06.21.02.44.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 02:44:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V7yhW9LpMmKGzBXwAjsWvLaDaxNgxsE3wMeuD2ea0AU=; b=H9UZYGLc6STaRXKWyKPbPSy5uS9++6V9Fp/gXV2XgG26SPBJu7aFpQ0l3rhYjhxAzf 0EY2azf9Ag6ANJrn1FlPqfJLrGRlcSPO2LdR82IDxCFs29YgOiO5tJSDQtmbFp/cOHxF 7wAxSUe9Fm9jEjdrZN7R7IdP+WgQwjNjIUDs05PUr2/OABvhRCAT75nSEYMcrjgKPrpl umV8UsxtA0+eyw2oTl013cBa5HpCNdakdMAvXnSwOxVDNeiAeFy+dhjp/pSroI0wKGl/ S/UxierJDjO+SWowWGocZbjvU8e2hOzLKYlQd+6AIXoSLKLlaM2dqypMLq9rkJ8LQoIU G52g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V7yhW9LpMmKGzBXwAjsWvLaDaxNgxsE3wMeuD2ea0AU=; b=KpF5PRC4R7Yc1vxPwNtmNONrH/shp1KiGoX/yBAA2vYcgVTev6Bkcsf1CHdlF3Vavs ySFxFnup4KBO8tSuIIsIUEjox9kM+84oORLHb/SF1bbmL33Yf4sk0ZPdvBXCkfl2Bkrz VYbi9OuJWAkq1CZbPIvoZkodF0PBUZXx+eGHoZwVps6/EDxG5GiNREoDskI2jWJf2YVY NH3q9Bq4+IRI1K6uOFOcmHamunU6c+kKqogFBCbCS988YB3RV5xuF+Wy+VjvQ4gf6NlN 8DnRhqsIjbmFoG3ujHqXQMc+LTL64CRrETlraFWkf8sP/xAPPQ9ysQg+1xztjCbaxCml FnOg== X-Gm-Message-State: AJIora+Lj1z2Uou/T+wc43dliAkQUajpn1AsHIqVUYMFc9Mjo+ykY3Tk c6vWlTppH0TO7olKSU1g6cLKAbGfJKYcHg== X-Google-Smtp-Source: AGRyM1ukIgxQ1VNLUiYhfZ9yDj4D12XbxQjy80n8rgv7UW83cTRijAAXmAeWnJ27Qdx4qSDGf21ivw== X-Received: by 2002:a05:6808:18a6:b0:332:fae8:dbd7 with SMTP id bi38-20020a05680818a600b00332fae8dbd7mr8618340oib.172.1655804669541; Tue, 21 Jun 2022 02:44:29 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, Matheus Ferst Subject: [PULL 10/15] target/ppc: fix vbpermd in big endian hosts Date: Tue, 21 Jun 2022 06:43:55 -0300 Message-Id: <20220621094400.122800-11-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621094400.122800-1-danielhb413@gmail.com> References: <20220621094400.122800-1-danielhb413@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=2607:f8b0:4864:20::233; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x233.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655805443076100001 Content-Type: text/plain; charset="utf-8" From: Matheus Ferst The extract64 arguments are not endian dependent as they are only used for bitwise operations. The current behavior in little-endian hosts is correct; since the indexes in VRB are in PowerISA-ordering, we should always invert the value before calling extract64. Also, using the VsrD macro, we can have a single EXTRACT_BIT definition for big and little-endian with the correct behavior. Signed-off-by: Matheus Ferst Reviewed-by: Richard Henderson Message-Id: <20220601125355.1266165-1-matheus.ferst@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/int_helper.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 16357c0900..11871947bc 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -1413,14 +1413,13 @@ XXGENPCV(XXGENPCVDM, 8) #define VBPERMQ_INDEX(avr, i) ((avr)->u8[(i)]) #define VBPERMD_INDEX(i) (i) #define VBPERMQ_DW(index) (((index) & 0x40) !=3D 0) -#define EXTRACT_BIT(avr, i, index) (extract64((avr)->u64[i], index, 1)) #else #define VBPERMQ_INDEX(avr, i) ((avr)->u8[15 - (i)]) #define VBPERMD_INDEX(i) (1 - i) #define VBPERMQ_DW(index) (((index) & 0x40) =3D=3D 0) -#define EXTRACT_BIT(avr, i, index) \ - (extract64((avr)->u64[1 - i], 63 - index, 1)) #endif +#define EXTRACT_BIT(avr, i, index) \ + (extract64((avr)->VsrD(i), 63 - index, 1)) =20 void helper_vbpermd(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) { --=20 2.36.1 From nobody Tue May 21 10:02:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655805245; cv=none; d=zohomail.com; s=zohoarc; b=QoyqQW6D2JKo2c5NNVI6uk8sYnHKY1Ih6DouGH6h46ZmTVvfbOBkIbTEQQwWwvWtWIqobmX5wVPvvtuNNXSUbJdeJ7wFvy6UBKZg6U3qkkGDV2XARcpD6T29CNO5f7cxaDSpf4nkDubT+bSGRcumCTyl3BrvMTpGm9ZdND/KFfo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655805245; h=Content-Type: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=svUkRWP5wlLbdXls872JxaD3X8JWFFzuJPhQ18Bbx7s=; b=FM6UxEl3uwwXF6NEjM33R35viIKe9Ay2eGM1X2M2paZ4JBZogEqDwZw+VqOD4XRvqSRqcZh6NOIcXdcjW3MJxRlyCoqU41dM7xSK2FeIy9DjJUCQ+SDCrYC/LfRjAdIS8K2x9N53ovEPIdIxixalU2Q/6XuJBvjS/Od/gb5DlPg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655805245821471.25930645345886; Tue, 21 Jun 2022 02:54:05 -0700 (PDT) Received: from localhost ([::1]:47038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3aaC-0006oQ-Mk for importer@patchew.org; Tue, 21 Jun 2022 05:54:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3aR1-0007nc-2H; Tue, 21 Jun 2022 05:44:35 -0400 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]:46633) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3aQz-0007Of-Hb; Tue, 21 Jun 2022 05:44:34 -0400 Received: by mail-ot1-x32e.google.com with SMTP id 93-20020a9d02e6000000b0060c252ee7a4so10252842otl.13; Tue, 21 Jun 2022 02:44:32 -0700 (PDT) Received: from balboa.ibmuc.com ([187.34.29.129]) by smtp.gmail.com with ESMTPSA id z9-20020a9d7a49000000b0061020865f1asm7555119otm.50.2022.06.21.02.44.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 02:44:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=svUkRWP5wlLbdXls872JxaD3X8JWFFzuJPhQ18Bbx7s=; b=hDnJtOxmroGlHOodWkYzznQHuXsrPJpfcwUkNL+i56Qhpxl7xYGqVwJlhenGPGWTqm FUmavQwmP0SCAgj0jTuw2aJsdlwHwDzjBdiFiuztR1+AdGrxAdmPLAi/YGqvrCYas7XO QxmtNmgKFA3RwCaYw+KgmOVsmgu1ih44lIs0yi9eX49b2/ynzKNoDt/ntc9jYslA49m1 pCxRoWU5dUIxUXVNBUkLJiwA/mU+h175WCfXCfzePSjuZt1k4VBI9UEhzJFrMGaDvpqN 0aAATZuS1c7MRHuKmH8aNXKvgo1a3UaBN6Gb12KgkWqwjC1GBG3q9wTA20DijL6ppGZ3 1kMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=svUkRWP5wlLbdXls872JxaD3X8JWFFzuJPhQ18Bbx7s=; b=yRFUzXvqaqLrt+nuEYLMqblu4qJNOkcKnOu8Ica4wy6uTpunz8IoSlB+JdSfTmqbVn B/emLOeWITY1MgAIGnsilDNshUuMIvTHgBBADHx7kBqO1EjE9pzZzZXOqWETa3MSI+83 MsBf99DMPLp/SN3zbS7rb17GtVoaN9FopLzLU2v1al/Hhano1/q7ZWtLtF8NxHeNjhTI f3XP/KdiRFfDDsS6yj5bQ1FZzJy7leN1pSzsJo51W+lGXxQB7aBLaRRjoxOblC37qfu/ NY1KTxsulQITqj2aVcmdvRBMHtSdCPY57764bbwh0WWpI+dHrZeO5mWGItZXSRVIa/Ms yoFg== X-Gm-Message-State: AJIora/xxUKlRLnhDDfPuxRBUr00lja5N9I0sSuWo2I/8DWg1blaHCDX Jj+Eab8ittCgAegJvS1mGMiqv5QVigMliA== X-Google-Smtp-Source: AGRyM1sKMosk7RnxriQMYPCRKGgBTk22glWWgT21YOE+21P8PPnnh3IkuuU9ZSrVWOA4BlXJk20szw== X-Received: by 2002:a05:6830:43ab:b0:610:45bd:b8c8 with SMTP id s43-20020a05683043ab00b0061045bdb8c8mr6478249otv.252.1655804671965; Tue, 21 Jun 2022 02:44:31 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, Frederic Barrat , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 11/15] pnv/xive2: Access direct mapped thread contexts from all chips Date: Tue, 21 Jun 2022 06:43:56 -0300 Message-Id: <20220621094400.122800-12-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621094400.122800-1-danielhb413@gmail.com> References: <20220621094400.122800-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2607:f8b0:4864:20::32e; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x32e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655805247925100001 From: Frederic Barrat When accessing a thread context through the IC BAR, the offset of the page in the BAR identifies the CPU. From that offset, we can compute the PIR (processor ID register) of the CPU to do the data structure lookup. On P10, the current code assumes an access for node 0 when computing the PIR. Everything is almost in place to allow access for other nodes though. So this patch reworks how the PIR value is computed so that we can access all thread contexts through the IC BAR. The PIR is already correct on P9, so no need to modify anything there. Signed-off-by: Frederic Barrat Reviewed-by: C=C3=A9dric Le Goater Message-Id: <20220602165310.558810-1-fbarrat@linux.ibm.com> Signed-off-by: Daniel Henrique Barboza --- hw/intc/pnv_xive2.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c index a39e070e82..f31c53c28d 100644 --- a/hw/intc/pnv_xive2.c +++ b/hw/intc/pnv_xive2.c @@ -1574,6 +1574,12 @@ static const MemoryRegionOps pnv_xive2_ic_sync_ops = =3D { * When the TM direct pages of the IC controller are accessed, the * target HW thread is deduced from the page offset. */ +static uint32_t pnv_xive2_ic_tm_get_pir(PnvXive2 *xive, hwaddr offset) +{ + /* On P10, the node ID shift in the PIR register is 8 bits */ + return xive->chip->chip_id << 8 | offset >> xive->ic_shift; +} + static XiveTCTX *pnv_xive2_get_indirect_tctx(PnvXive2 *xive, uint32_t pir) { PnvChip *chip =3D xive->chip; @@ -1596,10 +1602,12 @@ static uint64_t pnv_xive2_ic_tm_indirect_read(void = *opaque, hwaddr offset, unsigned size) { PnvXive2 *xive =3D PNV_XIVE2(opaque); - uint32_t pir =3D offset >> xive->ic_shift; - XiveTCTX *tctx =3D pnv_xive2_get_indirect_tctx(xive, pir); + uint32_t pir; + XiveTCTX *tctx; uint64_t val =3D -1; =20 + pir =3D pnv_xive2_ic_tm_get_pir(xive, offset); + tctx =3D pnv_xive2_get_indirect_tctx(xive, pir); if (tctx) { val =3D xive_tctx_tm_read(NULL, tctx, offset, size); } @@ -1611,9 +1619,11 @@ static void pnv_xive2_ic_tm_indirect_write(void *opa= que, hwaddr offset, uint64_t val, unsigned size) { PnvXive2 *xive =3D PNV_XIVE2(opaque); - uint32_t pir =3D offset >> xive->ic_shift; - XiveTCTX *tctx =3D pnv_xive2_get_indirect_tctx(xive, pir); + uint32_t pir; + XiveTCTX *tctx; =20 + pir =3D pnv_xive2_ic_tm_get_pir(xive, offset); + tctx =3D pnv_xive2_get_indirect_tctx(xive, pir); if (tctx) { xive_tctx_tm_write(NULL, tctx, offset, val, size); } --=20 2.36.1 From nobody Tue May 21 10:02:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655805524; cv=none; d=zohomail.com; s=zohoarc; b=YEpv6QDsIGhF2ff+0WPkqFzHKHGlJWCr49+A0E7eBT8EXg/R1vpmAHjN1/40kguQb4/c6srybgu53WE/JwpNGeyz7qzKNobK7fdXdmwsN8B7hxCvvN+O18qHI/23Hl57HXJC5AhzXhNCFK44Wgm8wVyJvO91IgamaQtFxQBWCxQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655805524; 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=/ZxwtskLmFvgISK1U3su1Dai1pSu06Ej2pDh25MW1aY=; b=g11uFw4nacW9ufCr+i592BaPQd9wh5eaul2N0BAcRU8GrUPbBLSo5bcTb/wNRAfx+RMknf6lO9Ty6nGo6gs13v2p7NckBhm27CNhENwwiGieoZjEyzW6OWcVd9a5Y9etKJdzQClPFmsinEmCfi3leGonlGwr/u+ZK0USUTdtvrE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655805524053292.91940483395945; Tue, 21 Jun 2022 02:58:44 -0700 (PDT) Received: from localhost ([::1]:56184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3aeg-0004n1-Mu for importer@patchew.org; Tue, 21 Jun 2022 05:58:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3aR3-0007qn-6V; Tue, 21 Jun 2022 05:44:37 -0400 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]:38437) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3aR1-0007Ot-IW; Tue, 21 Jun 2022 05:44:36 -0400 Received: by mail-ot1-x335.google.com with SMTP id c3-20020a9d6843000000b0060c2c63c337so10278690oto.5; Tue, 21 Jun 2022 02:44:34 -0700 (PDT) Received: from balboa.ibmuc.com ([187.34.29.129]) by smtp.gmail.com with ESMTPSA id z9-20020a9d7a49000000b0061020865f1asm7555119otm.50.2022.06.21.02.44.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 02:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/ZxwtskLmFvgISK1U3su1Dai1pSu06Ej2pDh25MW1aY=; b=DR9fY6/mWr1jhFCwwllDhF48zkKZn8xlQNfXE8tu8C5EFvj2BDwqFfVlkve6dLTE2R K8FDiTo2FjwHH/E3N0Oeagnra0G5Srmu/CxdHQHleQ0VP9g41vC1ECffl9PtqSqD8BDO psmi78WecU2SfEecWVxiMoLnmv7c0IqYsgwHrqqZRjkJGVUMOLWTthFafelYWoC/nqRL eZFubrw9OCu1Fova0CputZ14BkwP0MZ54aYeLJPtrlxIiI0pEYqkVHoxQXz1U2R2EnGc 8laHXJBFngtwQshQyLSx9EjiCFWfSD8lCkaxXZBhUEM6gzMBT+G6CFZJIgVV9XDnvUrc 8dkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/ZxwtskLmFvgISK1U3su1Dai1pSu06Ej2pDh25MW1aY=; b=6bxE41WG4REnqdjZaKFzwta0NvhxRJxEXbSX/MK+OI+XzG6nvvKreGVn6beKAnRlx+ CPuNJAUO1v2FJ1d1HdA0xC9lvUq8pTnMnzWc3S6uRFQcS+WIL4wifrWtiAsx2+hVvlJ8 tUdWBQG11RU4a80YOeYeV7nzUPwuD588V9f01ZhiQKZJ7dVTMmxSw5KYtWjpp91GtZNi ZHdAXR+RHapQc6C7aFmZGXLYYRgYmID2TDYLRod1hLX3MJiy9YO5m9RgvsZ78zBXmbxN VpX2fOwv+Vd2NvrOAsYooCU5D8qQgFvhF/e0WBChaaqLog6iIy+lYjy38987NrSXIb2y OE8g== X-Gm-Message-State: AJIora/gTriUTqS7TxMtLWQV2CHt79ovO+UTnJhDL5W/A3PKBvqd99qp wzdyGxLVlhj42HQ9d3B5MPrgA55DSUVA1Q== X-Google-Smtp-Source: AGRyM1s2Q0MqJjsgvmI8KTLzs65skmSTPwSAktQKjlkft+0H5Cvn4pla3EbHJl+poqZ/tl7djvyE4g== X-Received: by 2002:a9d:468b:0:b0:610:f9d0:885e with SMTP id z11-20020a9d468b000000b00610f9d0885emr6049631ote.66.1655804674119; Tue, 21 Jun 2022 02:44:34 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, Mark Cave-Ayland Subject: [PULL 12/15] ppc/pnv: fix extra indent spaces with DEFINE_PROP* Date: Tue, 21 Jun 2022 06:43:57 -0300 Message-Id: <20220621094400.122800-13-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621094400.122800-1-danielhb413@gmail.com> References: <20220621094400.122800-1-danielhb413@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=2607:f8b0:4864:20::335; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x335.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655805525395100001 Content-Type: text/plain; charset="utf-8" The DEFINE_PROP* macros in pnv files are using extra spaces for no good reason. Cc: Mark Cave-Ayland Signed-off-by: Daniel Henrique Barboza Reviewed-by: Mark Cave-Ayland Message-Id: <20220602215351.149910-1-danielhb413@gmail.com> Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb3.c | 8 ++++---- hw/pci-host/pnv_phb4.c | 10 +++++----- hw/pci-host/pnv_phb4_pec.c | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index 3f03467dde..26ac9b7123 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -1088,10 +1088,10 @@ static const char *pnv_phb3_root_bus_path(PCIHostSt= ate *host_bridge, } =20 static Property pnv_phb3_properties[] =3D { - DEFINE_PROP_UINT32("index", PnvPHB3, phb_id, 0), - DEFINE_PROP_UINT32("chip-id", PnvPHB3, chip_id, 0), - DEFINE_PROP_LINK("chip", PnvPHB3, chip, TYPE_PNV_CHIP, PnvChip *), - DEFINE_PROP_END_OF_LIST(), + DEFINE_PROP_UINT32("index", PnvPHB3, phb_id, 0), + DEFINE_PROP_UINT32("chip-id", PnvPHB3, chip_id, 0), + DEFINE_PROP_LINK("chip", PnvPHB3, chip, TYPE_PNV_CHIP, PnvChip *), + DEFINE_PROP_END_OF_LIST(), }; =20 static void pnv_phb3_class_init(ObjectClass *klass, void *data) diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c index 13ba9e45d8..6594016121 100644 --- a/hw/pci-host/pnv_phb4.c +++ b/hw/pci-host/pnv_phb4.c @@ -1692,11 +1692,11 @@ static void pnv_phb4_xive_notify(XiveNotifier *xf, = uint32_t srcno, } =20 static Property pnv_phb4_properties[] =3D { - DEFINE_PROP_UINT32("index", PnvPHB4, phb_id, 0), - DEFINE_PROP_UINT32("chip-id", PnvPHB4, chip_id, 0), - DEFINE_PROP_LINK("pec", PnvPHB4, pec, TYPE_PNV_PHB4_PEC, - PnvPhb4PecState *), - DEFINE_PROP_END_OF_LIST(), + DEFINE_PROP_UINT32("index", PnvPHB4, phb_id, 0), + DEFINE_PROP_UINT32("chip-id", PnvPHB4, chip_id, 0), + DEFINE_PROP_LINK("pec", PnvPHB4, pec, TYPE_PNV_PHB4_PEC, + PnvPhb4PecState *), + DEFINE_PROP_END_OF_LIST(), }; =20 static void pnv_phb4_class_init(ObjectClass *klass, void *data) diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 61bc0b503e..8b7e823fa5 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -215,11 +215,11 @@ static int pnv_pec_dt_xscom(PnvXScomInterface *dev, v= oid *fdt, } =20 static Property pnv_pec_properties[] =3D { - DEFINE_PROP_UINT32("index", PnvPhb4PecState, index, 0), - DEFINE_PROP_UINT32("chip-id", PnvPhb4PecState, chip_id, 0), - DEFINE_PROP_LINK("chip", PnvPhb4PecState, chip, TYPE_PNV_CHIP, - PnvChip *), - DEFINE_PROP_END_OF_LIST(), + DEFINE_PROP_UINT32("index", PnvPhb4PecState, index, 0), + DEFINE_PROP_UINT32("chip-id", PnvPhb4PecState, chip_id, 0), + DEFINE_PROP_LINK("chip", PnvPhb4PecState, chip, TYPE_PNV_CHIP, + PnvChip *), + DEFINE_PROP_END_OF_LIST(), }; =20 static uint32_t pnv_pec_xscom_pci_base(PnvPhb4PecState *pec) --=20 2.36.1 From nobody Tue May 21 10:02:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655805080; cv=none; d=zohomail.com; s=zohoarc; b=HAXLAG9CBqCcyXquuc5ajP8Iyvbg5D8Q0W026OdiqmdXGImHi09ibpQSrC79fZkUfVRIODeF9rXBcDoT11Warcjpe87iMc8D4L3GB2zL3Utlpjr3dDsMEJSNcOxTeTXeTfL4Y+Gi5I6Q/0Trlh02HDdJlrpaeIHW/DpBGuYjpQ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655805080; 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=8j3mSBud8SR0reAw6KEwp2o8Neb26wSgmj15b5qeYag=; b=kvaEf7Eb8UGJPmUmI2byRy/batB5M3DnWqbdEhUMdQ64bdwcazl//F7Qet+el2DGt3/E7xJG5E4sKOzIakX+4uoSkKbd3sDfwX27T5A/Opux+OqmdcqNneFR345pnVvlU4J3mQcr1U/bIiPAlvWaLGAJTxfGF1URpoapMEb4Q9c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655805080596246.83240752409006; Tue, 21 Jun 2022 02:51:20 -0700 (PDT) Received: from localhost ([::1]:38816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3aXW-0001FC-Vu for importer@patchew.org; Tue, 21 Jun 2022 05:51:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3aR6-0007sk-Vg; Tue, 21 Jun 2022 05:44:40 -0400 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]:45022) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3aR3-0007MW-UO; Tue, 21 Jun 2022 05:44:39 -0400 Received: by mail-oo1-xc2c.google.com with SMTP id v33-20020a4a9764000000b0035f814bb06eso2594704ooi.11; Tue, 21 Jun 2022 02:44:36 -0700 (PDT) Received: from balboa.ibmuc.com ([187.34.29.129]) by smtp.gmail.com with ESMTPSA id z9-20020a9d7a49000000b0061020865f1asm7555119otm.50.2022.06.21.02.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 02:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8j3mSBud8SR0reAw6KEwp2o8Neb26wSgmj15b5qeYag=; b=D7rYvkXRuR1pkowzpiyKq7CRtAOZ3UL3F7Bfre77TqUcE+IbmU8Jpm6YlSa3ExKJjS lRGFMKiuAJyIWc4rsCM0TMB24gJ0zswRWXAfEHRyzHbELxzoJ7nuSGyaDtOt2tl2cNps f5s2aqqPHmX94DkT6c/iR2/ccZ5Vu2Q7Np+CGwkF561QIk+tzDNdaOpRegK/IXyeT5Jx rxnYNLeqrhWZL9pYjNXCEN/AMQQTEII9FpHHEj7S1FTQWcUpzlr82Y4RsMFB2CZjpWuv MQNcIE4BTqMSy6YNejQ/8pY3GwLq25XdNPfzeab10M8xFfjO6xe2w0jIlrht64cgDgkS D9Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8j3mSBud8SR0reAw6KEwp2o8Neb26wSgmj15b5qeYag=; b=eEY5H9Km0UGIvWcs/AcDAW0J83uIqLRP/PoCLOtP1YVeMpt3xxzePC6fiuaTboaCAW a4tSzBtukADWDwH0jV4OkEOXM2YU88AyAhhMk7NkH2fwenJhU+1kkg9c2vLnxd0vTJeo +UPf0P35oM1djtyoDBa9I2Wv591KOXJ0xrr4mjlsQjwgQBkbeKFQ7xBxltgccTYqZtgS Prvqvdbflz0djQyGswD+C8lZjYihosZMrvlm7LtuWUu0xk4g6K72JHHXipIwLhjGSMj/ 8Nopn0Z0HWTNmsCVtRlv5/cAgYx2hfL+UZMg2a5/WIqjW9fbX2zmzYD7nfkHSL65xhKf p/Dw== X-Gm-Message-State: AJIora+rrDDhH1HhahtFDw7oIhFxS3+q+Q979+t0xE4+on87qipzDI9E B8GR6rLY2BYzD0Jvnw/kmzgVzlGGGTTyDw== X-Google-Smtp-Source: AGRyM1sOrsNi5fhhk9ShTlHGKCoYU3pkAx4UyVRUyYFwqwj46/ub1Yw59Qth7aNd+0ZbfWWzycj3YQ== X-Received: by 2002:a05:6820:614:b0:41b:8f3f:a6c9 with SMTP id e20-20020a056820061400b0041b8f3fa6c9mr10844995oow.95.1655804676310; Tue, 21 Jun 2022 02:44:36 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, Lucas Mateus Castro Subject: [PULL 13/15] target/ppc: avoid int32 multiply overflow in int_helper.c Date: Tue, 21 Jun 2022 06:43:58 -0300 Message-Id: <20220621094400.122800-14-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621094400.122800-1-danielhb413@gmail.com> References: <20220621094400.122800-1-danielhb413@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=2607:f8b0:4864:20::c2c; envelope-from=danielhb413@gmail.com; helo=mail-oo1-xc2c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655805081452100001 Content-Type: text/plain; charset="utf-8" Coverity is not thrilled about the multiply operations being done in ger_rank8() and ger_rank2(), giving an error like the following: Integer handling issues (OVERFLOW_BEFORE_WIDEN) Potentially overflowing expression "sextract32(a, 4 * i, 4) * sextract32(b, 4 * i, 4)" with type "int" (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "int64_t" (64 bits, signed). Fix both instances where this occur by adding an int64_t cast in the first operand, forcing the result to be 64 bit. Fixes: Coverity CID 1489444, 1489443 Fixes: 345531533f26 ("target/ppc: Implemented xvi*ger* instructions") Cc: Lucas Mateus Castro (alqotel) Cc: Richard Henderson Signed-off-by: Daniel Henrique Barboza Reviewed-by: Richard Henderson Reviewed-by: Lucas Mateus Castro (alqotel) Message-Id: <20220602141449.118173-1-danielhb413@gmail.com> Signed-off-by: Daniel Henrique Barboza --- target/ppc/int_helper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 11871947bc..3ae03f73d3 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -789,7 +789,7 @@ static int64_t ger_rank8(uint32_t a, uint32_t b, uint32= _t mask) int64_t psum =3D 0; for (int i =3D 0; i < 8; i++, mask >>=3D 1) { if (mask & 1) { - psum +=3D sextract32(a, 4 * i, 4) * sextract32(b, 4 * i, 4); + psum +=3D (int64_t)sextract32(a, 4 * i, 4) * sextract32(b, 4 *= i, 4); } } return psum; @@ -811,7 +811,8 @@ static int64_t ger_rank2(uint32_t a, uint32_t b, uint32= _t mask) int64_t psum =3D 0; for (int i =3D 0; i < 2; i++, mask >>=3D 1) { if (mask & 1) { - psum +=3D sextract32(a, 16 * i, 16) * sextract32(b, 16 * i, 16= ); + psum +=3D (int64_t)sextract32(a, 16 * i, 16) * + sextract32(b, 16 * i, 16); } } return psum; --=20 2.36.1 From nobody Tue May 21 10:02:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655805762; cv=none; d=zohomail.com; s=zohoarc; b=K/PukFGryxLh6KQlSz0WnFySsb8Gj1zDmIA2NTJZn0xmjRf5w+/CF3MMD09M+nxw5NHsFh9EFWy4j5JMQSkC7wWOI+8e/0kJa+CggqWJEmLpMSExsn0quyGOkKiWLFr5QQHgG2/QpgP7VbSNS2ZVbJY8zccKhN7nlVW0dAmArI4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655805762; 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=4men+xRdozA/VMBJA8BCK2Zs91riJ50H73TWq8v6YLM=; b=hwJG/TgCQToX1BhbnacXIXt4/VypJeXhIAgLhe9oqGPhXo2bMlPYml26dGV8OleFCDYHQ7uM9bRyxP2DQKVPr2Gb/Jnh4lLaGV0FaNhM+E3NLuZrPFhKgB5XSBNDokJFZG8TZLqyzm0o6k1zGcd31VuxY9PyMy0bvdQbttD4Hr4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165580576253077.00274379021084; Tue, 21 Jun 2022 03:02:42 -0700 (PDT) Received: from localhost ([::1]:34880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3aiW-0001VV-TB for importer@patchew.org; Tue, 21 Jun 2022 06:02:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3aR9-00080h-Or; Tue, 21 Jun 2022 05:44:43 -0400 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]:37548) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3aR7-0007Po-3w; Tue, 21 Jun 2022 05:44:43 -0400 Received: by mail-oi1-x229.google.com with SMTP id j10so511110oih.4; Tue, 21 Jun 2022 02:44:39 -0700 (PDT) Received: from balboa.ibmuc.com ([187.34.29.129]) by smtp.gmail.com with ESMTPSA id z9-20020a9d7a49000000b0061020865f1asm7555119otm.50.2022.06.21.02.44.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 02:44:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4men+xRdozA/VMBJA8BCK2Zs91riJ50H73TWq8v6YLM=; b=ICbuL4SLRPSHR6PEGEQdTALc7skXBF0wJrh+5ipb1WxqcVB0Mio4GoZrlYn678fDkA 3aUqxN6YzX6KnTwRA0mFQTW+lu7f6eQ/oSdcUJq1hzFg7OxZzL3nqPFKYNSJvF6kFYu7 Cei/ghyDwHaSo72zNgV49MDWLByqaY0KURvSH3GPw/ledKutk5VRPSOiPvGXvkwSZ1hT wJjkmtrtujAgswlIkUdva6Uq0i4CCfnDqCeH1CGKHEYUWWkNCaOvTeVmoeVLhmTLs+zI +BIRzOPotwK8VV+uwel8CH+0UMlbJkyM8YLSuwjK5nTp0OmJ5KzZ3RpV3168/+VwhLsx 87Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4men+xRdozA/VMBJA8BCK2Zs91riJ50H73TWq8v6YLM=; b=PLnk3yGxSmCTw0UGW8iMfvXffNbZGEn6TLJhm822EGAYjNB2TneEEESQh2bl3yRYHn EDl6YeoxhRRYGWBjarkDh2HWhxlmAH14UPM5T4JuuosmG4rEradOdIyeoUiggYt6DfIh MCLvWK9xjDWWxo4EsGt9Ymuqx18sJ/dN/aqr2d3/jWWahEhEV3IGWh5D1FBGeRCVutUB WAOduXqoMt8D2tHVYXsMZiu9dAWoVw6bhZc0uTwvjCm0yVFwsDz1ZCI4qrXex5fZT9PO WY7imHt2oejwzWqzeFEsIKybhuNEncCXmVRtAefsZZ6pULoX/pbxzbUNa/XERUHJ1sNs IL1w== X-Gm-Message-State: AJIora90OfrKhLsxvCE4c2qCHgoHK285AS+Y+9dNmbAjlESzecuFlRVR tOye39Sy+ohZoKJFBfrKjethwkimFnmbSQ== X-Google-Smtp-Source: AGRyM1saUdJVoyyH9oxRVtROlFS8pieXd7WK+sqiA/ZtPhoaeDGd4oTJIZHxFRrSpMqgdcp29QGZug== X-Received: by 2002:a05:6808:1b0c:b0:32e:f087:b9a7 with SMTP id bx12-20020a0568081b0c00b0032ef087b9a7mr13250526oib.273.1655804678538; Tue, 21 Jun 2022 02:44:38 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, Lucas Mateus Castro Subject: [PULL 14/15] target/ppc: fix unreachable code in fpu_helper.c Date: Tue, 21 Jun 2022 06:43:59 -0300 Message-Id: <20220621094400.122800-15-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621094400.122800-1-danielhb413@gmail.com> References: <20220621094400.122800-1-danielhb413@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=2607:f8b0:4864:20::229; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x229.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655805762916100001 Content-Type: text/plain; charset="utf-8" Commit c29018cc7395 added an env->fpscr OR operation using a ternary that checks if 'error' is not zero: env->fpscr |=3D error ? FP_FEX : 0; However, in the current body of do_fpscr_check_status(), 'error' is granted to be always non-zero at that point. The result is that Coverity is less than pleased: Control flow issues (DEADCODE) Execution cannot reach the expression "0ULL" inside this statement: "env->fpscr |=3D (error ? 1073...". Remove the ternary and always make env->fpscr |=3D FP_FEX. Cc: Lucas Mateus Castro (alqotel) Cc: Richard Henderson Fixes: Coverity CID 1489442 Fixes: c29018cc7395 ("target/ppc: Implemented xvf*ger*") Signed-off-by: Daniel Henrique Barboza Reviewed-by: Lucas Mateus Castro (alqotel) Message-Id: <20220602191048.137511-1-danielhb413@gmail.com> Signed-off-by: Daniel Henrique Barboza --- target/ppc/fpu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index fed0ce420a..7ab6beadad 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -464,7 +464,7 @@ static void do_fpscr_check_status(CPUPPCState *env, uin= tptr_t raddr) } cs->exception_index =3D POWERPC_EXCP_PROGRAM; env->error_code =3D error | POWERPC_EXCP_FP; - env->fpscr |=3D error ? FP_FEX : 0; + env->fpscr |=3D FP_FEX; /* Deferred floating-point exception after target FPSCR update */ if (fp_exceptions_enabled(env)) { raise_exception_err_ra(env, cs->exception_index, --=20 2.36.1 From nobody Tue May 21 10:02:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655805701; cv=none; d=zohomail.com; s=zohoarc; b=TpW3t/CG1sPwsUf+JtBeLRGS4qCbf3u8oo0qdnTuZes1Sorr/xve+owQLkVoZMyp934Ym/AEVXHpcKXkHa1OHYSNZthssnY2wrshDUsUwVf5TUsA7XxBpYrJeOX3dqoGPrZjPZnhkKxpuIrWLwdKg0XFwmqqJnPadNADl3NAMrc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655805701; h=Content-Type: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=SlXraOtf2sbS3ADdQCtU+Ose4IYOB9EgS1SJhAMg7yI=; b=acYV/w0K+kBqk3RkBAfSJSbrTV5o6ZNZPyKM1nRDmNnxLI0GNG1MROkDFd3CSqTgTGUGRfyptmqmFzp9Jv6SpTPzIh7FrHfI6XUkyO9xl0gAKYR88ER8bb5fn0SnkRv+/1ifHOJiFekyhpiB87iOf9fgeu49SZjB3z5/1XL+vkY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655805701062859.3183023536396; Tue, 21 Jun 2022 03:01:41 -0700 (PDT) Received: from localhost ([::1]:60896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3ahX-0008C4-Oh for importer@patchew.org; Tue, 21 Jun 2022 06:01:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3aRE-000852-LO; Tue, 21 Jun 2022 05:44:48 -0400 Received: from mail-oi1-x22d.google.com ([2607:f8b0:4864:20::22d]:34603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3aR9-0007Q8-L1; Tue, 21 Jun 2022 05:44:45 -0400 Received: by mail-oi1-x22d.google.com with SMTP id v4so16415756oiv.1; Tue, 21 Jun 2022 02:44:42 -0700 (PDT) Received: from balboa.ibmuc.com ([187.34.29.129]) by smtp.gmail.com with ESMTPSA id z9-20020a9d7a49000000b0061020865f1asm7555119otm.50.2022.06.21.02.44.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 02:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SlXraOtf2sbS3ADdQCtU+Ose4IYOB9EgS1SJhAMg7yI=; b=fBuyB22Rn4o3ZcaNEiOnXqQQYywgDK01zLFZIoT2X+ku88zHtnGKbbrCOmnOdfnQ3g ZcqHo9frpDNa5ve084HcGJK7/aIZDdB4WYQOkXETySZNtTIGcum9Mrdo+EVQNwGKRMf7 xy0++1lNFiZB+lSidCWhDxlqnCBpRJp51u/C5AljauLPfHes7FKP2j06aqeOAGQuTvZI vZbKELjTnu8sZQrlVR08oCFoM0mIJDmoS9ZyVBEkJJD5iZOM7KdGqG/Gl1X4GFgpwvNz RJjzPL7Idg0IFeU9j289w3fn7UPdZlg9BiPI3Ttb2NqB34i1kEixhMV2SqfeOC+csESS 0nIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SlXraOtf2sbS3ADdQCtU+Ose4IYOB9EgS1SJhAMg7yI=; b=wzZ7fbE0/Hv+o0IPs2tecgf1C+gMC4NjAXEMI9LRKIWzz5hN+OWX5SWjgO5l1+mO5m XhHOpmLsXVNgQULqnM/1gkWp5/QWsIQjP/XMerjUaxIk6CTmakbzgPQ3jTCTBqRgwqoO 9T4HPGCGllzjcSq57w6wvj1gJuQlKVNEsD3g8lGiH0tiD2rn7W8uMRlSn9J55CsnRF+H CLcC5S9fJS7CYkbCIWeY+A1tlOP1Zqwla3GmSvZGexAEf5JflmHKYiPe2TrMn8GfvmEi BY2qO/s0oKbJ1Dok6AgXaQETHjPSw612gftKYho6qjYkh8dQKuCmTpkrrnDma7f8PRk4 UMWA== X-Gm-Message-State: AOAM530iTpQFlOfIEv9/ZRZZO2qRBU1PniBkzXv4TXdKz4IrKka6HlDp VQ1gBfT+hk1mENiXlHtp5k0AhpGCegJiTg== X-Google-Smtp-Source: ABdhPJw1kFieY7/epyMLEw4a9asrz9ztWYQ5vD2TIRnk3fJ3EvYrZXJ1I+RwW8moMY3UVyg2yoXbLw== X-Received: by 2002:a05:6808:e87:b0:32e:3cfb:fad7 with SMTP id k7-20020a0568080e8700b0032e3cfbfad7mr19535657oil.197.1655804681193; Tue, 21 Jun 2022 02:44:41 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, Frederic Barrat , Fabiano Rosas , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 15/15] target/ppc: cpu_init: Clean up stop state on cpu reset Date: Tue, 21 Jun 2022 06:44:00 -0300 Message-Id: <20220621094400.122800-16-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621094400.122800-1-danielhb413@gmail.com> References: <20220621094400.122800-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2607:f8b0:4864:20::22d; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x22d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655805702873100001 From: Frederic Barrat The 'resume_as_sreset' attribute of a cpu is set when a thread is entering a stop state on ppc books. It causes the thread to be re-routed to vector 0x100 when woken up by an exception. So it must be cleared on reset or a thread might be re-routed unexpectedly after a reset, when it was not in a stop state and/or when the appropriate exception handler isn't set up yet. Using skiboot, it can be tested by resetting the system when it is quiet and most threads are idle and in stop state. After the reset occurs, skiboot elects a primary thread and all the others wait in secondary_wait. The primary thread does all the system initialization from main_cpu_entry() and at some point, the decrementer interrupt starts ticking. The exception vector for the decrementer interrupt is in place, so that shouldn't be a problem. However, if that primary thread was in stop state prior to the reset, and because the resume_as_sreset parameters is still set, it is re-routed to exception vector 0x100. Which, at that time, is still defined as the entry point for BML. So that primary thread restarts as new and ends up being treated like any other secondary thread. All threads are now waiting in secondary_wait. It results in a full system hang with no message on the console, as the uart hasn't been init'ed yet. It's actually not obvious to realise what's happening if not tracing reset (-d cpu_reset). The fix is simply to clear the 'resume_as_sreset' attribute on reset. Signed-off-by: Frederic Barrat Reviewed-by: Fabiano Rosas Reviewed-by: C=C3=A9dric Le Goater Message-Id: <20220617095222.612212-1-fbarrat@linux.ibm.com> Signed-off-by: Daniel Henrique Barboza --- target/ppc/cpu_init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 0f891afa04..c16cb8dbe7 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7186,6 +7186,9 @@ static void ppc_cpu_reset(DeviceState *dev) } pmu_update_summaries(env); } + + /* clean any pending stop state */ + env->resume_as_sreset =3D 0; #endif hreg_compute_hflags(env); env->reserve_addr =3D (target_ulong)-1ULL; --=20 2.36.1