1 // RUN: %clang_cc1 -triple aarch64 -fsyntax-only -verify -DVERIFY %s
2 // RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
4 typedef unsigned char uint8_t;
8 asm("" :: "s"(i
)); // expected-error{{invalid input constraint 's' in asm}}
12 asm("" :: "S"(test_s(i
))); // expected-error{{invalid type 'void' in asm input for constraint 'S'}}
15 uint8_t constraint_r(uint8_t *addr
) {
18 __asm__
volatile("ldrb %0, [%1]" : "=r" (byte
) : "r" (addr
) : "memory");
19 // CHECK: warning: value size does not match register size specified by the constraint and modifier
20 // CHECK: note: use constraint modifier "w"
21 // CHECK: fix-it:{{.*}}:{[[#@LINE-3]]:26-[[#@LINE-3]]:28}:"%w0"
26 uint8_t constraint_r_symbolic(uint8_t *addr
) {
29 __asm__
volatile("ldrb %[s0], [%[s1]]" : [s0
] "=r" (byte
) : [s1
] "r" (addr
) : "memory");
30 // CHECK: warning: value size does not match register size specified by the constraint and modifier
31 // CHECK: note: use constraint modifier "w"
32 // CHECK: fix-it:{{.*}}:{[[#@LINE-3]]:26-[[#@LINE-3]]:31}:"%w[s0]"
39 uint8_t constraint_r_symbolic_macro(uint8_t *addr
) {
42 __asm__
volatile("ldrb "PERCENT
"[s0], [%[s1]]" : [s0
] "=r" (byte
) : [s1
] "r" (addr
) : "memory");
43 // CHECK: warning: value size does not match register size specified by the constraint and modifier
44 // CHECK: note: use constraint modifier "w"
50 // CHECK: warning: value size does not match register size specified by the constraint and modifier
51 // CHECK: asm ("%w0 %w1 %2" : "+r" (one) : "r" (wide_two));
52 // CHECK: note: use constraint modifier "w"
54 void read_write_modifier0(int one
, int two
) {
56 asm ("%w0 %w1 %2" : "+r" (one
) : "r" (wide_two
));
57 // CHECK: fix-it:{{.*}}:{[[#@LINE-1]]:17-[[#@LINE-1]]:19}:"%w2"
60 // CHECK-NOT: warning:
61 void read_write_modifier1(int one
, int two
) {
63 asm ("%w0 %1" : "+r" (one
), "+r" (wide_two
));