From nobody Wed Oct 1 08:42:12 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550741824433751.6299038438519; Thu, 21 Feb 2019 01:37:04 -0800 (PST) Received: from localhost ([127.0.0.1]:57118 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwkmq-0003xK-Pv for importer@patchew.org; Thu, 21 Feb 2019 04:37:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwkl4-0002zM-33 for qemu-devel@nongnu.org; Thu, 21 Feb 2019 04:35:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwkl3-0004Am-7a for qemu-devel@nongnu.org; Thu, 21 Feb 2019 04:35:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58408) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gwkl2-00048N-Vj for qemu-devel@nongnu.org; Thu, 21 Feb 2019 04:35:09 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DEE13308FC5E; Thu, 21 Feb 2019 09:35:06 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-222.ams2.redhat.com [10.36.116.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6EA475C205; Thu, 21 Feb 2019 09:35:00 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 21 Feb 2019 10:34:59 +0100 Message-Id: <20190221093459.22547-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 21 Feb 2019 09:35:06 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v1] include/exec/helper-head.h: support "const void *" in helper calls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , David Hildenbrand , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Especially when dealing with out-of-line gvec helpers, it is often helpful to specify some vector pointers as constant. E.g. when we have two inputs and one output, marking the two inputs as consts pointers helps to avoid bugs. Const pointers can be specified via "cptr", however behave in TCG just like ordinary pointers. We can specify helpers like: DEF_HELPER_FLAGS_4(gvec_vbperm, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) void HELPER(gvec_vbperm)(void *v1, const void *v2, const void *v3, uint32_t desc) And make sure that here, only v1 will be written (as long as const is not casted away, of course). Signed-off-by: David Hildenbrand --- include/exec/helper-head.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/exec/helper-head.h b/include/exec/helper-head.h index ab4f8b6623..f2519c9741 100644 --- a/include/exec/helper-head.h +++ b/include/exec/helper-head.h @@ -30,6 +30,7 @@ #define dh_alias_f32 i32 #define dh_alias_f64 i64 #define dh_alias_ptr ptr +#define dh_alias_cptr ptr #define dh_alias_void void #define dh_alias_noreturn noreturn #define dh_alias(t) glue(dh_alias_, t) @@ -43,6 +44,7 @@ #define dh_ctype_f32 float32 #define dh_ctype_f64 float64 #define dh_ctype_ptr void * +#define dh_ctype_cptr const void * #define dh_ctype_void void #define dh_ctype_noreturn void QEMU_NORETURN #define dh_ctype(t) dh_ctype_##t @@ -88,6 +90,7 @@ #define dh_is_64bit_i32 0 #define dh_is_64bit_i64 1 #define dh_is_64bit_ptr (sizeof(void *) =3D=3D 8) +#define dh_is_64bit_cptr dh_is_64bit_ptr #define dh_is_64bit(t) glue(dh_is_64bit_, dh_alias(t)) =20 #define dh_is_signed_void 0 @@ -105,6 +108,7 @@ extension instructions that may be required, e.g. ia64's addp4. But for now we don't support any 64-bit targets with 32-bit pointers. */ #define dh_is_signed_ptr 0 +#define dh_is_signed_cptr dh_is_signed_ptr #define dh_is_signed_env dh_is_signed_ptr #define dh_is_signed(t) dh_is_signed_##t =20 @@ -117,6 +121,7 @@ #define dh_callflag_f32 0 #define dh_callflag_f64 0 #define dh_callflag_ptr 0 +#define dh_callflag_cptr dh_callflag_ptr #define dh_callflag_void 0 #define dh_callflag_noreturn TCG_CALL_NO_RETURN #define dh_callflag(t) glue(dh_callflag_, dh_alias(t)) --=20 2.17.2