summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2014-09-17 23:35:14 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2014-09-17 23:35:14 +0000
commit31c6d3b71e4b15afcf3300336b5da0bb9de3855a (patch)
tree5d682fe22e8ac94504abc261c0d213e619e01602 /clang/test
parent61570df7158a7b8248fed90eced0caebd9238cb8 (diff)
downloadbcm5719-llvm-31c6d3b71e4b15afcf3300336b5da0bb9de3855a.tar.gz
bcm5719-llvm-31c6d3b71e4b15afcf3300336b5da0bb9de3855a.zip
[X86, inline-asm] Check that the input size is correct for constraints R, q, Q,
S, D, A, y, x, f, t, and u. This is a follow-up patch for r167717. rdar://problem/11846140 rdar://problem/17476970 llvm-svn: 217994
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/x86_32-inline-asm.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/test/CodeGen/x86_32-inline-asm.c b/clang/test/CodeGen/x86_32-inline-asm.c
index 473f78ebcae..65c7eeb5787 100644
--- a/clang/test/CodeGen/x86_32-inline-asm.c
+++ b/clang/test/CodeGen/x86_32-inline-asm.c
@@ -1,5 +1,8 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -verify %s
+
// <rdar://problem/12415959>
+// rdar://problem/11846140
+// rdar://problem/17476970
typedef unsigned int u_int32_t;
typedef u_int32_t uint32_t;
@@ -7,6 +10,12 @@ typedef u_int32_t uint32_t;
typedef unsigned long long u_int64_t;
typedef u_int64_t uint64_t;
+typedef float __m128 __attribute__ ((vector_size (16)));
+typedef float __m256 __attribute__ ((vector_size (32)));
+
+__m128 val128;
+__m256 val256;
+
int func1() {
// Error out if size is > 32-bits.
uint32_t msr = 0x8b;
@@ -21,4 +30,17 @@ int func1() {
unsigned char data;
unsigned int port;
__asm__ volatile("outb %0, %w1" : : "a" (data), "Nd" (port)); // No error expected.
+
+ __asm__ volatile("outb %0, %w1" : : "R" (val), "Nd" (port)); // expected-error {{invalid input size for constraint 'R'}}
+ __asm__ volatile("outb %0, %w1" : : "q" (val), "Nd" (port)); // expected-error {{invalid input size for constraint 'q'}}
+ __asm__ volatile("outb %0, %w1" : : "Q" (val), "Nd" (port)); // expected-error {{invalid input size for constraint 'Q'}}
+ __asm__ volatile("outb %0, %w1" : : "b" (val), "Nd" (port)); // expected-error {{invalid input size for constraint 'b'}}
+ __asm__ volatile("outb %0, %w1" : : "c" (val), "Nd" (port)); // expected-error {{invalid input size for constraint 'c'}}
+ __asm__ volatile("outb %0, %w1" : : "d" (val), "Nd" (port)); // expected-error {{invalid input size for constraint 'd'}}
+ __asm__ volatile("outb %0, %w1" : : "S" (val), "Nd" (port)); // expected-error {{invalid input size for constraint 'S'}}
+ __asm__ volatile("outb %0, %w1" : : "D" (val), "Nd" (port)); // expected-error {{invalid input size for constraint 'D'}}
+ __asm__ volatile("foo1 %0" : : "A" (val128)); // expected-error {{invalid input size for constraint 'A'}}
+ __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'}}
}
OpenPOWER on IntegriCloud