[PATCH] [AArch64] Lower sdiv x, pow2 using add + select + shift.

Tim Northover t.p.northover at gmail.com
Thu Jul 10 04:11:30 PDT 2014

> I’ve taken a look at the performance of that code sequence, and can confirm
> that it is no worse in all situations than the current sequence. In some
> situations it causes a ~5% performance uplift on A53, and in some cases a
> ~20% performance uplift in A57 (on a microbenchmark running this sequence in
> a loop).

I've run some very simplistic tests on Cyclone and it seems like it's
helpful there too.

As for the code, that's a fairly nasty function to spot the idiom. It
would be better if we could avoid forming the original pattern in the
first place. What if we move the call to BuildSDIV above the pow2
block in DAGCombiner::visitSDIV and override it on AArch64 to handle
this specific case?

I'd actually be interested to know which sequence is better on other
targets: the existing one seems to win on my Sandy Bridge x86, but I'm
slightly suspicious of it in general. Never mind, we can ignore that
for this patch, I think.



More information about the llvm-commits mailing list