brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.6 KiB · 63cfef6 Raw
112 lines · plain
1; RUN: opt < %s -O3 -S | FileCheck %s2; See issue #55013 and PR #70845 for more details.3; This test comes from the following C program, compiled with clang4;5;; short vecreduce_smin_v2i16(int n, short* v)6;; {7;;   short p = 0;8;;   for (int i = 0; i < n; ++i)9;;     p = p > v[i] ? v[i] : p;10;;   return p;11;; }12;13;; short vecreduce_smax_v2i16(int n, short* v)14;; {15;;   short p = 0;16;;   for (int i = 0; i < n; ++i)17;;     p = p < v[i] ? v[i] : p;18;;   return p;19;; }20 21define i16 @vecreduce_smin_v2i16(i32 %n, ptr %v) {22; CHECK-LABEL: define range(i16 -32768, 1) i16 @vecreduce_smin_v2i16(23; CHECK:    @llvm.smin.v2i1624 25entry:26  br label %for.cond27 28for.cond:                                         ; preds = %for.inc, %entry29  %p.0 = phi i16 [ 0, %entry ], [ %conv8, %for.inc ]30  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]31  %cmp = icmp slt i32 %i.0, %n32  br i1 %cmp, label %for.body, label %for.end33 34for.body:                                         ; preds = %for.cond35  %conv = sext i16 %p.0 to i3236  %idxprom = sext i32 %i.0 to i6437  %arrayidx = getelementptr inbounds i16, ptr %v, i64 %idxprom38  %0 = load i16, ptr %arrayidx, align 239  %conv1 = sext i16 %0 to i3240  %cmp2 = icmp sgt i32 %conv, %conv141  br i1 %cmp2, label %cond.true, label %cond.false42 43cond.true:                                        ; preds = %for.body44  %idxprom4 = sext i32 %i.0 to i6445  %arrayidx5 = getelementptr inbounds i16, ptr %v, i64 %idxprom446  %1 = load i16, ptr %arrayidx5, align 247  %conv6 = sext i16 %1 to i3248  br label %cond.end49 50cond.false:                                       ; preds = %for.body51  %conv7 = sext i16 %p.0 to i3252  br label %cond.end53 54cond.end:                                         ; preds = %cond.false, %cond.true55  %cond = phi i32 [ %conv6, %cond.true ], [ %conv7, %cond.false ]56  %conv8 = trunc i32 %cond to i1657  br label %for.inc58 59for.inc:                                          ; preds = %cond.end60  %inc = add nsw i32 %i.0, 161  br label %for.cond62 63for.end:                                          ; preds = %for.cond64  ret i16 %p.065}66 67define i16 @vecreduce_smax_v2i16(i32 %n, ptr %v) {68; CHECK-LABEL: define range(i16 0, -32768) i16 @vecreduce_smax_v2i16(69; CHECK:  @llvm.smax.v2i1670 71entry:72  br label %for.cond73 74for.cond:                                         ; preds = %for.inc, %entry75  %p.0 = phi i16 [ 0, %entry ], [ %conv8, %for.inc ]76  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]77  %cmp = icmp slt i32 %i.0, %n78  br i1 %cmp, label %for.body, label %for.end79 80for.body:                                         ; preds = %for.cond81  %conv = sext i16 %p.0 to i3282  %idxprom = sext i32 %i.0 to i6483  %arrayidx = getelementptr inbounds i16, ptr %v, i64 %idxprom84  %0 = load i16, ptr %arrayidx, align 285  %conv1 = sext i16 %0 to i3286  %cmp2 = icmp slt i32 %conv, %conv187  br i1 %cmp2, label %cond.true, label %cond.false88 89cond.true:                                        ; preds = %for.body90  %idxprom4 = sext i32 %i.0 to i6491  %arrayidx5 = getelementptr inbounds i16, ptr %v, i64 %idxprom492  %1 = load i16, ptr %arrayidx5, align 293  %conv6 = sext i16 %1 to i3294  br label %cond.end95 96cond.false:                                       ; preds = %for.body97  %conv7 = sext i16 %p.0 to i3298  br label %cond.end99 100cond.end:                                         ; preds = %cond.false, %cond.true101  %cond = phi i32 [ %conv6, %cond.true ], [ %conv7, %cond.false ]102  %conv8 = trunc i32 %cond to i16103  br label %for.inc104 105for.inc:                                          ; preds = %cond.end106  %inc = add nsw i32 %i.0, 1107  br label %for.cond108 109for.end:                                          ; preds = %for.cond110  ret i16 %p.0111}112