brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · d5fc187 Raw
47 lines · c
1// REQUIRES: hexagon-registered-target2// RUN: %clang_cc1 -emit-llvm -O2 -o - -triple hexagon-unknown-elf -target-cpu hexagonv60 %s | FileCheck %s3// This unit test validates that the store to "dst" variable needs to be eliminated.4 5// CHECK: @brev_store_elimination_test16// CHECK: llvm.hexagon.L2.loadri.pbr7// CHECK-NOT: store8 9int *brev_store_elimination_test1(int *ptr, int mod) {10  int dst = 100;11  return __builtin_brev_ldw(ptr, &dst, mod);12}13 14// CHECK: @brev_store_elimination_test215// CHECK: llvm.hexagon.L2.loadri.pbr16// CHECK-NOT: store17extern int add(int a);18int brev_store_elimination_test2(int *ptr, int mod) {19  int dst = 100;20  __builtin_brev_ldw(ptr, &dst, mod);21  return add(dst);22}23 24// CHECK: @brev_store_elimination_test325// CHECK: llvm.hexagon.L2.loadri.pbr26// CHECK-NOT: store27int brev_store_elimination_test3(int *ptr, int mod, int inc) {28  int dst = 100;29  for (int i = 0; i < inc; ++i) {30    __builtin_brev_ldw(ptr, &dst, mod);31    dst = add(dst);32  }33  return dst;34}35 36// brev_store_elimination_test4 validates the fact that we are not deleting the37// stores if the value is passed by reference later.38// CHECK: @brev_store_elimination_test439// CHECK: llvm.hexagon.L2.loadri.pbr40// CHECK: store41extern int sub(int *a);42int brev_store_elimination_test4(int *ptr, int mod) {43  int dst = 100;44  __builtin_brev_ldw(ptr, &dst, mod);45  return sub(&dst);46}47