brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.6 KiB · 4fe58f8 Raw
97 lines · plain
1; REQUIRES: asserts2; RUN: llc < %s -O3 -mtriple=x86_64-- -mcpu=core2 -stress-ivchain | FileCheck %s -check-prefix=X643; RUN: llc < %s -O3 -mtriple=i686-- -mcpu=core2 -stress-ivchain | FileCheck %s -check-prefix=X864 5; @sharedidx is an unrolled variant of this loop:6;  for (unsigned long i = 0; i < len; i += s) {7;    c[i] = a[i] + b[i];8;  }9; where 's' cannot be folded into the addressing mode.10;11; This is not quite profitable to chain. But with -stress-ivchain, we12; can form three address chains in place of the shared induction13; variable.14 15; X64: sharedidx:16; X64: %for.body.preheader17; X64-NOT: leal ({{.*}},4)18; X64: %for.body.119 20; X86: sharedidx:21; X86: %for.body.222; X86: add23; X86: add24; X86: add25; X86: add26; X86: add27; X86: %for.body.328define void @sharedidx(ptr nocapture %a, ptr nocapture %b, ptr nocapture %c, i32 %s, i32 %len) nounwind ssp {29entry:30  %cmp8 = icmp eq i32 %len, 031  br i1 %cmp8, label %for.end, label %for.body32 33for.body:                                         ; preds = %entry, %for.body.334  %i.09 = phi i32 [ %add5.3, %for.body.3 ], [ 0, %entry ]35  %arrayidx = getelementptr inbounds i8, ptr %a, i32 %i.0936  %0 = load i8, ptr %arrayidx, align 137  %conv6 = zext i8 %0 to i3238  %arrayidx1 = getelementptr inbounds i8, ptr %b, i32 %i.0939  %1 = load i8, ptr %arrayidx1, align 140  %conv27 = zext i8 %1 to i3241  %add = add nsw i32 %conv27, %conv642  %conv3 = trunc i32 %add to i843  %arrayidx4 = getelementptr inbounds i8, ptr %c, i32 %i.0944  store i8 %conv3, ptr %arrayidx4, align 145  %add5 = add i32 %i.09, %s46  %cmp = icmp ult i32 %add5, %len47  br i1 %cmp, label %for.body.1, label %for.end48 49for.end:                                          ; preds = %for.body, %for.body.1, %for.body.2, %for.body.3, %entry50  ret void51 52for.body.1:                                       ; preds = %for.body53  %arrayidx.1 = getelementptr inbounds i8, ptr %a, i32 %add554  %2 = load i8, ptr %arrayidx.1, align 155  %conv6.1 = zext i8 %2 to i3256  %arrayidx1.1 = getelementptr inbounds i8, ptr %b, i32 %add557  %3 = load i8, ptr %arrayidx1.1, align 158  %conv27.1 = zext i8 %3 to i3259  %add.1 = add nsw i32 %conv27.1, %conv6.160  %conv3.1 = trunc i32 %add.1 to i861  %arrayidx4.1 = getelementptr inbounds i8, ptr %c, i32 %add562  store i8 %conv3.1, ptr %arrayidx4.1, align 163  %add5.1 = add i32 %add5, %s64  %cmp.1 = icmp ult i32 %add5.1, %len65  br i1 %cmp.1, label %for.body.2, label %for.end66 67for.body.2:                                       ; preds = %for.body.168  %arrayidx.2 = getelementptr inbounds i8, ptr %a, i32 %add5.169  %4 = load i8, ptr %arrayidx.2, align 170  %conv6.2 = zext i8 %4 to i3271  %arrayidx1.2 = getelementptr inbounds i8, ptr %b, i32 %add5.172  %5 = load i8, ptr %arrayidx1.2, align 173  %conv27.2 = zext i8 %5 to i3274  %add.2 = add nsw i32 %conv27.2, %conv6.275  %conv3.2 = trunc i32 %add.2 to i876  %arrayidx4.2 = getelementptr inbounds i8, ptr %c, i32 %add5.177  store i8 %conv3.2, ptr %arrayidx4.2, align 178  %add5.2 = add i32 %add5.1, %s79  %cmp.2 = icmp ult i32 %add5.2, %len80  br i1 %cmp.2, label %for.body.3, label %for.end81 82for.body.3:                                       ; preds = %for.body.283  %arrayidx.3 = getelementptr inbounds i8, ptr %a, i32 %add5.284  %6 = load i8, ptr %arrayidx.3, align 185  %conv6.3 = zext i8 %6 to i3286  %arrayidx1.3 = getelementptr inbounds i8, ptr %b, i32 %add5.287  %7 = load i8, ptr %arrayidx1.3, align 188  %conv27.3 = zext i8 %7 to i3289  %add.3 = add nsw i32 %conv27.3, %conv6.390  %conv3.3 = trunc i32 %add.3 to i891  %arrayidx4.3 = getelementptr inbounds i8, ptr %c, i32 %add5.292  store i8 %conv3.3, ptr %arrayidx4.3, align 193  %add5.3 = add i32 %add5.2, %s94  %cmp.3 = icmp ult i32 %add5.3, %len95  br i1 %cmp.3, label %for.body, label %for.end96}97