Hello, Stephan> I didn't know about exceptions like _Complex that you mentioned. The > only way to support them is to place the burden of correct parameter > passing on the front-end, I understand that now.Right. Especially when ABI dictates quite "weird" rules (read e.g. x86-64 ABI or ARM EABI). We do support one "exception" though for win64 - __m128 vectors. This was done since they are native types and thus do not get changed by type legalizer. I have no idea why MS decided not to pass then in registers... This is silly...> So, today I created a new transformation pass that makes sure that > LLVM IR, which works alright with the default Win32 calling > conventions, also plays nice with Win64 code within the limited scope > of my language (that requires packing of aggregates of sizes 8, 16, > 32, and 64-bits into an integer argument, and passing of larger > aggregates by reference).Sounds like pretty sane approach :) -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
Ahoi Anton,> We do support one "exception" though for win64 - __m128 vectors. This > was done since they are > native types and thus do not get changed by type legalizer. I have no > idea why MS decided not to > pass then in registers... This is silly...Hmm, maybe I can explain this: The Microsoft docs state that for unprototyped functions floating-point values need to be passed as double precision in both the floating-point registers (XMMn) and the integer registers (RCX, etc.). That obviously doesn't work for SSE vectors because they don't fit into the integer registers. So, there's only pass-by-reference of the first four vectors, which they might have generalized to all functions (even with complete signatures) for consistency. Still weird though ...> Sounds like pretty sane approach :)... which I just modified to *not* massage SSE vectors, as you mentioned that LLVM would take care of this. :-) Have a great weekend and thanks for your help, Stephan
Hello, Stephan> Hmm, maybe I can explain this: The Microsoft docs state that for > unprototyped functions floating-point values need to be passed as > double precision in both the floating-point registers (XMMn) and the > integer registers (RCX, etc.). That obviously doesn't work for SSE > vectors because they don't fit into the integer registers. So, there's > only pass-by-reference of the first four vectors, which they might > have generalized to all functions (even with complete signatures) for > consistency. Still weird though ...Right. Since this is definitely a waste of resources (=registers). Looks like they didn't care about performance at all! -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University