2b7ee754df5eea53e707c57a39016bf9e43d2681
[oota-llvm.git] / test / Transforms / SLPVectorizer / X86 / intrinsic.ll
1 ; RUN: opt < %s -basicaa -slp-vectorizer -slp-threshold=-999 -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
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 target triple = "x86_64-apple-macosx10.8.0"
5
6 declare double @llvm.fabs.f64(double) nounwind readnone
7
8 ;CHECK-LABEL: @vec_fabs_f64(
9 ;CHECK: load <2 x double>
10 ;CHECK: load <2 x double>
11 ;CHECK: call <2 x double> @llvm.fabs.v2f64
12 ;CHECK: store <2 x double>
13 ;CHECK: ret
14 define void @vec_fabs_f64(double* %a, double* %b, double* %c) {
15 entry:
16   %i0 = load double* %a, align 8
17   %i1 = load double* %b, align 8
18   %mul = fmul double %i0, %i1
19   %call = tail call double @llvm.fabs.f64(double %mul) nounwind readnone
20   %arrayidx3 = getelementptr inbounds double* %a, i64 1
21   %i3 = load double* %arrayidx3, align 8
22   %arrayidx4 = getelementptr inbounds double* %b, i64 1
23   %i4 = load double* %arrayidx4, align 8
24   %mul5 = fmul double %i3, %i4
25   %call5 = tail call double @llvm.fabs.f64(double %mul5) nounwind readnone
26   store double %call, double* %c, align 8
27   %arrayidx5 = getelementptr inbounds double* %c, i64 1
28   store double %call5, double* %arrayidx5, align 8
29   ret void
30 }
31
32 declare float @llvm.copysign.f32(float, float) nounwind readnone
33
34 ;CHECK-LABEL: @vec_copysign_f32(
35 ;CHECK: load <4 x float>
36 ;CHECK: load <4 x float>
37 ;CHECK: call <4 x float> @llvm.copysign.v4f32
38 ;CHECK: store <4 x float>
39 ;CHECK: ret
40 define void @vec_copysign_f32(float* %a, float* %b, float* noalias %c) {
41 entry:
42   %0 = load float* %a, align 4
43   %1 = load float* %b, align 4
44   %call0 = tail call float @llvm.copysign.f32(float %0, float %1) nounwind readnone
45   store float %call0, float* %c, align 4
46
47   %ix2 = getelementptr inbounds float* %a, i64 1
48   %2 = load float* %ix2, align 4
49   %ix3 = getelementptr inbounds float* %b, i64 1
50   %3 = load float* %ix3, align 4
51   %call1 = tail call float @llvm.copysign.f32(float %2, float %3) nounwind readnone
52   %c1 = getelementptr inbounds float* %c, i64 1
53   store float %call1, float* %c1, align 4
54
55   %ix4 = getelementptr inbounds float* %a, i64 2
56   %4 = load float* %ix4, align 4
57   %ix5 = getelementptr inbounds float* %b, i64 2
58   %5 = load float* %ix5, align 4
59   %call2 = tail call float @llvm.copysign.f32(float %4, float %5) nounwind readnone
60   %c2 = getelementptr inbounds float* %c, i64 2
61   store float %call2, float* %c2, align 4
62
63   %ix6 = getelementptr inbounds float* %a, i64 3
64   %6 = load float* %ix6, align 4
65   %ix7 = getelementptr inbounds float* %b, i64 3
66   %7 = load float* %ix7, align 4
67   %call3 = tail call float @llvm.copysign.f32(float %6, float %7) nounwind readnone
68   %c3 = getelementptr inbounds float* %c, i64 3
69   store float %call3, float* %c3, align 4
70
71   ret void
72 }
73
74
75