Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
Date 6/24/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Multiplication Operators

The multiplication operators can only accept and return data types from the I[s|u]16vec4 or I[s|u]16vec8 classes, as shown in the following examples:

  • Explicitly convert B to Is16vec4:
    Is16vec4 A,C; 
    Iu32vec2 B; 
    
    C = A * C; 
    C = A * (Is16vec4)B; 
    
  • Return nearest common ancestor type, I16vec4:
    Is16vec4 A; 
    Iu16vec4 B; 
    I16vec4 C; 
    
    C = A + B; 
    
  • The mul_high and mul_add functions take Is16vec4 data only:
    Is16vec4 A,B,C,D; 
    
    C = mul_high(A,B);
    D = mul_add(A,B);
    

Multiplication Operators with Corresponding Intrinsics

Symbols

Syntax Usage

Intrinsic

*

*=

R = A * B
R *= A

_mm_mullo_pi16
_mm_mullo_epi16

mul_high

N/A

R = mul_high(A, B)

_mm_mulhi_pi16
_mm_mulhi_epi16

mul_add

N/A

R = mul_high(A, B)

_mm_madd_pi16
_mm_madd_epi16

Multiplication Operator Overloading

The multiplication return operators always return the nearest common ancestor as listed in the following table. The two operands must be 16 bits in size, otherwise you must explicitly indicate typecasting.

R

Mul

Operand A

Operand B

I16vec4 R

*

I[s|u]16vec4 A

I[s|u]16vec4 B

I16vec8 R

*

I[s|u]16vec8 A

I[s|u]16vec8 B

Is16vec4 R

mul_add

Is16vec4 A

Is16vec4 B

Is16vec8

mul_add

Is16vec8 A

Is16vec8 B

Is32vec2 R

mul_high

Is16vec4 A

Is16vec4 B

Is32vec4 R

mul_high

s16vec8 A

Is16vec8 B

Multiplication with Assignment

The following table lists the return values and data type assignments for operands of the multiplication operators with assignment. All operands must be 16 bytes in size. If the operands are not the right size, you must use an explicit typecast.

Return Value

Left Side Operand

Mul

Right Side Operand

I[x]16vec8

I[x]16vec8

*=

I[s|u]16vec8 A;

I[x]16vec4

I[x]16vec4

*=

I[s|u]16vec4 A;