Developer Guide and Reference

Contents

Shift Operators

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]
.
Example Syntax Usage for Shift Operators
Automatic size and sign conversion.
Is16vec4 A,C;
Iu32vec2 B;
C = A;
A&B returns
I16vec4
, which must be cast to
Iu16vec4
to ensure logical shift, not arithmetic shift.
Is16vec4 A, C;
Iu16vec4 B, R;
R = (Iu16vec4)(A & B) C;
A&B returns
I16vec4
, which must be cast to
Is16vec4
to ensure arithmetic shift, not logical shift.
R = (Is16vec4)(A & B) C;
Shift Operators with Corresponding Intrinsics
Operation
Symbols
Syntax Usage
Intrinsic
Shift Left
<<
&=
R = A << B
R &= A
_mm_sll_si64
_mm_slli_si64
_mm_sll_pi32
_mm_slli_pi32
_mm_sll_pi16