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

--- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> ---
A quick smoke-test of the idea from Comment #3.

The following patch:

--cut here--
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 95abde95f89d..e126fdcb8480 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -4775,9 +4775,8 @@ ix86_conditional_register_usage (void)

   /* If MMX is disabled, squash the registers.  */
   if (! TARGET_MMX)
-    for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-      if (TEST_HARD_REG_BIT (reg_class_contents[(int)MMX_REGS], i))
-       fixed_regs[i] = call_used_regs[i] = 1, reg_names[i] = "";
+    AND_COMPL_HARD_REG_SET (accessible_reg_set,
+                           reg_class_contents[(int) MMX_REGS]);

   /* If SSE is disabled, squash the registers.  */
   if (! TARGET_SSE)
--cut here--

and the following testcase

void foo (int i)
{
  register int c __asm__ ("mm0") = i;
  asm volatile ("%0" : : "y"(c) : "mm1");
}

generate following warning (-mno-mmx):

mm.c: In function ‘foo’:
mm.c:3:16: error: the register specified for ‘c’ cannot be accessed by the
current target

where without the patch:

mm.c: In function ‘foo’:
mm.c:3:16: error: invalid register name for ‘c’
mm.c:4:3: error: unknown register name ‘mm1’ in ‘asm’

IMO, the new error is better, but something should be done to detect invalid
clobber name.

Reply via email to