1 ; RUN: opt -S -passes=loop-vectorize < %s 2>&1 -pass-remarks-analysis=.* | FileCheck %s
3 ; Test the optimization remark emitter for recognition
4 ; of a mathlib function vs. an arbitrary function.
6 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
7 target triple = "x86_64-apple-macosx10.14.0"
8 @data = external local_unnamed_addr global [32768 x float], align 16
10 ; CHECK: loop not vectorized: library call cannot be vectorized
12 define void @libcall_blocks_vectorization() {
20 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
21 %arrayidx = getelementptr inbounds [32768 x float], ptr @data, i64 0, i64 %indvars.iv
22 %t0 = load float, ptr %arrayidx, align 4
23 %sqrtf = tail call float @sqrtf(float %t0)
24 store float %sqrtf, ptr %arrayidx, align 4
25 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
26 %exitcond = icmp eq i64 %indvars.iv.next, 32768
27 br i1 %exitcond, label %for.cond.cleanup, label %for.body
30 ; CHECK: loop not vectorized: call instruction cannot be vectorized
32 define void @arbitrary_call_blocks_vectorization() {
40 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
41 %arrayidx = getelementptr inbounds [32768 x float], ptr @data, i64 0, i64 %indvars.iv
42 %t0 = load float, ptr %arrayidx, align 4
43 %sqrtf = tail call float @arbitrary(float %t0)
44 store float %sqrtf, ptr %arrayidx, align 4
45 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
46 %exitcond = icmp eq i64 %indvars.iv.next, 32768
47 br i1 %exitcond, label %for.cond.cleanup, label %for.body
50 declare float @sqrtf(float)
51 declare float @arbitrary(float)