[PATCH] x86: allow to suppress default clobbers added to asm()s
Jeff Law
law@redhat.com
Fri Oct 31 19:20:00 GMT 2014
On 10/31/14 02:07, Jan Beulich wrote:
> While it always seemed wrong to me that there's no way to avoid the
> default "flags" and "fpsr" clobbers, the regression the fix for
> PR/60663 introduced (see PR/63637) makes it even more desirable to have
> such a mechanism: This way, at least asm()s with a single output and no
> explicit clobbers can again be made subject to CSE.
>
> gcc:
> 2014-10-31 Jan Beulich <jbeulich@suse.com>
>
> * config/i386/i386.c (ix86_target_string): Add
> -mno-default-asm-clobbers.
> (ix86_valid_target_attribute_inner_p): Handle
> -m{,no-}default-asm-clobbers.
> (ix86_md_asm_clobbers): Handle "inverse" clobbers.
> * config/i386/i386.h (NOCC_REGNUM, NOFPSR_REGNUM): Define.
> (ADDITIONAL_REGISTER_NAMES): Add "cc", "!cc", "!flags", and
> "!fpsr".
> * config/i386/i386.opt: Add mdefault-asm-clobbers and
> mno-default-asm-clobbers.
> * varasm.c (decode_reg_name_and_count): Permit negative
> register numbers in ADDITIONAL_REGISTER_NAMES.
>
> gcc/testsuite:
> 2014-10-31 Jan Beulich <jbeulich@suse.com>
>
> * gcc.target/i386/20060218-1.c: Adjust expected error.
> * gcc.target/i386/invclbr[123].c: New.
I really don't like having an option that's globally applied for this
feature. THough I am OK with having a mechanism to avoid implicit
clobbers on specific ASMs.
Why use negative numbers for the hard register numbers? I wouldn't be
at all surprised if lots of random code assumes register numbers are
always positive.
I don't like adding new registers with special names like !foo. Instead
I think that listing "!cc" or something similar in the asm itself if it
doesn't clobber the cc register would be better.
Other opinions?
jeff
More information about the Gcc-patches
mailing list