[clang] [llvm] [X86] Accept 'a' modifier for 'p' constraint in inline asm (PR #185590)

Phoebe Wang via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 10 01:00:12 PDT 2026


================
@@ -54,12 +54,20 @@ __m512 testZMM0(void) {
   return zmm0;
 }
 
+// CHECK-LABEL: test_a_p(
+// CHECK: call void asm sideeffect "lea ${0:a}, %eax", "p,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr %0)
+// CHECK: call void asm sideeffect "lea ${0:a}, %eax", "p,~{eax},~{dirflag},~{fpsr},~{flags}"(i32 %add)
+void test_a_p(int *ptr, int i) {
+  asm("lea %a0, %%eax" :: "p"(ptr) : "eax");
+  asm("lea %a0, %%eax" :: "p"(0x1480 + i * 8) : "eax");
+}
+
 extern int var, arr[4];
 struct Pair { int a, b; } pair;
 
 // CHECK-LABEL: test_Ws(
-// CHECK:         call void asm sideeffect "// ${0:p} ${1:p} ${2:p}", "^Ws,^Ws,^Ws,~{dirflag},~{fpsr},~{flags}"(ptr @var, ptr getelementptr inbounds ([4 x i32], ptr @arr, i64 0, i64 3), ptr @test_Ws)
-// CHECK:         call void asm sideeffect "// $0", "^Ws,~{dirflag},~{fpsr},~{flags}"(ptr getelementptr inbounds (%struct.Pair, ptr @pair, i32 0, i32 1))
+// CHECK:         call void asm sideeffect "// ${0:p} ${1:p} ${2:p}", "^Ws,^Ws,^Ws,~{dirflag},~{fpsr},~{flags}"(ptr @var, ptr getelementptr inbounds nuw (i8, ptr @arr, i64 12), ptr @test_Ws)
+// CHECK:         call void asm sideeffect "// $0", "^Ws,~{dirflag},~{fpsr},~{flags}"(ptr getelementptr inbounds nuw (i8, ptr @pair, i64 4))
----------------
phoebewang wrote:

I don't see how these affected by this change.

https://github.com/llvm/llvm-project/pull/185590


More information about the cfe-commits mailing list