mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
7b837d8c75
This adds a second implementation of the AArch64 architecture to LLVM, accessible in parallel via the "arm64" triple. The plan over the coming weeks & months is to merge the two into a single backend, during which time thorough code review should naturally occur. Everything will be easier with the target in-tree though, hence this commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205090 91177308-0d34-0410-b5e6-96231b3b80d8
73 lines
1.9 KiB
LLVM
73 lines
1.9 KiB
LLVM
; RUN: llc -march=arm64 < %s | FileCheck %s
|
|
; rdar://10232252
|
|
|
|
@object = external hidden global i64, section "__DATA, __objc_ivar", align 8
|
|
|
|
; base + offset (imm9)
|
|
; CHECK: @t1
|
|
; CHECK: ldr xzr, [x{{[0-9]+}}, #8]
|
|
; CHECK: ret
|
|
define void @t1() {
|
|
%incdec.ptr = getelementptr inbounds i64* @object, i64 1
|
|
%tmp = load volatile i64* %incdec.ptr, align 8
|
|
ret void
|
|
}
|
|
|
|
; base + offset (> imm9)
|
|
; CHECK: @t2
|
|
; CHECK: sub [[ADDREG:x[0-9]+]], x{{[0-9]+}}, #264
|
|
; CHECK: ldr xzr, [
|
|
; CHECK: [[ADDREG]]]
|
|
; CHECK: ret
|
|
define void @t2() {
|
|
%incdec.ptr = getelementptr inbounds i64* @object, i64 -33
|
|
%tmp = load volatile i64* %incdec.ptr, align 8
|
|
ret void
|
|
}
|
|
|
|
; base + unsigned offset (> imm9 and <= imm12 * size of type in bytes)
|
|
; CHECK: @t3
|
|
; CHECK: ldr xzr, [x{{[0-9]+}}, #32760]
|
|
; CHECK: ret
|
|
define void @t3() {
|
|
%incdec.ptr = getelementptr inbounds i64* @object, i64 4095
|
|
%tmp = load volatile i64* %incdec.ptr, align 8
|
|
ret void
|
|
}
|
|
|
|
; base + unsigned offset (> imm12 * size of type in bytes)
|
|
; CHECK: @t4
|
|
; CHECK: add [[ADDREG:x[0-9]+]], x{{[0-9]+}}, #32768
|
|
; CHECK: ldr xzr, [
|
|
; CHECK: [[ADDREG]]]
|
|
; CHECK: ret
|
|
define void @t4() {
|
|
%incdec.ptr = getelementptr inbounds i64* @object, i64 4096
|
|
%tmp = load volatile i64* %incdec.ptr, align 8
|
|
ret void
|
|
}
|
|
|
|
; base + reg
|
|
; CHECK: @t5
|
|
; CHECK: ldr xzr, [x{{[0-9]+}}, x{{[0-9]+}}, lsl #3]
|
|
; CHECK: ret
|
|
define void @t5(i64 %a) {
|
|
%incdec.ptr = getelementptr inbounds i64* @object, i64 %a
|
|
%tmp = load volatile i64* %incdec.ptr, align 8
|
|
ret void
|
|
}
|
|
|
|
; base + reg + imm
|
|
; CHECK: @t6
|
|
; CHECK: add [[ADDREG:x[0-9]+]], x{{[0-9]+}}, x{{[0-9]+}}, lsl #3
|
|
; CHECK-NEXT: add [[ADDREG]], [[ADDREG]], #32768
|
|
; CHECK: ldr xzr, [
|
|
; CHECK: [[ADDREG]]]
|
|
; CHECK: ret
|
|
define void @t6(i64 %a) {
|
|
%tmp1 = getelementptr inbounds i64* @object, i64 %a
|
|
%incdec.ptr = getelementptr inbounds i64* %tmp1, i64 4096
|
|
%tmp = load volatile i64* %incdec.ptr, align 8
|
|
ret void
|
|
}
|