1051 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple riscv32-unknown-elf -mattr=+experimental-xsfmclic -o - %s \3; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV324; RUN: llc -mtriple riscv64-unknown-elf -mattr=+experimental-xsfmclic -o - %s \5; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV646 7; Test Handling of the SiFive-CLIC interrupt attributes.8;9; "stack-swap" means that sp should be swapped into `sf.mscratchcsw`10;11; "preemptible" means that `mcause` and `mepc` should be saved and interrupts12; should be re-enabled by setting a bit in `mstatus`.13 14; FIXME: A lot of the CFI information here is wrong.15 16define void @stack_swap_empty() "interrupt"="SiFive-CLIC-stack-swap" {17; RV32-LABEL: stack_swap_empty:18; RV32: # %bb.0:19; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp20; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp21; RV32-NEXT: mret22;23; RV64-LABEL: stack_swap_empty:24; RV64: # %bb.0:25; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp26; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp27; RV64-NEXT: mret28 ret void29}30 31define void @stack_swap_empty_fp() "interrupt"="SiFive-CLIC-stack-swap" "frame-pointer"="all" {32; RV32-LABEL: stack_swap_empty_fp:33; RV32: # %bb.0:34; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp35; RV32-NEXT: addi sp, sp, -1636; RV32-NEXT: .cfi_def_cfa_offset 1637; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill38; RV32-NEXT: sw s0, 8(sp) # 4-byte Folded Spill39; RV32-NEXT: .cfi_offset ra, -440; RV32-NEXT: .cfi_offset s0, -841; RV32-NEXT: addi s0, sp, 1642; RV32-NEXT: .cfi_def_cfa s0, 043; RV32-NEXT: .cfi_def_cfa sp, 1644; RV32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload45; RV32-NEXT: lw s0, 8(sp) # 4-byte Folded Reload46; RV32-NEXT: .cfi_restore ra47; RV32-NEXT: .cfi_restore s048; RV32-NEXT: addi sp, sp, 1649; RV32-NEXT: .cfi_def_cfa_offset 050; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp51; RV32-NEXT: mret52;53; RV64-LABEL: stack_swap_empty_fp:54; RV64: # %bb.0:55; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp56; RV64-NEXT: addi sp, sp, -1657; RV64-NEXT: .cfi_def_cfa_offset 1658; RV64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill59; RV64-NEXT: sd s0, 0(sp) # 8-byte Folded Spill60; RV64-NEXT: .cfi_offset ra, -861; RV64-NEXT: .cfi_offset s0, -1662; RV64-NEXT: addi s0, sp, 1663; RV64-NEXT: .cfi_def_cfa s0, 064; RV64-NEXT: .cfi_def_cfa sp, 1665; RV64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload66; RV64-NEXT: ld s0, 0(sp) # 8-byte Folded Reload67; RV64-NEXT: .cfi_restore ra68; RV64-NEXT: .cfi_restore s069; RV64-NEXT: addi sp, sp, 1670; RV64-NEXT: .cfi_def_cfa_offset 071; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp72; RV64-NEXT: mret73 ret void74}75 76define void @preemptible_empty() "interrupt"="SiFive-CLIC-preemptible" {77; RV32-LABEL: preemptible_empty:78; RV32: # %bb.0:79; RV32-NEXT: addi sp, sp, -1680; RV32-NEXT: .cfi_def_cfa_offset 1681; RV32-NEXT: sw s0, 12(sp) # 4-byte Folded Spill82; RV32-NEXT: sw s1, 8(sp) # 4-byte Folded Spill83; RV32-NEXT: csrr s0, mcause84; RV32-NEXT: csrr s1, mepc85; RV32-NEXT: csrsi mstatus, 886; RV32-NEXT: csrci mstatus, 887; RV32-NEXT: csrw mepc, s188; RV32-NEXT: csrw mcause, s089; RV32-NEXT: lw s1, 8(sp) # 4-byte Folded Reload90; RV32-NEXT: lw s0, 12(sp) # 4-byte Folded Reload91; RV32-NEXT: addi sp, sp, 1692; RV32-NEXT: .cfi_def_cfa_offset 093; RV32-NEXT: mret94;95; RV64-LABEL: preemptible_empty:96; RV64: # %bb.0:97; RV64-NEXT: addi sp, sp, -1698; RV64-NEXT: .cfi_def_cfa_offset 1699; RV64-NEXT: sd s0, 8(sp) # 8-byte Folded Spill100; RV64-NEXT: sd s1, 0(sp) # 8-byte Folded Spill101; RV64-NEXT: csrr s0, mcause102; RV64-NEXT: csrr s1, mepc103; RV64-NEXT: csrsi mstatus, 8104; RV64-NEXT: csrci mstatus, 8105; RV64-NEXT: csrw mepc, s1106; RV64-NEXT: csrw mcause, s0107; RV64-NEXT: ld s1, 0(sp) # 8-byte Folded Reload108; RV64-NEXT: ld s0, 8(sp) # 8-byte Folded Reload109; RV64-NEXT: addi sp, sp, 16110; RV64-NEXT: .cfi_def_cfa_offset 0111; RV64-NEXT: mret112 ret void113}114 115define void @both_empty() "interrupt"="SiFive-CLIC-preemptible-stack-swap" {116; RV32-LABEL: both_empty:117; RV32: # %bb.0:118; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp119; RV32-NEXT: addi sp, sp, -16120; RV32-NEXT: .cfi_def_cfa_offset 16121; RV32-NEXT: sw s0, 12(sp) # 4-byte Folded Spill122; RV32-NEXT: sw s1, 8(sp) # 4-byte Folded Spill123; RV32-NEXT: csrr s0, mcause124; RV32-NEXT: csrr s1, mepc125; RV32-NEXT: csrsi mstatus, 8126; RV32-NEXT: csrci mstatus, 8127; RV32-NEXT: csrw mepc, s1128; RV32-NEXT: csrw mcause, s0129; RV32-NEXT: lw s1, 8(sp) # 4-byte Folded Reload130; RV32-NEXT: lw s0, 12(sp) # 4-byte Folded Reload131; RV32-NEXT: addi sp, sp, 16132; RV32-NEXT: .cfi_def_cfa_offset 0133; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp134; RV32-NEXT: mret135;136; RV64-LABEL: both_empty:137; RV64: # %bb.0:138; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp139; RV64-NEXT: addi sp, sp, -16140; RV64-NEXT: .cfi_def_cfa_offset 16141; RV64-NEXT: sd s0, 8(sp) # 8-byte Folded Spill142; RV64-NEXT: sd s1, 0(sp) # 8-byte Folded Spill143; RV64-NEXT: csrr s0, mcause144; RV64-NEXT: csrr s1, mepc145; RV64-NEXT: csrsi mstatus, 8146; RV64-NEXT: csrci mstatus, 8147; RV64-NEXT: csrw mepc, s1148; RV64-NEXT: csrw mcause, s0149; RV64-NEXT: ld s1, 0(sp) # 8-byte Folded Reload150; RV64-NEXT: ld s0, 8(sp) # 8-byte Folded Reload151; RV64-NEXT: addi sp, sp, 16152; RV64-NEXT: .cfi_def_cfa_offset 0153; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp154; RV64-NEXT: mret155 ret void156}157 158declare void @callee()159 160define void @stack_swap_caller() "interrupt"="SiFive-CLIC-stack-swap" {161; RV32-LABEL: stack_swap_caller:162; RV32: # %bb.0:163; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp164; RV32-NEXT: addi sp, sp, -64165; RV32-NEXT: .cfi_def_cfa_offset 64166; RV32-NEXT: sw ra, 60(sp) # 4-byte Folded Spill167; RV32-NEXT: sw t0, 56(sp) # 4-byte Folded Spill168; RV32-NEXT: sw t1, 52(sp) # 4-byte Folded Spill169; RV32-NEXT: sw t2, 48(sp) # 4-byte Folded Spill170; RV32-NEXT: sw a0, 44(sp) # 4-byte Folded Spill171; RV32-NEXT: sw a1, 40(sp) # 4-byte Folded Spill172; RV32-NEXT: sw a2, 36(sp) # 4-byte Folded Spill173; RV32-NEXT: sw a3, 32(sp) # 4-byte Folded Spill174; RV32-NEXT: sw a4, 28(sp) # 4-byte Folded Spill175; RV32-NEXT: sw a5, 24(sp) # 4-byte Folded Spill176; RV32-NEXT: sw a6, 20(sp) # 4-byte Folded Spill177; RV32-NEXT: sw a7, 16(sp) # 4-byte Folded Spill178; RV32-NEXT: sw t3, 12(sp) # 4-byte Folded Spill179; RV32-NEXT: sw t4, 8(sp) # 4-byte Folded Spill180; RV32-NEXT: sw t5, 4(sp) # 4-byte Folded Spill181; RV32-NEXT: sw t6, 0(sp) # 4-byte Folded Spill182; RV32-NEXT: .cfi_offset ra, -4183; RV32-NEXT: .cfi_offset t0, -8184; RV32-NEXT: .cfi_offset t1, -12185; RV32-NEXT: .cfi_offset t2, -16186; RV32-NEXT: .cfi_offset a0, -20187; RV32-NEXT: .cfi_offset a1, -24188; RV32-NEXT: .cfi_offset a2, -28189; RV32-NEXT: .cfi_offset a3, -32190; RV32-NEXT: .cfi_offset a4, -36191; RV32-NEXT: .cfi_offset a5, -40192; RV32-NEXT: .cfi_offset a6, -44193; RV32-NEXT: .cfi_offset a7, -48194; RV32-NEXT: .cfi_offset t3, -52195; RV32-NEXT: .cfi_offset t4, -56196; RV32-NEXT: .cfi_offset t5, -60197; RV32-NEXT: .cfi_offset t6, -64198; RV32-NEXT: call callee199; RV32-NEXT: lw ra, 60(sp) # 4-byte Folded Reload200; RV32-NEXT: lw t0, 56(sp) # 4-byte Folded Reload201; RV32-NEXT: lw t1, 52(sp) # 4-byte Folded Reload202; RV32-NEXT: lw t2, 48(sp) # 4-byte Folded Reload203; RV32-NEXT: lw a0, 44(sp) # 4-byte Folded Reload204; RV32-NEXT: lw a1, 40(sp) # 4-byte Folded Reload205; RV32-NEXT: lw a2, 36(sp) # 4-byte Folded Reload206; RV32-NEXT: lw a3, 32(sp) # 4-byte Folded Reload207; RV32-NEXT: lw a4, 28(sp) # 4-byte Folded Reload208; RV32-NEXT: lw a5, 24(sp) # 4-byte Folded Reload209; RV32-NEXT: lw a6, 20(sp) # 4-byte Folded Reload210; RV32-NEXT: lw a7, 16(sp) # 4-byte Folded Reload211; RV32-NEXT: lw t3, 12(sp) # 4-byte Folded Reload212; RV32-NEXT: lw t4, 8(sp) # 4-byte Folded Reload213; RV32-NEXT: lw t5, 4(sp) # 4-byte Folded Reload214; RV32-NEXT: lw t6, 0(sp) # 4-byte Folded Reload215; RV32-NEXT: .cfi_restore ra216; RV32-NEXT: .cfi_restore t0217; RV32-NEXT: .cfi_restore t1218; RV32-NEXT: .cfi_restore t2219; RV32-NEXT: .cfi_restore a0220; RV32-NEXT: .cfi_restore a1221; RV32-NEXT: .cfi_restore a2222; RV32-NEXT: .cfi_restore a3223; RV32-NEXT: .cfi_restore a4224; RV32-NEXT: .cfi_restore a5225; RV32-NEXT: .cfi_restore a6226; RV32-NEXT: .cfi_restore a7227; RV32-NEXT: .cfi_restore t3228; RV32-NEXT: .cfi_restore t4229; RV32-NEXT: .cfi_restore t5230; RV32-NEXT: .cfi_restore t6231; RV32-NEXT: addi sp, sp, 64232; RV32-NEXT: .cfi_def_cfa_offset 0233; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp234; RV32-NEXT: mret235;236; RV64-LABEL: stack_swap_caller:237; RV64: # %bb.0:238; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp239; RV64-NEXT: addi sp, sp, -128240; RV64-NEXT: .cfi_def_cfa_offset 128241; RV64-NEXT: sd ra, 120(sp) # 8-byte Folded Spill242; RV64-NEXT: sd t0, 112(sp) # 8-byte Folded Spill243; RV64-NEXT: sd t1, 104(sp) # 8-byte Folded Spill244; RV64-NEXT: sd t2, 96(sp) # 8-byte Folded Spill245; RV64-NEXT: sd a0, 88(sp) # 8-byte Folded Spill246; RV64-NEXT: sd a1, 80(sp) # 8-byte Folded Spill247; RV64-NEXT: sd a2, 72(sp) # 8-byte Folded Spill248; RV64-NEXT: sd a3, 64(sp) # 8-byte Folded Spill249; RV64-NEXT: sd a4, 56(sp) # 8-byte Folded Spill250; RV64-NEXT: sd a5, 48(sp) # 8-byte Folded Spill251; RV64-NEXT: sd a6, 40(sp) # 8-byte Folded Spill252; RV64-NEXT: sd a7, 32(sp) # 8-byte Folded Spill253; RV64-NEXT: sd t3, 24(sp) # 8-byte Folded Spill254; RV64-NEXT: sd t4, 16(sp) # 8-byte Folded Spill255; RV64-NEXT: sd t5, 8(sp) # 8-byte Folded Spill256; RV64-NEXT: sd t6, 0(sp) # 8-byte Folded Spill257; RV64-NEXT: .cfi_offset ra, -8258; RV64-NEXT: .cfi_offset t0, -16259; RV64-NEXT: .cfi_offset t1, -24260; RV64-NEXT: .cfi_offset t2, -32261; RV64-NEXT: .cfi_offset a0, -40262; RV64-NEXT: .cfi_offset a1, -48263; RV64-NEXT: .cfi_offset a2, -56264; RV64-NEXT: .cfi_offset a3, -64265; RV64-NEXT: .cfi_offset a4, -72266; RV64-NEXT: .cfi_offset a5, -80267; RV64-NEXT: .cfi_offset a6, -88268; RV64-NEXT: .cfi_offset a7, -96269; RV64-NEXT: .cfi_offset t3, -104270; RV64-NEXT: .cfi_offset t4, -112271; RV64-NEXT: .cfi_offset t5, -120272; RV64-NEXT: .cfi_offset t6, -128273; RV64-NEXT: call callee274; RV64-NEXT: ld ra, 120(sp) # 8-byte Folded Reload275; RV64-NEXT: ld t0, 112(sp) # 8-byte Folded Reload276; RV64-NEXT: ld t1, 104(sp) # 8-byte Folded Reload277; RV64-NEXT: ld t2, 96(sp) # 8-byte Folded Reload278; RV64-NEXT: ld a0, 88(sp) # 8-byte Folded Reload279; RV64-NEXT: ld a1, 80(sp) # 8-byte Folded Reload280; RV64-NEXT: ld a2, 72(sp) # 8-byte Folded Reload281; RV64-NEXT: ld a3, 64(sp) # 8-byte Folded Reload282; RV64-NEXT: ld a4, 56(sp) # 8-byte Folded Reload283; RV64-NEXT: ld a5, 48(sp) # 8-byte Folded Reload284; RV64-NEXT: ld a6, 40(sp) # 8-byte Folded Reload285; RV64-NEXT: ld a7, 32(sp) # 8-byte Folded Reload286; RV64-NEXT: ld t3, 24(sp) # 8-byte Folded Reload287; RV64-NEXT: ld t4, 16(sp) # 8-byte Folded Reload288; RV64-NEXT: ld t5, 8(sp) # 8-byte Folded Reload289; RV64-NEXT: ld t6, 0(sp) # 8-byte Folded Reload290; RV64-NEXT: .cfi_restore ra291; RV64-NEXT: .cfi_restore t0292; RV64-NEXT: .cfi_restore t1293; RV64-NEXT: .cfi_restore t2294; RV64-NEXT: .cfi_restore a0295; RV64-NEXT: .cfi_restore a1296; RV64-NEXT: .cfi_restore a2297; RV64-NEXT: .cfi_restore a3298; RV64-NEXT: .cfi_restore a4299; RV64-NEXT: .cfi_restore a5300; RV64-NEXT: .cfi_restore a6301; RV64-NEXT: .cfi_restore a7302; RV64-NEXT: .cfi_restore t3303; RV64-NEXT: .cfi_restore t4304; RV64-NEXT: .cfi_restore t5305; RV64-NEXT: .cfi_restore t6306; RV64-NEXT: addi sp, sp, 128307; RV64-NEXT: .cfi_def_cfa_offset 0308; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp309; RV64-NEXT: mret310 call void @callee()311 ret void312}313 314define void @stack_swap_caller_fp() "interrupt"="SiFive-CLIC-stack-swap" "frame-pointer"="all" {315; RV32-LABEL: stack_swap_caller_fp:316; RV32: # %bb.0:317; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp318; RV32-NEXT: addi sp, sp, -80319; RV32-NEXT: .cfi_def_cfa_offset 80320; RV32-NEXT: sw ra, 76(sp) # 4-byte Folded Spill321; RV32-NEXT: sw t0, 72(sp) # 4-byte Folded Spill322; RV32-NEXT: sw t1, 68(sp) # 4-byte Folded Spill323; RV32-NEXT: sw t2, 64(sp) # 4-byte Folded Spill324; RV32-NEXT: sw s0, 60(sp) # 4-byte Folded Spill325; RV32-NEXT: sw a0, 56(sp) # 4-byte Folded Spill326; RV32-NEXT: sw a1, 52(sp) # 4-byte Folded Spill327; RV32-NEXT: sw a2, 48(sp) # 4-byte Folded Spill328; RV32-NEXT: sw a3, 44(sp) # 4-byte Folded Spill329; RV32-NEXT: sw a4, 40(sp) # 4-byte Folded Spill330; RV32-NEXT: sw a5, 36(sp) # 4-byte Folded Spill331; RV32-NEXT: sw a6, 32(sp) # 4-byte Folded Spill332; RV32-NEXT: sw a7, 28(sp) # 4-byte Folded Spill333; RV32-NEXT: sw t3, 24(sp) # 4-byte Folded Spill334; RV32-NEXT: sw t4, 20(sp) # 4-byte Folded Spill335; RV32-NEXT: sw t5, 16(sp) # 4-byte Folded Spill336; RV32-NEXT: sw t6, 12(sp) # 4-byte Folded Spill337; RV32-NEXT: .cfi_offset ra, -4338; RV32-NEXT: .cfi_offset t0, -8339; RV32-NEXT: .cfi_offset t1, -12340; RV32-NEXT: .cfi_offset t2, -16341; RV32-NEXT: .cfi_offset s0, -20342; RV32-NEXT: .cfi_offset a0, -24343; RV32-NEXT: .cfi_offset a1, -28344; RV32-NEXT: .cfi_offset a2, -32345; RV32-NEXT: .cfi_offset a3, -36346; RV32-NEXT: .cfi_offset a4, -40347; RV32-NEXT: .cfi_offset a5, -44348; RV32-NEXT: .cfi_offset a6, -48349; RV32-NEXT: .cfi_offset a7, -52350; RV32-NEXT: .cfi_offset t3, -56351; RV32-NEXT: .cfi_offset t4, -60352; RV32-NEXT: .cfi_offset t5, -64353; RV32-NEXT: .cfi_offset t6, -68354; RV32-NEXT: addi s0, sp, 80355; RV32-NEXT: .cfi_def_cfa s0, 0356; RV32-NEXT: call callee357; RV32-NEXT: .cfi_def_cfa sp, 80358; RV32-NEXT: lw ra, 76(sp) # 4-byte Folded Reload359; RV32-NEXT: lw t0, 72(sp) # 4-byte Folded Reload360; RV32-NEXT: lw t1, 68(sp) # 4-byte Folded Reload361; RV32-NEXT: lw t2, 64(sp) # 4-byte Folded Reload362; RV32-NEXT: lw s0, 60(sp) # 4-byte Folded Reload363; RV32-NEXT: lw a0, 56(sp) # 4-byte Folded Reload364; RV32-NEXT: lw a1, 52(sp) # 4-byte Folded Reload365; RV32-NEXT: lw a2, 48(sp) # 4-byte Folded Reload366; RV32-NEXT: lw a3, 44(sp) # 4-byte Folded Reload367; RV32-NEXT: lw a4, 40(sp) # 4-byte Folded Reload368; RV32-NEXT: lw a5, 36(sp) # 4-byte Folded Reload369; RV32-NEXT: lw a6, 32(sp) # 4-byte Folded Reload370; RV32-NEXT: lw a7, 28(sp) # 4-byte Folded Reload371; RV32-NEXT: lw t3, 24(sp) # 4-byte Folded Reload372; RV32-NEXT: lw t4, 20(sp) # 4-byte Folded Reload373; RV32-NEXT: lw t5, 16(sp) # 4-byte Folded Reload374; RV32-NEXT: lw t6, 12(sp) # 4-byte Folded Reload375; RV32-NEXT: .cfi_restore ra376; RV32-NEXT: .cfi_restore t0377; RV32-NEXT: .cfi_restore t1378; RV32-NEXT: .cfi_restore t2379; RV32-NEXT: .cfi_restore s0380; RV32-NEXT: .cfi_restore a0381; RV32-NEXT: .cfi_restore a1382; RV32-NEXT: .cfi_restore a2383; RV32-NEXT: .cfi_restore a3384; RV32-NEXT: .cfi_restore a4385; RV32-NEXT: .cfi_restore a5386; RV32-NEXT: .cfi_restore a6387; RV32-NEXT: .cfi_restore a7388; RV32-NEXT: .cfi_restore t3389; RV32-NEXT: .cfi_restore t4390; RV32-NEXT: .cfi_restore t5391; RV32-NEXT: .cfi_restore t6392; RV32-NEXT: addi sp, sp, 80393; RV32-NEXT: .cfi_def_cfa_offset 0394; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp395; RV32-NEXT: mret396;397; RV64-LABEL: stack_swap_caller_fp:398; RV64: # %bb.0:399; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp400; RV64-NEXT: addi sp, sp, -144401; RV64-NEXT: .cfi_def_cfa_offset 144402; RV64-NEXT: sd ra, 136(sp) # 8-byte Folded Spill403; RV64-NEXT: sd t0, 128(sp) # 8-byte Folded Spill404; RV64-NEXT: sd t1, 120(sp) # 8-byte Folded Spill405; RV64-NEXT: sd t2, 112(sp) # 8-byte Folded Spill406; RV64-NEXT: sd s0, 104(sp) # 8-byte Folded Spill407; RV64-NEXT: sd a0, 96(sp) # 8-byte Folded Spill408; RV64-NEXT: sd a1, 88(sp) # 8-byte Folded Spill409; RV64-NEXT: sd a2, 80(sp) # 8-byte Folded Spill410; RV64-NEXT: sd a3, 72(sp) # 8-byte Folded Spill411; RV64-NEXT: sd a4, 64(sp) # 8-byte Folded Spill412; RV64-NEXT: sd a5, 56(sp) # 8-byte Folded Spill413; RV64-NEXT: sd a6, 48(sp) # 8-byte Folded Spill414; RV64-NEXT: sd a7, 40(sp) # 8-byte Folded Spill415; RV64-NEXT: sd t3, 32(sp) # 8-byte Folded Spill416; RV64-NEXT: sd t4, 24(sp) # 8-byte Folded Spill417; RV64-NEXT: sd t5, 16(sp) # 8-byte Folded Spill418; RV64-NEXT: sd t6, 8(sp) # 8-byte Folded Spill419; RV64-NEXT: .cfi_offset ra, -8420; RV64-NEXT: .cfi_offset t0, -16421; RV64-NEXT: .cfi_offset t1, -24422; RV64-NEXT: .cfi_offset t2, -32423; RV64-NEXT: .cfi_offset s0, -40424; RV64-NEXT: .cfi_offset a0, -48425; RV64-NEXT: .cfi_offset a1, -56426; RV64-NEXT: .cfi_offset a2, -64427; RV64-NEXT: .cfi_offset a3, -72428; RV64-NEXT: .cfi_offset a4, -80429; RV64-NEXT: .cfi_offset a5, -88430; RV64-NEXT: .cfi_offset a6, -96431; RV64-NEXT: .cfi_offset a7, -104432; RV64-NEXT: .cfi_offset t3, -112433; RV64-NEXT: .cfi_offset t4, -120434; RV64-NEXT: .cfi_offset t5, -128435; RV64-NEXT: .cfi_offset t6, -136436; RV64-NEXT: addi s0, sp, 144437; RV64-NEXT: .cfi_def_cfa s0, 0438; RV64-NEXT: call callee439; RV64-NEXT: .cfi_def_cfa sp, 144440; RV64-NEXT: ld ra, 136(sp) # 8-byte Folded Reload441; RV64-NEXT: ld t0, 128(sp) # 8-byte Folded Reload442; RV64-NEXT: ld t1, 120(sp) # 8-byte Folded Reload443; RV64-NEXT: ld t2, 112(sp) # 8-byte Folded Reload444; RV64-NEXT: ld s0, 104(sp) # 8-byte Folded Reload445; RV64-NEXT: ld a0, 96(sp) # 8-byte Folded Reload446; RV64-NEXT: ld a1, 88(sp) # 8-byte Folded Reload447; RV64-NEXT: ld a2, 80(sp) # 8-byte Folded Reload448; RV64-NEXT: ld a3, 72(sp) # 8-byte Folded Reload449; RV64-NEXT: ld a4, 64(sp) # 8-byte Folded Reload450; RV64-NEXT: ld a5, 56(sp) # 8-byte Folded Reload451; RV64-NEXT: ld a6, 48(sp) # 8-byte Folded Reload452; RV64-NEXT: ld a7, 40(sp) # 8-byte Folded Reload453; RV64-NEXT: ld t3, 32(sp) # 8-byte Folded Reload454; RV64-NEXT: ld t4, 24(sp) # 8-byte Folded Reload455; RV64-NEXT: ld t5, 16(sp) # 8-byte Folded Reload456; RV64-NEXT: ld t6, 8(sp) # 8-byte Folded Reload457; RV64-NEXT: .cfi_restore ra458; RV64-NEXT: .cfi_restore t0459; RV64-NEXT: .cfi_restore t1460; RV64-NEXT: .cfi_restore t2461; RV64-NEXT: .cfi_restore s0462; RV64-NEXT: .cfi_restore a0463; RV64-NEXT: .cfi_restore a1464; RV64-NEXT: .cfi_restore a2465; RV64-NEXT: .cfi_restore a3466; RV64-NEXT: .cfi_restore a4467; RV64-NEXT: .cfi_restore a5468; RV64-NEXT: .cfi_restore a6469; RV64-NEXT: .cfi_restore a7470; RV64-NEXT: .cfi_restore t3471; RV64-NEXT: .cfi_restore t4472; RV64-NEXT: .cfi_restore t5473; RV64-NEXT: .cfi_restore t6474; RV64-NEXT: addi sp, sp, 144475; RV64-NEXT: .cfi_def_cfa_offset 0476; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp477; RV64-NEXT: mret478 call void @callee()479 ret void480}481 482define void @preeemptible_caller() "interrupt"="SiFive-CLIC-preemptible" {483; RV32-LABEL: preeemptible_caller:484; RV32: # %bb.0:485; RV32-NEXT: addi sp, sp, -80486; RV32-NEXT: .cfi_def_cfa_offset 80487; RV32-NEXT: sw s0, 76(sp) # 4-byte Folded Spill488; RV32-NEXT: sw s1, 72(sp) # 4-byte Folded Spill489; RV32-NEXT: csrr s0, mcause490; RV32-NEXT: csrr s1, mepc491; RV32-NEXT: csrsi mstatus, 8492; RV32-NEXT: sw ra, 68(sp) # 4-byte Folded Spill493; RV32-NEXT: sw t0, 64(sp) # 4-byte Folded Spill494; RV32-NEXT: sw t1, 60(sp) # 4-byte Folded Spill495; RV32-NEXT: sw t2, 56(sp) # 4-byte Folded Spill496; RV32-NEXT: sw a0, 52(sp) # 4-byte Folded Spill497; RV32-NEXT: sw a1, 48(sp) # 4-byte Folded Spill498; RV32-NEXT: sw a2, 44(sp) # 4-byte Folded Spill499; RV32-NEXT: sw a3, 40(sp) # 4-byte Folded Spill500; RV32-NEXT: sw a4, 36(sp) # 4-byte Folded Spill501; RV32-NEXT: sw a5, 32(sp) # 4-byte Folded Spill502; RV32-NEXT: sw a6, 28(sp) # 4-byte Folded Spill503; RV32-NEXT: sw a7, 24(sp) # 4-byte Folded Spill504; RV32-NEXT: sw t3, 20(sp) # 4-byte Folded Spill505; RV32-NEXT: sw t4, 16(sp) # 4-byte Folded Spill506; RV32-NEXT: sw t5, 12(sp) # 4-byte Folded Spill507; RV32-NEXT: sw t6, 8(sp) # 4-byte Folded Spill508; RV32-NEXT: .cfi_offset ra, -12509; RV32-NEXT: .cfi_offset t0, -16510; RV32-NEXT: .cfi_offset t1, -20511; RV32-NEXT: .cfi_offset t2, -24512; RV32-NEXT: .cfi_offset a0, -28513; RV32-NEXT: .cfi_offset a1, -32514; RV32-NEXT: .cfi_offset a2, -36515; RV32-NEXT: .cfi_offset a3, -40516; RV32-NEXT: .cfi_offset a4, -44517; RV32-NEXT: .cfi_offset a5, -48518; RV32-NEXT: .cfi_offset a6, -52519; RV32-NEXT: .cfi_offset a7, -56520; RV32-NEXT: .cfi_offset t3, -60521; RV32-NEXT: .cfi_offset t4, -64522; RV32-NEXT: .cfi_offset t5, -68523; RV32-NEXT: .cfi_offset t6, -72524; RV32-NEXT: call callee525; RV32-NEXT: lw ra, 68(sp) # 4-byte Folded Reload526; RV32-NEXT: lw t0, 64(sp) # 4-byte Folded Reload527; RV32-NEXT: lw t1, 60(sp) # 4-byte Folded Reload528; RV32-NEXT: lw t2, 56(sp) # 4-byte Folded Reload529; RV32-NEXT: lw a0, 52(sp) # 4-byte Folded Reload530; RV32-NEXT: lw a1, 48(sp) # 4-byte Folded Reload531; RV32-NEXT: lw a2, 44(sp) # 4-byte Folded Reload532; RV32-NEXT: lw a3, 40(sp) # 4-byte Folded Reload533; RV32-NEXT: lw a4, 36(sp) # 4-byte Folded Reload534; RV32-NEXT: lw a5, 32(sp) # 4-byte Folded Reload535; RV32-NEXT: lw a6, 28(sp) # 4-byte Folded Reload536; RV32-NEXT: lw a7, 24(sp) # 4-byte Folded Reload537; RV32-NEXT: lw t3, 20(sp) # 4-byte Folded Reload538; RV32-NEXT: lw t4, 16(sp) # 4-byte Folded Reload539; RV32-NEXT: lw t5, 12(sp) # 4-byte Folded Reload540; RV32-NEXT: lw t6, 8(sp) # 4-byte Folded Reload541; RV32-NEXT: .cfi_restore ra542; RV32-NEXT: .cfi_restore t0543; RV32-NEXT: .cfi_restore t1544; RV32-NEXT: .cfi_restore t2545; RV32-NEXT: .cfi_restore a0546; RV32-NEXT: .cfi_restore a1547; RV32-NEXT: .cfi_restore a2548; RV32-NEXT: .cfi_restore a3549; RV32-NEXT: .cfi_restore a4550; RV32-NEXT: .cfi_restore a5551; RV32-NEXT: .cfi_restore a6552; RV32-NEXT: .cfi_restore a7553; RV32-NEXT: .cfi_restore t3554; RV32-NEXT: .cfi_restore t4555; RV32-NEXT: .cfi_restore t5556; RV32-NEXT: .cfi_restore t6557; RV32-NEXT: csrci mstatus, 8558; RV32-NEXT: csrw mepc, s1559; RV32-NEXT: csrw mcause, s0560; RV32-NEXT: lw s1, 72(sp) # 4-byte Folded Reload561; RV32-NEXT: lw s0, 76(sp) # 4-byte Folded Reload562; RV32-NEXT: addi sp, sp, 80563; RV32-NEXT: .cfi_def_cfa_offset 0564; RV32-NEXT: mret565;566; RV64-LABEL: preeemptible_caller:567; RV64: # %bb.0:568; RV64-NEXT: addi sp, sp, -144569; RV64-NEXT: .cfi_def_cfa_offset 144570; RV64-NEXT: sd s0, 136(sp) # 8-byte Folded Spill571; RV64-NEXT: sd s1, 128(sp) # 8-byte Folded Spill572; RV64-NEXT: csrr s0, mcause573; RV64-NEXT: csrr s1, mepc574; RV64-NEXT: csrsi mstatus, 8575; RV64-NEXT: sd ra, 120(sp) # 8-byte Folded Spill576; RV64-NEXT: sd t0, 112(sp) # 8-byte Folded Spill577; RV64-NEXT: sd t1, 104(sp) # 8-byte Folded Spill578; RV64-NEXT: sd t2, 96(sp) # 8-byte Folded Spill579; RV64-NEXT: sd a0, 88(sp) # 8-byte Folded Spill580; RV64-NEXT: sd a1, 80(sp) # 8-byte Folded Spill581; RV64-NEXT: sd a2, 72(sp) # 8-byte Folded Spill582; RV64-NEXT: sd a3, 64(sp) # 8-byte Folded Spill583; RV64-NEXT: sd a4, 56(sp) # 8-byte Folded Spill584; RV64-NEXT: sd a5, 48(sp) # 8-byte Folded Spill585; RV64-NEXT: sd a6, 40(sp) # 8-byte Folded Spill586; RV64-NEXT: sd a7, 32(sp) # 8-byte Folded Spill587; RV64-NEXT: sd t3, 24(sp) # 8-byte Folded Spill588; RV64-NEXT: sd t4, 16(sp) # 8-byte Folded Spill589; RV64-NEXT: sd t5, 8(sp) # 8-byte Folded Spill590; RV64-NEXT: sd t6, 0(sp) # 8-byte Folded Spill591; RV64-NEXT: .cfi_offset ra, -24592; RV64-NEXT: .cfi_offset t0, -32593; RV64-NEXT: .cfi_offset t1, -40594; RV64-NEXT: .cfi_offset t2, -48595; RV64-NEXT: .cfi_offset a0, -56596; RV64-NEXT: .cfi_offset a1, -64597; RV64-NEXT: .cfi_offset a2, -72598; RV64-NEXT: .cfi_offset a3, -80599; RV64-NEXT: .cfi_offset a4, -88600; RV64-NEXT: .cfi_offset a5, -96601; RV64-NEXT: .cfi_offset a6, -104602; RV64-NEXT: .cfi_offset a7, -112603; RV64-NEXT: .cfi_offset t3, -120604; RV64-NEXT: .cfi_offset t4, -128605; RV64-NEXT: .cfi_offset t5, -136606; RV64-NEXT: .cfi_offset t6, -144607; RV64-NEXT: call callee608; RV64-NEXT: ld ra, 120(sp) # 8-byte Folded Reload609; RV64-NEXT: ld t0, 112(sp) # 8-byte Folded Reload610; RV64-NEXT: ld t1, 104(sp) # 8-byte Folded Reload611; RV64-NEXT: ld t2, 96(sp) # 8-byte Folded Reload612; RV64-NEXT: ld a0, 88(sp) # 8-byte Folded Reload613; RV64-NEXT: ld a1, 80(sp) # 8-byte Folded Reload614; RV64-NEXT: ld a2, 72(sp) # 8-byte Folded Reload615; RV64-NEXT: ld a3, 64(sp) # 8-byte Folded Reload616; RV64-NEXT: ld a4, 56(sp) # 8-byte Folded Reload617; RV64-NEXT: ld a5, 48(sp) # 8-byte Folded Reload618; RV64-NEXT: ld a6, 40(sp) # 8-byte Folded Reload619; RV64-NEXT: ld a7, 32(sp) # 8-byte Folded Reload620; RV64-NEXT: ld t3, 24(sp) # 8-byte Folded Reload621; RV64-NEXT: ld t4, 16(sp) # 8-byte Folded Reload622; RV64-NEXT: ld t5, 8(sp) # 8-byte Folded Reload623; RV64-NEXT: ld t6, 0(sp) # 8-byte Folded Reload624; RV64-NEXT: .cfi_restore ra625; RV64-NEXT: .cfi_restore t0626; RV64-NEXT: .cfi_restore t1627; RV64-NEXT: .cfi_restore t2628; RV64-NEXT: .cfi_restore a0629; RV64-NEXT: .cfi_restore a1630; RV64-NEXT: .cfi_restore a2631; RV64-NEXT: .cfi_restore a3632; RV64-NEXT: .cfi_restore a4633; RV64-NEXT: .cfi_restore a5634; RV64-NEXT: .cfi_restore a6635; RV64-NEXT: .cfi_restore a7636; RV64-NEXT: .cfi_restore t3637; RV64-NEXT: .cfi_restore t4638; RV64-NEXT: .cfi_restore t5639; RV64-NEXT: .cfi_restore t6640; RV64-NEXT: csrci mstatus, 8641; RV64-NEXT: csrw mepc, s1642; RV64-NEXT: csrw mcause, s0643; RV64-NEXT: ld s1, 128(sp) # 8-byte Folded Reload644; RV64-NEXT: ld s0, 136(sp) # 8-byte Folded Reload645; RV64-NEXT: addi sp, sp, 144646; RV64-NEXT: .cfi_def_cfa_offset 0647; RV64-NEXT: mret648 call void @callee()649 ret void650}651 652define void @both_caller() "interrupt"="SiFive-CLIC-preemptible-stack-swap" {653; RV32-LABEL: both_caller:654; RV32: # %bb.0:655; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp656; RV32-NEXT: addi sp, sp, -80657; RV32-NEXT: .cfi_def_cfa_offset 80658; RV32-NEXT: sw s0, 76(sp) # 4-byte Folded Spill659; RV32-NEXT: sw s1, 72(sp) # 4-byte Folded Spill660; RV32-NEXT: csrr s0, mcause661; RV32-NEXT: csrr s1, mepc662; RV32-NEXT: csrsi mstatus, 8663; RV32-NEXT: sw ra, 68(sp) # 4-byte Folded Spill664; RV32-NEXT: sw t0, 64(sp) # 4-byte Folded Spill665; RV32-NEXT: sw t1, 60(sp) # 4-byte Folded Spill666; RV32-NEXT: sw t2, 56(sp) # 4-byte Folded Spill667; RV32-NEXT: sw a0, 52(sp) # 4-byte Folded Spill668; RV32-NEXT: sw a1, 48(sp) # 4-byte Folded Spill669; RV32-NEXT: sw a2, 44(sp) # 4-byte Folded Spill670; RV32-NEXT: sw a3, 40(sp) # 4-byte Folded Spill671; RV32-NEXT: sw a4, 36(sp) # 4-byte Folded Spill672; RV32-NEXT: sw a5, 32(sp) # 4-byte Folded Spill673; RV32-NEXT: sw a6, 28(sp) # 4-byte Folded Spill674; RV32-NEXT: sw a7, 24(sp) # 4-byte Folded Spill675; RV32-NEXT: sw t3, 20(sp) # 4-byte Folded Spill676; RV32-NEXT: sw t4, 16(sp) # 4-byte Folded Spill677; RV32-NEXT: sw t5, 12(sp) # 4-byte Folded Spill678; RV32-NEXT: sw t6, 8(sp) # 4-byte Folded Spill679; RV32-NEXT: .cfi_offset ra, -12680; RV32-NEXT: .cfi_offset t0, -16681; RV32-NEXT: .cfi_offset t1, -20682; RV32-NEXT: .cfi_offset t2, -24683; RV32-NEXT: .cfi_offset a0, -28684; RV32-NEXT: .cfi_offset a1, -32685; RV32-NEXT: .cfi_offset a2, -36686; RV32-NEXT: .cfi_offset a3, -40687; RV32-NEXT: .cfi_offset a4, -44688; RV32-NEXT: .cfi_offset a5, -48689; RV32-NEXT: .cfi_offset a6, -52690; RV32-NEXT: .cfi_offset a7, -56691; RV32-NEXT: .cfi_offset t3, -60692; RV32-NEXT: .cfi_offset t4, -64693; RV32-NEXT: .cfi_offset t5, -68694; RV32-NEXT: .cfi_offset t6, -72695; RV32-NEXT: call callee696; RV32-NEXT: lw ra, 68(sp) # 4-byte Folded Reload697; RV32-NEXT: lw t0, 64(sp) # 4-byte Folded Reload698; RV32-NEXT: lw t1, 60(sp) # 4-byte Folded Reload699; RV32-NEXT: lw t2, 56(sp) # 4-byte Folded Reload700; RV32-NEXT: lw a0, 52(sp) # 4-byte Folded Reload701; RV32-NEXT: lw a1, 48(sp) # 4-byte Folded Reload702; RV32-NEXT: lw a2, 44(sp) # 4-byte Folded Reload703; RV32-NEXT: lw a3, 40(sp) # 4-byte Folded Reload704; RV32-NEXT: lw a4, 36(sp) # 4-byte Folded Reload705; RV32-NEXT: lw a5, 32(sp) # 4-byte Folded Reload706; RV32-NEXT: lw a6, 28(sp) # 4-byte Folded Reload707; RV32-NEXT: lw a7, 24(sp) # 4-byte Folded Reload708; RV32-NEXT: lw t3, 20(sp) # 4-byte Folded Reload709; RV32-NEXT: lw t4, 16(sp) # 4-byte Folded Reload710; RV32-NEXT: lw t5, 12(sp) # 4-byte Folded Reload711; RV32-NEXT: lw t6, 8(sp) # 4-byte Folded Reload712; RV32-NEXT: .cfi_restore ra713; RV32-NEXT: .cfi_restore t0714; RV32-NEXT: .cfi_restore t1715; RV32-NEXT: .cfi_restore t2716; RV32-NEXT: .cfi_restore a0717; RV32-NEXT: .cfi_restore a1718; RV32-NEXT: .cfi_restore a2719; RV32-NEXT: .cfi_restore a3720; RV32-NEXT: .cfi_restore a4721; RV32-NEXT: .cfi_restore a5722; RV32-NEXT: .cfi_restore a6723; RV32-NEXT: .cfi_restore a7724; RV32-NEXT: .cfi_restore t3725; RV32-NEXT: .cfi_restore t4726; RV32-NEXT: .cfi_restore t5727; RV32-NEXT: .cfi_restore t6728; RV32-NEXT: csrci mstatus, 8729; RV32-NEXT: csrw mepc, s1730; RV32-NEXT: csrw mcause, s0731; RV32-NEXT: lw s1, 72(sp) # 4-byte Folded Reload732; RV32-NEXT: lw s0, 76(sp) # 4-byte Folded Reload733; RV32-NEXT: addi sp, sp, 80734; RV32-NEXT: .cfi_def_cfa_offset 0735; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp736; RV32-NEXT: mret737;738; RV64-LABEL: both_caller:739; RV64: # %bb.0:740; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp741; RV64-NEXT: addi sp, sp, -144742; RV64-NEXT: .cfi_def_cfa_offset 144743; RV64-NEXT: sd s0, 136(sp) # 8-byte Folded Spill744; RV64-NEXT: sd s1, 128(sp) # 8-byte Folded Spill745; RV64-NEXT: csrr s0, mcause746; RV64-NEXT: csrr s1, mepc747; RV64-NEXT: csrsi mstatus, 8748; RV64-NEXT: sd ra, 120(sp) # 8-byte Folded Spill749; RV64-NEXT: sd t0, 112(sp) # 8-byte Folded Spill750; RV64-NEXT: sd t1, 104(sp) # 8-byte Folded Spill751; RV64-NEXT: sd t2, 96(sp) # 8-byte Folded Spill752; RV64-NEXT: sd a0, 88(sp) # 8-byte Folded Spill753; RV64-NEXT: sd a1, 80(sp) # 8-byte Folded Spill754; RV64-NEXT: sd a2, 72(sp) # 8-byte Folded Spill755; RV64-NEXT: sd a3, 64(sp) # 8-byte Folded Spill756; RV64-NEXT: sd a4, 56(sp) # 8-byte Folded Spill757; RV64-NEXT: sd a5, 48(sp) # 8-byte Folded Spill758; RV64-NEXT: sd a6, 40(sp) # 8-byte Folded Spill759; RV64-NEXT: sd a7, 32(sp) # 8-byte Folded Spill760; RV64-NEXT: sd t3, 24(sp) # 8-byte Folded Spill761; RV64-NEXT: sd t4, 16(sp) # 8-byte Folded Spill762; RV64-NEXT: sd t5, 8(sp) # 8-byte Folded Spill763; RV64-NEXT: sd t6, 0(sp) # 8-byte Folded Spill764; RV64-NEXT: .cfi_offset ra, -24765; RV64-NEXT: .cfi_offset t0, -32766; RV64-NEXT: .cfi_offset t1, -40767; RV64-NEXT: .cfi_offset t2, -48768; RV64-NEXT: .cfi_offset a0, -56769; RV64-NEXT: .cfi_offset a1, -64770; RV64-NEXT: .cfi_offset a2, -72771; RV64-NEXT: .cfi_offset a3, -80772; RV64-NEXT: .cfi_offset a4, -88773; RV64-NEXT: .cfi_offset a5, -96774; RV64-NEXT: .cfi_offset a6, -104775; RV64-NEXT: .cfi_offset a7, -112776; RV64-NEXT: .cfi_offset t3, -120777; RV64-NEXT: .cfi_offset t4, -128778; RV64-NEXT: .cfi_offset t5, -136779; RV64-NEXT: .cfi_offset t6, -144780; RV64-NEXT: call callee781; RV64-NEXT: ld ra, 120(sp) # 8-byte Folded Reload782; RV64-NEXT: ld t0, 112(sp) # 8-byte Folded Reload783; RV64-NEXT: ld t1, 104(sp) # 8-byte Folded Reload784; RV64-NEXT: ld t2, 96(sp) # 8-byte Folded Reload785; RV64-NEXT: ld a0, 88(sp) # 8-byte Folded Reload786; RV64-NEXT: ld a1, 80(sp) # 8-byte Folded Reload787; RV64-NEXT: ld a2, 72(sp) # 8-byte Folded Reload788; RV64-NEXT: ld a3, 64(sp) # 8-byte Folded Reload789; RV64-NEXT: ld a4, 56(sp) # 8-byte Folded Reload790; RV64-NEXT: ld a5, 48(sp) # 8-byte Folded Reload791; RV64-NEXT: ld a6, 40(sp) # 8-byte Folded Reload792; RV64-NEXT: ld a7, 32(sp) # 8-byte Folded Reload793; RV64-NEXT: ld t3, 24(sp) # 8-byte Folded Reload794; RV64-NEXT: ld t4, 16(sp) # 8-byte Folded Reload795; RV64-NEXT: ld t5, 8(sp) # 8-byte Folded Reload796; RV64-NEXT: ld t6, 0(sp) # 8-byte Folded Reload797; RV64-NEXT: .cfi_restore ra798; RV64-NEXT: .cfi_restore t0799; RV64-NEXT: .cfi_restore t1800; RV64-NEXT: .cfi_restore t2801; RV64-NEXT: .cfi_restore a0802; RV64-NEXT: .cfi_restore a1803; RV64-NEXT: .cfi_restore a2804; RV64-NEXT: .cfi_restore a3805; RV64-NEXT: .cfi_restore a4806; RV64-NEXT: .cfi_restore a5807; RV64-NEXT: .cfi_restore a6808; RV64-NEXT: .cfi_restore a7809; RV64-NEXT: .cfi_restore t3810; RV64-NEXT: .cfi_restore t4811; RV64-NEXT: .cfi_restore t5812; RV64-NEXT: .cfi_restore t6813; RV64-NEXT: csrci mstatus, 8814; RV64-NEXT: csrw mepc, s1815; RV64-NEXT: csrw mcause, s0816; RV64-NEXT: ld s1, 128(sp) # 8-byte Folded Reload817; RV64-NEXT: ld s0, 136(sp) # 8-byte Folded Reload818; RV64-NEXT: addi sp, sp, 144819; RV64-NEXT: .cfi_def_cfa_offset 0820; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp821; RV64-NEXT: mret822 call void @callee()823 ret void824}825 826define void @stack_swap_clobber() "interrupt"="SiFive-CLIC-stack-swap" {827; RV32-LABEL: stack_swap_clobber:828; RV32: # %bb.0:829; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp830; RV32-NEXT: addi sp, sp, -16831; RV32-NEXT: .cfi_def_cfa_offset 16832; RV32-NEXT: sw s0, 12(sp) # 4-byte Folded Spill833; RV32-NEXT: sw s1, 8(sp) # 4-byte Folded Spill834; RV32-NEXT: .cfi_offset s0, -4835; RV32-NEXT: .cfi_offset s1, -8836; RV32-NEXT: #APP837; RV32-NEXT: #NO_APP838; RV32-NEXT: lw s0, 12(sp) # 4-byte Folded Reload839; RV32-NEXT: lw s1, 8(sp) # 4-byte Folded Reload840; RV32-NEXT: .cfi_restore s0841; RV32-NEXT: .cfi_restore s1842; RV32-NEXT: addi sp, sp, 16843; RV32-NEXT: .cfi_def_cfa_offset 0844; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp845; RV32-NEXT: mret846;847; RV64-LABEL: stack_swap_clobber:848; RV64: # %bb.0:849; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp850; RV64-NEXT: addi sp, sp, -16851; RV64-NEXT: .cfi_def_cfa_offset 16852; RV64-NEXT: sd s0, 8(sp) # 8-byte Folded Spill853; RV64-NEXT: sd s1, 0(sp) # 8-byte Folded Spill854; RV64-NEXT: .cfi_offset s0, -8855; RV64-NEXT: .cfi_offset s1, -16856; RV64-NEXT: #APP857; RV64-NEXT: #NO_APP858; RV64-NEXT: ld s0, 8(sp) # 8-byte Folded Reload859; RV64-NEXT: ld s1, 0(sp) # 8-byte Folded Reload860; RV64-NEXT: .cfi_restore s0861; RV64-NEXT: .cfi_restore s1862; RV64-NEXT: addi sp, sp, 16863; RV64-NEXT: .cfi_def_cfa_offset 0864; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp865; RV64-NEXT: mret866 call void asm sideeffect "", "~{x8},~{x9}"() #4867 ret void868}869 870define void @stack_swap_clobber_fp() "interrupt"="SiFive-CLIC-stack-swap" "frame-pointer"="all" {871; RV32-LABEL: stack_swap_clobber_fp:872; RV32: # %bb.0:873; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp874; RV32-NEXT: addi sp, sp, -16875; RV32-NEXT: .cfi_def_cfa_offset 16876; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill877; RV32-NEXT: sw s0, 8(sp) # 4-byte Folded Spill878; RV32-NEXT: sw s1, 4(sp) # 4-byte Folded Spill879; RV32-NEXT: .cfi_offset ra, -4880; RV32-NEXT: .cfi_offset s0, -8881; RV32-NEXT: .cfi_offset s1, -12882; RV32-NEXT: addi s0, sp, 16883; RV32-NEXT: .cfi_def_cfa s0, 0884; RV32-NEXT: #APP885; RV32-NEXT: #NO_APP886; RV32-NEXT: .cfi_def_cfa sp, 16887; RV32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload888; RV32-NEXT: lw s0, 8(sp) # 4-byte Folded Reload889; RV32-NEXT: lw s1, 4(sp) # 4-byte Folded Reload890; RV32-NEXT: .cfi_restore ra891; RV32-NEXT: .cfi_restore s0892; RV32-NEXT: .cfi_restore s1893; RV32-NEXT: addi sp, sp, 16894; RV32-NEXT: .cfi_def_cfa_offset 0895; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp896; RV32-NEXT: mret897;898; RV64-LABEL: stack_swap_clobber_fp:899; RV64: # %bb.0:900; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp901; RV64-NEXT: addi sp, sp, -32902; RV64-NEXT: .cfi_def_cfa_offset 32903; RV64-NEXT: sd ra, 24(sp) # 8-byte Folded Spill904; RV64-NEXT: sd s0, 16(sp) # 8-byte Folded Spill905; RV64-NEXT: sd s1, 8(sp) # 8-byte Folded Spill906; RV64-NEXT: .cfi_offset ra, -8907; RV64-NEXT: .cfi_offset s0, -16908; RV64-NEXT: .cfi_offset s1, -24909; RV64-NEXT: addi s0, sp, 32910; RV64-NEXT: .cfi_def_cfa s0, 0911; RV64-NEXT: #APP912; RV64-NEXT: #NO_APP913; RV64-NEXT: .cfi_def_cfa sp, 32914; RV64-NEXT: ld ra, 24(sp) # 8-byte Folded Reload915; RV64-NEXT: ld s0, 16(sp) # 8-byte Folded Reload916; RV64-NEXT: ld s1, 8(sp) # 8-byte Folded Reload917; RV64-NEXT: .cfi_restore ra918; RV64-NEXT: .cfi_restore s0919; RV64-NEXT: .cfi_restore s1920; RV64-NEXT: addi sp, sp, 32921; RV64-NEXT: .cfi_def_cfa_offset 0922; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp923; RV64-NEXT: mret924 call void asm sideeffect "", "~{x8},~{x9}"() #4925 ret void926}927 928define void @preemptible_clobber() "interrupt"="SiFive-CLIC-preemptible" {929; RV32-LABEL: preemptible_clobber:930; RV32: # %bb.0:931; RV32-NEXT: addi sp, sp, -16932; RV32-NEXT: .cfi_def_cfa_offset 16933; RV32-NEXT: sw s0, 12(sp) # 4-byte Folded Spill934; RV32-NEXT: sw s1, 8(sp) # 4-byte Folded Spill935; RV32-NEXT: csrr s0, mcause936; RV32-NEXT: csrr s1, mepc937; RV32-NEXT: csrsi mstatus, 8938; RV32-NEXT: sw s0, 4(sp) # 4-byte Folded Spill939; RV32-NEXT: sw s1, 0(sp) # 4-byte Folded Spill940; RV32-NEXT: .cfi_offset s0, -12941; RV32-NEXT: .cfi_offset s1, -16942; RV32-NEXT: #APP943; RV32-NEXT: #NO_APP944; RV32-NEXT: lw s0, 4(sp) # 4-byte Folded Reload945; RV32-NEXT: lw s1, 0(sp) # 4-byte Folded Reload946; RV32-NEXT: .cfi_restore s0947; RV32-NEXT: .cfi_restore s1948; RV32-NEXT: csrci mstatus, 8949; RV32-NEXT: csrw mepc, s1950; RV32-NEXT: csrw mcause, s0951; RV32-NEXT: lw s1, 8(sp) # 4-byte Folded Reload952; RV32-NEXT: lw s0, 12(sp) # 4-byte Folded Reload953; RV32-NEXT: addi sp, sp, 16954; RV32-NEXT: .cfi_def_cfa_offset 0955; RV32-NEXT: mret956;957; RV64-LABEL: preemptible_clobber:958; RV64: # %bb.0:959; RV64-NEXT: addi sp, sp, -32960; RV64-NEXT: .cfi_def_cfa_offset 32961; RV64-NEXT: sd s0, 24(sp) # 8-byte Folded Spill962; RV64-NEXT: sd s1, 16(sp) # 8-byte Folded Spill963; RV64-NEXT: csrr s0, mcause964; RV64-NEXT: csrr s1, mepc965; RV64-NEXT: csrsi mstatus, 8966; RV64-NEXT: sd s0, 8(sp) # 8-byte Folded Spill967; RV64-NEXT: sd s1, 0(sp) # 8-byte Folded Spill968; RV64-NEXT: .cfi_offset s0, -24969; RV64-NEXT: .cfi_offset s1, -32970; RV64-NEXT: #APP971; RV64-NEXT: #NO_APP972; RV64-NEXT: ld s0, 8(sp) # 8-byte Folded Reload973; RV64-NEXT: ld s1, 0(sp) # 8-byte Folded Reload974; RV64-NEXT: .cfi_restore s0975; RV64-NEXT: .cfi_restore s1976; RV64-NEXT: csrci mstatus, 8977; RV64-NEXT: csrw mepc, s1978; RV64-NEXT: csrw mcause, s0979; RV64-NEXT: ld s1, 16(sp) # 8-byte Folded Reload980; RV64-NEXT: ld s0, 24(sp) # 8-byte Folded Reload981; RV64-NEXT: addi sp, sp, 32982; RV64-NEXT: .cfi_def_cfa_offset 0983; RV64-NEXT: mret984 call void asm sideeffect "", "~{x8},~{x9}"() #4985 ret void986}987 988define void @both_clobber() "interrupt"="SiFive-CLIC-preemptible-stack-swap" {989; RV32-LABEL: both_clobber:990; RV32: # %bb.0:991; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp992; RV32-NEXT: addi sp, sp, -16993; RV32-NEXT: .cfi_def_cfa_offset 16994; RV32-NEXT: sw s0, 12(sp) # 4-byte Folded Spill995; RV32-NEXT: sw s1, 8(sp) # 4-byte Folded Spill996; RV32-NEXT: csrr s0, mcause997; RV32-NEXT: csrr s1, mepc998; RV32-NEXT: csrsi mstatus, 8999; RV32-NEXT: sw s0, 4(sp) # 4-byte Folded Spill1000; RV32-NEXT: sw s1, 0(sp) # 4-byte Folded Spill1001; RV32-NEXT: .cfi_offset s0, -121002; RV32-NEXT: .cfi_offset s1, -161003; RV32-NEXT: #APP1004; RV32-NEXT: #NO_APP1005; RV32-NEXT: lw s0, 4(sp) # 4-byte Folded Reload1006; RV32-NEXT: lw s1, 0(sp) # 4-byte Folded Reload1007; RV32-NEXT: .cfi_restore s01008; RV32-NEXT: .cfi_restore s11009; RV32-NEXT: csrci mstatus, 81010; RV32-NEXT: csrw mepc, s11011; RV32-NEXT: csrw mcause, s01012; RV32-NEXT: lw s1, 8(sp) # 4-byte Folded Reload1013; RV32-NEXT: lw s0, 12(sp) # 4-byte Folded Reload1014; RV32-NEXT: addi sp, sp, 161015; RV32-NEXT: .cfi_def_cfa_offset 01016; RV32-NEXT: csrrw sp, sf.mscratchcsw, sp1017; RV32-NEXT: mret1018;1019; RV64-LABEL: both_clobber:1020; RV64: # %bb.0:1021; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp1022; RV64-NEXT: addi sp, sp, -321023; RV64-NEXT: .cfi_def_cfa_offset 321024; RV64-NEXT: sd s0, 24(sp) # 8-byte Folded Spill1025; RV64-NEXT: sd s1, 16(sp) # 8-byte Folded Spill1026; RV64-NEXT: csrr s0, mcause1027; RV64-NEXT: csrr s1, mepc1028; RV64-NEXT: csrsi mstatus, 81029; RV64-NEXT: sd s0, 8(sp) # 8-byte Folded Spill1030; RV64-NEXT: sd s1, 0(sp) # 8-byte Folded Spill1031; RV64-NEXT: .cfi_offset s0, -241032; RV64-NEXT: .cfi_offset s1, -321033; RV64-NEXT: #APP1034; RV64-NEXT: #NO_APP1035; RV64-NEXT: ld s0, 8(sp) # 8-byte Folded Reload1036; RV64-NEXT: ld s1, 0(sp) # 8-byte Folded Reload1037; RV64-NEXT: .cfi_restore s01038; RV64-NEXT: .cfi_restore s11039; RV64-NEXT: csrci mstatus, 81040; RV64-NEXT: csrw mepc, s11041; RV64-NEXT: csrw mcause, s01042; RV64-NEXT: ld s1, 16(sp) # 8-byte Folded Reload1043; RV64-NEXT: ld s0, 24(sp) # 8-byte Folded Reload1044; RV64-NEXT: addi sp, sp, 321045; RV64-NEXT: .cfi_def_cfa_offset 01046; RV64-NEXT: csrrw sp, sf.mscratchcsw, sp1047; RV64-NEXT: mret1048 call void asm sideeffect "", "~{x8},~{x9}"() #41049 ret void1050}1051