From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by sourceware.org (Postfix) with ESMTPS id 7869A3858D29 for ; Wed, 22 Sep 2021 18:15:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7869A3858D29 Received: by mail-pj1-x102e.google.com with SMTP id k23so2706712pji.0 for ; Wed, 22 Sep 2021 11:15:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=v89n+sAbIx6l1qr9/587lAW8KY5nuCOaPi1DQ6wCXnY=; b=1Z4+KKHj17iqLh+fDBkVdkhD/aGJuJN29XCO5W5W8BZTvpJFLQ6uamMUPi5tzSG1FR wttp2gKEks2aViVKV3ZZOP5h5fmzmawHm6uTyyrit2cIZVWxpKxMLJNVTq3ndGRW+Qkj zSHZXuw40KAR8dQzyyc9gTLfOofRPdzMoDwOHd/zVfh9o+H+w41BdPon0kSx+Hu6iZx3 4rwcOlYaGAseYocatKfO3ouym8gT5tp3mebTgnRGGC4KOWYCgWgFjT58UjEbprps1t+g zCZo2as+UUy/KwhciUkER5pahzXTuiej49N1kWzPhN9kvhIfGVilDC4A77oju+WUVc7X I8yA== X-Gm-Message-State: AOAM533mCvpyxkobRoJMkHIDiGyBd83bvfA2gFPz7dFvd+6Rnnm73VPw FRsyff0norvM3/dReMOZTCNUMjq/60MTA0h8NwE= X-Google-Smtp-Source: ABdhPJyoDr86nm2Q2EjtKYChZ/URxZf/Lk92wgpdzXPrWRiGa3+JLjVsae9BtK7U6hQbIsekdgcxyGoBx1TddL+KSDc= X-Received: by 2002:a17:90b:1c8f:: with SMTP id oo15mr8072729pjb.87.1632334535603; Wed, 22 Sep 2021 11:15:35 -0700 (PDT) MIME-Version: 1.0 References: <87lf3vb7m5.fsf@oldenburg.str.redhat.com> In-Reply-To: From: Noah Goldstein Date: Wed, 22 Sep 2021 13:15:24 -0500 Message-ID: Subject: Re: [libc-coord] Add new ABI '__memcmpeq()' to libc To: =?UTF-8?Q?Christoph_M=C3=BCllner?= Cc: GNU C Library , GCC Development , Florian Weimer , Joseph Myers X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 18:15:38 -0000 On Wed, Sep 22, 2021 at 12:46 PM Christoph M=C3=BCllner wrote: > Would it make sense to extend this proposal to include __strcmpeq() > and __strncmpeq()? > > Both are already available internally in GCC in form of > BUILT_IN_STRCMP_EQ and BUILT_IN_STRNCMP_EQ > (tree-ssa-strlen.c detects them in handle_builtin_string_cmp() and > builtins.c tries to inline them in expand_builtin_memcmp()). > However, they are currently restricted to cases where the length of > the string or the size of the array (of both arguments) is known. > > A use case for strcmpeq() would be the comparison of std::type_info > objects (equality and inequality operator) in libstdc++. > > I agree and am happy to implement them along side __memcmpeq() if the proposal is accepted. Do they need a seperate writeup with full specifications? > On Tue, Sep 21, 2021 at 9:54 PM Noah Goldstein via Gcc > wrote: > > > > On Fri, Sep 17, 2021 at 9:27 AM Florian Weimer via Libc-alpha < > > libc-alpha@sourceware.org> wrote: > > > > > * Joseph Myers: > > > > > > > I was supposing a build-time decision (using > > > GCC_GLIBC_VERSION_GTE_IFELSE > > > > to know if the glibc version on the target definitely has this > > > function). > > > > But if we add a header declaration, you could check for __memcmpeq > being > > > > declared (and so cover arbitrary C libraries, not just glibc, and > avoid > > > > issues of needing to disable this logic for freestanding > compilations, > > > > which would otherwise be an issue if a glibc-target toolchain is us= ed > > > for > > > > a freestanding kernel compilation). The case of people calling > > > > __builtin_memcmp (or declaring memcmp themselves) without string.h > > > > included probably isn't one it's important to optimize. > > > > > > The header-less case looks relevant to C++ and other language front > > > ends, though. So a GCC_GLIBC_VERSION_GTE_IFELSE check could still ma= ke > > > sense for them. > > > > > > (Dropping libc-coord.) > > > > > > Thanks, > > > Florian > > > > > > > > What are we going with? > > > > Should I go forward with the proposal in GLIBC? > > > > If I should go forward with it should I include a def in string.h? >