llvm-project/llvm/test/CodeGen/X86/asm-modifier-error.ll
Fangrui Song 961e25144f
[X86] Accept 'a' modifier for 'p' constraint in inline asm (#185590)
GCC supports the %a modifier with the p constraint (e.g., %a0), while
Clang rejected it. The 'a' modifier means "print as address", which on
a 'p' constraint memory operand is what the default path already does.

Like GCC, reject 'a' with other memory constraints (e.g. 'm').

Close https://github.com/llvm/llvm-project/issues/185343
2026-03-10 17:55:59 +00:00

22 lines
754 B
LLVM

; RUN: not llc < %s -mtriple=x86_64-unknown-unknown 2>&1 | FileCheck %s
; CHECK: error: invalid operand in inline asm: 'mov %ah, ${0:h}'
define void @test1() {
entry:
%0 = tail call i8 asm sideeffect "mov %ah, ${0:h}", "=r,~{eax},~{ebx},~{ecx},~{edx},~{dirflag},~{fpsr},~{flags}"()
ret void
}
; CHECK: error: invalid operand in inline asm: '#TEST ${0:a}'
define void @test_a_m(ptr %p) {
call void asm sideeffect "#TEST ${0:a}", "*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %p)
ret void
}
;CHECK: error: invalid operand in inline asm: 'vmovd ${1:k}, $0'
define i32 @foo() {
entry:
%0 = tail call i32 asm sideeffect "vmovd ${1:k}, $0", "=r,x,~{dirflag},~{fpsr},~{flags}"(<2 x i64> <i64 240518168632, i64 240518168632>)
ret i32 %0
}