1 // REQUIRES: hexagon-registered-target
2 // RUN: %clang_cc1 -emit-llvm -O2 -o - -triple hexagon-unknown-elf -target-cpu hexagonv60 %s | FileCheck %s
3 // This unit test validates that the store to "dst" variable needs to be eliminated.
5 // CHECK: @brev_store_elimination_test1
6 // CHECK: llvm.hexagon.L2.loadri.pbr
9 int *brev_store_elimination_test1(int *ptr
, int mod
) {
11 return __builtin_brev_ldw(ptr
, &dst
, mod
);
14 // CHECK: @brev_store_elimination_test2
15 // CHECK: llvm.hexagon.L2.loadri.pbr
17 extern int add(int a
);
18 int brev_store_elimination_test2(int *ptr
, int mod
) {
20 __builtin_brev_ldw(ptr
, &dst
, mod
);
24 // CHECK: @brev_store_elimination_test3
25 // CHECK: llvm.hexagon.L2.loadri.pbr
27 int brev_store_elimination_test3(int *ptr
, int mod
, int inc
) {
29 for (int i
= 0; i
< inc
; ++i
) {
30 __builtin_brev_ldw(ptr
, &dst
, mod
);
36 // brev_store_elimination_test4 validates the fact that we are not deleting the
37 // stores if the value is passed by reference later.
38 // CHECK: @brev_store_elimination_test4
39 // CHECK: llvm.hexagon.L2.loadri.pbr
41 extern int sub(int *a
);
42 int brev_store_elimination_test4(int *ptr
, int mod
) {
44 __builtin_brev_ldw(ptr
, &dst
, mod
);