brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.7 KiB · da14564 Raw
191 lines · plain
1; RUN: llc -mtriple=mipsel -O0 < %s | FileCheck %s -check-prefix=None2; RUN: llc -mtriple=mipsel     -relocation-model=pic    < %s | \3; RUN: FileCheck %s -check-prefix=Default4; RUN: llc -mtriple=mipsel -O1 -relocation-model=static < %s | \5; RUN: FileCheck %s -check-prefix=STATICO16; RUN: llc -mtriple=mipsel -disable-mips-df-forward-search=false \7; RUN: -relocation-model=static < %s | FileCheck %s -check-prefix=FORWARD8; RUN: llc -mtriple=mipsel -disable-mips-df-backward-search -relocation-model=pic \9; RUN: -enable-shrink-wrap=false \10; RUN: -disable-mips-df-succbb-search=false -disable-preheader-prot=true < %s | \11; RUN: FileCheck %s -check-prefix=SUCCBB12 13define void @foo1() nounwind {14entry:15; Default:     jalr16; Default-NOT: nop17; Default:     jr18; Default-NOT: nop19; Default:     .end20; None: jalr21; None: nop22; None: jr23; None: nop24; None: .end25 26  call void @foo2(i32 3) nounwind27  ret void28}29 30declare void @foo2(i32)31 32; Check that cvt.d.w goes into jalr's delay slot.33;34define void @foo3(i32 %a) nounwind {35entry:36; Default-LABEL:     foo3:37; Default:     jalr38; Default:     cvt.d.w39 40  %conv = sitofp i32 %a to double41  call void @foo4(double %conv) nounwind42  ret void43}44 45declare void @foo4(double)46 47@g2 = external global i3248@g1 = external global i3249@g3 = external global i3250 51; Check that branch delay slot can be filled with an instruction with operand52; $1.53;54; Default-LABEL:     foo5:55; Default-NOT: nop56 57define void @foo5(i32 %a) nounwind {58entry:59  %0 = load i32, ptr @g2, align 460  %tobool = icmp eq i32 %a, 061  br i1 %tobool, label %if.else, label %if.then62 63if.then:64  %1 = load i32, ptr @g1, align 465  %add = add nsw i32 %1, %066  store i32 %add, ptr @g1, align 467  br label %if.end68 69if.else:70  %2 = load i32, ptr @g3, align 471  %sub = sub nsw i32 %2, %072  store i32 %sub, ptr @g3, align 473  br label %if.end74 75if.end:76  ret void77}78 79; Check that delay slot filler can place mov.s or mov.d in delay slot.80;81; Default-LABEL:     foo6:82; Default-NOT: nop83; Default:     .end foo684 85define void @foo6(float %a0, double %a1) nounwind {86entry:87  call void @foo7(double %a1, float %a0) nounwind88  ret void89}90 91declare void @foo7(double, float)92 93; Check that a store can move past other memory instructions.94;95; STATICO1-LABEL:      foo8:96; STATICO1:      jalr ${{[0-9]+}}97; STATICO1-NEXT: sw ${{[0-9]+}}, %lo(g1)98 99@foo9 = common global ptr null, align 4100 101define i32 @foo8(i32 %a) nounwind {102entry:103  store i32 %a, ptr @g1, align 4104  %0 = load ptr, ptr @foo9, align 4105  call void %0() nounwind106  %1 = load i32, ptr @g1, align 4107  %add = add nsw i32 %1, %a108  ret i32 %add109}110 111; Test searchForward. Check that the second jal's slot is filled with another112; instruction in the same block.113;114; FORWARD-LABEL:     foo10:115; FORWARD:     jal foo11116; FORWARD:     jal foo11117; FORWARD-NOT: nop118; FORWARD:     end foo10119 120define void @foo10() nounwind {121entry:122  tail call void @foo11() nounwind123  tail call void @foo11() nounwind124  store i32 0, ptr @g1, align 4125  tail call void @foo11() nounwind126  store i32 0, ptr @g1, align 4127  ret void128}129 130declare void @foo11()131 132; Check that delay slots of branches in both the entry block and loop body are133; filled.134;135; SUCCBB-LABEL:      succbbs_loop1:136; SUCCBB:      blez $5, $BB137; SUCCBB-NEXT: sll138; SUCCBB-NEXT: # %bb139; SUCCBB-NEXT: addu140; SUCCBB:      addiu ${{[0-9]+}}, ${{[0-9]+}}, 4141; SUCCBB-NEXT: bne ${{[0-9]+}}, ${{[0-9]+}}, $BB142; SUCCBB-NEXT: nop143 144define i32 @succbbs_loop1(ptr nocapture %a, i32 %n) {145entry:146  %cmp4 = icmp sgt i32 %n, 0147  br i1 %cmp4, label %for.body, label %for.end148 149for.body:                                         ; preds = %entry, %for.body150  %s.06 = phi i32 [ %add, %for.body ], [ 0, %entry ]151  %i.05 = phi i32 [ %inc, %for.body ], [ 0, %entry ]152  %arrayidx = getelementptr inbounds i32, ptr %a, i32 %i.05153  %0 = load i32, ptr %arrayidx, align 4154  %add = add nsw i32 %0, %s.06155  %inc = add nsw i32 %i.05, 1156  %exitcond = icmp eq i32 %inc, %n157  br i1 %exitcond, label %for.end, label %for.body158 159for.end:                                          ; preds = %for.body, %entry160  %s.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]161  ret i32 %s.0.lcssa162}163 164; Check that the first branch has its slot filled.165;166; SUCCBB-LABEL:      succbbs_br1:167; SUCCBB:      beqz ${{[0-9]+}}, $BB168; SUCCBB-NEXT: lw ${{[0-9]+}}, %got(foo101)(${{[0-9]+}})169 170define internal fastcc void @foo101() {171entry:172  tail call void @foo100()173  tail call void @foo100()174  ret void175}176 177define void @succbbs_br1(i32 %a) {178entry:179  %tobool = icmp eq i32 %a, 0180  br i1 %tobool, label %if.end, label %if.then181 182if.then:                                          ; preds = %entry183  tail call fastcc void @foo101()184  br label %if.end185 186if.end:                                           ; preds = %entry, %if.then187  ret void188}189 190declare void @foo100()191