On Mon, Jul 15, 2013 at 10:40:04PM -0500, Peter Bergner wrote:
> On Mon, 2013-07-15 at 23:03 -0400, David Edelsohn wrote:
> > On Mon, Jul 15, 2013 at 4:26 PM, Peter Bergner <[email protected]> wrote:
> > > David, do you prefer reverting the above hunk from the Power HTM
> > > patch or should I add the associated -mno-* options to the building
> > > of libitm?
> >
> > How is libitm built for Intel? The principle of least surprises
> > suggests following that precedent.
>
> They use -mrtm (like we use -mhtm) to build libitm, but it looks like
> their -mrtm does not enable any other isa flags like we currently are
> doing with -mhtm. Meaning their -mrtm option is independent of any
> -mcpu values while ours is not. If we revert the patch I mentioned,
> then I think we will match what Intel is doing.
> Hopefully Jakub will correct me if I am wrong.
Yes, that is my understanding of it too. On Intel we have:
#define OPTION_MASK_ISA_RTM_SET OPTION_MASK_ISA_RTM
#define OPTION_MASK_ISA_RTM_UNSET OPTION_MASK_ISA_RTM
which means that -mrtm doesn't set any other options except for itself
and -mno-rtm doesn't reset other options. libitm is built with -mrtm,
assuming that the only thing the -mrtm switch affects are the HTM builtins
and that those will only be found explicitly in code guarded with the
htm_available () runtime check.
Right now, -mhtm on PowerPC basically implies -march=power8 if I understand
the code well, and libitm is built with it, which means essentially that
when gcc is configured for a pre-power8 CPU, libitm will work just fine on
power8 (including HTM support), but when running on power7 and earlier
it might very well SIGILL, because the implicit -march=power8 could affect
even code not guarded by htm_available ().
And on s/390, right now we enable HTM support in libitm when configured for
-march=zEC12 by default (which isn't ideal).
Jakub