| From: | John Naylor <johncnaylorls(at)gmail(dot)com> |
|---|---|
| To: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Lukas Fittl <lukas(at)fittl(dot)com> |
| Subject: | Re: Centralised architecture detection |
| Date: | 2026-04-09 08:16:33 |
| Message-ID: | CANWCAZZ3KyXYEsBpSpMHtXAdo=KXkUG00rX+bG4_fe1w9vzjAw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, Apr 9, 2026 at 8:02 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> Here's an update of my old patch. It just defines macros like this,
> in c.h, though since then we gained port/pg_cpu.h, so perhaps it
> belongs in there.
port/pg_cpu.h would seem like the natural place for something like
this, and I deliberately made that header's name not specific to one
architecture. But see below.
> Lukas and John have both been doing similar sorts of things and may
> have better ideas or patches, but I figured I should at least re-post
> what I have.
From that thread, I think the final committed version ended up with
fewer places that cared about architecture macros, and that's why it
was left out. I for one was not motivated to continue that work, but I
don't see a reason not to, either. And as you said, this might help
avoid errors of omission going forward.
--- a/src/port/pg_crc32c_sse42.c
+++ b/src/port/pg_crc32c_sse42.c
@@ -39,7 +39,7 @@ pg_comp_crc32c_sse42(pg_crc32c crc, const void
*data, size_t len)
* and performance testing didn't show any performance gain from aligning
* the begin address.
*/
-#ifdef __x86_64__
+#ifdef PG_ARCH_X86_64
while (p + 8 <= pend)
That probably should have been "SIZEOF_VOID_P >= 8" to begin with.
Also, src/port/pg_cpu_x86.c currently has this hack:
#if defined(USE_SSE2) || defined(__i386__)
That's an awkward way of saying "x86 of any word size, but forget
about 32-bit MSVC because it won't get tested in the buildfarm", and
should probably use PG_ARCH_X86 from this patch. However, as currently
written, that would only work if the new macros were in c.h, to keep
the property that system headers come before (most) PG headers.
--
John Naylor
Amazon Web Services
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jakub Wartak | 2026-04-09 08:35:48 | Re: Failing test_aio tests due to too low(illegal?) segsize_blocks |
| Previous Message | Richard Guo | 2026-04-09 08:05:11 | Re: Potential partition pruning regression on PostgreSQL 18 |