1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s 2*0a6a1f1dSLionel Sambuc 3*0a6a1f1dSLionel Sambuc typedef unsigned char uint8_t; 4*0a6a1f1dSLionel Sambuc constraint_r(uint8_t * addr)5*0a6a1f1dSLionel Sambucuint8_t constraint_r(uint8_t *addr) { 6*0a6a1f1dSLionel Sambuc uint8_t byte; 7*0a6a1f1dSLionel Sambuc 8*0a6a1f1dSLionel Sambuc __asm__ volatile("ldrb %0, [%1]" : "=r" (byte) : "r" (addr) : "memory"); 9*0a6a1f1dSLionel Sambuc // CHECK: warning: value size does not match register size specified by the constraint and modifier 10*0a6a1f1dSLionel Sambuc // CHECK: note: use constraint modifier "w" 11*0a6a1f1dSLionel Sambuc // CHECK: fix-it:{{.*}}:{8:26-8:28}:"%w0" 12*0a6a1f1dSLionel Sambuc 13*0a6a1f1dSLionel Sambuc return byte; 14*0a6a1f1dSLionel Sambuc } 15*0a6a1f1dSLionel Sambuc constraint_r_symbolic(uint8_t * addr)16*0a6a1f1dSLionel Sambucuint8_t constraint_r_symbolic(uint8_t *addr) { 17*0a6a1f1dSLionel Sambuc uint8_t byte; 18*0a6a1f1dSLionel Sambuc 19*0a6a1f1dSLionel Sambuc __asm__ volatile("ldrb %[s0], [%[s1]]" : [s0] "=r" (byte) : [s1] "r" (addr) : "memory"); 20*0a6a1f1dSLionel Sambuc // CHECK: warning: value size does not match register size specified by the constraint and modifier 21*0a6a1f1dSLionel Sambuc // CHECK: note: use constraint modifier "w" 22*0a6a1f1dSLionel Sambuc // CHECK: fix-it:{{.*}}:{19:26-19:31}:"%w[s0]" 23*0a6a1f1dSLionel Sambuc 24*0a6a1f1dSLionel Sambuc return byte; 25*0a6a1f1dSLionel Sambuc } 26*0a6a1f1dSLionel Sambuc 27*0a6a1f1dSLionel Sambuc #define PERCENT "%" 28*0a6a1f1dSLionel Sambuc constraint_r_symbolic_macro(uint8_t * addr)29*0a6a1f1dSLionel Sambucuint8_t constraint_r_symbolic_macro(uint8_t *addr) { 30*0a6a1f1dSLionel Sambuc uint8_t byte; 31*0a6a1f1dSLionel Sambuc 32*0a6a1f1dSLionel Sambuc __asm__ volatile("ldrb "PERCENT"[s0], [%[s1]]" : [s0] "=r" (byte) : [s1] "r" (addr) : "memory"); 33*0a6a1f1dSLionel Sambuc // CHECK: warning: value size does not match register size specified by the constraint and modifier 34*0a6a1f1dSLionel Sambuc // CHECK: note: use constraint modifier "w" 35*0a6a1f1dSLionel Sambuc // CHECK-NOT: fix-it 36*0a6a1f1dSLionel Sambuc 37*0a6a1f1dSLionel Sambuc return byte; 38*0a6a1f1dSLionel Sambuc } 39