[Issue 24189] New: Result of float-vector comparison has inconsistent type
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Oct 15 07:41:20 UTC 2023
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 at puremagic.com
Reporter: kytodragon at 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.
--
More information about the Digitalmars-d-bugs
mailing list