[MLIR][TOSA] Update CustomOp input and output names (#118408)
[llvm-project.git] / clang / test / CodeGen / X86 / x86_32-inline-asm.c
blob4d96b04205c034fd8d690f6331b24903e6f5b917
1 // RUN: %clang_cc1 -triple i386-apple-darwin9 -verify %s
2 // RUN: %clang_cc1 -triple i386-apple-darwin9 -target-feature +avx -verify %s
4 typedef unsigned int u_int32_t;
5 typedef u_int32_t uint32_t;
7 typedef unsigned long long u_int64_t;
8 typedef u_int64_t uint64_t;
10 typedef float __m128 __attribute__ ((vector_size (16)));
11 typedef float __m256 __attribute__ ((vector_size (32)));
12 typedef float __m512 __attribute__ ((vector_size (64)));
14 __m128 val128;
15 __m256 val256;
16 __m512 val512;
18 int func1(void) {
19 // Error out if size is > 32-bits.
20 uint32_t msr = 0x8b;
21 uint64_t val = 0;
22 __asm__ volatile("wrmsr"
24 : "c" (msr),
25 "a" ((val & 0xFFFFFFFFUL)), // expected-error {{invalid input size for constraint 'a'}}
26 "d" (((val >> 32) & 0xFFFFFFFFUL)));
28 // Don't error out if the size of the destination is <= 32 bits.
29 unsigned char data;
30 unsigned int port;
31 __asm__ volatile("outb %0, %w1" : : "a" (data), "Nd" (port)); // No error expected.
33 __asm__ volatile("outb %0, %w1" : : "R" (val), "Nd" (port)); // expected-error {{invalid input size for constraint 'R'}}
34 __asm__ volatile("outb %0, %w1" : : "q" (val), "Nd" (port)); // expected-error {{invalid input size for constraint 'q'}}
35 __asm__ volatile("outb %0, %w1" : : "Q" (val), "Nd" (port)); // expected-error {{invalid input size for constraint 'Q'}}
36 __asm__ volatile("outb %0, %w1" : : "b" (val), "Nd" (port)); // expected-error {{invalid input size for constraint 'b'}}
37 __asm__ volatile("outb %0, %w1" : : "c" (val), "Nd" (port)); // expected-error {{invalid input size for constraint 'c'}}
38 __asm__ volatile("outb %0, %w1" : : "d" (val), "Nd" (port)); // expected-error {{invalid input size for constraint 'd'}}
39 __asm__ volatile("outb %0, %w1" : : "S" (val), "Nd" (port)); // expected-error {{invalid input size for constraint 'S'}}
40 __asm__ volatile("outb %0, %w1" : : "D" (val), "Nd" (port)); // expected-error {{invalid input size for constraint 'D'}}
41 __asm__ volatile("foo1 %0" : : "A" (val128)); // expected-error {{invalid input size for constraint 'A'}}
42 __asm__ volatile("foo1 %0" : : "f" (val256)); // expected-error {{invalid input size for constraint 'f'}}
43 __asm__ volatile("foo1 %0" : : "t" (val256)); // expected-error {{invalid input size for constraint 't'}}
44 __asm__ volatile("foo1 %0" : : "u" (val256)); // expected-error {{invalid input size for constraint 'u'}}
45 __asm__ volatile("foo1 %0" : : "x" (val512)); // expected-error {{invalid input size for constraint 'x'}}
47 __asm__ volatile("foo1 %0" : "=R" (val)); // expected-error {{invalid output size for constraint '=R'}}
48 __asm__ volatile("foo1 %0" : "=q" (val)); // expected-error {{invalid output size for constraint '=q'}}
49 __asm__ volatile("foo1 %0" : "=Q" (val)); // expected-error {{invalid output size for constraint '=Q'}}
50 __asm__ volatile("foo1 %0" : "=a" (val)); // expected-error {{invalid output size for constraint '=a'}}
51 __asm__ volatile("foo1 %0" : "=b" (val)); // expected-error {{invalid output size for constraint '=b'}}
52 __asm__ volatile("foo1 %0" : "=c" (val)); // expected-error {{invalid output size for constraint '=c'}}
53 __asm__ volatile("foo1 %0" : "=d" (val)); // expected-error {{invalid output size for constraint '=d'}}
54 __asm__ volatile("foo1 %0" : "=S" (val)); // expected-error {{invalid output size for constraint '=S'}}
55 __asm__ volatile("foo1 %0" : "=D" (val)); // expected-error {{invalid output size for constraint '=D'}}
56 __asm__ volatile("foo1 %0" : "=A" (val128)); // expected-error {{invalid output size for constraint '=A'}}
57 __asm__ volatile("foo1 %0" : "=t" (val256)); // expected-error {{invalid output size for constraint '=t'}}
58 __asm__ volatile("foo1 %0" : "=u" (val256)); // expected-error {{invalid output size for constraint '=u'}}
59 __asm__ volatile("foo1 %0" : "=x" (val512)); // expected-error {{invalid output size for constraint '=x'}}
61 #ifdef __AVX__
62 __asm__ volatile("foo1 %0" : : "x" (val256)); // No error.
63 __asm__ volatile("foo1 %0" : "=x" (val256)); // No error.
64 #else
65 __asm__ volatile("foo1 %0" : : "x" (val256)); // expected-error {{invalid input size for constraint 'x'}}
66 __asm__ volatile("foo1 %0" : "=x" (val256)); // expected-error {{invalid output size for constraint '=x'}}
67 #endif
70 int __attribute__((__target__("sse"))) _func2(void) {
71 __asm__ volatile("foo1 %0" : : "x" (val128)); // No error.
72 __asm__ volatile("foo1 %0" : "=x" (val128)); // No error.
73 #ifdef __AVX__
74 __asm__ volatile("foo1 %0" : : "x" (val256)); // No error.
75 __asm__ volatile("foo1 %0" : "=x" (val256)); // No error.
76 #else
77 __asm__ volatile("foo1 %0" : : "x" (val256)); // expected-error {{invalid input size for constraint 'x'}}
78 __asm__ volatile("foo1 %0" : "=x" (val256)); // expected-error {{invalid output size for constraint '=x'}}
79 #endif
80 __asm__ volatile("foo1 %0" : : "x" (val512)); // expected-error {{invalid input size for constraint 'x'}}
81 __asm__ volatile("foo1 %0" : "=x" (val512)); // expected-error {{invalid output size for constraint '=x'}}
84 int __attribute__((__target__("avx"))) _func3(void) {
85 __asm__ volatile("foo1 %0" : : "x" (val128)); // No error.
86 __asm__ volatile("foo1 %0" : "=x" (val128)); // No error.
87 __asm__ volatile("foo1 %0" : : "x" (val256)); // No error.
88 __asm__ volatile("foo1 %0" : "=x" (val256)); // No error.
89 __asm__ volatile("foo1 %0" : : "x" (val512)); // expected-error {{invalid input size for constraint 'x'}}
90 __asm__ volatile("foo1 %0" : "=x" (val512)); // expected-error {{invalid output size for constraint '=x'}}
93 int __attribute__((__target__("avx512f"))) _func4(void) {
94 __asm__ volatile("foo1 %0" : : "x" (val128)); // No error.
95 __asm__ volatile("foo1 %0" : "=x" (val128)); // No error.
96 __asm__ volatile("foo1 %0" : : "x" (val256)); // No error.
97 __asm__ volatile("foo1 %0" : "=x" (val256)); // No error.
98 __asm__ volatile("foo1 %0" : : "x" (val512)); // No error.
99 __asm__ volatile("foo1 %0" : "=x" (val512)); // No error.