brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 0a276a5 Raw
64 lines · plain
1; RUN: llc -mtriple=thumbv7-apple-ios -disable-block-placement < %s | FileCheck %s2; RUN: llc -mtriple=armv7-apple-ios   -disable-block-placement < %s | FileCheck %s3 4; LLVM IR optimizers canonicalize icmp+select this way.5; Make sure that TwoAddressInstructionPass can commute the corresponding6; MOVCC instructions to avoid excessive copies in one of the if blocks.7;8; CHECK: %if.then9; CHECK-NOT: mov10; CHECK: movlo11; CHECK: movlo12; CHECK-NOT: mov13 14; CHECK: %if.else15; CHECK-NOT: mov16; CHECK: movls17; CHECK: movls18; CHECK-NOT: mov19 20; This is really an LSR test: Make sure that cmp is using the incremented21; induction variable.22; CHECK: %if.end823; CHECK: add{{(s|\.w)?}} [[IV:r[0-9]+]], {{.*}}#124; CHECK: cmp [[IV]], #25 26define i32 @f(ptr nocapture %a, i32 %Pref) nounwind ssp {27entry:28  br label %for.body29 30for.body:                                         ; preds = %entry, %if.end831  %i.012 = phi i32 [ 0, %entry ], [ %inc, %if.end8 ]32  %BestCost.011 = phi i32 [ -1, %entry ], [ %BestCost.1, %if.end8 ]33  %BestIdx.010 = phi i32 [ 0, %entry ], [ %BestIdx.1, %if.end8 ]34  %arrayidx = getelementptr inbounds i32, ptr %a, i32 %i.01235  %0 = load i32, ptr %arrayidx, align 436  %mul = mul i32 %0, %037  %sub = add nsw i32 %i.012, -538  %cmp2 = icmp eq i32 %sub, %Pref39  br i1 %cmp2, label %if.else, label %if.then40 41if.then:                                          ; preds = %for.body42  %cmp3 = icmp ult i32 %mul, %BestCost.01143  %i.0.BestIdx.0 = select i1 %cmp3, i32 %i.012, i32 %BestIdx.01044  %mul.BestCost.0 = select i1 %cmp3, i32 %mul, i32 %BestCost.01145  br label %if.end846 47if.else:                                          ; preds = %for.body48  %cmp5 = icmp ugt i32 %mul, %BestCost.01149  %BestIdx.0.i.0 = select i1 %cmp5, i32 %BestIdx.010, i32 %i.01250  %BestCost.0.mul = select i1 %cmp5, i32 %BestCost.011, i32 %mul51  br label %if.end852 53if.end8:                                          ; preds = %if.else, %if.then54  %BestIdx.1 = phi i32 [ %i.0.BestIdx.0, %if.then ], [ %BestIdx.0.i.0, %if.else ]55  %BestCost.1 = phi i32 [ %mul.BestCost.0, %if.then ], [ %BestCost.0.mul, %if.else ]56  store i32 %mul, ptr %arrayidx, align 457  %inc = add i32 %i.012, 158  %cmp = icmp eq i32 %inc, 1159  br i1 %cmp, label %for.end, label %for.body60 61for.end:                                          ; preds = %if.end862  ret i32 %BestIdx.163}64