The real intrinsic takes a const int
and the ISA specifies that only the bits that are relevant for the registers involved are taken into account. That is, the higher bits of the mask are ignored, and the higher bits of the destination registers are unmodified.
what should happen if you pass 33? A compile-time error? Maybe even an error issued from the assembler?
Neither. The blendps
instruction is generated with the immediate value specified by the user. Even if there was an intrinsic for which the wrong value would result in hardware undefined behavior, which AFAIK is not the case (but I don't know all intrinsics by heart), that would just mean that there is a pre-condition on the value that the user must uphold, but that's ok because the intrinsic is unsafe
anyways, which means that the user is responsible of upholding such preconditions.
I think there will be many applications which benefit from doing the calculation at run time, with an expectation that the compiler will select the appropriate instruction, perhaps one with an immediate mask operand, perhaps not.
That's what the portable packed-SIMD vector types are for. The ISA intrinsics map to the ISA.