xref: /llvm-project/flang/test/Fir/vector-always-cfg.fir (revision c6b6e18c4d25305ab98b6eab752de99ea4e15344)
1// RUN: fir-opt --fir-to-llvm-ir %s | FileCheck %s
2
3#access_group = #llvm.access_group<id = distinct[0]<>>
4// CHECK: #[[ACCESS:.*]] = #llvm.access_group<id = distinct[0]<>>
5#loop_vectorize = #llvm.loop_vectorize<disable = false>
6// CHECK: #[[VECTORIZE:.*]] = #llvm.loop_vectorize<disable = false>
7#loop_annotation = #llvm.loop_annotation<vectorize = #loop_vectorize, parallelAccesses = #access_group>
8// CHECK: #[[ANNOTATION:.*]] = #llvm.loop_annotation<vectorize = #[[VECTORIZE]], parallelAccesses = #[[ACCESS]]>
9
10func.func @_QPvector_always() -> i32 {
11  %c1 = arith.constant 1 : index
12  %c10_i32 = arith.constant 10 : i32
13  %c1_i32 = arith.constant 1 : i32
14  %c10 = arith.constant 10 : index
15  %0 = arith.subi %c10, %c1 : index
16  %1 = arith.addi %0, %c1 : index
17  %2 = arith.divsi %1, %c1 : index
18  cf.br ^bb1(%c1, %c1_i32, %2 : index, i32, index)
19^bb1(%3: index, %4: i32, %5: index):  // 2 preds: ^bb0, ^bb2
20  %c0 = arith.constant 0 : index
21  %6 = arith.cmpi sgt, %5, %c0 : index
22  cf.cond_br %6, ^bb2, ^bb3 {loop_annotation = #loop_annotation}
23// CHECK:   llvm.cond_br %{{.*}}, ^{{.*}}, ^{{.*}} {loop_annotation = #[[ANNOTATION]]}
24^bb2:  // pred: ^bb1
25  %7 = arith.addi %3, %c1 : index
26  %c1_0 = arith.constant 1 : index
27  %8 = arith.subi %5, %c1_0 : index
28  cf.br ^bb1(%7, %c1_i32, %8 : index, i32, index)
29^bb3:  // pred: ^bb1
30  return %4 : i32
31}
32
33