brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · e1253fe Raw
65 lines · plain
1; RUN: llc -mtriple=sparc < %s | FileCheck %s2 3;; Ensure that spills and reloads work for various types on4;; sparcv8.5 6;; For i32/i64 tests, use an asm statement which clobbers most7;; registers to ensure the spill will happen.8 9; CHECK-LABEL: test_i32_spill:10; CHECK:       and %i0, %i1, %o011; CHECK:       st %o0, [%fp+{{.+}}]12; CHECK:       add %o0, %o0, %g013; CHECK:       ld [%fp+{{.+}}, %i014define i32 @test_i32_spill(i32 %a, i32 %b) {15entry:16  %r0 = and i32 %a, %b17  ; The clobber list has all registers except g0/o0. (Only o0 is usable.)18  %0 = call i32 asm sideeffect "add $0,$1,%g0", "=r,0,~{i0},~{i1},~{i2},~{i3},~{i4},~{i5},~{i6},~{i7},~{g1},~{g2},~{g3},~{g4},~{g5},~{g6},~{g7},~{l0},~{l1},~{l2},~{l3},~{l4},~{l5},~{l6},~{l7},~{o1},~{o2},~{o3},~{o4},~{o5},~{o6},~{o7}"(i32 %r0)19  ret i32 %r020}21 22; CHECK-LABEL: test_i64_spill:23; CHECK:       and %i0, %i2, %o024; CHECK:       and %i1, %i3, %o125; CHECK:       std %o0, [%fp+{{.+}}]26; CHECK:       add %o0, %o0, %g027; CHECK:       ldd [%fp+{{.+}}, %i028define i64 @test_i64_spill(i64 %a, i64 %b) {29entry:30  %r0 = and i64 %a, %b31  ; The clobber list has all registers except g0,g1,o0,o1. (Only o0/o1 are a usable pair)32  ; So, o0/o1 must be used.33  %0 = call i64 asm sideeffect "add $0,$1,%g0", "=r,0,~{i0},~{i1},~{i2},~{i3},~{i4},~{i5},~{i6},~{i7},~{g2},~{g3},~{g4},~{g5},~{g6},~{g7},~{l0},~{l1},~{l2},~{l3},~{l4},~{l5},~{l6},~{l7},~{o2},~{o3},~{o4},~{o5},~{o7}"(i64 %r0)34  ret i64 %r035}36 37;; For float/double tests, a call is a suitable clobber as *all* FPU38;; registers are caller-save on sparcv8.39 40; CHECK-LABEL: test_float_spill:41; CHECK:       fadds %f1, %f0, [[R:%[f][0-31]]]42; CHECK:       st [[R]], [%fp+{{.+}}]43; CHECK:       call44; CHECK:       ld [%fp+{{.+}}, %f045declare float @foo_float(float)46define float @test_float_spill(float %a, float %b) {47entry:48  %r0 = fadd float %a, %b49  %0 = call float @foo_float(float %r0)50  ret float %r051}52 53; CHECK-LABEL: test_double_spill:54; CHECK:       faddd %f2, %f0, [[R:%[f][0-31]]]55; CHECK:       std [[R]], [%fp+{{.+}}]56; CHECK:       call57; CHECK:       ldd [%fp+{{.+}}, %f058declare double @foo_double(double)59define double @test_double_spill(double %a, double %b) {60entry:61  %r0 = fadd double %a, %b62  %0 = call double @foo_double(double %r0)63  ret double %r064}65