I guess x86 Windows is bearophile's platform of choice, and that's the compiler he used when he found the bug.
Comment #6 by bearophile_hugs — 2013-12-09T03:00:11Z
The ICE is fixex, but this code gives:
import core.simd: ulong2;
void main() {
ulong2 x;
immutable ulong2 y;
bool b = x == y;
}
temp.d(5): Error: incompatible types for ((cast(const(__vector(ulong[2])))x) == (cast(const(__vector(ulong[2])))y)): 'const(__vector(ulong[2]))' and 'const(__vector(ulong[2]))'
Comment #7 by ibuclaw — 2013-12-09T03:11:48Z
See the testcase in the pull request.
Currently the frontend explicitly disallows comparing vectors using == expression. This seems like an odd limitation to me, but I'm not arguing it.
Please raise a new pull request if you wish to change the language behaviour.
Regards
Iain
Comment #8 by ibuclaw — 2013-12-09T03:12:36Z
Err... I mean please raise a new bug report.
Comment #9 by ibuclaw — 2013-12-10T02:01:53Z
One thing to note is that the result of a vector == comparison would not be a boolean.
import core.simd;
int4 a = [1,2,3,4];
int4 b = [3,2,1,4];
if (a == b) { } // Error: vector comparison returning a boolean.
int4 c = (a == b);
assert(c.array = [0, -1, 0, -1]);
Comment #10 by bearophile_hugs — 2013-12-10T04:53:50Z
(In reply to comment #9)
> One thing to note is that the result of a vector == comparison would not be a
> boolean.
>
> import core.simd;
>
> int4 a = [1,2,3,4];
> int4 b = [3,2,1,4];
>
> if (a == b) { } // Error: vector comparison returning a boolean.
>
> int4 c = (a == b);
> assert(c.array = [0, -1, 0, -1]);
That seems acceptable. But Manu is much more expert than me on such matters, so we should listen to his opinion on this.
A possible semantics for:
if (a == b) {} else {}
Is to run the first branch if all items are equal ([-1, -1, -1, -1]) and the second branch otherwise. I am not sure but I think some kind of Intel compiler works like this.