]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Transforms/LoopVectorize/X86/fp32_to_uint32-cost-model.ll
Vendor import of llvm RELEASE_350/final tag r216957 (effectively, 3.5.0 release):
[FreeBSD/FreeBSD.git] / test / Transforms / LoopVectorize / X86 / fp32_to_uint32-cost-model.ll
1 ; RUN: opt < %s -mcpu=core-avx2 -loop-vectorize -S | llc -mcpu=core-avx2 | FileCheck %s
2
3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-apple-macosx"
5
6 @float_array = common global [10000 x float] zeroinitializer, align 16
7 @unsigned_array = common global [10000 x i32] zeroinitializer, align 16
8
9 ; If we need to scalarize the fptoui and then use inserts to build up the
10 ; vector again, then there is certainly no value in going 256-bit wide.
11 ; CHECK-NOT: vinserti128
12
13 define void @convert(i32 %N) {
14 entry:
15   %0 = icmp eq i32 %N, 0
16   br i1 %0, label %for.end, label %for.body.preheader
17
18 for.body.preheader:                               ; preds = %entry
19   br label %for.body
20
21 for.body:                                         ; preds = %for.body.preheader, %for.body
22   %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
23   %arrayidx = getelementptr inbounds [10000 x float]* @float_array, i64 0, i64 %indvars.iv
24   %1 = load float* %arrayidx, align 4
25   %conv = fptoui float %1 to i32
26   %arrayidx2 = getelementptr inbounds [10000 x i32]* @unsigned_array, i64 0, i64 %indvars.iv
27   store i32 %conv, i32* %arrayidx2, align 4
28   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
29   %lftr.wideiv = trunc i64 %indvars.iv.next to i32
30   %exitcond = icmp eq i32 %lftr.wideiv, %N
31   br i1 %exitcond, label %for.end.loopexit, label %for.body
32
33 for.end.loopexit:                                 ; preds = %for.body
34   br label %for.end
35
36 for.end:                                          ; preds = %for.end.loopexit, %entry
37   ret void
38 }
39