mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
c69d5b5cbb
This patch re-introduces the "S" inline assembler constraint. This matches an absolute symbolic address or a label reference. The primary use case is asm("adrp %0, %1\n\t" "add %0, %0, :lo12:%1" : "=r"(addr) : "S"(&var)); I say re-introduces as it seems like "S" was implemented in the original AArch64 backend, but it looks like it wasn't carried forward to the merged backend. The original implementation had A and L modifiers that could be used to print ":lo12:" to the string. It looks like gcc doesn't use these and :lo12: is expected to be written in the inline assembly string so I've not implemented A and L. Clang already supports the S modifier. Fixes PR37180 Differential Revision: https://reviews.llvm.org/D46745 llvm-svn: 332444
21 lines
675 B
LLVM
21 lines
675 B
LLVM
;RUN: llc -mtriple=aarch64-none-linux-gnu -mattr=+neon < %s | FileCheck %s
|
|
@var = global i32 0
|
|
define void @test_inline_constraint_S() {
|
|
; CHECK-LABEL: test_inline_constraint_S:
|
|
call void asm sideeffect "adrp x0, $0", "S"(i32* @var)
|
|
call void asm sideeffect "add x0, x0, :lo12:$0", "S"(i32* @var)
|
|
; CHECK: adrp x0, var
|
|
; CHECK: add x0, x0, :lo12:var
|
|
ret void
|
|
}
|
|
define i32 @test_inline_constraint_S_label(i1 %in) {
|
|
; CHECK-LABEL: test_inline_constraint_S_label:
|
|
call void asm sideeffect "adr x0, $0", "S"(i8* blockaddress(@test_inline_constraint_S_label, %loc))
|
|
; CHECK: adr x0, .Ltmp{{[0-9]+}}
|
|
br i1 %in, label %loc, label %loc2
|
|
loc:
|
|
ret i32 0
|
|
loc2:
|
|
ret i32 42
|
|
}
|