On Fri, 2016-07-29 at 16:42 +1000, Benjamin Herrenschmidt wrote: > On Fri, 2016-07-29 at 09:46 +0530, Richard Henderson wrote: > > > > The form of declaration you're using takes care of that. In order > > to > > not clobber, you have to use DEF_HELPER_FLAGS with *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.