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 [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 628AB3980436 for ; Thu, 20 May 2021 20:24:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 628AB3980436 Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-87-qepVy40XPPKBWj5U90JIQg-1; Thu, 20 May 2021 16:24:29 -0400 X-MC-Unique: qepVy40XPPKBWj5U90JIQg-1 Received: by mail-qv1-f69.google.com with SMTP id b5-20020a0cc9850000b02901eece87073bso12758919qvk.21 for ; Thu, 20 May 2021 13:24:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=+23KT2fNC9wFg8Tz9Oh3eQfZKm8uq1nfwjF0gGZ/Poc=; b=T/KnnBQUfB2a0WvliWF18bFAlToQk3IrsxjO1aCUk30qu93hla7jHFplv63eaiOrSZ O6K3qjgWwLeX2CEfLz08PgDcVp8qJwF34MtsDXamBer27Kh8lLHpgS2XMuDWJedBV8iE mIwJ7SbMCJ4WJoxVEO3SRJ589Ko8X52gq1gkqGFczIF/VOJ3/HDAvw6GMbvcCQydkdo7 jTxegorjcwQQQVbTzI5FvQnwuM/gvKWXqvycXP3OHoE/6JjIpu+W2y72b32+vvlgUq41 1jWsA9N9r0Zj2sbN+7JqDs4RckdW0WuVzziwY8vlXIa+sKCLGgYEH2bODo5u5LJksJXC 8Yng== X-Gm-Message-State: AOAM530p4lsYkw2i7ULrBQZf1U0It2W6qTIIY/ryJNGL1XF1motCRUxi zPKF6vJ7FqXA5RzVdtSHvWe2SbEoJhaogA31JU7kViuD8Tz0LZfQppbLGzPCUQNsDG98+S67lzB 6h5cfxFo= X-Received: by 2002:ac8:7f4e:: with SMTP id g14mr7279243qtk.356.1621542268899; Thu, 20 May 2021 13:24:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRRRRIvxnUZVoyGaGLJF2F7FFQpbeecwFW3/oaNnbj08WHGsaX8KVhm0txVnpjO2KBExEdMQ== X-Received: by 2002:ac8:7f4e:: with SMTP id g14mr7279229qtk.356.1621542268710; Thu, 20 May 2021 13:24:28 -0700 (PDT) Received: from t14s.localdomain (c-73-69-212-193.hsd1.nh.comcast.net. [73.69.212.193]) by smtp.gmail.com with ESMTPSA id f12sm2777024qtj.26.2021.05.20.13.24.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 13:24:26 -0700 (PDT) Message-ID: Subject: Re: [PATCH] libgccjit: Add support for types used by atomic builtins [PR96066] [PR96067] From: David Malcolm To: Antoni Boucher , jit@gcc.gnu.org, gcc-patches@gcc.gnu.org Date: Thu, 20 May 2021 16:24:25 -0400 In-Reply-To: <212418d2a4b81cfff1e125ddb12d0b4d10d8404a.camel@zoho.com> References: <212418d2a4b81cfff1e125ddb12d0b4d10d8404a.camel@zoho.com> User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: jit@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Jit mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 20:24:33 -0000 On Mon, 2021-05-17 at 21:02 -0400, Antoni Boucher via Jit wrote: > Hello. > This patch fixes the issue with using atomic builtins in libgccjit. > Thanks to review it. [...snip...] > diff --git a/gcc/jit/jit-recording.c b/gcc/jit/jit-recording.c > index 117ff70114c..de876ff9fa6 100644 > --- a/gcc/jit/jit-recording.c > +++ b/gcc/jit/jit-recording.c > @@ -2598,8 +2598,18 @@ recording::memento_of_get_pointer::accepts_writes_from (type *rtype) > return false; > > /* It's OK to assign to a (const T *) from a (T *). */ > - return m_other_type->unqualified () > - ->accepts_writes_from (rtype_points_to); > + if (m_other_type->unqualified () > + ->accepts_writes_from (rtype_points_to)) { > + return true; > + } > + > + /* It's OK to assign to a (volatile const T *) from a (volatile const T *). */ > + if (m_other_type->unqualified ()->unqualified () > + ->accepts_writes_from (rtype_points_to->unqualified ())) { > + return true; > + } Presumably you need this to get the atomic builtins working? If I'm reading the above correctly, the new test doesn't distinguish between the 3 different kinds of qualifiers (aligned, volatile, and const), it merely tries to strip some of them off. It's not valid to e.g. assign to a (aligned T *) from a (const T *). Maybe we need an internal enum to discriminate between different subclasses of decorated_type? > + > + return false; > } > > /* Implementation of pure virtual hook recording::memento::replay_into > diff --git a/gcc/testsuite/jit.dg/all-non-failing-tests.h b/gcc/testsuite/jit.dg/all-non-failing-tests.h > index 4202eb7798b..dfc6596358c 100644 > --- a/gcc/testsuite/jit.dg/all-non-failing-tests.h > +++ b/gcc/testsuite/jit.dg/all-non-failing-tests.h > @@ -181,6 +181,13 @@ > #undef create_code > #undef verify_code > > +/* test-builtin-types.c */ > +#define create_code create_code_builtin_types > +#define verify_code verify_code_builtin_types > +#include "test-builtin-types.c" > +#undef create_code > +#undef verify_code > + > /* test-hello-world.c */ > #define create_code create_code_hello_world > #define verify_code verify_code_hello_world As with various other patches, this needs to also add a new entry to the "testcases" array making use of the new {create|verify}_code_builtin_types functions. [...snip...] Hope this is constructive Dave