Re: Alignment of struct containing SIMD field - GDC

2017-03-02 Thread Johan Engelen via Digitalmars-d-learn
On Thursday, 2 March 2017 at 13:00:08 UTC, Cecil Ward wrote: Raised bug here, and I'm raising a PR now also. https://issues.dlang.org/show_bug.cgi?id=17237 Iain, this of course is present in my version of LDC too. (I checked.) You couldn't poke David Nadlinger or whoever for me? Poke recei

Re: Alignment of struct containing SIMD field - GDC

2017-03-02 Thread Cecil Ward via Digitalmars-d-learn
On Wednesday, 1 March 2017 at 22:15:59 UTC, Iain Buclaw wrote: On Wednesday, 1 March 2017 at 19:09:24 UTC, Johan Engelen wrote: On Wednesday, 1 March 2017 at 18:34:16 UTC, Iain Buclaw wrote: Simple test case would be: struct vec_struct { bool b2; struct { bool b; int8

Re: Alignment of struct containing SIMD field - GDC

2017-03-01 Thread Cecil Ward via Digitalmars-d-learn
On Wednesday, 1 March 2017 at 22:15:59 UTC, Iain Buclaw wrote: On Wednesday, 1 March 2017 at 19:09:24 UTC, Johan Engelen wrote: On Wednesday, 1 March 2017 at 18:34:16 UTC, Iain Buclaw wrote: Simple test case would be: struct vec_struct { bool b2; struct { bool b; int8

Re: Alignment of struct containing SIMD field - GDC

2017-03-01 Thread Cecil Ward via Digitalmars-d-learn
On Wednesday, 1 March 2017 at 22:15:59 UTC, Iain Buclaw wrote: On Wednesday, 1 March 2017 at 19:09:24 UTC, Johan Engelen wrote: On Wednesday, 1 March 2017 at 18:34:16 UTC, Iain Buclaw wrote: Simple test case would be: struct vec_struct { bool b2; struct { bool b; int8

Re: Alignment of struct containing SIMD field - GDC

2017-03-01 Thread Iain Buclaw via Digitalmars-d-learn
On Wednesday, 1 March 2017 at 19:09:24 UTC, Johan Engelen wrote: On Wednesday, 1 March 2017 at 18:34:16 UTC, Iain Buclaw wrote: Simple test case would be: struct vec_struct { bool b2; struct { bool b; int8 field; } } static assert(vec_struct.b.offsetof == 32); stat

Re: Alignment of struct containing SIMD field - GDC

2017-03-01 Thread Johan Engelen via Digitalmars-d-learn
On Wednesday, 1 March 2017 at 18:34:16 UTC, Iain Buclaw wrote: Simple test case would be: struct vec_struct { bool b2; struct { bool b; int8 field; } } static assert(vec_struct.b.offsetof == 32); static assert(vec_struct.field.offsetof == 64); With explicit align(

Re: Alignment of struct containing SIMD field - GDC

2017-03-01 Thread Iain Buclaw via Digitalmars-d-learn
On Wednesday, 1 March 2017 at 06:04:32 UTC, Cecil Ward wrote: struct vec_struct { alias field this; bool b; int8 field; } In this code when you look at the generated x64 code output by GDC it seems to be doing a nice job, because it has got the offset right for the 256-bit YMM

Alignment of struct containing SIMD field - GDC

2017-02-28 Thread Cecil Ward via Digitalmars-d-learn
struct vec_struct { alias field this; bool b; int8 field; } In this code when you look at the generated x64 code output by GDC it seems to be doing a nice job, because it has got the offset right for the 256-bit YMM 'field' correct. Does D automatically propagate the alignment

Re: alignment of struct

2014-03-14 Thread TJB
On Friday, 14 March 2014 at 00:07:12 UTC, bearophile wrote: Justin Whear: It did change a few versions ago (not sure exactly when). Try adding `align(1):` inside the structs before the members. Yes it's a recent change, the align() on outside is the alignment of the whole struct, and the a

Re: alignment of struct

2014-03-13 Thread bearophile
Justin Whear: It did change a few versions ago (not sure exactly when). Try adding `align(1):` inside the structs before the members. Yes it's a recent change, the align() on outside is the alignment of the whole struct, and the align inside is the alignment of the single field relative to

Re: alignment of struct

2014-03-13 Thread Justin Whear
On Thu, 13 Mar 2014 23:19:59 +, TJB wrote: > Why the difference? What is weird is that the two codes used to give > the same answers. Has the alignment value of structs changed recently? It did change a few versions ago (not sure exactly when). Try adding `align(1):` inside the structs be

alignment of struct

2014-03-13 Thread TJB
I am a bit confused by the alignment of a struct in D. I have some C++ code that I am translating into D. Here is the C++: #include #include #include struct TradesIdx { char symbol[10]; int tdate; int begrec; int endrec; }__attribute__((packed)); struct TradesBin { int ttim; i