r218073 - [X86, inline-asm] Allow 256-bit wide operands for the 'x' constraints

Hans Wennborg hans at hanshq.net
Thu Sep 18 13:24:04 PDT 2014


Author: hans
Date: Thu Sep 18 15:24:04 2014
New Revision: 218073

URL: http://llvm.org/viewvc/llvm-project?rev=218073&view=rev
Log:
[X86, inline-asm] Allow 256-bit wide operands for the 'x' constraints

The 'x' constraint is for "any SSE register", and GCC seems to include the
256-bit ymm registers in that concept.

Modified:
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/test/CodeGen/x86_32-inline-asm.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=218073&r1=218072&r2=218073&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Sep 18 15:24:04 2014
@@ -3079,11 +3079,12 @@ bool X86TargetInfo::validateOperandSize(
   default: break;
   case 'y':
     return Size <= 64;
-  case 'x':
   case 'f':
   case 't':
   case 'u':
     return Size <= 128;
+  case 'x':
+    return Size <= 256;
   }
 
   return true;

Modified: cfe/trunk/test/CodeGen/x86_32-inline-asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_32-inline-asm.c?rev=218073&r1=218072&r2=218073&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/x86_32-inline-asm.c (original)
+++ cfe/trunk/test/CodeGen/x86_32-inline-asm.c Thu Sep 18 15:24:04 2014
@@ -12,9 +12,11 @@ typedef u_int64_t uint64_t;
 
 typedef float __m128 __attribute__ ((vector_size (16)));
 typedef float __m256 __attribute__ ((vector_size (32)));
+typedef float __m512 __attribute__ ((vector_size (64)));
 
 __m128 val128;
 __m256 val256;
+__m512 val512;
 
 int func1() {
   // Error out if size is > 32-bits.
@@ -43,6 +45,8 @@ int func1() {
   __asm__ volatile("foo1 %0" : : "f" (val256)); // expected-error {{invalid input size for constraint 'f'}}
   __asm__ volatile("foo1 %0" : : "t" (val256)); // expected-error {{invalid input size for constraint 't'}}
   __asm__ volatile("foo1 %0" : : "u" (val256)); // expected-error {{invalid input size for constraint 'u'}}
+  __asm__ volatile("foo1 %0" : : "x" (val256)); // No error.
+  __asm__ volatile("foo1 %0" : : "x" (val512)); // expected-error {{invalid input size for constraint 'x'}}
 
   __asm__ volatile("foo1 %0" : "=R" (val)); // expected-error {{invalid output size for constraint '=R'}}
   __asm__ volatile("foo1 %0" : "=q" (val)); // expected-error {{invalid output size for constraint '=q'}}
@@ -56,4 +60,6 @@ int func1() {
   __asm__ volatile("foo1 %0" : "=A" (val128)); // expected-error {{invalid output size for constraint '=A'}}
   __asm__ volatile("foo1 %0" : "=t" (val256)); // expected-error {{invalid output size for constraint '=t'}}
   __asm__ volatile("foo1 %0" : "=u" (val256)); // expected-error {{invalid output size for constraint '=u'}}
+  __asm__ volatile("foo1 %0" : "=x" (val256)); // No error.
+  __asm__ volatile("foo1 %0" : "=x" (val512)); // expected-error {{invalid output size for constraint '=x'}}
 }





More information about the cfe-commits mailing list