LDC 0.11.0 Beta 3

bearophile bearophileHUGS at lycos.com
Sat Jun 22 08:16:41 PDT 2013


David Nadlinger:

> I just added the issues to the GitHub tracker, thanks again for 
> the excellent reports.

You are welcome. Minutes ago I have added some SIMD-related bug 
reports in the D Bugzilla. I have also found two SIMD-related 
things that maybe are related just to LDC2.

---------------------------------

This seems a LDC2 bug:

LDC bug:


import core.simd: double2;
void main() {
     double2 x = [1.0, 2.0];
     double2 r1 = x + [1.0, 2.0];
     double2 r2 = [1.0, 2.0] + x;
}


LDC2 v.0.11.0 gives:

test.d(5): Error: cannot implicitly convert expression 
(cast(__vector(double[2u]))[1, 2] + x) of type double[] to 
__vector(double[2u])



import core.simd: double2;
void main() {
     double x = 1.0, y = 2.0;
     double2 a = [x, y];
     double2 sum = [0.0, 0.0];
     sum += [x, y] / a;
}


LDC2 v.0.11.0 gives:

test.d(6): Error: incompatible types for ((sum) += 
(cast(__vector(double[2u]))[x, y] / a)): '__vector(double[2u])' 
and 'double[]'

---------------------------------

And this seems a ldc2 performance bug worth fixing:


import core.simd: double2;
double foo(in double2 x) pure nothrow {
     return x.array[0] + x.array[1];
}
int main() {
     double2 x = [1.0, 2.0];
     return cast(int)foo(x);
}


LDC2 compiles "foo" to:

__D4temp3fooFNaNbxNhG2dZd:
     pushl   %ebp
     movl    %esp, %ebp
     andl    $-8, %esp
     subl    $8, %esp
     movapd  %xmm0, %xmm1
     unpckhpd    %xmm1, %xmm1
     addsd   %xmm0, %xmm1
     movsd   %xmm1, (%esp)
     fldl    (%esp)
     movl    %ebp, %esp
     popl    %ebp
     ret


But gcc compiles similar code (that uses __m128d instead of 
double2) using the instruction "haddpd", that I think is 
shorter/more efficient here.

(I don't know how dmd and gdc compile that program).

Bye,
bearophile


More information about the digitalmars-d-ldc mailing list