This is the mail archive of the gcc@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]

What to do against "X" constraints in asm statements


Hi!

What do you think should be done against crap like:

/* { dg-do compile } */
/* { dg-options "-O2 -funroll-all-loops" } */

typedef union {
  float sf[4];
} __attribute__ ((aligned (16))) A;

void foo (const float *x, int length)
{
  int i;
  for (i = 0; i < length; i += 4)
    __asm__ __volatile__ ("xmms %0, %%xmms1" : : "X" (*(A *)(x + i)));
}

This results in internal error in the (likely) case that %0 should expand to
something not representable.
Shouldn't we issue an error if "X" constraint is seen and __asm pattern
wants that operand emitted, or are ICEs allowed if user messes with __asm
improperly?
The only thing where "X" makes sense in __asm is IMHO if the operand is not
referenced in the pattern as in:
__asm ("" : : "X" (foo));

	Jakub


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