News for hackers. Stuff that matters.
Re:New JIT optimizer in the Zing JVM by gopalv on Wednesday May 03, 2017 @04:51PM (#14259940)
> I have no idea if HotSpot optimises the specific loop Gil posted,

I'm actually curious to see what the output assembly of LLVM is for that loop, because JDK8 does not optimize a branch in a loop.

But the JVM does do a pretty decent job using ymm<n> registers if you write the loops without branches.

But you end up with really obscure java code like

"(((a - b) ^ (b - a)) >>> 63) ^ 1"

To convert a branch into an integer.

Re:New JIT optimizer in the Zing JVM by giltene on Wednesday May 03, 2017 @04:58PM (#14260015)
I had actually posted an annotated assembly output for one of this example vector tests (the doAddArraysIfEven one) here: https://groups.google.com/d/msg/mechanical-sympathy/EMIBqjX4...

Enjoy!

Re:New JIT optimizer in the Zing JVM by mike_hearn on Thursday May 04, 2017 @04:17AM (#14263366)
If you're testing with JDK8 you're missing the last two years of work on the optimiser. I'd be interested to see what Java 9 does, as it's (supposedly) coming out in a few months.
Re:New JIT optimizer in the Zing JVM by opportun1st on Thursday May 04, 2017 @02:39PM (#14267493)
JDK9 has the capability to vectorize a loop with branch inside. I tried JDK9 early release with a simple testing case myself.
Re:New JIT optimizer in the Zing JVM by flamedoge on Wednesday May 03, 2017 @04:56PM (#14260000)
you certainly can vectorize branch in a loop. Unroll loop, compute conditions in parallel, use result as a mask for conditional computation.
Re:New JIT optimizer in the Zing JVM by barrkel on Wednesday May 03, 2017 @06:33PM (#14260819)
The parent's point was that the JVM didn't vectorize, not that it wasn't possible.
Re:New JIT optimizer in the Zing JVM by raphlinus on Wednesday May 03, 2017 @07:00PM (#14260997)
Pretty sure that code gives the wrong answer for a = 0, b = 1 << 63 (assuming the goal is equality represented as 0 or 1).