All of lore.kernel.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Matt Brown <matthew.brown.dev@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2 2/5] powerpc/lib/sstep: Add popcnt instruction emulation
Date: Mon, 24 Jul 2017 02:36:55 -0500	[thread overview]
Message-ID: <20170724073654.GR13471@gate.crashing.org> (raw)
In-Reply-To: <20170724010109.21263-2-matthew.brown.dev@gmail.com>

Hi Matt,

On Mon, Jul 24, 2017 at 11:01:06AM +1000, Matt Brown wrote:
> +	for (i = 0; i < (64 / size); i++) {

If you do

  for (i = 0; i < 64; i += size)

things are slightly nicer.

> +		if ((i * size) < 32)
> +			low |= n << (i * size);
> +		else
> +			high |= n << ((i * size) - 32);
> +	}
> +	regs->gpr[ra] = (high << 32) | low;

Why have separate high and low vars?

And there are much better ways to calculate popcount, of course.


Segher

  reply	other threads:[~2017-07-24  7:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24  1:01 [PATCH v2 1/5] powerpc/lib/sstep: Add cmpb instruction emulation Matt Brown
2017-07-24  1:01 ` [PATCH v2 2/5] powerpc/lib/sstep: Add popcnt " Matt Brown
2017-07-24  7:36   ` Segher Boessenkool [this message]
2017-07-24 10:28   ` Balbir Singh
2017-07-25  0:53     ` Matt Brown
2017-07-24  1:01 ` [PATCH v2 3/5] powerpc/lib/sstep: Add bpermd " Matt Brown
2017-07-24  1:01 ` [PATCH 4/5] powerpc/lib/sstep: Add prty " Matt Brown
2017-07-24  1:01 ` [PATCH v2 5/5] powerpc/lib/sstep: Add isel " Matt Brown

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=20170724073654.GR13471@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=matthew.brown.dev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.