1 ; RUN: llc -march=hexagon -O3 -hexagon-small-data-threshold=0 < %s | FileCheck %s
2 ; This test checks the case if there are more than 2 uses of a constan address, move the
3 ; value in to a register and replace all instances of constant with the register.
4 ; The GenMemAbsolute pass generates a absolute-set instruction if there are more
5 ; than 2 uses of this register.
7 ; CHECK: storetrunci32_3
8 ; CHECK-NOT: memw(##441652) = r{{[0-9]+}}
9 ; CHECK-NOT: memw(r{{[0-9]+}}+#0) = r{{[0-9]+}}
10 ; CHECK:memw(r[[REG:[0-9]+]]=##441652) = r{{[0-9]+}}
11 ; CHECK-NOT: memw(##441652) = r{{[0-9]+}}
12 ; CHECK:memw(r[[REG]]+#0) = r{{[0-9]+}}
13 ; CHECK-NOT: memw(##441652) = r{{[0-9]+}}
14 ; CHECK:memw(r[[REG]]+#0) = r{{[0-9]+}}
15 ; CHECK-NOT: memw(##441652) = r{{[0-9]+}}
17 define void @storetrunci32_3(i64 %descr_addr, i32 %rpm_or_sys, i32 %kkr) #0 {
19 %conv = trunc i64 %descr_addr to i32
20 store volatile i32 %conv, ptr inttoptr (i32 441652 to ptr), align 4
21 store volatile i32 %rpm_or_sys, ptr inttoptr (i32 441652 to ptr), align 4
22 store volatile i32 %kkr, ptr inttoptr (i32 441652 to ptr), align 4
26 ; CHECK: storetrunci32_2
27 ; CHECK-NOT: r{{[0-9]+}} = ##441652
28 ; CHECK: memw(##441652) = r{{[0-9]+}}
29 ; CHECK: memw(##441652) = r{{[0-9]+}}
31 define void @storetrunci32_2(i64 %descr_addr, i32 %rpm_or_sys) #0 {
33 %conv = trunc i64 %descr_addr to i32
34 store volatile i32 %conv, ptr inttoptr (i32 441652 to ptr), align 4
35 store volatile i32 %rpm_or_sys, ptr inttoptr (i32 441652 to ptr), align 4
39 ; CHECK: storetrunci32_abs_global_3
40 ; CHECK-NOT: memw(##globalInt) = r{{[0-9]+}}
41 ; CHECK-NOT: memw(r{{[0-9]+}}+#0) = r{{[0-9]+}}
42 ; CHECK:memw(r[[REG:[0-9]+]]=##globalInt) = r{{[0-9]+}}
43 ; CHECK-NOT: memw(##globalInt) = r{{[0-9]+}}
44 ; CHECK:memw(r[[REG]]+#0) = r{{[0-9]+}}
45 ; CHECK-NOT: memw(##globalInt) = r{{[0-9]+}}
46 ; CHECK:memw(r[[REG]]+#0) = r{{[0-9]+}}
47 ; CHECK-NOT: memw(##globalInt) = r{{[0-9]+}}
49 @globalInt = external global i32, align 8
50 define void @storetrunci32_abs_global_3(i64 %descr_addr, i32 %rpm_or_sys, i32 %kkr) #0 {
52 %conv = trunc i64 %descr_addr to i32
53 store volatile i32 %conv, ptr @globalInt, align 4
54 store volatile i32 %rpm_or_sys, ptr @globalInt, align 4
55 store volatile i32 %kkr, ptr @globalInt, align 4
59 ; CHECK: storetrunci32_abs_global_2
60 ; CHECK-NOT:r[[REG:[0-9]+]] = ##globalInt
61 ; CHECK:memw(##globalInt) = r{{[0-9]+}}
62 ; CHECK:memw(##globalInt) = r{{[0-9]+}}
64 define void @storetrunci32_abs_global_2(i64 %descr_addr, i32 %rpm_or_sys) #0 {
66 %conv = trunc i64 %descr_addr to i32
67 store volatile i32 %conv, ptr @globalInt, align 4
68 store volatile i32 %rpm_or_sys, ptr @globalInt, align 4
72 attributes #0 = { nounwind }