www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24189] New: Result of float-vector comparison has

https://issues.dlang.org/show_bug.cgi?id=24189

          Issue ID: 24189
           Summary: Result of float-vector comparison has inconsistent
                    type
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kytodragon e.mail.de

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.

--
Oct 15 2023