https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111828

--- Comment #3 from Kewen Lin <linkw at gcc dot gnu.org> ---
(In reply to Peter Bergner from comment #1)
> (In reply to Kewen Lin from comment #0)
> > Technically speaking we are able to parse the inline asm string and figure
> > out it's HTM related or not.  Excepting for the HTM specific instructions
> > like .tbegin etc., we also need to take care of those special registers
> > related to HTM feature. 
> 
> I don't like the idea of scanning the inline asm string for HTM
> instructions.  The problem is, the user could have used ".long 0x7c00051d"
> which is a valid HTM instruction, rather than typing "tbegin.".  There's
> just no easy way to handle all possible cases.  It's also a slippery slope
> of peeking into the inline asm string and I don't think we want to do that! 
> If we start doing it for this, there will just be more and more requests for
> doing it for other things.  Let's not.

Thanks for the comments, fair enough, I guess that's why we don't have such a
inline asm parser. Another idea is to launch a child process to invoke the
assembler to parse it without htm support (if assembler can support this
fine-grain feature) and see if it works. But it's still complicated.

> 
> I also believe that if the user compiles some inline asm using
> -mcpu=power10, then the compiler can assume that inline asm only uses
> features available on Power10, meaning we can assume the inline asm does not
> contain HTM or any other feature not supported on Power10.  If the user
> compiles a piece of inline asm that doesn't support the features used in
> that inline asm, then that is user error!

We can. But it's not the case that this request aims to solve. 

The motivation of this request is to try our best to make power10 attributed
code inline more power8/power9 attribute code which likely includes some inline
asm but not HTM related as the quoted OSS shows. For now, for one function
which has any non-empty inline asm string, we would consider it's possible to
have HTM code so it's unsafe to inline it.

Users usually think higher cpu attributed code can safely inline lower cpu
attributed code, but it's out of expectation for power10 code inlining
power8/power9 code as we drops HTM from power10. If we can support it better,
users don't need more extra efforts to teach about it.

Reply via email to