blob: 014767d5a3923e902c6d2069e0898f16a550d322 [file] [log] [blame]
Akira Hatanaka987f1862014-08-22 06:05:21 +00001// RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
2
3typedef unsigned char uint8_t;
4
5uint8_t constraint_r(uint8_t *addr) {
6 uint8_t byte;
7
8 __asm__ volatile("ldrb %0, [%1]" : "=r" (byte) : "r" (addr) : "memory");
9// CHECK: warning: value size does not match register size specified by the constraint and modifier
10// CHECK: note: use constraint modifier "w"
11// CHECK: fix-it:{{.*}}:{8:26-8:28}:"%w0"
12
13 return byte;
14}
15
16uint8_t constraint_r_symbolic(uint8_t *addr) {
17 uint8_t byte;
18
19 __asm__ volatile("ldrb %[s0], [%[s1]]" : [s0] "=r" (byte) : [s1] "r" (addr) : "memory");
20// CHECK: warning: value size does not match register size specified by the constraint and modifier
21// CHECK: note: use constraint modifier "w"
22// CHECK: fix-it:{{.*}}:{19:26-19:31}:"%w[s0]"
23
24 return byte;
25}
26
27#define PERCENT "%"
28
29uint8_t constraint_r_symbolic_macro(uint8_t *addr) {
30 uint8_t byte;
31
32 __asm__ volatile("ldrb "PERCENT"[s0], [%[s1]]" : [s0] "=r" (byte) : [s1] "r" (addr) : "memory");
33// CHECK: warning: value size does not match register size specified by the constraint and modifier
34// CHECK: note: use constraint modifier "w"
35// CHECK-NOT: fix-it
36
37 return byte;
38}
Akira Hatanaka96a36012015-02-04 00:27:13 +000039
40// CHECK: warning: value size does not match register size specified by the constraint and modifier
41// CHECK: asm ("%w0 %w1 %2" : "+r" (one) : "r" (wide_two));
42// CHECK: note: use constraint modifier "w"
43// CHECK: fix-it:{{.*}}:{47:17-47:19}:"%w2"
44
45void read_write_modifier0(int one, int two) {
46 long wide_two = two;
47 asm ("%w0 %w1 %2" : "+r" (one) : "r" (wide_two));
48}
49
50// CHECK-NOT: warning:
51void read_write_modifier1(int one, int two) {
52 long wide_two = two;
53 asm ("%w0 %1" : "+r" (one), "+r" (wide_two));
54}