From nobody Tue Nov 18 11:51:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.218.41 as permitted sender) client-ip=209.85.218.41; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ej1-f41.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1610377310; cv=none; d=zohomail.com; s=zohoarc; b=cLUUC8fkEJS9JtO3iJx2vHzIMelAOUFjfVzqcnOC27fwysPz9xIJvnTo62pLtFHBXVyqSXd4fHod8A//s1CRFZ9fDjzcLOz8oGRwf55KH8m3T2kWAfV7YVQDSqUrAmr1TKUGdRphu8H63M41NYyxg7O2NMSIgsDKh/Ay1VN1ai8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610377310; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xngzeQsXbx86Y0kY9uD4ruhCQIyXt4hJmccYItVWSgE=; b=OrnnF1sifx6J0HnkBZ85+NrWkiYprBkFdbTkqoAzwox+/IfrOOIavmM7Ol8K8A5r/Cdsbde+HueKBpmjRYq55Ihae8l/tG/8lL1GZ11rxbkVhvPw8UokcVerYrgwQEosFM4KDyovRvHB2Hizp5StYLcO3Tyi1IjsY3lKQIXN5jA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by mx.zohomail.com with SMTPS id 1610377310672977.9690621205358; Mon, 11 Jan 2021 07:01:50 -0800 (PST) Received: by mail-ej1-f41.google.com with SMTP id qw4so25081808ejb.12 for ; Mon, 11 Jan 2021 07:01:49 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (129.red-88-21-205.staticip.rima-tde.net. [88.21.205.129]) by smtp.gmail.com with ESMTPSA id b21sm51043edr.53.2021.01.11.07.01.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 07:01:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xngzeQsXbx86Y0kY9uD4ruhCQIyXt4hJmccYItVWSgE=; b=JU8/uZzyfrbCCh0sfNNRgDfkqxalS6KTv/bDHUEEQWCbD2O+7GHhpXW5jPv2F5/Otj ED89jPRaY4rSPbLXDOmAD4pYYOFh4eiGlSUL5E1aYNUwyOBYmM590+O4CHqGsPdJiI3T MEuO41mbNYK9zfHoRye9MP3MANfc3Y+N9cPHyaltOIJjukQ3bgE/Di8uoGiph0Pw8Nz5 O7qDedIU6bQIH39IeJ3ycpfwG0BsWJcqrMAgxCp4I9fDHPnKN4QTqR+yDdZXClXKY/BC pBxKlz2d/G2tNiPmZpAQxqWOPqpburxAXsusZUsAlQZ6twjehGHFpIxNlxpAZi+Fvmxh gsUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=xngzeQsXbx86Y0kY9uD4ruhCQIyXt4hJmccYItVWSgE=; b=YLIt9V87BhAQOn23Jqam5SWkAjRRlTk/VPC2NV/hAZhiMdeeKmtbQhr8Ip01jYGLjG P8k5M0ajaLqv7VrocLOovnoORnF0VJrB7INM64MxK/SOMeUvFIiuGBhID+5Db1eN5nRh pecN/w99PAEUXftcooXZqvxGZmWHrEytCKTEKjEmfYcjj4Lbk/rswpSPAba8Fec6LrLi mimnLnmfc0rjEnP0tO9CUyV8mSiC9uYqV9fsUWkI3RpLLm9W0m2mcsNB9B6pTcBhch3f OS1TB0LQj2APd4U5UzpG+1yRcLzKy45qAylMHrpBnw5GCRqY3coHCuDGt7GPCppfJWl2 9Wtw== X-Gm-Message-State: AOAM532uf8DM3Um5IijP9RVImms3FaqIPSvSoj1P/gpYCRX/a9Vy2oey UcJRmMG5iLsgG2+iztP9Xyc= X-Google-Smtp-Source: ABdhPJxhDeFTNk2Ehjp96NDAKoPS7SZvuzzlTjnuMiEpwVOKkdWW0y7TQXWtxKdkpf5rmRU4AOoFjw== X-Received: by 2002:a17:906:fcda:: with SMTP id qx26mr11168873ejb.213.1610377308517; Mon, 11 Jan 2021 07:01:48 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Huacai Chen , Aurelien Jarno , Aleksandar Rikalo , Thomas Huth , Stefan Weil , qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Jiaxun Yang , qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cornelia Huck , Richard Henderson , Andrzej Zaborowski , Alistair Francis , Palmer Dabbelt Subject: [RFC PATCH 5/5] tcg: Restrict tcg_out_vec_op() to arrays of TCG_MAX_OP_ARGS elements Date: Mon, 11 Jan 2021 16:01:14 +0100 Message-Id: <20210111150114.1415930-6-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210111150114.1415930-1-f4bug@amsat.org> References: <20210111150114.1415930-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) tcg_reg_alloc_op() allocates arrays of TCG_MAX_OP_ARGS elements. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tcg/tcg.c | 14 ++++++++------ tcg/aarch64/tcg-target.c.inc | 3 ++- tcg/i386/tcg-target.c.inc | 3 ++- tcg/ppc/tcg-target.c.inc | 3 ++- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 97d074d8fab..3a20327f9cb 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -120,9 +120,10 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType ty= pe, unsigned vece, TCGReg dst, TCGReg base, intptr_t offset); static void tcg_out_dupi_vec(TCGContext *s, TCGType type, TCGReg dst, tcg_target_long arg); -static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, unsigned vecl, - unsigned vece, const TCGArg *args, - const int *const_args); +static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, + unsigned vecl, unsigned vece, + const TCGArg args[TCG_MAX_OP_ARGS], + const int const_args[TCG_MAX_OP_ARGS]); #else static inline bool tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned v= ece, TCGReg dst, TCGReg src) @@ -139,9 +140,10 @@ static inline void tcg_out_dupi_vec(TCGContext *s, TCG= Type type, { g_assert_not_reached(); } -static inline void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, unsigned v= ecl, - unsigned vece, const TCGArg *args, - const int *const_args) +static inline void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, + unsigned vecl, unsigned vece, + const TCGArg args[TCG_MAX_OP_ARGS], + const int const_args[TCG_MAX_OP_ARGS]) { g_assert_not_reached(); } diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index ab199b143f3..32811976e78 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -2276,7 +2276,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, =20 static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, unsigned vecl, unsigned vece, - const TCGArg *args, const int *const_args) + const TCGArg args[TCG_MAX_OP_ARGS], + const int const_args[TCG_MAX_OP_ARGS]) { static const AArch64Insn cmp_insn[16] =3D { [TCG_COND_EQ] =3D I3616_CMEQ, diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index d121dca8789..87bf75735a1 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -2654,7 +2654,8 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcod= e opc, =20 static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, unsigned vecl, unsigned vece, - const TCGArg *args, const int *const_args) + const TCGArg args[TCG_MAX_OP_ARGS], + const int const_args[TCG_MAX_OP_ARGS]) { static int const add_insn[4] =3D { OPC_PADDB, OPC_PADDW, OPC_PADDD, OPC_PADDQ diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index d37b519d693..279ec4b743c 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -3137,7 +3137,8 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType t= ype, unsigned vece, =20 static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, unsigned vecl, unsigned vece, - const TCGArg *args, const int *const_args) + const TCGArg args[TCG_MAX_OP_ARGS], + const int const_args[TCG_MAX_OP_ARGS]) { static const uint32_t add_op[4] =3D { VADDUBM, VADDUHM, VADDUWM, VADDUDM }, --=20 2.26.2