mirror of https://github.com/microsoft/clang.git
[X86, inlineasm] Do not allow using constraint 'x' for a variable larger than
128-bit unless the target CPU supports AVX. rdar://problem/11846140 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218082 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
dba2234b1b
commit
7877b51ba4
|
@ -3084,7 +3084,8 @@ bool X86TargetInfo::validateOperandSize(StringRef Constraint,
|
||||||
case 'u':
|
case 'u':
|
||||||
return Size <= 128;
|
return Size <= 128;
|
||||||
case 'x':
|
case 'x':
|
||||||
return Size <= 256;
|
// 256-bit ymm registers can be used if target supports AVX.
|
||||||
|
return Size <= (SSELevel >= AVX ? 256 : 128);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// RUN: %clang_cc1 -triple i386-apple-darwin9 -verify %s
|
// RUN: %clang_cc1 -triple i386-apple-darwin9 -verify %s
|
||||||
|
// RUN: %clang_cc1 -triple i386-apple-darwin9 -target-feature +avx -verify %s
|
||||||
|
|
||||||
// <rdar://problem/12415959>
|
// <rdar://problem/12415959>
|
||||||
// rdar://problem/11846140
|
// rdar://problem/11846140
|
||||||
|
@ -45,7 +46,6 @@ int func1() {
|
||||||
__asm__ volatile("foo1 %0" : : "f" (val256)); // expected-error {{invalid input size for constraint 'f'}}
|
__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" : : "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" : : "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" : : "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" : "=R" (val)); // expected-error {{invalid output size for constraint '=R'}}
|
||||||
|
@ -60,6 +60,13 @@ int func1() {
|
||||||
__asm__ volatile("foo1 %0" : "=A" (val128)); // expected-error {{invalid output size for constraint '=A'}}
|
__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" : "=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" : "=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'}}
|
__asm__ volatile("foo1 %0" : "=x" (val512)); // expected-error {{invalid output size for constraint '=x'}}
|
||||||
|
|
||||||
|
#ifdef __AVX__
|
||||||
|
__asm__ volatile("foo1 %0" : : "x" (val256)); // No error.
|
||||||
|
__asm__ volatile("foo1 %0" : "=x" (val256)); // No error.
|
||||||
|
#else
|
||||||
|
__asm__ volatile("foo1 %0" : : "x" (val256)); // expected-error {{invalid input size for constraint 'x'}}
|
||||||
|
__asm__ volatile("foo1 %0" : "=x" (val256)); // expected-error {{invalid output size for constraint '=x'}}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue