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
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
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 ptr @func_a(i64 zeroext)
20 declare ptr @func_b(i64 zeroext)
21 ; Function Attrs: nounwind
22 define ptr @test(i64 zeroext %nbytes) local_unnamed_addr #0 {
24 %cmp = icmp eq i64 %nbytes, 0
25 br i1 %cmp, label %if.else, label %if.then
27 if.then: ; preds = %entry
28 %call = tail call ptr @func_a(i64 zeroext %nbytes)
31 if.else: ; preds = %entry
32 %call1 = tail call ptr @func_b(i64 zeroext 0)
35 return: ; preds = %if.else, %if.then
36 %retval.0 = phi ptr [ %call, %if.then ], [ %call1, %if.else ]
39 ; Function Attrs: nounwind
40 declare void @llvm.stackprotector(ptr, ptr) #0
42 attributes #0 = { nounwind }
48 exposesReturnsTwice: false
50 regBankSelected: false
53 tracksRegLiveness: true
57 - { reg: '$a0_64', virtual-reg: '' }
59 isFrameAddressTaken: false
60 isReturnAddressTaken: false
70 cvBytesOfCalleeSavedRegisters: 0
71 hasOpaqueSPAdjustment: false
73 hasMustTailInVarArgFunc: false
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: '' }
84 machineFunctionInfo: {}
86 ; CHECK-LABEL: name: test
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
94 ; CHECK: $sp_64 = DADDiu $sp_64, -16
95 ; CHECK: $sp_64 = DADDiu $sp_64, 16
97 ; CHECK: BEQ64 renamable $a0_64, $zero_64, %bb.2, implicit-def $at {
98 ; CHECK: $zero = SLL $zero, 0
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: $zero = SLL $zero, 0
105 ; CHECK: J %bb.3, implicit-def dead $at {
106 ; CHECK: $zero = SLL $zero, 0
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
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
119 successors: %bb.2(0x30000000), %bb.1(0x50000000)
120 liveins: $a0_64, $ra_64
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:
128 $sp_64 = DADDiu $sp_64, -16
129 $sp_64 = DADDiu $sp_64, 16
131 BEQ64 renamable $a0_64, $zero_64, %bb.2, implicit-def $at
134 successors: %bb.3(0x80000000)
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
141 successors: %bb.3(0x80000000)
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
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