; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc < %s -mtriple=ve | FileCheck %s ;;; Check stack frame allocation especially about the new SP calculation ;;; using multiple sizes as a test of emitSPAdjustment(). ; Function Attrs: norecurse nounwind readnone define signext i32 @test_frame0(i32 signext %0) { ; CHECK-LABEL: test_frame0: ; CHECK: # %bb.0: ; CHECK-NEXT: adds.w.sx %s0, 3, %s0 ; CHECK-NEXT: adds.w.sx %s0, %s0, (0)1 ; CHECK-NEXT: b.l.t (, %s10) %2 = add nsw i32 %0, 3 ret i32 %2 } ; Function Attrs: nounwind define i8* @test_frame8(i8* %0) { ; CHECK-LABEL: test_frame8: ; CHECK: # %bb.0: ; CHECK-NEXT: adds.l %s11, -16, %s11 ; CHECK-NEXT: brge.l.t %s11, %s8, .LBB1_2 ; CHECK-NEXT: # %bb.1: ; CHECK-NEXT: ld %s61, 24(, %s14) ; CHECK-NEXT: or %s62, 0, %s0 ; CHECK-NEXT: lea %s63, 315 ; CHECK-NEXT: shm.l %s63, (%s61) ; CHECK-NEXT: shm.l %s8, 8(%s61) ; CHECK-NEXT: shm.l %s11, 16(%s61) ; CHECK-NEXT: monc ; CHECK-NEXT: or %s0, 0, %s62 ; CHECK-NEXT: .LBB1_2: ; CHECK-NEXT: ld1b.zx %s1, (, %s0) ; CHECK-NEXT: lea %s0, 8(, %s11) ; CHECK-NEXT: st1b %s1, 8(, %s11) ; CHECK-NEXT: adds.l %s11, 16, %s11 ; CHECK-NEXT: b.l.t (, %s10) %2 = alloca [8 x i8], align 1 %3 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0 %4 = load i8, i8* %0, align 1 store i8 %4, i8* %3, align 1 ret i8* %3 } ; Function Attrs: nounwind define i8* @test_frame16(i8* %0) { ; CHECK-LABEL: test_frame16: ; CHECK: # %bb.0: ; CHECK-NEXT: adds.l %s11, -16, %s11 ; CHECK-NEXT: brge.l.t %s11, %s8, .LBB2_2 ; CHECK-NEXT: # %bb.1: ; CHECK-NEXT: ld %s61, 24(, %s14) ; CHECK-NEXT: or %s62, 0, %s0 ; CHECK-NEXT: lea %s63, 315 ; CHECK-NEXT: shm.l %s63, (%s61) ; CHECK-NEXT: shm.l %s8, 8(%s61) ; CHECK-NEXT: shm.l %s11, 16(%s61) ; CHECK-NEXT: monc ; CHECK-NEXT: or %s0, 0, %s62 ; CHECK-NEXT: .LBB2_2: ; CHECK-NEXT: ld1b.zx %s1, (, %s0) ; CHECK-NEXT: lea %s0, (, %s11) ; CHECK-NEXT: st1b %s1, (, %s11) ; CHECK-NEXT: adds.l %s11, 16, %s11 ; CHECK-NEXT: b.l.t (, %s10) %2 = alloca [16 x i8], align 1 %3 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0 %4 = load i8, i8* %0, align 1 store i8 %4, i8* %3, align 1 ret i8* %3 } ; Function Attrs: nounwind define i8* @test_frame32(i8* %0) { ; CHECK-LABEL: test_frame32: ; CHECK: # %bb.0: ; CHECK-NEXT: adds.l %s11, -32, %s11 ; CHECK-NEXT: brge.l.t %s11, %s8, .LBB3_2 ; CHECK-NEXT: # %bb.1: ; CHECK-NEXT: ld %s61, 24(, %s14) ; CHECK-NEXT: or %s62, 0, %s0 ; CHECK-NEXT: lea %s63, 315 ; CHECK-NEXT: shm.l %s63, (%s61) ; CHECK-NEXT: shm.l %s8, 8(%s61) ; CHECK-NEXT: shm.l %s11, 16(%s61) ; CHECK-NEXT: monc ; CHECK-NEXT: or %s0, 0, %s62 ; CHECK-NEXT: .LBB3_2: ; CHECK-NEXT: ld1b.zx %s1, (, %s0) ; CHECK-NEXT: lea %s0, (, %s11) ; CHECK-NEXT: st1b %s1, (, %s11) ; CHECK-NEXT: adds.l %s11, 32, %s11 ; CHECK-NEXT: b.l.t (, %s10) %2 = alloca [32 x i8], align 1 %3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0 %4 = load i8, i8* %0, align 1 store i8 %4, i8* %3, align 1 ret i8* %3 } ; Function Attrs: nounwind define i8* @test_frame64(i8* %0) { ; CHECK-LABEL: test_frame64: ; CHECK: # %bb.0: ; CHECK-NEXT: adds.l %s11, -64, %s11 ; CHECK-NEXT: brge.l.t %s11, %s8, .LBB4_2 ; CHECK-NEXT: # %bb.1: ; CHECK-NEXT: ld %s61, 24(, %s14) ; CHECK-NEXT: or %s62, 0, %s0 ; CHECK-NEXT: lea %s63, 315 ; CHECK-NEXT: shm.l %s63, (%s61) ; CHECK-NEXT: shm.l %s8, 8(%s61) ; CHECK-NEXT: shm.l %s11, 16(%s61) ; CHECK-NEXT: monc ; CHECK-NEXT: or %s0, 0, %s62 ; CHECK-NEXT: .LBB4_2: ; CHECK-NEXT: ld1b.zx %s1, (, %s0) ; CHECK-NEXT: lea %s0, (, %s11) ; CHECK-NEXT: st1b %s1, (, %s11) ; CHECK-NEXT: lea %s11, 64(, %s11) ; CHECK-NEXT: b.l.t (, %s10) %2 = alloca [64 x i8], align 1 %3 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0 %4 = load i8, i8* %0, align 1 store i8 %4, i8* %3, align 1 ret i8* %3 } ; Function Attrs: nounwind define i8* @test_frame128(i8* %0) { ; CHECK-LABEL: test_frame128: ; CHECK: # %bb.0: ; CHECK-NEXT: lea %s11, -128(, %s11) ; CHECK-NEXT: brge.l.t %s11, %s8, .LBB5_2 ; CHECK-NEXT: # %bb.1: ; CHECK-NEXT: ld %s61, 24(, %s14) ; CHECK-NEXT: or %s62, 0, %s0 ; CHECK-NEXT: lea %s63, 315 ; CHECK-NEXT: shm.l %s63, (%s61) ; CHECK-NEXT: shm.l %s8, 8(%s61) ; CHECK-NEXT: shm.l %s11, 16(%s61) ; CHECK-NEXT: monc ; CHECK-NEXT: or %s0, 0, %s62 ; CHECK-NEXT: .LBB5_2: ; CHECK-NEXT: ld1b.zx %s1, (, %s0) ; CHECK-NEXT: lea %s0, (, %s11) ; CHECK-NEXT: st1b %s1, (, %s11) ; CHECK-NEXT: lea %s11, 128(, %s11) ; CHECK-NEXT: b.l.t (, %s10) %2 = alloca [128 x i8], align 1 %3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0 %4 = load i8, i8* %0, align 1 store i8 %4, i8* %3, align 1 ret i8* %3 } ; Function Attrs: nounwind define i8* @test_frame65536(i8* %0) { ; CHECK-LABEL: test_frame65536: ; CHECK: # %bb.0: ; CHECK-NEXT: lea %s11, -65536(, %s11) ; CHECK-NEXT: brge.l.t %s11, %s8, .LBB6_2 ; CHECK-NEXT: # %bb.1: ; CHECK-NEXT: ld %s61, 24(, %s14) ; CHECK-NEXT: or %s62, 0, %s0 ; CHECK-NEXT: lea %s63, 315 ; CHECK-NEXT: shm.l %s63, (%s61) ; CHECK-NEXT: shm.l %s8, 8(%s61) ; CHECK-NEXT: shm.l %s11, 16(%s61) ; CHECK-NEXT: monc ; CHECK-NEXT: or %s0, 0, %s62 ; CHECK-NEXT: .LBB6_2: ; CHECK-NEXT: ld1b.zx %s1, (, %s0) ; CHECK-NEXT: lea %s0, (, %s11) ; CHECK-NEXT: st1b %s1, (, %s11) ; CHECK-NEXT: lea %s11, 65536(, %s11) ; CHECK-NEXT: b.l.t (, %s10) %2 = alloca [65536 x i8], align 1 %3 = getelementptr inbounds [65536 x i8], [65536 x i8]* %2, i64 0, i64 0 %4 = load i8, i8* %0, align 1 store i8 %4, i8* %3, align 1 ret i8* %3 } ; Function Attrs: nounwind define i8* @test_frame4294967296(i8* %0) { ; CHECK-LABEL: test_frame4294967296: ; CHECK: # %bb.0: ; CHECK-NEXT: lea %s13, 0 ; CHECK-NEXT: and %s13, %s13, (32)0 ; CHECK-NEXT: lea.sl %s11, -1(%s13, %s11) ; CHECK-NEXT: brge.l.t %s11, %s8, .LBB7_2 ; CHECK-NEXT: # %bb.1: ; CHECK-NEXT: ld %s61, 24(, %s14) ; CHECK-NEXT: or %s62, 0, %s0 ; CHECK-NEXT: lea %s63, 315 ; CHECK-NEXT: shm.l %s63, (%s61) ; CHECK-NEXT: shm.l %s8, 8(%s61) ; CHECK-NEXT: shm.l %s11, 16(%s61) ; CHECK-NEXT: monc ; CHECK-NEXT: or %s0, 0, %s62 ; CHECK-NEXT: .LBB7_2: ; CHECK-NEXT: ld1b.zx %s1, (, %s0) ; CHECK-NEXT: lea %s0, (, %s11) ; CHECK-NEXT: st1b %s1, (, %s11) ; CHECK-NEXT: lea %s13, 0 ; CHECK-NEXT: and %s13, %s13, (32)0 ; CHECK-NEXT: lea.sl %s11, 1(%s13, %s11) ; CHECK-NEXT: b.l.t (, %s10) %2 = alloca [4294967296 x i8], align 1 %3 = getelementptr inbounds [4294967296 x i8], [4294967296 x i8]* %2, i64 0, i64 0 %4 = load i8, i8* %0, align 1 store i8 %4, i8* %3, align 1 ret i8* %3 }