If two float-vectors are compared (using ==, <, >, <=, >=) the result cannot be used for further vector-operations, unless the intermediate value is stored in a variable or cast to its own type. Example:
import core.simd;
void foo() {
float4 value1 = 0;
float4 value2 = 1;
// Error: incompatible types for '(value1 == value2) & (value1 < value2)': '__vector(uint[4])' and '__vector(uint[4])'
uint4 mask = ((value1 == value2) & (value1 < value2));
// works, even though the same types are used
uint4 equal = (value1 == value2);
uint4 less = (value1 < value2);
uint4 mask2 = (equal & less);
uint4 mask3 = (cast(uint4)(value1 == value2) & cast(uint4)(value1 < value2));
}
Tested on DMD v2.105.2.
Comment #1 by robert.schadek — 2024-12-13T19:31:09Z