Intrinsics for Math.min and max
Vitaly Davidovich
vitalyd at gmail.com
Tue Apr 1 21:58:26 UTC 2014
Apologies, meant to reply to the list.
Sent from my phone
On Apr 1, 2014 5:48 PM, "Vitaly Davidovich" <vitalyd at gmail.com> wrote:
> I can't see the attachment (on my phone) but I'm guessing the jumps
> generated by manual code are highly predicted? What if you try it with an
> array of random values?
>
> I'm guessing the cmov based intrinsics only win on (a) cpus with poor
> branch prediction, (b) unpredictable branches, or (c) code with lots of
> branches clogging up branch history buffer. Also, is compiler generating
> larger code when using jumps? If so, icache pressure could be an issue; I
> don't think a microbenchmark will capture that though.
>
> Sent from my phone
> On Apr 1, 2014 5:30 PM, "Martin Grajcar" <maaartinus at gmail.com> wrote:
>
>> Done and attached. The results are pretty clear:
>>
>> Benchmark Mode Samples Mean Mean
>> error Units
>> o.o.j.s.JmhMaxBenchmark.intrinsic avgt 100 0.922
>> 0.001 ns/op
>> o.o.j.s.JmhMaxBenchmark.own avgt 100 0.408
>> 0.005 ns/op
>>
>> openjdk version "1.9.0-internal"
>> OpenJDK Runtime Environment (build
>> 1.9.0-internal-maaartin_2014_02_18_06_05-b00)
>> OpenJDK 64-Bit Server VM (build 25.0-b62, mixed mode)
>> model name : Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz
>>
>> Regards,
>> Martin.
>>
>>
>>
>> On Tue, Apr 1, 2014 at 10:42 AM, Andrew Haley <aph at redhat.com> wrote:
>>
>>> On 04/01/2014 07:02 AM, Martin Grajcar wrote:
>>> > I wonder if these intrinsics still make sense when the compiler can
>>> > generate movcc itself. According to this SO question
>>> >
>>> http://stackoverflow.com/questions/22752198/java-math-min-max-performance
>>> > it can lead to a factor two slowdown (I guess a JMH benchmark would
>>> confirm
>>> > this).
>>>
>>> Exactly. Will you do it?
>>>
>>> Andrew.
>>>
>>>
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20140401/a5eaec26/attachment-0001.html>
More information about the hotspot-compiler-dev
mailing list