The right shift argument can be any integer or Ivec value, and is implicitly converted to a M64 data type. The first or left operand of a << can be of any type except I[s|u]8vec[8|16]. For example:
Is16vec4 A,C; Iu32vec2 B; C = A;
Is16vec4 A, C; Iu16vec4 B, R; R = (Iu16vec4)(A & B) C;
R = (Is16vec4)(A & B) C;
Shift Operators with Corresponding Intrinsics
Operation |
Symbols |
Syntax Usage |
Intrinsic |
---|---|---|---|
Shift Left |
<< |
R = A << B |
_mm_sll_si64 |
Shift Right |
>> |
R = A >> B |
_mm_srl_si64 |
Shift Operator Overloading
Right shift operations with signed data types use arithmetic shifts. All unsigned and intermediate classes correspond to logical shifts. The following table lists how the return type is determined by the first argument type:
Option |
R |
Right Shift | Left Shift | A |
B |
||
---|---|---|---|---|---|---|---|
Logical |
I64vec1 |
>> |
>>= |
<< |
<<= |
I64vec1 A; |
I64vec1 B; |
Logical |
I32vec2 |
>> |
>>= |
<< |
<<= |
I32vec2 A |
I32vec2 B; |
Arithmetic |
Is32vec2 |
>> |
>>= |
<< |
<<= |
Is32vec2 A |
I[s|u][N]vec[N] B; |
Logical |
Iu32vec2 |
>> |
>>= |
<< |
<<= |
Iu32vec2 A |
I[s|u][N]vec[N] B; |
Logical |
I16vec4 |
>> |
>>= |
<< |
<<= |
I16vec4 A |
I16vec4 B |
Arithmetic |
Is16vec4 |
>> |
>>= |
<< |
<<= |
Is16vec4 A |
I[s|u][N]vec[N] B; |
Logical |
Iu16vec4 |
>> |
>>= |
<< |
<<= |
Iu16vec4 A |
I[s|u][N]vec[N] B; |