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 1t99ci-0085D6-5h for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Nov 2024 21:00:59 +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 1t99cf-002SdL-Fy for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Nov 2024 21:00:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t99cf-002SY2-4i for pgsql-hackers@lists.postgresql.org; Thu, 07 Nov 2024 21:00:57 +0000 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t99cd-000guF-0K for pgsql-hackers@lists.postgresql.org; Thu, 07 Nov 2024 21:00:56 +0000 Received: by mail-il1-x134.google.com with SMTP id e9e14a558f8ab-3a6bfc1dc8eso5690855ab.1 for ; Thu, 07 Nov 2024 13:00:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731013254; x=1731618054; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Dxt69BQdNUQSKzwnqOOV/WaDjQtAgt2R2qX9Gkjs8RM=; b=B9HbeMAulI598goDbOEEr6WySjJPKtncye4W7jKYNO9lG6+TT5o16RgjexC2FTDFrf 3tvHVb7/15v8swKhHzD2hWjEO0th2ab/6o5jifcKCLIfxcU5wMt8jmZfDFEDiiJxcB+t n8/1IS9fzzWL+j1CqIzGYyCgSixtYP73qQwTbFAg//HLoJigXRTCL8aWW5LP8CACueHm 4JCDa/0AiAkoBGGDxsE6uBnZhafbZKdLkayvXdHzUKPF1VUencwYdNefUtpACcGdBB2p jEh0kYV+h8keaZMHN3PlKey9t4KclzSY6QWVp45Eg48dDCmvxn+4cS7wu7nrqEYyqEce UeiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731013254; x=1731618054; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Dxt69BQdNUQSKzwnqOOV/WaDjQtAgt2R2qX9Gkjs8RM=; b=MUZVREEABmRdmoM/g7yGxKFUOxsqSn2M0nTNUBiDC9fkGR+E+H1BE+kZeXj0f/zge4 2jivu8hJdf8dZzX9/JfjuRbwx511jz1JXbPBCBA1clHCzVUnJDAfU15x/ttzgubqTQu3 GgiMcqvgkJm16ns2OF5gm9mWtmnjoK+w1OfdylGdbGhB9JflD8/j5xs2sCj9C+P6ICh2 UmEW4zcAVHgwVT9xQwrrntal8Mtu+Ab9pHln2jIS83rx150z589WDtq4cW0OXWKgVFBj qz8/JAi+wTM2XSW3savCIxSIRl1J+QEb11+rm1dQdC81PmcCxcS9QK6YqMHzuvDHIcrW y84Q== X-Gm-Message-State: AOJu0YzMpS/94k49SHJXYroEv+5oXcCsqvKb6Ce2nU9wEUiMUX3NRXuN Z9FKe5Q4SiqEGJas/1QyPrX3fpHoBo/IL07bmRuQpBF/HvvAJQWjc8XvYQ== X-Google-Smtp-Source: AGHT+IH7zi2z6HKT5hkcawiDSIM27v237DjmwwjXD1dtEEMa8VI++KUMIngLQlGPA81ERkFb3ERdkg== X-Received: by 2002:a05:6e02:18c7:b0:3a3:67b1:3080 with SMTP id e9e14a558f8ab-3a6f19b1847mr8826115ab.7.1731013253360; Thu, 07 Nov 2024 13:00:53 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6eacaa218sm4852005ab.25.2024.11.07.13.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 13:00:53 -0800 (PST) Date: Thu, 7 Nov 2024 15:00:51 -0600 From: Nathan Bossart To: "Devulapalli, Raghuveer" Cc: "pgsql-hackers@lists.postgresql.org" Subject: Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk + __attribute__((target("sse4.2"))) These need to be surrounded with #if defined(__has_attribute) && __has_attribute (target) so that we still attempt the check on compilers that don't support it (e.g., MSVC). # Check for Intel SSE 4.2 intrinsics to do CRC calculations. # -# First check if the _mm_crc32_u8 and _mm_crc32_u64 intrinsics can be used -# with the default compiler flags. If not, check if adding the -msse4.2 -# flag helps. CFLAGS_CRC is set to -msse4.2 if that's required. +# Check if the _mm_crc32_u8 and _mm_crc32_u64 intrinsics can be used +# with the __attribute__((target("sse4.2"))). PGAC_SSE42_CRC32_INTRINSICS([]) -if test x"$pgac_sse42_crc32_intrinsics" != x"yes"; then - PGAC_SSE42_CRC32_INTRINSICS([-msse4.2]) -fi IIUC this means we will never set USE_SSE42_CRC32C_WITH_RUNTIME_CHECK. To maintain the existing behavior, I think we need to still perform two configure tests (one with __attribute__((target(...))) and another without), and then we can choose whether to set USE_SSE42_CRC32C or USE_SSE42_CRC32C_WITH_RUNTIME_CHECK based on the results. + 'pg_crc32c_sse42_choose.c', + 'pg_crc32c_sse42.c', Can we combine these? -- nathan