| From: | Ewan Young <kdbase(dot)hack(at)gmail(dot)com> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, David Rowley <dgrowleyml(at)gmail(dot)com>, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
| Subject: | Re: Use pg_neg_s*_overflow() for open-coded negation overflow checks |
| Date: | 2026-09-02 03:29:25 |
| Message-ID: | CAON2xHOGZYim=B8OfQpLXHza7B0QmRK5uoquWLj+Ft4EPxYWpw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, Sep 2, 2026 at 7:16 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Tue, Sep 01, 2026 at 02:26:38PM +0800, Ewan Young wrote:
> > I see this went in as 8e483af5515 in the meantime -- thanks a lot for
> > the commit and the credit!
> >
> > FWIW, the two um/div sites left out, int2um() and int2div(), turn out
> > to be mixed rather than clean: clang 15 compiles the int16
> > __builtin_sub_overflow() one instruction worse on the hot path, while
> > gcc 12 does one better (neg + jo).
>
> Please note that I'd be OK to look at this stuff again if we have
> other similar opportunities. I am not really convinced by your
> v2-0002. The other opportunities in v2-0001 could be reconsidered if
> rewritten in a different way, but it's also tricky to evaluate due to
> the with/without builtin and compiler requirements.
>
> I would accept something that proves to be a net benefit in rather new
> versions of gcc and clang, as well as a net benefit with/without the
> builtin. 8e483af5515 was exactly that, with less or the same amount of
> instructions (the cash change was super nice) for all setups I have
> tested (Linux and macos).
Fair enough on 0002 -- let's drop it. Thanks again for taking the good batch!
> --
> Michael
--
Regards,
Ewan Young
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tender Wang | 2026-09-02 03:42:16 | Re: remove_useless_joins vs. bug #19560 |
| Previous Message | Marina Polyakova | 2026-09-02 03:08:31 | Re: Function scan FDW pushdown |