diff --git a/clang/lib/Basic/Targets/AArch64.h b/clang/lib/Basic/Targets/AArch64.h --- a/clang/lib/Basic/Targets/AArch64.h +++ b/clang/lib/Basic/Targets/AArch64.h @@ -95,11 +95,8 @@ R = std::string("@3") + std::string(Constraint, 3); Constraint += 2; break; - default: - R = std::string(1, *Constraint); - break; } - return R; + return TargetInfo::convertConstraint(Constraint); } bool validateAsmConstraint(const char *&Name, diff --git a/clang/test/CodeGen/inline-asm-p-constraint.c b/clang/test/CodeGen/inline-asm-p-constraint.c new file mode 100644 --- /dev/null +++ b/clang/test/CodeGen/inline-asm-p-constraint.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - -triple aarch64-linux-gnu | FileCheck %s +void foo(void* ptr) { + asm volatile("prfm pldl1keep, %a0\n" : : "p" (ptr)); + // CHECK: call void asm sideeffect "prfm pldl1keep, ${0:a}\0A", "r"(i8* %0) + // CHECK-NOT: call void asm sideeffect "prfm pldl1keep, ${0:a}\0A", "p"(i8* %0) +}