brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 11cda78 Raw
60 lines · cpp
1// RUN: %clang_cc1 -triple arm-none-eabi -std=c++11 -emit-llvm -o - %s | FileCheck %s2 3void unroll_and_jam(int *List, int Length, int Value) {4  // CHECK-LABEL: define {{.*}} @_Z14unroll_and_jam5#pragma unroll_and_jam6  for (int i = 0; i < Length; i++) {7    for (int j = 0; j < Length; j++) {8      // CHECK: br label {{.*}}, !llvm.loop ![[LOOP_1:.*]]9      // CHECK: br label {{.*}}, !llvm.loop ![[LOOP_2:.*]]10      List[i * Length + j] = Value;11    }12  }13}14 15void unroll_and_jam_count(int *List, int Length, int Value) {16  // CHECK-LABEL: define {{.*}} @_Z20unroll_and_jam_count17#pragma unroll_and_jam(4)18  for (int i = 0; i < Length; i++) {19    for (int j = 0; j < Length; j++) {20      // CHECK: br label {{.*}}, !llvm.loop ![[LOOP_3:.*]]21      // CHECK: br label {{.*}}, !llvm.loop ![[LOOP_4:.*]]22      List[i * Length + j] = Value;23    }24  }25}26 27void nounroll_and_jam(int *List, int Length, int Value) {28  // CHECK-LABEL: define {{.*}} @_Z16nounroll_and_jam29#pragma nounroll_and_jam30  for (int i = 0; i < Length; i++) {31    for (int j = 0; j < Length; j++) {32      // CHECK: br label {{.*}}, !llvm.loop ![[LOOP_5:.*]]33      // CHECK: br label {{.*}}, !llvm.loop ![[LOOP_6:.*]]34      List[i * Length + j] = Value;35    }36  }37}38 39void clang_unroll_plus_nounroll_and_jam(int *List, int Length, int Value) {40  // CHECK-LABEL: define {{.*}} @_Z34clang_unroll_plus_nounroll_and_jam41#pragma nounroll_and_jam42#pragma unroll(4)43  for (int i = 0; i < Length; i++) {44    for (int j = 0; j < Length; j++) {45      // CHECK: br label {{.*}}, !llvm.loop ![[LOOP_7:.*]]46      // CHECK: br label {{.*}}, !llvm.loop ![[LOOP_8:.*]]47      List[i * Length + j] = Value;48    }49  }50}51 52// CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2]], [[MP:![0-9]+]], ![[UNJ_ENABLE:.*]]}53// CHECK: ![[UNJ_ENABLE]] = !{!"llvm.loop.unroll_and_jam.enable"}54// CHECK: ![[LOOP_4]] = distinct !{![[LOOP_4]], [[MP]], ![[UNJ_4:.*]]}55// CHECK: ![[UNJ_4]] = !{!"llvm.loop.unroll_and_jam.count", i32 4}56// CHECK: ![[LOOP_6]] = distinct !{![[LOOP_6]], [[MP]], ![[UNJ_DISABLE:.*]]}57// CHECK: ![[UNJ_DISABLE]] = !{!"llvm.loop.unroll_and_jam.disable"}58// CHECK: ![[LOOP_8]] = distinct !{![[LOOP_8]], [[MP]], ![[UNJ_DISABLE:.*]], ![[UNROLL_4:.*]]}59// CHECK: ![[UNROLL_4]] = !{!"llvm.loop.unroll.count", i32 4}60