Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uRpsP-00H4vM-9b for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Jun 2025 10:18:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uRpsM-000Rdx-AM for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Jun 2025 10:18:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uRpsM-000Rdn-0L for pgsql-hackers@lists.postgresql.org; Wed, 18 Jun 2025 10:18:38 +0000 Received: from m16.mail.163.com ([117.135.210.2]) by magus.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1uRpsF-002kKD-0m for pgsql-hackers@lists.postgresql.org; Wed, 18 Jun 2025 10:18:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=ovuAjFY1yrwjIlButKuUTsCw/P4HrqeQpBmqiK6yR5A=; b=mphERuH5qAf3f3c8mgNZUIi6S1+sfyI+My0gqNK/u1PPjxTPHxj54adjNG12KU pci5tZmGNb1l8zGXtWWXTuJP0Zz6/HaADUfsDDeX9nwngJb097TE0R/snm9BGent JXlda+vzhPmM7DHPX5n3treQ44CF4cd35FnShkAcPt+Zg= Received: from lovely-coding (unknown []) by gzga-smtp-mtada-g0-2 (Coremail) with SMTP id _____wDnSYdnklJoqtncAA--.13043S3; Wed, 18 Jun 2025 18:18:16 +0800 (CST) From: Andy Fan To: John Naylor Cc: "Devulapalli, Raghuveer" , Nathan Bossart , Jesper Pedersen , Tomas Vondra , "pgsql-hackers@lists.postgresql.org" , "Shankaran, Akash" Subject: Re: Improve CRC32C performance on SSE4.2 In-Reply-To: (John Naylor's message of "Tue, 17 Jun 2025 15:55:06 +0700") References: <87o6uqd3iv.fsf@163.com> <029f0848-8bc2-4d99-aebd-345949f97622@gmail.com> <87frg1dc3k.fsf@163.com> <87bjqncl24.fsf@163.com> Date: Wed, 18 Jun 2025 10:18:15 +0000 Message-ID: <877c19cpzs.fsf@163.com> MIME-Version: 1.0 Content-Type: text/plain X-CM-TRANSID: _____wDnSYdnklJoqtncAA--.13043S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrKF1xWrW5uFyUGFWftw13urg_yoWfGwc_ua 1YyrWqg34DAFn7tF43WwsY9F97JrWvvF4UG3WUGrnxGry3Z3ZxCFs5XFyfAayxXrWvqr9r Gr1qqF4fArW7KjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRRrgADUUUUU== X-Originating-IP: [113.250.190.7] X-CM-SenderInfo: x2klx3xlid0iqsrtqiywtou0bp/xtbBhR9wU2hShP-6igABsJ List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk John Naylor writes: Hi, >> Just be curious, what kind of optimization (like what -O2 does) could >> mask this issue? > > In case Andy is asking about "how" rather than "under what > circumstances", my guess is: -O1+ may have just chosen instructions > that also happen to zero-extend, which are common. -O0 doesn't > represent the naive straightforward structure of what the programmer > wrote, it's more like an "exploded" representation suitable for later > optimization passes. That's why it always looks goofy. Thanks for the explaination! >> > Replacing that with _mm512_zextsi128_si512 fixes the problem. > > Here's a patch for testing, which also reverts the previous > workaround. Help welcome, but I still promise to test it in the near > future regardless. I verified the your patch, it works for me. -- Best Regards Andy Fan