This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR 27528: Expanding constant asm operands


Richard Sandiford <richard@codesourcery.com> writes:

> Note that EXPAND_INITIALIZER doesn't actually cause non-initialisers
> to be rejected, so we still deal gracefully with bogus code like:
> 
>    int x;
>    asm volatile ("..." :: "i" (x));

But note that this is valid and actually used:

static inline void my_favorite_insn(int x) __attribute__ ((always_inline));
static inline void my_favorite_insn(int x)
{
  asm volatile ("insn %0" :: "i" (x));
}
int
foo()
{
  my_favorite_insn (1);
  my_favorite_insn (2);
}

Here we can count on the inliner to give the asm a constant.  In some
cases this may require compiling with optimization, but that is
acceptable for some embedded targets which is where this kind of thing
is typically used.

I don't think your patch will break this, but let's be sure.  If you
add a test case for this, and confirm that it still works with your
patch, then your patch is OK.

Thanks.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]