Sanjay Patel | b653de1 | 2014-09-10 17:58:16 +0000 | [diff] [blame] | 1 | ; RUN: opt -S -loop-vectorize -force-vector-width=2 -force-vector-interleave=1 < %s | FileCheck %s |
Arnold Schwaighofer | ef51cf2 | 2013-07-01 00:54:44 +0000 | [diff] [blame] | 2 | |
| 3 | target 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" |
| 4 | |
| 5 | ; Make sure we can vectorize loops with functions to math library functions. |
| 6 | ; They might read the rounding mode but we are only vectorizing loops that |
| 7 | ; contain a limited set of function calls and none of them sets the rounding |
| 8 | ; mode, so vectorizing them is safe. |
| 9 | |
Matt Arsenault | e64c7c7 | 2013-10-02 20:29:00 +0000 | [diff] [blame] | 10 | ; CHECK-LABEL: @test( |
Arnold Schwaighofer | ef51cf2 | 2013-07-01 00:54:44 +0000 | [diff] [blame] | 11 | ; CHECK: <2 x double> |
| 12 | |
| 13 | define void @test(double* %d, double %t) { |
| 14 | entry: |
| 15 | br label %for.body |
| 16 | |
| 17 | for.body: |
| 18 | %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 19 | %arrayidx = getelementptr inbounds double, double* %d, i64 %indvars.iv |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 20 | %0 = load double, double* %arrayidx, align 8 |
Arnold Schwaighofer | ef51cf2 | 2013-07-01 00:54:44 +0000 | [diff] [blame] | 21 | %1 = tail call double @llvm.pow.f64(double %0, double %t) |
| 22 | store double %1, double* %arrayidx, align 8 |
| 23 | %indvars.iv.next = add i64 %indvars.iv, 1 |
| 24 | %lftr.wideiv = trunc i64 %indvars.iv.next to i32 |
| 25 | %exitcond = icmp ne i32 %lftr.wideiv, 128 |
| 26 | br i1 %exitcond, label %for.body, label %for.end |
| 27 | |
| 28 | for.end: |
| 29 | ret void |
| 30 | } |
| 31 | |
| 32 | declare double @llvm.pow.f64(double, double) |