mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 18:29:46 +00:00
Phabricator: http://reviews.llvm.org/D9863 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237963 91177308-0d34-0410-b5e6-96231b3b80d8
112 lines
3.7 KiB
LLVM
112 lines
3.7 KiB
LLVM
; RUN: llc < %s -march=arm64 -enable-misched=false -aarch64-stp-suppress=false -verify-machineinstrs | FileCheck %s
|
|
|
|
; The next set of tests makes sure we can combine the second instruction into
|
|
; the first.
|
|
|
|
; CHECK-LABEL: stp_int_aa
|
|
; CHECK: stp w0, w1, [x2]
|
|
; CHECK: ldr w0, [x2, #8]
|
|
; CHECK: ret
|
|
define i32 @stp_int_aa(i32 %a, i32 %b, i32* nocapture %p) nounwind {
|
|
store i32 %a, i32* %p, align 4
|
|
%ld.ptr = getelementptr inbounds i32, i32* %p, i64 2
|
|
%tmp = load i32, i32* %ld.ptr, align 4
|
|
%add.ptr = getelementptr inbounds i32, i32* %p, i64 1
|
|
store i32 %b, i32* %add.ptr, align 4
|
|
ret i32 %tmp
|
|
}
|
|
|
|
; CHECK-LABEL: stp_long_aa
|
|
; CHECK: stp x0, x1, [x2]
|
|
; CHECK: ldr x0, [x2, #16]
|
|
; CHECK: ret
|
|
define i64 @stp_long_aa(i64 %a, i64 %b, i64* nocapture %p) nounwind {
|
|
store i64 %a, i64* %p, align 8
|
|
%ld.ptr = getelementptr inbounds i64, i64* %p, i64 2
|
|
%tmp = load i64, i64* %ld.ptr, align 4
|
|
%add.ptr = getelementptr inbounds i64, i64* %p, i64 1
|
|
store i64 %b, i64* %add.ptr, align 8
|
|
ret i64 %tmp
|
|
}
|
|
|
|
; CHECK-LABEL: stp_float_aa
|
|
; CHECK: stp s0, s1, [x0]
|
|
; CHECK: ldr s0, [x0, #8]
|
|
; CHECK: ret
|
|
define float @stp_float_aa(float %a, float %b, float* nocapture %p) nounwind {
|
|
store float %a, float* %p, align 4
|
|
%ld.ptr = getelementptr inbounds float, float* %p, i64 2
|
|
%tmp = load float, float* %ld.ptr, align 4
|
|
%add.ptr = getelementptr inbounds float, float* %p, i64 1
|
|
store float %b, float* %add.ptr, align 4
|
|
ret float %tmp
|
|
}
|
|
|
|
; CHECK-LABEL: stp_double_aa
|
|
; CHECK: stp d0, d1, [x0]
|
|
; CHECK: ldr d0, [x0, #16]
|
|
; CHECK: ret
|
|
define double @stp_double_aa(double %a, double %b, double* nocapture %p) nounwind {
|
|
store double %a, double* %p, align 8
|
|
%ld.ptr = getelementptr inbounds double, double* %p, i64 2
|
|
%tmp = load double, double* %ld.ptr, align 4
|
|
%add.ptr = getelementptr inbounds double, double* %p, i64 1
|
|
store double %b, double* %add.ptr, align 8
|
|
ret double %tmp
|
|
}
|
|
|
|
; The next set of tests makes sure we can combine the first instruction into
|
|
; the second.
|
|
|
|
; CHECK-LABEL: stp_int_aa_after
|
|
; CHECK: ldr w0, [x3, #4]
|
|
; CHECK: stp w1, w2, [x3]
|
|
; CHECK: ret
|
|
define i32 @stp_int_aa_after(i32 %w0, i32 %a, i32 %b, i32* nocapture %p) nounwind {
|
|
store i32 %a, i32* %p, align 4
|
|
%ld.ptr = getelementptr inbounds i32, i32* %p, i64 1
|
|
%tmp = load i32, i32* %ld.ptr, align 4
|
|
%add.ptr = getelementptr inbounds i32, i32* %p, i64 1
|
|
store i32 %b, i32* %add.ptr, align 4
|
|
ret i32 %tmp
|
|
}
|
|
|
|
; CHECK-LABEL: stp_long_aa_after
|
|
; CHECK: ldr x0, [x3, #8]
|
|
; CHECK: stp x1, x2, [x3]
|
|
; CHECK: ret
|
|
define i64 @stp_long_aa_after(i64 %x0, i64 %a, i64 %b, i64* nocapture %p) nounwind {
|
|
store i64 %a, i64* %p, align 8
|
|
%ld.ptr = getelementptr inbounds i64, i64* %p, i64 1
|
|
%tmp = load i64, i64* %ld.ptr, align 4
|
|
%add.ptr = getelementptr inbounds i64, i64* %p, i64 1
|
|
store i64 %b, i64* %add.ptr, align 8
|
|
ret i64 %tmp
|
|
}
|
|
|
|
; CHECK-LABEL: stp_float_aa_after
|
|
; CHECK: ldr s0, [x0, #4]
|
|
; CHECK: stp s1, s2, [x0]
|
|
; CHECK: ret
|
|
define float @stp_float_aa_after(float %s0, float %a, float %b, float* nocapture %p) nounwind {
|
|
store float %a, float* %p, align 4
|
|
%ld.ptr = getelementptr inbounds float, float* %p, i64 1
|
|
%tmp = load float, float* %ld.ptr, align 4
|
|
%add.ptr = getelementptr inbounds float, float* %p, i64 1
|
|
store float %b, float* %add.ptr, align 4
|
|
ret float %tmp
|
|
}
|
|
|
|
; CHECK-LABEL: stp_double_aa_after
|
|
; CHECK: ldr d0, [x0, #8]
|
|
; CHECK: stp d1, d2, [x0]
|
|
; CHECK: ret
|
|
define double @stp_double_aa_after(double %d0, double %a, double %b, double* nocapture %p) nounwind {
|
|
store double %a, double* %p, align 8
|
|
%ld.ptr = getelementptr inbounds double, double* %p, i64 1
|
|
%tmp = load double, double* %ld.ptr, align 4
|
|
%add.ptr = getelementptr inbounds double, double* %p, i64 1
|
|
store double %b, double* %add.ptr, align 8
|
|
ret double %tmp
|
|
}
|