RFR: 8338021: Support new unsigned and saturating vector operators in VectorAPI [v13]

Paul Sandoz psandoz at openjdk.org
Wed Sep 18 16:56:13 UTC 2024


On Wed, 18 Sep 2024 14:22:16 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

> > > Why is this even called `VectorMath`? Because those ops are not at all restricted to vectorization, right?
> > 
> > 
> > Nomenclature is suggested by Paul.
> 
> @PaulSandoz Do you want to limit these **scalar** operations to a class name that implies **vector** use?
> 

It's whatever math functions are required to in support of vector operations (as the JavaDoc indicates) that are not provided by other classes such as the boxed primitives or `java.lang.Math`.


/**
 * The class {@code VectorMath} contains methods for performing
 * scalar numeric operations in support of vector numeric operations.
 */
public final class VectorMath {


These are referenced by the vector operators e.g.,


    /** Produce saturating {@code a+b}.  Integral only.
     * @see VectorMath#addSaturating(int, int)
     */
    public static final Binary SADD = binary("SADD", "+", VectorSupport.VECTOR_OP_SADD, VO_NOFP);


And in addition these methods would be used by any tail computation (and the fallback code).

At the moment we are uncertain whether such operations should reside elsewhere and we did not want to block progress. I am not beholden to the name, but so far i cannot think of a concise alternative.`VectorOperatorMath` is arguably more precise but more verbose.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20507#issuecomment-2358973116


More information about the hotspot-dev mailing list