| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6 | |
| ; RUN: llc -mtriple=riscv32 -verify-machineinstrs \ | |
| ; RUN: -mattr=+experimental-smnip,+experimental-ssnip,+experimental-smip,+experimental-ssip \ | |
| ; RUN: < %s | FileCheck %s --check-prefix=RV32 | |
| ; RUN: llc -mtriple=riscv32 -target-abi=ilp32e -verify-machineinstrs \ | |
| ; RUN: -mattr=+e,+experimental-smnip,+experimental-ssnip,+experimental-smip,+experimental-ssip \ | |
| ; RUN: < %s | FileCheck %s --check-prefix=RV32E | |
| ; RUN: llc -mtriple=riscv64 -verify-machineinstrs \ | |
| ; RUN: -mattr=+experimental-smnip,+experimental-ssnip,+experimental-smip,+experimental-ssip \ | |
| ; RUN: < %s | FileCheck %s --check-prefix=RV64 | |
| define void @m_preemptible_fp_large() #0 { | |
| ; RV32-LABEL: m_preemptible_fp_large: | |
| ; RV32: # %bb.0: | |
| ; RV32-NEXT: addi sp, sp, -2032 | |
| ; RV32-NEXT: .cfi_def_cfa_offset 2032 | |
| ; RV32-NEXT: sw t0, 2016(sp) # 4-byte Folded Spill | |
| ; RV32-NEXT: .cfi_offset t0, -16 | |
| ; RV32-NEXT: csrr t0, mepc | |
| ; RV32-NEXT: sw t0, 2028(sp) # 4-byte Folded Spill | |
| ; RV32-NEXT: csrrsi t0, mistatus, 1 | |
| ; RV32-NEXT: sw t0, 2024(sp) # 4-byte Folded Spill | |
| ; RV32-NEXT: sw ra, 2020(sp) # 4-byte Folded Spill | |
| ; RV32-NEXT: sw s0, 2012(sp) # 4-byte Folded Spill | |
| ; RV32-NEXT: sw a0, 2008(sp) # 4-byte Folded Spill | |
| ; RV32-NEXT: sw a1, 2004(sp) # 4-byte Folded Spill | |
| ; RV32-NEXT: .cfi_offset ra, -12 | |
| ; RV32-NEXT: .cfi_offset s0, -20 | |
| ; RV32-NEXT: .cfi_offset a0, -24 | |
| ; RV32-NEXT: .cfi_offset a1, -28 | |
| ; RV32-NEXT: addi s0, sp, 2032 | |
| ; RV32-NEXT: .cfi_def_cfa s0, 0 | |
| ; RV32-NEXT: addi sp, sp, -2048 | |
| ; RV32-NEXT: addi sp, sp, -48 | |
| ; RV32-NEXT: lui a0, 1 | |
| ; RV32-NEXT: mv a1, sp | |
| ; RV32-NEXT: add a0, a1, a0 | |
| ; RV32-NEXT: sb zero, -1(a0) | |
| ; RV32-NEXT: addi sp, sp, 2032 | |
| ; RV32-NEXT: addi sp, sp, 64 | |
| ; RV32-NEXT: .cfi_def_cfa sp, 2032 | |
| ; RV32-NEXT: lw ra, 2020(sp) # 4-byte Folded Reload | |
| ; RV32-NEXT: lw s0, 2012(sp) # 4-byte Folded Reload | |
| ; RV32-NEXT: lw a0, 2008(sp) # 4-byte Folded Reload | |
| ; RV32-NEXT: lw a1, 2004(sp) # 4-byte Folded Reload | |
| ; RV32-NEXT: lw t0, 2024(sp) # 4-byte Folded Reload | |
| ; RV32-NEXT: csrw mistatus, t0 | |
| ; RV32-NEXT: lw t0, 2028(sp) # 4-byte Folded Reload | |
| ; RV32-NEXT: csrw mepc, t0 | |
| ; RV32-NEXT: lw t0, 2016(sp) # 4-byte Folded Reload | |
| ; RV32-NEXT: .cfi_restore t0 | |
| ; RV32-NEXT: .cfi_restore ra | |
| ; RV32-NEXT: .cfi_restore s0 | |
| ; RV32-NEXT: .cfi_restore a0 | |
| ; RV32-NEXT: .cfi_restore a1 | |
| ; RV32-NEXT: addi sp, sp, 2032 | |
| ; RV32-NEXT: .cfi_def_cfa_offset 0 | |
| ; RV32-NEXT: mret | |
| ; | |
| ; RV32E-LABEL: m_preemptible_fp_large: | |
| ; RV32E: # %bb.0: | |
| ; RV32E-NEXT: addi sp, sp, -2044 | |
| ; RV32E-NEXT: .cfi_def_cfa_offset 2044 | |
| ; RV32E-NEXT: sw t0, 2028(sp) # 4-byte Folded Spill | |
| ; RV32E-NEXT: .cfi_offset t0, -16 | |
| ; RV32E-NEXT: csrr t0, mepc | |
| ; RV32E-NEXT: sw t0, 2040(sp) # 4-byte Folded Spill | |
| ; RV32E-NEXT: csrrsi t0, mistatus, 1 | |
| ; RV32E-NEXT: sw t0, 2036(sp) # 4-byte Folded Spill | |
| ; RV32E-NEXT: sw ra, 2032(sp) # 4-byte Folded Spill | |
| ; RV32E-NEXT: sw s0, 2024(sp) # 4-byte Folded Spill | |
| ; RV32E-NEXT: sw a0, 2020(sp) # 4-byte Folded Spill | |
| ; RV32E-NEXT: sw a1, 2016(sp) # 4-byte Folded Spill | |
| ; RV32E-NEXT: .cfi_offset ra, -12 | |
| ; RV32E-NEXT: .cfi_offset s0, -20 | |
| ; RV32E-NEXT: .cfi_offset a0, -24 | |
| ; RV32E-NEXT: .cfi_offset a1, -28 | |
| ; RV32E-NEXT: addi s0, sp, 2044 | |
| ; RV32E-NEXT: .cfi_def_cfa s0, 0 | |
| ; RV32E-NEXT: addi sp, sp, -2048 | |
| ; RV32E-NEXT: addi sp, sp, -52 | |
| ; RV32E-NEXT: andi sp, sp, -16 | |
| ; RV32E-NEXT: lui a0, 1 | |
| ; RV32E-NEXT: addi a1, sp, 16 | |
| ; RV32E-NEXT: add a0, a1, a0 | |
| ; RV32E-NEXT: sb zero, -1(a0) | |
| ; RV32E-NEXT: addi sp, s0, -2044 | |
| ; RV32E-NEXT: .cfi_def_cfa sp, 2044 | |
| ; RV32E-NEXT: lw ra, 2032(sp) # 4-byte Folded Reload | |
| ; RV32E-NEXT: lw s0, 2024(sp) # 4-byte Folded Reload | |
| ; RV32E-NEXT: lw a0, 2020(sp) # 4-byte Folded Reload | |
| ; RV32E-NEXT: lw a1, 2016(sp) # 4-byte Folded Reload | |
| ; RV32E-NEXT: lw t0, 2036(sp) # 4-byte Folded Reload | |
| ; RV32E-NEXT: csrw mistatus, t0 | |
| ; RV32E-NEXT: lw t0, 2040(sp) # 4-byte Folded Reload | |
| ; RV32E-NEXT: csrw mepc, t0 | |
| ; RV32E-NEXT: lw t0, 2028(sp) # 4-byte Folded Reload | |
| ; RV32E-NEXT: .cfi_restore t0 | |
| ; RV32E-NEXT: .cfi_restore ra | |
| ; RV32E-NEXT: .cfi_restore s0 | |
| ; RV32E-NEXT: .cfi_restore a0 | |
| ; RV32E-NEXT: .cfi_restore a1 | |
| ; RV32E-NEXT: addi sp, sp, 2044 | |
| ; RV32E-NEXT: .cfi_def_cfa_offset 0 | |
| ; RV32E-NEXT: mret | |
| ; | |
| ; RV64-LABEL: m_preemptible_fp_large: | |
| ; RV64: # %bb.0: | |
| ; RV64-NEXT: addi sp, sp, -2032 | |
| ; RV64-NEXT: .cfi_def_cfa_offset 2032 | |
| ; RV64-NEXT: sd t0, 2000(sp) # 8-byte Folded Spill | |
| ; RV64-NEXT: .cfi_offset t0, -32 | |
| ; RV64-NEXT: csrr t0, mepc | |
| ; RV64-NEXT: sd t0, 2024(sp) # 8-byte Folded Spill | |
| ; RV64-NEXT: csrrsi t0, mistatus, 1 | |
| ; RV64-NEXT: sd t0, 2016(sp) # 8-byte Folded Spill | |
| ; RV64-NEXT: sd ra, 2008(sp) # 8-byte Folded Spill | |
| ; RV64-NEXT: sd s0, 1992(sp) # 8-byte Folded Spill | |
| ; RV64-NEXT: sd a0, 1984(sp) # 8-byte Folded Spill | |
| ; RV64-NEXT: sd a1, 1976(sp) # 8-byte Folded Spill | |
| ; RV64-NEXT: .cfi_offset ra, -24 | |
| ; RV64-NEXT: .cfi_offset s0, -40 | |
| ; RV64-NEXT: .cfi_offset a0, -48 | |
| ; RV64-NEXT: .cfi_offset a1, -56 | |
| ; RV64-NEXT: addi s0, sp, 2032 | |
| ; RV64-NEXT: .cfi_def_cfa s0, 0 | |
| ; RV64-NEXT: addi sp, sp, -2048 | |
| ; RV64-NEXT: addi sp, sp, -80 | |
| ; RV64-NEXT: lui a0, 1 | |
| ; RV64-NEXT: mv a1, sp | |
| ; RV64-NEXT: add a0, a1, a0 | |
| ; RV64-NEXT: sb zero, -1(a0) | |
| ; RV64-NEXT: addi sp, sp, 2032 | |
| ; RV64-NEXT: addi sp, sp, 96 | |
| ; RV64-NEXT: .cfi_def_cfa sp, 2032 | |
| ; RV64-NEXT: ld ra, 2008(sp) # 8-byte Folded Reload | |
| ; RV64-NEXT: ld s0, 1992(sp) # 8-byte Folded Reload | |
| ; RV64-NEXT: ld a0, 1984(sp) # 8-byte Folded Reload | |
| ; RV64-NEXT: ld a1, 1976(sp) # 8-byte Folded Reload | |
| ; RV64-NEXT: ld t0, 2016(sp) # 8-byte Folded Reload | |
| ; RV64-NEXT: csrw mistatus, t0 | |
| ; RV64-NEXT: ld t0, 2024(sp) # 8-byte Folded Reload | |
| ; RV64-NEXT: csrw mepc, t0 | |
| ; RV64-NEXT: ld t0, 2000(sp) # 8-byte Folded Reload | |
| ; RV64-NEXT: .cfi_restore t0 | |
| ; RV64-NEXT: .cfi_restore ra | |
| ; RV64-NEXT: .cfi_restore s0 | |
| ; RV64-NEXT: .cfi_restore a0 | |
| ; RV64-NEXT: .cfi_restore a1 | |
| ; RV64-NEXT: addi sp, sp, 2032 | |
| ; RV64-NEXT: .cfi_def_cfa_offset 0 | |
| ; RV64-NEXT: mret | |
| %frame = alloca [4096 x i8], align 16 | |
| %end = getelementptr [4096 x i8], ptr %frame, i32 0, i32 4095 | |
| store volatile i8 0, ptr %end | |
| ret void | |
| } | |
| define void @s_preemptible_push_pop_fp() #1 { | |
| ; RV32-LABEL: s_preemptible_push_pop_fp: | |
| ; RV32: # %bb.0: | |
| ; RV32-NEXT: .cfi_def_cfa_offset 32 | |
| ; RV32-NEXT: .cfi_offset a0, -4 | |
| ; RV32-NEXT: .cfi_offset a1, -8 | |
| ; RV32-NEXT: .cfi_offset a2, -12 | |
| ; RV32-NEXT: .cfi_offset a3, -16 | |
| ; RV32-NEXT: .cfi_offset a4, -20 | |
| ; RV32-NEXT: .cfi_offset a5, -24 | |
| ; RV32-NEXT: addi sp, sp, -32 | |
| ; RV32-NEXT: .cfi_def_cfa_offset 64 | |
| ; RV32-NEXT: sw t0, 16(sp) # 4-byte Folded Spill | |
| ; RV32-NEXT: .cfi_offset t0, -48 | |
| ; RV32-NEXT: csrr t0, sepc | |
| ; RV32-NEXT: sw t0, 28(sp) # 4-byte Folded Spill | |
| ; RV32-NEXT: csrrsi t0, sistatus, 1 | |
| ; RV32-NEXT: sw t0, 24(sp) # 4-byte Folded Spill | |
| ; RV32-NEXT: sw ra, 20(sp) # 4-byte Folded Spill | |
| ; RV32-NEXT: sw s0, 12(sp) # 4-byte Folded Spill | |
| ; RV32-NEXT: .cfi_offset ra, -44 | |
| ; RV32-NEXT: .cfi_offset s0, -52 | |
| ; RV32-NEXT: addi s0, sp, 64 | |
| ; RV32-NEXT: .cfi_def_cfa s0, 0 | |
| ; RV32-NEXT: sw zero, 8(sp) | |
| ; RV32-NEXT: .cfi_def_cfa sp, 64 | |
| ; RV32-NEXT: lw ra, 20(sp) # 4-byte Folded Reload | |
| ; RV32-NEXT: lw s0, 12(sp) # 4-byte Folded Reload | |
| ; RV32-NEXT: lw t0, 24(sp) # 4-byte Folded Reload | |
| ; RV32-NEXT: csrw sistatus, t0 | |
| ; RV32-NEXT: lw t0, 28(sp) # 4-byte Folded Reload | |
| ; RV32-NEXT: csrw sepc, t0 | |
| ; RV32-NEXT: lw t0, 16(sp) # 4-byte Folded Reload | |
| ; RV32-NEXT: .cfi_restore t0 | |
| ; RV32-NEXT: .cfi_restore ra | |
| ; RV32-NEXT: .cfi_restore s0 | |
| ; RV32-NEXT: addi sp, sp, 32 | |
| ; RV32-NEXT: .cfi_def_cfa_offset 32 | |
| ; RV32-NEXT: sipopret | |
| ; | |
| ; RV32E-LABEL: s_preemptible_push_pop_fp: | |
| ; RV32E: # %bb.0: | |
| ; RV32E-NEXT: .cfi_def_cfa_offset 24 | |
| ; RV32E-NEXT: .cfi_offset a0, -4 | |
| ; RV32E-NEXT: .cfi_offset a1, -8 | |
| ; RV32E-NEXT: .cfi_offset a2, -12 | |
| ; RV32E-NEXT: .cfi_offset a3, -16 | |
| ; RV32E-NEXT: .cfi_offset a4, -20 | |
| ; RV32E-NEXT: .cfi_offset a5, -24 | |
| ; RV32E-NEXT: addi sp, sp, -24 | |
| ; RV32E-NEXT: .cfi_def_cfa_offset 48 | |
| ; RV32E-NEXT: sw t0, 8(sp) # 4-byte Folded Spill | |
| ; RV32E-NEXT: .cfi_offset t0, -40 | |
| ; RV32E-NEXT: csrr t0, sepc | |
| ; RV32E-NEXT: sw t0, 20(sp) # 4-byte Folded Spill | |
| ; RV32E-NEXT: csrrsi t0, sistatus, 1 | |
| ; RV32E-NEXT: sw t0, 16(sp) # 4-byte Folded Spill | |
| ; RV32E-NEXT: sw ra, 12(sp) # 4-byte Folded Spill | |
| ; RV32E-NEXT: sw s0, 4(sp) # 4-byte Folded Spill | |
| ; RV32E-NEXT: .cfi_offset ra, -36 | |
| ; RV32E-NEXT: .cfi_offset s0, -44 | |
| ; RV32E-NEXT: addi s0, sp, 48 | |
| ; RV32E-NEXT: .cfi_def_cfa s0, 0 | |
| ; RV32E-NEXT: sw zero, 0(sp) | |
| ; RV32E-NEXT: .cfi_def_cfa sp, 48 | |
| ; RV32E-NEXT: lw ra, 12(sp) # 4-byte Folded Reload | |
| ; RV32E-NEXT: lw s0, 4(sp) # 4-byte Folded Reload | |
| ; RV32E-NEXT: lw t0, 16(sp) # 4-byte Folded Reload | |
| ; RV32E-NEXT: csrw sistatus, t0 | |
| ; RV32E-NEXT: lw t0, 20(sp) # 4-byte Folded Reload | |
| ; RV32E-NEXT: csrw sepc, t0 | |
| ; RV32E-NEXT: lw t0, 8(sp) # 4-byte Folded Reload | |
| ; RV32E-NEXT: .cfi_restore t0 | |
| ; RV32E-NEXT: .cfi_restore ra | |
| ; RV32E-NEXT: .cfi_restore s0 | |
| ; RV32E-NEXT: addi sp, sp, 24 | |
| ; RV32E-NEXT: .cfi_def_cfa_offset 24 | |
| ; RV32E-NEXT: sipopret | |
| ; | |
| ; RV64-LABEL: s_preemptible_push_pop_fp: | |
| ; RV64: # %bb.0: | |
| ; RV64-NEXT: .cfi_def_cfa_offset 48 | |
| ; RV64-NEXT: .cfi_offset a0, -8 | |
| ; RV64-NEXT: .cfi_offset a1, -16 | |
| ; RV64-NEXT: .cfi_offset a2, -24 | |
| ; RV64-NEXT: .cfi_offset a3, -32 | |
| ; RV64-NEXT: .cfi_offset a4, -40 | |
| ; RV64-NEXT: .cfi_offset a5, -48 | |
| ; RV64-NEXT: addi sp, sp, -48 | |
| ; RV64-NEXT: .cfi_def_cfa_offset 96 | |
| ; RV64-NEXT: sd t0, 16(sp) # 8-byte Folded Spill | |
| ; RV64-NEXT: .cfi_offset t0, -80 | |
| ; RV64-NEXT: csrr t0, sepc | |
| ; RV64-NEXT: sd t0, 40(sp) # 8-byte Folded Spill | |
| ; RV64-NEXT: csrrsi t0, sistatus, 1 | |
| ; RV64-NEXT: sd t0, 32(sp) # 8-byte Folded Spill | |
| ; RV64-NEXT: sd ra, 24(sp) # 8-byte Folded Spill | |
| ; RV64-NEXT: sd s0, 8(sp) # 8-byte Folded Spill | |
| ; RV64-NEXT: .cfi_offset ra, -72 | |
| ; RV64-NEXT: .cfi_offset s0, -88 | |
| ; RV64-NEXT: addi s0, sp, 96 | |
| ; RV64-NEXT: .cfi_def_cfa s0, 0 | |
| ; RV64-NEXT: sw zero, 4(sp) | |
| ; RV64-NEXT: .cfi_def_cfa sp, 96 | |
| ; RV64-NEXT: ld ra, 24(sp) # 8-byte Folded Reload | |
| ; RV64-NEXT: ld s0, 8(sp) # 8-byte Folded Reload | |
| ; RV64-NEXT: ld t0, 32(sp) # 8-byte Folded Reload | |
| ; RV64-NEXT: csrw sistatus, t0 | |
| ; RV64-NEXT: ld t0, 40(sp) # 8-byte Folded Reload | |
| ; RV64-NEXT: csrw sepc, t0 | |
| ; RV64-NEXT: ld t0, 16(sp) # 8-byte Folded Reload | |
| ; RV64-NEXT: .cfi_restore t0 | |
| ; RV64-NEXT: .cfi_restore ra | |
| ; RV64-NEXT: .cfi_restore s0 | |
| ; RV64-NEXT: addi sp, sp, 48 | |
| ; RV64-NEXT: .cfi_def_cfa_offset 48 | |
| ; RV64-NEXT: sipopret | |
| %slot = alloca i32 | |
| store volatile i32 0, ptr %slot | |
| ret void | |
| } | |
| attributes #0 = { "frame-pointer"="all" "interrupt"="machine-preemptible" } | |
| attributes #1 = { "frame-pointer"="all" "interrupt"="supervisor-preemptible-push-pop" } |