[vector] binary operations with a scalar

Paul Sandoz paul.sandoz at oracle.com
Tue Feb 20 22:17:15 UTC 2018



> On Feb 20, 2018, at 1:26 PM, Vladimir Ivanov <vladimir.x.ivanov at oracle.com> wrote:
> 
> 
> 
> 
>> I like this but suggest we keep the code marginally simpler and revisit if we have performance concerns. If we don’t make intrinsic the broadcast+op combination i think something like this is probably ok for now:
>>    @Override
>>    @ForceInline
>>    public Int256Vector add(int o) {
>>        return add(Int256Species.broadcastImpl(o));
>>    }
> 
> If we don't care about optimized default implementation, then even simpler variant should work:
> 
>     @Override
>     @ForceInline
>     public Int256Vector add(int i) {
>         return add(species().broadcast(i));
>     }
> 
> add(), species(), and broadcast() methdos are trivially inlined since the new method is declared in concrete vector class.
> 

Ah! so a call to say species() is problematic if we are at the abstract level, say IntVector?

Paul.


More information about the panama-dev mailing list