ppc: Avoid double translation for lvx/lvxl/stvx/stvxl
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 5 lines · Richard Henderson
But that doesn't yet make the leap to 128-bit types in tcg. I was going to raise that topic during the 2.8 cycle, since as a consequence I want to drop support for 32-bit hosts, at least for 64- bit guests, and maybe entirely.
I wonder (or is it too chancy ?) if it's worthwhile having a TCG ops that in effect does a translate and returns a host pointer...
That or a slightly more convoluted way of asking the backend to produce a series of load/stores. We can provide the element size (so it can do byteswap) and the base reg. Maybe a stride too.
We can have a default impl that turns it into a loop of existing load/stores and smart backends can check for page boundaries and limit the translations.
That would allow a much more efficient implementation for example of ppc store/load multiplem which are heavily used by 32-bit guest code for example.
Cheers,
Ben.
Quoted 2 lines · Richard Henderson
The form of declaration you're using takes care of that. In order to not clobber, you have to use
DEF_HELPER_FLAGSwith *NO_RWG*.
BTW. Is that stuff (and the various flags here) somewhat documented anywhere ? :-)
Cheers,
Ben.
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 4 lines · Richard Henderson
The form of declaration you're using takes care of that. In order to
not clobber, you have to useDEF_HELPER_FLAGSwith *NO_RWG*.BTW. Is that stuff (and the various flags here) somewhat documented anywhere ? :-)
More specifically, looking at the flags defined:
#define TCG_CALL_NO_READ_GLOBALS 0x0010
/* Helper does not write globals */
#define TCG_CALL_NO_WRITE_GLOBALS 0x0020
/* Helper can be safely suppressed if the return value is not used. */ #define TCG_CALL_NO_SIDE_EFFECTS 0x0040
I assume by "globals" that means things defined
with tcg_global_mem_new_i32() correct ?
So I can't do something like set TCG_CALL_NO_RWG (nor TCG_CALL_NO_WG) on something like dcbz because it can take an exception, correct ?
Now if a helper doens't access env->gpr/spr/... but instead take everything as in/out arguments and cannot take an exception, we can use these, right ?
I notice that sadly, all of the vector ops are helper with full clobbers, because I assume, the "avr" is passed as pointer due to the lack of an int128 type in TCG correct ?
Is the only option here to go down the int128 path or would there be a reasonable way to add a mechanism for more fine grained clobbers ?
Another reason why I think that might be handy is that a whole lot of helpers basically have full clobbers simply because they update a CR bit (or fscr for FP ops). It would be nice to be able to mark just that clobbered.
Maybe by declaring up to a handful of "globals" special, assigning them an index and having a special clobber bits corresponding to them in the flags ?
Cheers,
Ben.
Quoted 2 lines · Benjamin Herrenschmidt
So I can't do something like set
TCG_CALL_NO_RWG(norTCG_CALL_NO_WG) on something like dcbz because it can take an exception, correct ?
You can't set NO_RWG, but you can say NO_WG. It "reads" the registers via the exception (and it certainly has side effects). But it doesn't write to the registers (along the normal return path; a loophole I've used elsewhere).
r~
Quoted 3 lines · Benjamin Herrenschmidt
I notice that sadly, all of the vector ops are helper with full clobbers, because I assume, the "avr" is passed as pointer due to the lack of an int128 type in TCG correct ?
Yes. Although x86 doesn't declare the vector registers as tcg registers at all. Which is both a blessing and a curse.
My opinion is that aarch64 is the model to aim for -- most operations can operate on 64-bit slices at a time, no registers clobbered. There will always be exceptions, of course, but hopefully with rarer insns.
r~
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 4 lines · Richard Henderson
The form of declaration you're using takes care of that. In order to
not clobber, you have to useDEF_HELPER_FLAGSwith *NO_RWG*.BTW. Is that stuff (and the various flags here) somewhat documented anywhere ? :-)
I found the README ! :-)
Sorry for the noise.
Cheers,
Ben.