1*2e14900dSBjorn Pettersson; RUN: opt -S -passes=loop-vectorize -force-vector-width=2 -force-vector-interleave=1 < %s | FileCheck %s
2cee313d2SEric Christopher
3cee313d2SEric Christophertarget datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
4cee313d2SEric Christopher
5cee313d2SEric Christopher; Make sure we can vectorize loops with functions to math library functions.
6cee313d2SEric Christopher; They might read the rounding mode but we are only vectorizing loops that
7cee313d2SEric Christopher; contain a limited set of function calls and none of them sets the rounding
8cee313d2SEric Christopher; mode, so vectorizing them is safe.
9cee313d2SEric Christopher
10cee313d2SEric Christopher; CHECK-LABEL: @test(
11cee313d2SEric Christopher; CHECK: <2 x double>
12cee313d2SEric Christopher
13cee313d2SEric Christopherdefine void @test(double* %d, double %t) {
14cee313d2SEric Christopherentry:
15cee313d2SEric Christopher  br label %for.body
16cee313d2SEric Christopher
17cee313d2SEric Christopherfor.body:
18cee313d2SEric Christopher  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
19cee313d2SEric Christopher  %arrayidx = getelementptr inbounds double, double* %d, i64 %indvars.iv
20cee313d2SEric Christopher  %0 = load double, double* %arrayidx, align 8
21cee313d2SEric Christopher  %1 = tail call double @llvm.pow.f64(double %0, double %t)
22cee313d2SEric Christopher  store double %1, double* %arrayidx, align 8
23cee313d2SEric Christopher  %indvars.iv.next = add i64 %indvars.iv, 1
24cee313d2SEric Christopher  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
25cee313d2SEric Christopher  %exitcond = icmp ne i32 %lftr.wideiv, 128
26cee313d2SEric Christopher  br i1 %exitcond, label %for.body, label %for.end
27cee313d2SEric Christopher
28cee313d2SEric Christopherfor.end:
29cee313d2SEric Christopher  ret void
30cee313d2SEric Christopher}
31cee313d2SEric Christopher
32cee313d2SEric Christopherdeclare double @llvm.pow.f64(double, double)
33