Bug 32711 - Regression: ICE when using inline asm constraint "X"
Summary: Regression: ICE when using inline asm constraint "X"
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.1.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-09 22:55 UTC by Ryan Johnson
Modified: 2007-07-10 06:46 UTC (History)
1 user (show)

See Also:
Host:
Target: x86_64-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Johnson 2007-07-09 22:55:04 UTC
Compiling the following functions with gcc-4.{1,2,3} results in an ICE. gcc-3.4.4 does not ICE:

#include <emmintrin.h>
static inline
__m128i my_asm(__m128i a, __m128i b) {
   __m128i result;
   asm("pshufb\t%1,%0" : "=x"(result) : "X"(b), "0"(a));
   return result;
}
__m128i foo(__m128i src) {
  return my_asm(src, _mm_set1_epi32(1));
}

If the inline asm is called directly (not through an inline function) or if the "X" constraint changes to "mx" everything works fine.
Comment 1 Andrew Pinski 2007-07-09 22:59:16 UTC
"X" constraint means anything matches.  Now why we are ICEing is a bit weird.
Comment 2 Ryan Johnson 2007-07-09 23:27:43 UTC
(In reply to comment #1)
> "X" constraint means anything matches.  Now why we are ICEing is a bit weird.

I started using it because "g" doesn't seem to allow xmm references. Fortunately, "xm" seems to have the desired effect.
Comment 3 Uroš Bizjak 2007-07-10 06:46:37 UTC
(In reply to comment #1)
> "X" constraint means anything matches.  Now why we are ICEing is a bit weird

We hit:

      /* We have patterns that allow zero sets of memory, for instance.
	 In 64-bit mode, we should probably support all 8-byte vectors,
	 since we can in fact encode that into an immediate.  */
      if (GET_CODE (x) == CONST_VECTOR)
	{
	  gcc_assert (x == CONST0_RTX (GET_MODE (x)));
	  x = const0_rtx;
	}

It is true that a message would be nice there, but it is also true that X is an invalid constraint for most (all?) of the instructions.