diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp --- a/clang/lib/Basic/TargetInfo.cpp +++ b/clang/lib/Basic/TargetInfo.cpp @@ -896,14 +896,13 @@ Info.setAllowsMemory(); break; case 'g': // general register, memory operand or immediate integer. + case 'p': // address operand. case 'X': // any operand. Info.setAllowsRegister(); Info.setAllowsMemory(); break; case 'E': // immediate floating point. case 'F': // immediate floating point. - case 'p': // address operand. - break; case ',': // multiple alternative constraint. Ignore comma. break; case '#': // Ignore as constraint. diff --git a/clang/test/CodeGen/inline-asm-p-constraint.c b/clang/test/CodeGen/inline-asm-p-constraint.c --- a/clang/test/CodeGen/inline-asm-p-constraint.c +++ b/clang/test/CodeGen/inline-asm-p-constraint.c @@ -11,5 +11,4 @@ asm ("":"=r"(x):"p"(¤t_task)); } // CHECK: %0 = call i64 asm "", "=r,r"(ptr @current_task) #[[ATTR:[0-9]+]] -// FIXME: should be memory(read) -// CHECK: attributes #[[ATTR]] = { nounwind memory(none) } +// CHECK: attributes #[[ATTR]] = { nounwind memory(read) } diff --git a/clang/test/Sema/inline-asm-validate.c b/clang/test/Sema/inline-asm-validate.c --- a/clang/test/Sema/inline-asm-validate.c +++ b/clang/test/Sema/inline-asm-validate.c @@ -2,7 +2,9 @@ unsigned t, r, *p; -int foo (void) { +void foo (void) { __asm__ __volatile__( "stxr %w[_t], %[_r], [%[_p]]" : [_t] "=&r" (t) : [_p] "p" (p), [_r] "r" (r) : "memory"); // expected-warning{{value size does not match register size specified by the constraint and modifier}} expected-note {{use constraint modifier "w"}} - return 1; + // Ensure we accept pointer and non-pointer arguments to "p" constrained + // inputs. + asm (""::"p"(t), "p"(p), "p"(&t)); }