digitalmars.D.learn - Question about Vectors
- Charles (25/25) Nov 20 2014 So I was reading the documentation page:
- Marco Leise (6/40) Nov 21 2014 DMD supports SIMD only on amd64, but you can use the GDC or
So I was reading the documentation page: http://dlang.org/simd.html and noticed what appears to be a typo: int4 v; (cast(int*)&v)[3] = 2; // set 3rd element of the 4 int vector (cast(int[4])v)[3] = 2; // set 3rd element of the 4 int vector v.array[3] = 2; // set 3rd element of the 4 int vector v.ptr[3] = 2; // set 3rd element of the 4 int vector v.array[3] = 2; and v.ptr[3] = 2; set the fourth element, and not the third. As I was verifying this, I realized I had to compile it in 64 bit code. The 32 bit code produced the error "SIMD vector types not supported on this platform". My test code is: void main() { import std.stdio; import core.simd; int4 v = 7; v.ptr[3] = 2; writeln(v.array[]); } Is that related to me compiling while using a 64 bit OS, or is that true of any 32 bit OS, and thus, vectors can't be used in programs intended to be run on 32 bit OSs? Thanks, Charles
Nov 20 2014
Am Thu, 20 Nov 2014 20:17:31 +0000 schrieb "Charles" <csmith.ku2013 gmail.com>:So I was reading the documentation page: http://dlang.org/simd.html and noticed what appears to be a typo: int4 v; (cast(int*)&v)[3] = 2; // set 3rd element of the 4 int vector (cast(int[4])v)[3] = 2; // set 3rd element of the 4 int vector v.array[3] = 2; // set 3rd element of the 4 int vector v.ptr[3] = 2; // set 3rd element of the 4 int vector v.array[3] = 2; and v.ptr[3] = 2; set the fourth element, and not the third. As I was verifying this, I realized I had to compile it in 64 bit code. The 32 bit code produced the error "SIMD vector types not supported on this platform". My test code is: void main() { import std.stdio; import core.simd; int4 v = 7; v.ptr[3] = 2; writeln(v.array[]); } Is that related to me compiling while using a 64 bit OS, or is that true of any 32 bit OS, and thus, vectors can't be used in programs intended to be run on 32 bit OSs? Thanks, CharlesDMD supports SIMD only on amd64, but you can use the GDC or LDC2 compilers if you need 32-bit support for vector types. -- Marco
Nov 21 2014