brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.6 KiB · d1aa88e Raw
142 lines · plain
1; RUN: llc < %s -mtriple=arm64-eabi -enable-misched=false -aarch64-enable-stp-suppress=false -verify-machineinstrs | FileCheck %s2 3; The next set of tests makes sure we can combine the second instruction into4; the first.5 6; CHECK-LABEL: stp_int_aa7; CHECK: stp w0, w1, [x2]8; CHECK: ldr w0, [x2, #8]9; CHECK: ret10define i32 @stp_int_aa(i32 %a, i32 %b, ptr nocapture %p) nounwind {11  store i32 %a, ptr %p, align 412  %ld.ptr = getelementptr inbounds i32, ptr %p, i64 213  %tmp = load i32, ptr %ld.ptr, align 414  %add.ptr = getelementptr inbounds i32, ptr %p, i64 115  store i32 %b, ptr %add.ptr, align 416  ret i32 %tmp17}18 19; CHECK-LABEL: stp_long_aa20; CHECK: stp x0, x1, [x2]21; CHECK: ldr x0, [x2, #16]22; CHECK: ret23define i64 @stp_long_aa(i64 %a, i64 %b, ptr nocapture %p) nounwind {24  store i64 %a, ptr %p, align 825  %ld.ptr = getelementptr inbounds i64, ptr %p, i64 226  %tmp = load i64, ptr %ld.ptr, align 427  %add.ptr = getelementptr inbounds i64, ptr %p, i64 128  store i64 %b, ptr %add.ptr, align 829  ret i64 %tmp30}31 32; CHECK-LABEL: stp_float_aa33; CHECK: stp s0, s1, [x0]34; CHECK: ldr s0, [x0, #8]35; CHECK: ret36define float @stp_float_aa(float %a, float %b, ptr nocapture %p) nounwind {37  store float %a, ptr %p, align 438  %ld.ptr = getelementptr inbounds float, ptr %p, i64 239  %tmp = load float, ptr %ld.ptr, align 440  %add.ptr = getelementptr inbounds float, ptr %p, i64 141  store float %b, ptr %add.ptr, align 442  ret float %tmp43}44 45; CHECK-LABEL: stp_double_aa46; CHECK: stp d0, d1, [x0]47; CHECK: ldr d0, [x0, #16]48; CHECK: ret49define double @stp_double_aa(double %a, double %b, ptr nocapture %p) nounwind {50  store double %a, ptr %p, align 851  %ld.ptr = getelementptr inbounds double, ptr %p, i64 252  %tmp = load double, ptr %ld.ptr, align 453  %add.ptr = getelementptr inbounds double, ptr %p, i64 154  store double %b, ptr %add.ptr, align 855  ret double %tmp56}57 58; The next set of tests makes sure we can combine the first instruction into59; the second.60 61; CHECK-LABEL: stp_int_aa_after62; CHECK: ldr w0, [x3, #4]63; CHECK: stp w1, w2, [x3]64; CHECK: ret65define i32 @stp_int_aa_after(i32 %w0, i32 %a, i32 %b, ptr nocapture %p) nounwind {66  store i32 %a, ptr %p, align 467  %ld.ptr = getelementptr inbounds i32, ptr %p, i64 168  %tmp = load i32, ptr %ld.ptr, align 469  %add.ptr = getelementptr inbounds i32, ptr %p, i64 170  store i32 %b, ptr %add.ptr, align 471  ret i32 %tmp72}73 74; CHECK-LABEL: stp_long_aa_after75; CHECK: ldr x0, [x3, #8]76; CHECK: stp x1, x2, [x3]77; CHECK: ret78define i64 @stp_long_aa_after(i64 %x0, i64 %a, i64 %b, ptr nocapture %p) nounwind {79  store i64 %a, ptr %p, align 880  %ld.ptr = getelementptr inbounds i64, ptr %p, i64 181  %tmp = load i64, ptr %ld.ptr, align 482  %add.ptr = getelementptr inbounds i64, ptr %p, i64 183  store i64 %b, ptr %add.ptr, align 884  ret i64 %tmp85}86 87; CHECK-LABEL: stp_float_aa_after88; CHECK: ldr s0, [x0, #4]89; CHECK: stp s1, s2, [x0]90; CHECK: ret91define float @stp_float_aa_after(float %s0, float %a, float %b, ptr nocapture %p) nounwind {92  store float %a, ptr %p, align 493  %ld.ptr = getelementptr inbounds float, ptr %p, i64 194  %tmp = load float, ptr %ld.ptr, align 495  %add.ptr = getelementptr inbounds float, ptr %p, i64 196  store float %b, ptr %add.ptr, align 497  ret float %tmp98}99 100; CHECK-LABEL: stp_double_aa_after101; CHECK: ldr d0, [x0, #8]102; CHECK: stp d1, d2, [x0]103; CHECK: ret104define double @stp_double_aa_after(double %d0, double %a, double %b, ptr nocapture %p) nounwind {105  store double %a, ptr %p, align 8106  %ld.ptr = getelementptr inbounds double, ptr %p, i64 1107  %tmp = load double, ptr %ld.ptr, align 4108  %add.ptr = getelementptr inbounds double, ptr %p, i64 1109  store double %b, ptr %add.ptr, align 8110  ret double %tmp111}112 113; Check that the stores %c and %d are paired after the fadd instruction,114; and then the stores %a and %d are paired after proving that they do not115; depend on the (%c, %d) pair.116;117; CHECK-LABEL: st1:118; CHECK: stp q0, q1, [x{{[0-9]+}}]119; CHECK: fadd120; CHECK: stp q2, q0, [x{{[0-9]+}}, #32]121define void @st1(<4 x float> %a, <4 x float> %b, <4 x float> %c, <4 x float> %d, ptr %base, i64 %index) {122entry:123  %a0 = getelementptr inbounds float, ptr %base, i64 %index124  %b0 = getelementptr float, ptr %a0, i64 4125  %c0 = getelementptr float, ptr %a0, i64 8126  %d0 = getelementptr float, ptr %a0, i64 12127 128 129  store <4 x float> %c, ptr %c0, align 4130  store <4 x float> %a, ptr %a0, align 4131 132  ; This fadd forces the compiler to pair %c and %e after fadd, and leave the133  ; stores %a and %b separated by a stp. The dependence analysis needs then to134  ; prove that it is safe to move %b past the stp to be paired with %a.135  %e = fadd fast <4 x float> %d, %a136 137  store <4 x float> %e, ptr %d0, align 4138  store <4 x float> %b, ptr %b0, align 4139 140  ret void141}142