From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from devianza.investici.org (devianza.investici.org [198.167.222.108]) by sourceware.org (Postfix) with ESMTPS id C428F3858C78 for ; Mon, 7 Nov 2022 06:26:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C428F3858C78 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=autistici.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=autistici.org Received: from 1.mail-backend.investici.org (unknown [10.0.0.11]) by devianza.investici.org (Postfix) with ESMTP id 4N5LqP4XZzz6v8V; Mon, 7 Nov 2022 06:26:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1667802417; bh=f99O1yUnEAgd7H8mhp9ymAjNZK1exgxqWCxheF1OPa0=; h=Date:From:To:Subject:In-Reply-To:References:From; b=geqIp7lFjNJuAnxSZUujHX3KGR/SuDWO/Pcn9hFxmddzI+44YANU0wiyUah2serV1 QF1JQj+mqPBciqOkOe3MbXXL0TnZdLL2sP4/VllsbutwUHJdDI7ZgvXpfl2QahJ/hr HmYShju1PbHGpbymR0MGFzZJQZpv7PcO/nGLsjA4= Received: from 1.webmail.investici.org (localhost [127.0.0.1]) (Authenticated sender: i.nixman@autistici.org) by 1.mail-backend.investici.org (Postfix) with ESMTPA id 4N5LqP3d7hz5tGh; Mon, 7 Nov 2022 06:26:57 +0000 (UTC) MIME-Version: 1.0 Date: Mon, 07 Nov 2022 06:26:57 +0000 From: i.nixman@autistici.org To: Hongtao Liu , gcc-help@gcc.gnu.org Subject: Re: simd, redundant pcmpeqb and pxor In-Reply-To: References: User-Agent: Roundcube Webmail Message-ID: <71218c0c63bfa161f9f828cbf312debe@autistici.org> X-Sender: i.nixman@autistici.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,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: On 2022-11-07 03:32, Hongtao Liu wrote: > On Sun, Nov 6, 2022 at 6:54 PM i.nixman--- via Gcc-help > wrote: >> >> >> Hello, >> >> look at this example(https://godbolt.org/z/TnGMsfMs6): >> ``` >> auto foo(const char *p) { >> const auto substr = _mm_loadu_si128((const __m128i *)p); >> return _mm_cmplt_epi8(substr, _mm_set1_epi8('0')); >> } >> ``` >> and to the generated asm: >> ``` >> 1: foo(char const*): >> 2: movdqu xmm0, XMMWORD PTR [rdi] >> 3: pxor xmm1, xmm1 >> 4: pcmpgtb xmm0, XMMWORD PTR .LC0[rip] >> 5: pcmpeqb xmm0, xmm1 >> 6: ret >> ``` >> look at line 5. >> is there any reason for `pcmpeqb` instruction? hi, > Looks like a mis optimization from > > _4 = VIEW_CONVERT_EXPR<__v16qs>(_7); > _3 = _4 <= { 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, > 47, 47 }; > _5 = VIEW_CONVERT_EXPR(_3); --- this? > > Could you open a bugzilla for it > https://gcc.gnu.org/bugzilla/ sure, but for which component? >> >> just for info, clang's output(https://godbolt.org/z/MPnvEMdhr): >> ``` >> 1: foo(char const*): >> 2: movdqu xmm1, xmmword ptr [rdi] >> 3: movdqa xmm0, xmmword ptr [rip + .LCPI0_0] >> 4: pcmpgtb xmm0, xmm1 >> 5: ret >> ``` >> >> >> best!