From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cadetblue.ash.relay.mailchannels.net (cadetblue.ash.relay.mailchannels.net [23.83.222.28]) by sourceware.org (Postfix) with ESMTPS id 64C8C3857349 for ; Fri, 13 May 2022 11:32:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 64C8C3857349 X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id ACCD94C1A3A; Fri, 13 May 2022 11:31:57 +0000 (UTC) Received: from pdx1-sub0-mail-a307.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 508CD4C2330; Fri, 13 May 2022 11:31:57 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1652441517; a=rsa-sha256; cv=none; b=eKwkn0lKsP3jvMnadTQDlt57pd5Q6EzMuYfEhhZB0Hhdgzkori1IOfObhbOPgMYolYxoD7 UOFU4tYFSiQiWozTHdhdpNr4re4b4OoYcDkU+Dh/I6z4oZ2kwH/heOVvIXJ7qFQ3YDF7aU tMEVz0tYSwyLHQ00Dvbg98X24GziGXZVFLS7xjxeNwp/YjFE/7oWR/ftaLLEh5k0QvpXR8 kbUVVJRJCV0LJmwlrEQHwmtQ8BwUep0vNCpSD4hJDANFphPCnxW7NhVZXA4K8xIcZS7TR9 0z2jCWrrQ9e7qPO9kTNL8FU+eiNYhrz+u/BWsAqkRsJSzYo0/05YypBIQj2hDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1652441517; h=from:from: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=RSpm5z2uU1p/AYjExd8RVwm9eaOCV7f2vom97cEsNuE=; b=tVAx9j/dwlOJkKv73fotYcEgBwAyEnZ/9TorrhM1Q8VWckjSZ2v6l4nQ9fGuTy5y4i5s66 duZfUF3DCGYvRomrXSf9X2sy8XNdg1WyWVw9LydUdE82c7PL8ueb1K7C+arOzKufiPXeHL JXlTvc5hc/ERE8ButFxRD1EwKzhsZkjcRdUdukQ1EobbMunsyvHZmcbIqHmXWZB9qbENwp SCMOlnbiQkKH3paeBEySRmg+YKlRtS543iTNHPovD2oQzxQF4LwmPLalm0N/SimipJFt6j ThPfc9KzjkjpGIvgYyp54ShJP1xfC9wZTqBUxQXHD/2qPGGgRk1FnXt2fkfJ/Q== ARC-Authentication-Results: i=1; rspamd-6fcfc4d76-bhdc9; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@sourceware.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Junk X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Well-Made-Wide-Eyed: 446e410003b4521a_1652441517597_1630973578 X-MC-Loop-Signature: 1652441517597:2142895600 X-MC-Ingress-Time: 1652441517597 Received: from pdx1-sub0-mail-a307.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.105.211.134 (trex/6.7.1); Fri, 13 May 2022 11:31:57 +0000 Received: from [192.168.86.152] (unknown [103.199.173.7]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a307.dreamhost.com (Postfix) with ESMTPSA id 4L061R09C9z1Nq; Fri, 13 May 2022 04:31:54 -0700 (PDT) Message-ID: <02979241-ff47-ef76-0c77-268aca00c4b8@sourceware.org> Date: Fri, 13 May 2022 17:01:47 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v3] wcrtomb: Make behavior POSIX compliant Content-Language: en-US To: Paul Eggert Cc: fweimer@redhat.com, libc-alpha@sourceware.org, dickey@his.com References: <20220505184348.3357550-3-siddhesh@sourceware.org> <20220512131503.764504-1-siddhesh@sourceware.org> <4ffe566a-8002-b574-daee-d6927b8ceaef@cs.ucla.edu> From: Siddhesh Poyarekar In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1162.1 required=5.0 tests=BAYES_00, BODY_8BITS, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: Fri, 13 May 2022 11:32:03 -0000 On 13/05/2022 10:58, Paul Eggert wrote: > On 5/12/22 21:56, Paul Eggert wrote: >> Hope you don't mind my bikeshedding. > > Better yet, this: > >   s[0] = buf[0]; >   if (2 <= result && result <= 4) >     { >       s[1] = buf[1]; >       memcpy (&s[result - 2], &buf[result - 2], 2); >     } >   else >     memcpy (s, buf, result); > > On x86-64 with GCC 12.1 -O2 and a glibc-supplied charmap, this is only 9 > straight-line instructions, counting the compare insn and the > conditional-branch insn that is never taken. > Sorry I missed this one. I tried it and with gcc 11 it seems to produce worse code, merging the two memcpys instead of inlining the first one. Siddhesh