1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2 ; RUN: opt -p loop-vectorize -S %s | FileCheck %s
4 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128-Fn32"
5 target triple = "arm64-apple-macosx15.0.0"
7 define void @test(i32 %N, ptr %dst) {
8 ; CHECK-LABEL: define void @test(
9 ; CHECK-SAME: i32 [[N:%.*]], ptr [[DST:%.*]]) {
10 ; CHECK-NEXT: [[ENTRY:.*]]:
11 ; CHECK-NEXT: br label %[[LOOP:.*]]
13 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, %[[ENTRY]] ], [ [[IV_NEXT:%.*]], %[[LOOP]] ]
14 ; CHECK-NEXT: [[FNEG137:%.*]] = phi float [ 0.000000e+00, %[[ENTRY]] ], [ [[FNEG1:%.*]], %[[LOOP]] ]
15 ; CHECK-NEXT: [[FNEG46:%.*]] = phi float [ 0.000000e+00, %[[ENTRY]] ], [ [[FNEG:%.*]], %[[LOOP]] ]
16 ; CHECK-NEXT: [[FNEG]] = fneg float [[FNEG137]]
17 ; CHECK-NEXT: [[FNEG1]] = fneg float [[FNEG46]]
18 ; CHECK-NEXT: [[GEP:%.*]] = getelementptr float, ptr [[DST]], i32 [[IV]]
19 ; CHECK-NEXT: store float [[FNEG1]], ptr [[GEP]], align 4
20 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 1
21 ; CHECK-NEXT: [[EC:%.*]] = icmp eq i32 [[IV]], [[N]]
22 ; CHECK-NEXT: br i1 [[EC]], label %[[EXIT:.*]], label %[[LOOP]]
24 ; CHECK-NEXT: ret void
30 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
31 %fneg137 = phi float [ 0.000000e+00, %entry ], [ %fneg1, %loop ]
32 %fneg46 = phi float [ 0.000000e+00, %entry ], [ %fneg, %loop ]
33 %fneg = fneg float %fneg137
34 %fneg1 = fneg float %fneg46
35 %gep = getelementptr float, ptr %dst, i32 %iv
36 store float %fneg1, ptr %gep
37 %iv.next = add i32 %iv, 1
38 %ec = icmp eq i32 %iv, %N
39 br i1 %ec, label %exit, label %loop