From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 5E57C3858D35 for ; Mon, 20 Nov 2023 23:05:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5E57C3858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5E57C3858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700521516; cv=none; b=jvabXGhDajgfwJFwKXxGusHvIbOWd8jAPqDCm7aGjFyt7wrCjhyThc8fCfQhxtzU0uK4fzGZlO9u4lSTN4itqLrD4WnjfivtlDsK8P8Sil+y32uKVLxKB05wpy454Ieagv1+lDUCJjvRlb0twTwby6VD/2g0scII69xLUbjfNJ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700521516; c=relaxed/simple; bh=x66JbR7EThEZajnBtknSfKQdx+Llb7poPBsjWyrG68w=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=YhhoayK6UroO/l8Zf/W+qZWHIrRl5vfBo4BAsqOGARhgCoAGWbvysXyHKPInYq3PxyMgyofbvoILj48Q1hIHFU6969tU6KTd+Ug4pAXYaSrtp5cBQJcLdjKAuNz/FgvumIEk+K277+FDRWbXDORR0ea1383rHrOcrl+eYT3Nfx8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700521514; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U65trs/0LBcT4vHRGOFB1nZiQmFweJJzZXed+LXPtIM=; b=OTuOTEK7M7m1imOZA6ySLi0yj7Abv/Is+8MsF3tbCCcxLeubd1bm7gGrJZX1luw1LJKPYu e7bH4FrPk61hnK2kp7YWrl14N3i115mmQPc5hB7dtVB+MFI4QcUp8E1uF4XiadT/1GJEiq uJfAuLaV6mwxg1m67blz+rD3No4pSu8= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-8--zCOPNdQOM-BXCsqFYyQ9Q-1; Mon, 20 Nov 2023 18:05:12 -0500 X-MC-Unique: -zCOPNdQOM-BXCsqFYyQ9Q-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-77892a3d8f3so509652985a.3 for ; Mon, 20 Nov 2023 15:05:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700521512; x=1701126312; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1RaKgXrunkxS14po3ynN35+18OJcHT3bDGKKrJ75bEc=; b=sXknri15vfG8mUqWDEFsi2B9BE94rTWRLGwvuGXhgX4zso5/otQRVN8T6zVtHFImAO blPERi7LuhWLIoEgNEVSMz23/teUXyPxWrlkczjAxn3rIIzhoeALz/8P4A/Y+lGiry7P gzRm3VeEycc1PZpi34Rc4dfRw3Rca9zXOn7PVRwft4WuxXZ5Cl32yPN5E2aM0v1Qoi8j Z4Bf6I5OixK1lYpthL/dpxS5FK/eE60DrHqeoZU0Vgg9dKMgrVZZNKJLXW3Hrja5t9yy nevNaw+QxRdUV1UZNXbU1JMPXGfLgey2CNHR4nyoaO6nj0SPyR4nE1crwWs0W+yMOLwV jmMA== X-Gm-Message-State: AOJu0YwcbJXwYvm04XdlprV4QxZW/UyhDyMDNksnYSYFtT7z5+qNmOad GlTp9zgmVw/QG3Sq19FIFAf0s1r6pOoorozQlfPEw+i9D8ICrorGS3H6//hZtztqHK0Ynkf7raf Yp299UEQ= X-Received: by 2002:a05:620a:ed2:b0:77a:3f9:ee22 with SMTP id x18-20020a05620a0ed200b0077a03f9ee22mr6466145qkm.4.1700521512264; Mon, 20 Nov 2023 15:05:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IESiAQn5Scsv0NYQncPZs4IoN8OTCtANuaraavg6bbnel04NzK4Ky1wzzUZiJI3aiEW76T3bA== X-Received: by 2002:a05:620a:ed2:b0:77a:3f9:ee22 with SMTP id x18-20020a05620a0ed200b0077a03f9ee22mr6466134qkm.4.1700521511991; Mon, 20 Nov 2023 15:05:11 -0800 (PST) Received: from t14s.localdomain (c-76-28-97-5.hsd1.ma.comcast.net. [76.28.97.5]) by smtp.gmail.com with ESMTPSA id kq16-20020ac86190000000b00421bad3d029sm3032824qtb.24.2023.11.20.15.05.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 15:05:11 -0800 (PST) Message-ID: <9db455400eafdfc0ed204d5949840978174380cb.camel@redhat.com> Subject: Re: [PATCH] libgccjit: Add vector permutation and vector access operations From: David Malcolm To: Antoni Boucher , jit@gcc.gnu.org, gcc-patches@gcc.gnu.org Date: Mon, 20 Nov 2023 18:05:10 -0500 In-Reply-To: References: User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, 2023-11-17 at 17:36 -0500, Antoni Boucher wrote: > Hi. > This patch adds a vector permutation and vector access operations > (bug > 112602). >=20 > This was split from this patch: > https://gcc.gnu.org/pipermail/jit/2023q1/001606.html >=20 Thanks for the patch. Overall, looks good, but 3 minor nitpicks: [...snip...] > diff --git a/gcc/jit/docs/topics/compatibility.rst b/gcc/jit/docs/topics/= compatibility.rst > index ebede440ee4..a764e3968d1 100644 > --- a/gcc/jit/docs/topics/compatibility.rst > +++ b/gcc/jit/docs/topics/compatibility.rst > @@ -378,3 +378,13 @@ alignment of a variable: > -------------------- > ``LIBGCCJIT_ABI_25`` covers the addition of > :func:`gcc_jit_type_get_restrict` > + > + > +.. _LIBGCCJIT_ABI_26: > + > +``LIBGCCJIT_ABI_26`` > +-------------------- > +``LIBGCCJIT_ABI_26`` covers the addition of functions to manipulate vect= ors: > + > + * :func:`gcc_jit_context_new_rvalue_vector_perm` > + * :func:`gcc_jit_context_new_vector_access` > diff --git a/gcc/jit/docs/topics/expressions.rst b/gcc/jit/docs/topics/ex= pressions.rst > index 42cfee36302..4a45aa13f5c 100644 > --- a/gcc/jit/docs/topics/expressions.rst > +++ b/gcc/jit/docs/topics/expressions.rst > @@ -295,6 +295,35 @@ Vector expressions > =20 > #ifdef LIBGCCJIT_HAVE_gcc_jit_context_new_rvalue_from_vector > =20 > +.. function:: gcc_jit_rvalue * \ > + gcc_jit_context_new_rvalue_vector_perm (gcc_jit_context *c= txt, \ > + gcc_jit_location *= loc, \ > + gcc_jit_rvalue *el= ements1, \ > + gcc_jit_rvalue *el= ements2, \ > + gcc_jit_rvalue *ma= sk); > + > + Build a permutation of two vectors. > + > + "elements1" and "elements2" should have the same type. > + The length of "mask" and "elements1" should be the same. > + The element type of "mask" should be integral. > + The size of the element type of "mask" and "elements1" should be the = same. > + > + This entrypoint was added in :ref:`LIBGCCJIT_ABI_25`; you can test fo= r ^^ Should be 26 [...snip...] > Unary Operations > **************** > =20 > @@ -1020,3 +1049,27 @@ Field access is provided separately for both lvalu= es and rvalues. > PTR[INDEX] > =20 > in C (or, indeed, to ``PTR + INDEX``). > + > +.. function:: gcc_jit_lvalue *\ > + gcc_jit_context_new_vector_access (gcc_jit_context *ctxt,\ > + gcc_jit_location *loc,\ > + gcc_jit_rvalue *vector,= \ > + gcc_jit_rvalue *index) > + > + Given an rvalue of vector type ``T __attribute__ ((__vector_size__ (S= IZE)))``, get the element `T` at > + the given index. > + > + This entrypoint was added in :ref:`LIBGCCJIT_ABI_25`; you can test fo= r ^^ Likewise here. [...snip...] > @@ -4071,6 +4107,79 @@ gcc_jit_context_new_rvalue_from_vector (gcc_jit_co= ntext *ctxt, > (gcc::jit::recording::rvalue **)elements); > } > =20 > +/* Public entrypoint. See description in libgccjit.h. > + > + After error-checking, the real work is done by the > + gcc::jit::recording::context::new_rvalue_vector_perm method, in > + jit-recording.cc. */ > + > +gcc_jit_rvalue * > +gcc_jit_context_new_rvalue_vector_perm (gcc_jit_context *ctxt, > +=09=09=09=09=09gcc_jit_location *loc, > +=09=09=09=09=09gcc_jit_rvalue *elements1, > +=09=09=09=09=09gcc_jit_rvalue *elements2, > +=09=09=09=09=09gcc_jit_rvalue *mask) > +{ > + RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL ctxt"); > + JIT_LOG_FUNC (ctxt->get_logger ()); > + > + /* LOC can be NULL. */ ...but "elements1", "elements2", and "mask" must not be NULL, as they're dereferenced below. So this is going to need something like the following (untested): RETURN_NULL_IF_FAIL (elements1, ctxt, loc, "NULL elements1"); RETURN_NULL_IF_FAIL (elements2, ctxt, loc, "NULL elements2"); RETURN_NULL_IF_FAIL (mask, ctxt, loc, "NULL mask"); [...snip...] OK with those fixed. Thanks Dave