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 1t9TOm-00AOqh-Db for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Nov 2024 18:07:55 +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 1t9TOi-00Bs3c-Ro for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Nov 2024 18:07:53 +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 1t9TOi-00Bs3U-HR for pgsql-hackers@lists.postgresql.org; Fri, 08 Nov 2024 18:07:53 +0000 Received: from mail-il1-x12f.google.com ([2607:f8b0:4864:20::12f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t9TOe-000tCF-SF for pgsql-hackers@lists.postgresql.org; Fri, 08 Nov 2024 18:07:52 +0000 Received: by mail-il1-x12f.google.com with SMTP id e9e14a558f8ab-3a6e960fb5dso8522425ab.0 for ; Fri, 08 Nov 2024 10:07:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731089268; x=1731694068; 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=gbFXUhZSeIhq6E0F0RzbC/LyUayiSf8J//qhmLr8Wec=; b=QF9oS1HPa2ZIzqG9PwXHG3vQh9zAMTYd5bBPp5/ZZq2RgLGc6IjxywBFIluPvdkBUB 9gTuDT/AsVgP/IKjm0qbFVsDGpw3O3WJ3lo2qDuRGR06LO0gMnGgu1ZPwnvGfh9r7ofC UiAs6JKo8jLTnUWd1AuJ6Ki/TdQ3GXbZGEj+n90Of4uHYrwU0di7F/cZZPFtUVNCLUbw lDqK26o6Q9hgBkGWD0scI/gOObs2c2FlJH2BMItkxO21Jx+mtkLTNScqivPlntbWomgf wE9pZCJDTmJ7GKNv64OupjEVAI0QZ1LNFumcNYVdEXCAveSNDU2c8uzzh8dxUyQl1rlR wdqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731089268; x=1731694068; 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=gbFXUhZSeIhq6E0F0RzbC/LyUayiSf8J//qhmLr8Wec=; b=XKckTDcPtZJjIb5oWm0h+lczqB8w+dvwhbO1CoBpDqHzWZXnSIwCtrgZW28LzAeer1 xjE+TBsqrpDuXbTLJSfWHpM4Mp65rS/l9XNnCaw7IL6edDKvA12NGxupfLPqZiH4ud84 MP30NoNQLBQntmfg1QBsj0GE8HaTpXxle1CLFiPFx6kdWJ5jM/3UUGTWBsIoqr9a2pIF QYdU8CElM+1DzaUSbOkb1J2DUU3DP2XUMOiVGE6nfielr6tkdupZ7jWpgb+xbMyX27wX EC0mGZsJPqz2g2qsKVkoUInv6kscgiAQZJaoYkH6rb7xfD6y86SqOap4mMjmHHsd0HNL zYag== X-Gm-Message-State: AOJu0YwLoJtFnzGKbfwZPR0Qp3HXAOIE04aZ89EzjzSnZ7t8fWMAZXDM fsjgNNnL96DIVzGyVxzkKFJi9gH2n199wmHLpp+NWgVNxr5p26Hbn7Y2+Q== X-Google-Smtp-Source: AGHT+IEJbJZMbFy+yHdeNaSPlqsGb2m0y4aqjfyatv+J2ujM88kDhzqPyHcuxw+r2dOJ/Sq/Mjrgxw== X-Received: by 2002:a05:6e02:13ac:b0:3a0:8d60:8ba7 with SMTP id e9e14a558f8ab-3a6f19d0f2bmr49029105ab.14.1731089267868; Fri, 08 Nov 2024 10:07:47 -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-3a6eacaa583sm9875465ab.28.2024.11.08.10.07.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 10:07:47 -0800 (PST) Date: Fri, 8 Nov 2024 12:07:45 -0600 From: Nathan Bossart To: "Devulapalli, Raghuveer" Cc: "pgsql-hackers@lists.postgresql.org" , "Shankaran, Akash" 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 On Fri, Nov 08, 2024 at 05:52:23PM +0000, Devulapalli, Raghuveer wrote: >> So, for meson builds, we do test with and without __attribute___((target(..."))), >> but for autoconf builds, we check for __SSE4_2__ to determine whether we need >> a runtime check. This difference isn't the fault of your patch, but it's a little odd. >> That being said, I'm not sure there's a problem with either approach. > > I just realized, isn't this a problem on MSVC? When building with MSVC, > USE_SSE42_CRC32C is always set to true (because MSVC doesn't require a > specific SSE42 flag to build with): see > https://gcc.godbolt.org/z/eoc1Ec33j. This means it is always running the > SSE42 without a runtime check which can technically SEGILL on a really > old CPU (SSE42 is nearly 18 years old though). This problem exists in the > master branch too. I believe we expect MSVC builds to use meson at this point, which is probably why there's this extra check: if cc.get_id() == 'msvc' cdata.set('USE_SSE42_CRC32C', false) cdata.set('USE_SSE42_CRC32C_WITH_RUNTIME_CHECK', 1) have_optimized_crc = true There used to be special MSVC scripts (removed in commit 1301c80), and it looks like those just set USE_SSE42_CRC32C_WITH_RUNTIME_CHECK unconditionally, too. -- nathan