1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2## Check that the delay-slot filler does not attempt to split BUNDLE instructions 3# RUN: llc %s -start-before=mips-delay-slot-filler -stop-after=mips-delay-slot-filler \ 4# RUN: -verify-machineinstrs -o - | FileCheck %s 5## Check that we can emit assembly for input with BUNDLE instructions: 6# RUN: llc %s -start-before=mips-delay-slot-filler -verify-machineinstrs -o - | FileCheck %s -check-prefix ASM 7 8# ASM: # %bb.0: 9# ASM-NEXT: daddiu $sp, $sp, -16 10# ASM-NEXT: sd $ra, 8($sp) 11## BUNDLE should be emitted in order: 12# ASM-NEXT: daddiu $sp, $sp, -16 13# ASM-NEXT: daddiu $sp, $sp, 16 14# ASM-NEXT: beqz $4, .LBB0_2 15# ASM-NEXT: nop 16--- | 17 target datalayout = "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128" 18 target triple = "mips64-unknown-freebsd" 19 declare i8* @func_a(i64 zeroext) 20 declare i8* @func_b(i64 zeroext) 21 ; Function Attrs: nounwind 22 define i8* @test(i64 zeroext %nbytes) local_unnamed_addr #0 { 23 entry: 24 %cmp = icmp eq i64 %nbytes, 0 25 br i1 %cmp, label %if.else, label %if.then 26 27 if.then: ; preds = %entry 28 %call = tail call i8* @func_a(i64 zeroext %nbytes) 29 br label %return 30 31 if.else: ; preds = %entry 32 %call1 = tail call i8* @func_b(i64 zeroext 0) 33 br label %return 34 35 return: ; preds = %if.else, %if.then 36 %retval.0 = phi i8* [ %call, %if.then ], [ %call1, %if.else ] 37 ret i8* %retval.0 38 } 39 ; Function Attrs: nounwind 40 declare void @llvm.stackprotector(i8*, i8**) #0 41 42 attributes #0 = { nounwind } 43 44... 45--- 46name: test 47alignment: 8 48exposesReturnsTwice: false 49legalized: false 50regBankSelected: false 51selected: false 52failedISel: false 53tracksRegLiveness: true 54hasWinCFI: false 55registers: [] 56liveins: 57 - { reg: '$a0_64', virtual-reg: '' } 58frameInfo: 59 isFrameAddressTaken: false 60 isReturnAddressTaken: false 61 hasStackMap: false 62 hasPatchPoint: false 63 stackSize: 16 64 offsetAdjustment: 0 65 maxAlignment: 8 66 adjustsStack: true 67 hasCalls: true 68 stackProtector: '' 69 maxCallFrameSize: 0 70 cvBytesOfCalleeSavedRegisters: 0 71 hasOpaqueSPAdjustment: false 72 hasVAStart: false 73 hasMustTailInVarArgFunc: false 74 localFrameSize: 0 75 savePoint: '' 76 restorePoint: '' 77fixedStack: [] 78stack: 79 - { id: 0, name: '', type: spill-slot, offset: -8, size: 8, alignment: 8, 80 stack-id: default, callee-saved-register: '$ra_64', callee-saved-restored: true, 81 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 82callSites: [] 83constants: [] 84machineFunctionInfo: {} 85body: | 86 ; CHECK-LABEL: name: test 87 ; CHECK: bb.0.entry: 88 ; CHECK: successors: %bb.2(0x30000000), %bb.1(0x50000000) 89 ; CHECK: $sp_64 = DADDiu $sp_64, -16 90 ; CHECK: CFI_INSTRUCTION def_cfa_offset 16 91 ; CHECK: SD killed $ra_64, $sp_64, 8 :: (store (s64) into %stack.0) 92 ; CHECK: CFI_INSTRUCTION offset $ra_64, -8 93 ; CHECK: BUNDLE { 94 ; CHECK: $sp_64 = DADDiu $sp_64, -16 95 ; CHECK: $sp_64 = DADDiu $sp_64, 16 96 ; CHECK: } 97 ; CHECK: BEQ64 renamable $a0_64, $zero_64, %bb.2, implicit-def $at { 98 ; CHECK: NOP 99 ; CHECK: } 100 ; CHECK: bb.1.if.then: 101 ; CHECK: successors: %bb.3(0x80000000) 102 ; CHECK: JAL @func_a, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit-def $sp, implicit-def $v0_64 { 103 ; CHECK: NOP 104 ; CHECK: } 105 ; CHECK: J %bb.3, implicit-def dead $at { 106 ; CHECK: NOP 107 ; CHECK: } 108 ; CHECK: bb.2.if.else: 109 ; CHECK: successors: %bb.3(0x80000000) 110 ; CHECK: JAL @func_b, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit-def $sp, implicit-def $v0_64 { 111 ; CHECK: $a0_64 = DADDiu $zero_64, 0 112 ; CHECK: } 113 ; CHECK: bb.3.return: 114 ; CHECK: $ra_64 = LD $sp_64, 8 :: (load (s64) from %stack.0) 115 ; CHECK: PseudoReturn64 undef $ra_64, implicit $v0_64 { 116 ; CHECK: $sp_64 = DADDiu $sp_64, 16 117 ; CHECK: } 118 bb.0.entry: 119 successors: %bb.2(0x30000000), %bb.1(0x50000000) 120 liveins: $a0_64, $ra_64 121 122 $sp_64 = DADDiu $sp_64, -16 123 CFI_INSTRUCTION def_cfa_offset 16 124 SD killed $ra_64, $sp_64, 8 :: (store (s64) into %stack.0) 125 CFI_INSTRUCTION offset $ra_64, -8 126 ; This BUNDLE instruction must not be split by the delay slot filler: 127 BUNDLE { 128 $sp_64 = DADDiu $sp_64, -16 129 $sp_64 = DADDiu $sp_64, 16 130 } 131 BEQ64 renamable $a0_64, $zero_64, %bb.2, implicit-def $at 132 133 bb.1.if.then: 134 successors: %bb.3(0x80000000) 135 liveins: $a0_64 136 137 JAL @func_a, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit-def $sp, implicit-def $v0_64 138 J %bb.3, implicit-def dead $at 139 140 bb.2.if.else: 141 successors: %bb.3(0x80000000) 142 143 $a0_64 = DADDiu $zero_64, 0 144 JAL @func_b, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit-def $sp, implicit-def $v0_64 145 146 bb.3.return: 147 liveins: $v0_64 148 149 $ra_64 = LD $sp_64, 8 :: (load (s64) from %stack.0) 150 $sp_64 = DADDiu $sp_64, 16 151 PseudoReturn64 undef $ra_64, implicit $v0_64 152 153... 154