1 // RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s 2 3 typedef unsigned char uint8_t; 4 constraint_r(uint8_t * addr)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 constraint_r_symbolic(uint8_t * addr)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 constraint_r_symbolic_macro(uint8_t * addr)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 } 39