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 7E051382DB11 for ; Thu, 1 Sep 2022 09:23:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7E051382DB11 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662024227; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Owddg+rn0DA/VEDMwEumXGGIOvFJidphj1NGJ1JtmSc=; b=Hj224VMNSG9upeQBo0zhKoneU7DT7a9e0UBgkz8Bxs9Zr4ecQIu16XlDXRoSPU0j9tkCf3 +3i0qiTkJZx2eoau+dGrSJx0vFv2icVyTVr9nfD6w84gE0CbcMBTEQDmvv9I6DImT6RaAu ifq+HZvsauaOW9/5DEizUojubany3hM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-320-_6tr1TIGP2GDWvx0FNfS7g-1; Thu, 01 Sep 2022 05:23:42 -0400 X-MC-Unique: _6tr1TIGP2GDWvx0FNfS7g-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B26F2811E80; Thu, 1 Sep 2022 09:23:41 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5BD891121314; Thu, 1 Sep 2022 09:23:41 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2819Ncwk2082751 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 1 Sep 2022 11:23:38 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2819NbmX2082750; Thu, 1 Sep 2022 11:23:37 +0200 Date: Thu, 1 Sep 2022 11:23:36 +0200 From: Jakub Jelinek To: FX Cc: gcc@gcc.gnu.org, "Joseph S. Myers" , FX via Fortran Subject: Re: Floating-point comparisons in the middle-end Message-ID: Reply-To: Jakub Jelinek References: <8C6DDAA3-A40F-47C7-BE78-D56A3EC70C71@gmail.com> <3BD50DD7-5C9E-42CB-992C-A66584411A4F@gmail.com> MIME-Version: 1.0 In-Reply-To: <3BD50DD7-5C9E-42CB-992C-A66584411A4F@gmail.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,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 Thu, Sep 01, 2022 at 11:04:03AM +0200, FX wrote: > Hi Jakub, > > >> 2. All the functions are available as GCC type-generic built-ins (yeah!), > >> except there is no __builtin_ iseqsig > >> (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77928). Is there a > >> fundamental problem with creating one, and could someone help there? > > > > IMHO until that one is implemented you can just use > > tx = x, ty = y, tx>=ty && tx<=ty > > (in GENERIC just SAVE_EXPR >= SAVE_EXPR && SAVE_EXPR <= SAVE_EXPR > > If it’s just that (optimization aside), I probably can create a C built-in. It would need to be: > > 1. defined in builtins.def > 2. lowered in builtins.cc > 3. type-checked in c-family/c-common.cc > 4. documented in doc/extend.texi > 5. tested in fp-test.cc > 6. covered in the testsuite > > Is that right? Dunno if we really need a builtin for this, especially if it is lowered to that x >= y && x <= y early, will defer to Joseph. Because if it is for better code generation only, IMNSHO we want to optimize even when users write it that way by hand and so want to pattern recognize that during instruction selection before expansion (isel pass) or during expansion if target can do that. E.g. x86 with AVX can do that: where the 4 booleans are A>B, A= y && x <= y can be handled using vcmpeq_ossd or similar instructions. Jakub