From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sender3-pp-o97.zoho.com (sender3-pp-o97.zoho.com [136.143.184.97]) by sourceware.org (Postfix) with ESMTPS id D60933858C74; Thu, 12 Jan 2023 16:29:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D60933858C74 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=zoho.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=zoho.com ARC-Seal: i=1; a=rsa-sha256; t=1673540951; cv=none; d=zohomail.com; s=zohoarc; b=ZZqpPDrHECggRW59J9lWBgKvP7RnQUN5un7xe1c2CayPoIOIYHC8LNe/SX/2xXbjj67/FTOkW/E7o2SkM4ItOBg5PSbH3cOn7Ut2w0x897RPBAl7dZryC8Xc588/wswFIjCa5J9kI5rywlB0GWk8KY1Sy+hXnWgKoJi8gtrff1E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673540951; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=TTj5aTM5vlpJggkznQZ+s+MFmLaMpKfGm3/P6Q44FXI=; b=mNwWHhtpJrPXpJLAkdO/KYWuKDyw1X1WdtY/x0/CjaFYAQuP83N30d+D+fpvBbYuhxU6eHTzSpy/mVPg59GID6AukOvmLDdkwjcmnxAmJan9e0hmuJmsAC9vSCc/gUlx2pZDDelllFpJ3GZbQbhc2bkNrHgAATRt3PbOwv+ND3o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=zoho.com; spf=pass smtp.mailfrom=bouanto@zoho.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1673540951; s=zm2022; d=zoho.com; i=bouanto@zoho.com; h=Message-ID:Subject:Subject:From:From:To:To:Date:Date:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:MIME-Version:Message-Id:Reply-To:Cc; bh=TTj5aTM5vlpJggkznQZ+s+MFmLaMpKfGm3/P6Q44FXI=; b=RyTuwkPojiaiGbMfCHJ5r4E1Pevt0/gG450NuLSagAkHEjUfgtHPewRHyJ1jAH8q l3qdjna1x9HIq13G02omQSG3wfICOHf6v4afvLxqvlpIzTrmuPt4wrt1eB/nTl1Gt4R m0d6HIiXHneRizN8CraHc7OYWwD1hTTnNhkVBat0= Received: from [192.168.1.174] (38.87.11.6 [38.87.11.6]) by mx.zohomail.com with SMTPS id 1673540950875519.5902422386706; Thu, 12 Jan 2023 08:29:10 -0800 (PST) Message-ID: Subject: Re: [PATCH] libgccjit: Fix float vector comparison From: Antoni Boucher To: David Malcolm , gcc-patches@gcc.gnu.org, jit@gcc.gnu.org Date: Thu, 12 Jan 2023 11:29:08 -0500 In-Reply-To: References: <30eb27a08792e1e2b92e663753f22e31f65c7791.camel@redhat.com> <15fbee19972751bfa05c24ec95bc441c621c98ad.camel@zoho.com> <74150b934836583a532d310c68d29384daf2fbd0.camel@redhat.com> <5827fc95314506387b9b0e5c5da865eb28cf28e8.camel@zoho.com> <138f2f9ca9eeee76f3fc7532e32a535ac8884fe2.camel@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.3 MIME-Version: 1.0 X-ZohoMailClient: External X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Ping David: Some more notes about the try/catch API: I finally got unwinding implemented in rustc_codegen_gcc with the following GCC patch: https://github.com/antoyo/gcc/commit/fd603a3c715d3708f831cb637fbcc48bf46418= 59 It still requires clean-up, but you can have a look at it. I'm still unsure for the CFG: currently, it requires the finally to be terminated which would prevent a finally reached through unwinding to work correctly; unless you call unwind_resume, in which case, that would probably prevent a normal finally (e.g. reached not by unwinding, but by falling off the try). I'll try to not require the finally block to be terminated, but I remember having issues making that work. What are your thoughts on this?=20 On Fri, 2022-12-02 at 09:29 -0500, Antoni Boucher wrote: > On Thu, 2022-12-01 at 11:57 -0500, David Malcolm wrote: > > On Thu, 2022-12-01 at 10:33 -0500, Antoni Boucher wrote: > > > On Thu, 2022-12-01 at 10:25 -0500, David Malcolm wrote: > > > > On Thu, 2022-12-01 at 10:01 -0500, Antoni Boucher wrote: > > > > > Thanks, David. > > > > > Since we're not in phase 1 anymore, do we need an approval > > > > > before > > > > > I > > > > > merge like last year or can I merge immediately? > > > >=20 > > > > I think it counts as a bug fix and thus you can go ahead and > > > > merge > > > > (assuming you've done the usual testing). > > > >=20 > > > > > I also have many other patches (all in jit) that I need to > > > > > prepare > > > > > and > > > > > post to this mailing list. > > > > > What do you think? > > > >=20 > > > > Given that you're one of the main users of libgccjit I think > > > > there's > > > > a > > > > case for stretching the deadlines a bit here. > > > >=20 > > > > Do you have a repo I can look at? > > >=20 > > > Yes! The commits are in my fork: > > > https://github.com/antoyo/gcc > > >=20 > > > The only big one is the one adding support for target-dependent > > > builtins: > > > https://github.com/antoyo/gcc/commit/6d4313d4c02dd878f43917c978f299f5= 119330f0 > > >=20 > > > Regarding this one, there's the issue that since we record the > > > builtins > > > on the first context run, we only have access to the builtins > > > from > > > the > > > second run. > > > Do you have any idea how to fix this? > > > Or do you consider this is acceptable? > >=20 > > This is implemented behind the new > > gcc_jit_context_get_target_builtin_function entrypoint, right? >=20 > Yes. >=20 > >=20 > > If so, perhaps that recording::context::get_target_builtin_function > > could detect if it's the first time it's been called on this > > context, > > and if so make a playback::context to do the detection?=C2=A0 That way > > it > > would be transparent to the user, and work first time. >=20 > Oh, the issue is actually with the type reflection API and also the > type checking of function calls, so it's in the recording phase. > While I could think of a workaround for the type checking (e.g. > delayed > type checking at the playback phase), I could not think of any better > solution for the type reflection. >=20 > >=20 > >=20 > > I see you have patches to add function and variable attributes; I > > wonder if this would be cleaner internally if there was a > > recording::attribute class, rather than the std::pair currently in > > use > > (some attributes have int arguments rather than string, others have > > multiple args). > >=20 > > I also wondered if a "gcc_jit_attribute" type could be exposed to > > the > > user, e.g.: > >=20 > > =C2=A0 attr1 =3D gcc_jit_context_new_attribute (ctxt, "noreturn"); > > =C2=A0 attr2 =3D gcc_jit_context_new_attribute_with_string (ctxt, "alia= s", > > "__foo"); > > =C2=A0 gcc_jit_function_add_attribute (ctxt, attr1); > > =C2=A0 gcc_jit_function_add_attribute (ctxt, attr2); > >=20 > > or somesuch?=C2=A0 But I think the API you currently have is OK. >=20 > Thanks for the suggestion; I'll look into that. >=20 > >=20 > >=20 > > >=20 > > > I also have a WIP branch which adds support for try/catch: > > > https://github.com/antoyo/gcc/commit/6219339fcacb079431596a0bc6cf8d43= 0a1bd5a1 > > > I'm not sure if this one is going to be ready soon or not. > >=20 > > I see that the new entrypoints have e.g.: > >=20 > > /* Add a try/catch statement. > > =C2=A0=C2=A0 This is equivalent to this C++ code: > > =C2=A0=C2=A0=C2=A0=C2=A0 try { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 try_block > > =C2=A0=C2=A0=C2=A0=C2=A0 } > > =C2=A0=C2=A0=C2=A0=C2=A0 catch { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 catch_block > > =C2=A0=C2=A0=C2=A0=C2=A0 } > > */ > >=20 > > void > > gcc_jit_block_add_try_catch (gcc_jit_block *block, > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 gcc_jit_location *loc, > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 gcc_jit_block *try_block, > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 gcc_jit_block *catch_block); > >=20 > > but I'm not sure how this is meant to interact with the CFG-like > > model > > used by the rest of the gcc_jit_block_* API.=C2=A0 What happens at the > > end > > of the blocks?=C2=A0 Does the generated code use the C++ ABI for > > exception- > > handling? >=20 > Currently, it requires the try and catch blocks to be terminated, but > also require the block containing the try/catch to be terminated. > That doesn't make sense. > Would it be OK if it doesn't require the try and catch blocks to be > terminated? >=20 > For the ABI, I'm not sure it's necessarily tied to C++, but I might > be > wrong. From what I understand, GCC will use the dwarf-2 exception > handling model if it's available or the sjlj otherwise (perhaps that > can be configured). > And the user can change the personality function via the API I added. >=20 > Thanks for your feedback. >=20 > >=20 > > Dave > >=20 > > >=20 > > > Thanks. > > >=20 > > > >=20 > > > > Dave > > > >=20 > > > >=20 > > > > >=20 > > > > > On Thu, 2022-12-01 at 09:28 -0500, David Malcolm wrote: > > > > > > On Sun, 2022-11-20 at 14:03 -0500, Antoni Boucher via Jit > > > > > > wrote: > > > > > > > Hi. > > > > > > > This fixes bug 107770. > > > > > > > Thanks for the review. > > > > > >=20 > > > > > > Thanks, the patch looks good to me. > > > > > >=20 > > > > > > Dave > > > > > >=20 > > > > >=20 > > > >=20 > > >=20 > >=20 >=20