From: ori@eigenstate.org
To: kemalinanc8@gmail.com
To: 9front@9front.org
Subject: Re: [9front] [PATCH] branchless assembly abs() and labs() for amd64
Date: Fri, 25 Dec 2020 17:38:45 -0800 [thread overview]
Message-ID: <C2F9E8E3B4897A23622138292ADD342F@eigenstate.org> (raw)
In-Reply-To: <CABO6shc211=pPhOTNAT+tyTgihPWSrqwGYSkQyasK=xM69QmRQ@mail.gmail.com>
Quoth Kemal <kemalinanc8@gmail.com>:
> hello again,
>
> on maintainability issue, we can do it on c with bit shifts like this:
Simplicity and clarity should win unless the
added complexity buys us something. To me, the
bit twiddling operation seems less obviously
correct than the current:
if(a < 0)
return -a;
return a;
I appreciate the effort, but I'd prefer that we
leave this patch be unless it's solving a problem
Optimization should ideally start with measuring
a real program.
> on size, the assembly one seems to be the clear winner. the original
> abs's object file (unlinked) is around 400~ bytes, assembly one is
> 120-140~, the branchless c one is 300~.
Note that unlinked sizes don't matter much: our
object files do not contain encoded assembly, but
instead a simpler "bytecode" that the linker will
optimize lightly and then encode.
next prev parent reply other threads:[~2020-12-26 1:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-25 16:36 Kemal
2020-12-25 18:13 ` ori
2020-12-25 18:28 ` boehm.igor
2020-12-25 22:30 ` Kemal
2020-12-26 1:38 ` ori [this message]
2020-12-26 14:12 ` Kemal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C2F9E8E3B4897A23622138292ADD342F@eigenstate.org \
--to=ori@eigenstate.org \
--cc=9front@9front.org \
--cc=kemalinanc8@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).