|
From: Julian S. <js...@ac...> - 2012-08-23 17:08:28
|
> Long answer: Doubles are returned in %xmm0. So are SSE2 values > (__m128i). But integer aggregates -- including all arms of Valgrind's > V128 union -- are returned in RDX:RAX according to the ABI. Ok, good. > So, assuming dirty helpers are written in portable C (or "portable" > GCC), and that they only return integers or integer aggregates, then > yes, you can rely on the values being in RDX:RAX. > > Of course, there is nothing in principle preventing dirty helpers from > being platform dependent, but I assume you want to avoid that (?) > > On a related note, do you prefer portable C, or do you like GCC > extensions? In particular, GCC allows this: > > typedef unsigned long V128 __attribute__ ((mode(TI))); > > ...and then you can say "V128 x = 37; ++x;" and GCC will actually > generate code to perform 128-bit arithmetic on 64- or 32-bit > platforms. I prefer portable C. The ability of gcc to generate such 128 bit arithmetic is pretty much useless since we do zero 128 bit arithmetic except for some very obscure multiply cases, perhaps. > I assume you prefer portable C, especially since the above does not > extend to V256 and beyond, Yep. > So I guess my #1 question is this: Which one do you want? Implement > the platform-dependent ABI for each platform to allow helpers to > return V128? Or implement platform-independent marshalling to pass > "V128 *" to helpers? My inclination is to go for the platform-dependent ABI. After all we have to do ABI dependent stuff anyway as it is. There might be one complication though. If this works out, we will have a situation where helpers can return V128/V256 values, so that 128/256 bit shadow loads can be done in a single unit and hence we can do the partial- loads-ok game, which IIUC is the motivation for all this. However, it does mean Memcheck will then have an asymmetry w.r.t. processing shadow stores, in the sense that they will still be chopped up into 64-bit pieces. So it would ideally be nice to have a solution where we can also pass V128 and V256 as arguments. Is that doable also using the platform dependent ABIs? IIUC it's just more of the same game of passing the args on the stack, right? J |