1 ; RUN: llc -march=hexagon -O3 -hexagon-small-data-threshold=0 < %s | FileCheck %s
2 ; This lit test validates that storetrunc for a 64bit value picks a store
3 ; absolute pattern instead of base + index store pattern. This will facilitate
4 ; the constant extender optimization pass to move the immediate value to a register
5 ; if there are more than two uses and replace all the uses of the constant.
6 ; Generation of absolute pattern for a 64 bit truncated value also aviods an
9 @g0 = external global i8, align 8
10 @g1 = external global i16, align 8
11 @g2 = external global i32, align 8
14 ; CHECK: memd(##441656) = r{{[0-9]+}}
15 define void @f0(i64 %a0) #0 {
17 store volatile i64 %a0, ptr inttoptr (i32 441656 to ptr)
22 ; CHECK: memw(##441656) = r{{[0-9]+}}
23 define void @f1(i64 %a0) #0 {
25 %v0 = trunc i64 %a0 to i32
26 store volatile i32 %v0, ptr inttoptr (i32 441656 to ptr)
31 ; CHECK: memh(##441656) = r{{[0-9]+}}
32 define void @f2(i64 %a0) #0 {
34 %v0 = trunc i64 %a0 to i16
35 store volatile i16 %v0, ptr inttoptr (i32 441656 to ptr)
40 ; CHECK: memb(##441656) = r{{[0-9]+}}
41 define void @f3(i64 %a0) #0 {
43 %v0 = trunc i64 %a0 to i8
44 store volatile i8 %v0, ptr inttoptr (i32 441656 to ptr)
49 ; CHECK: memw(##g2) = r{{[0-9]+}}
50 define void @f4(i64 %a0) #0 {
52 %v0 = trunc i64 %a0 to i32
53 store volatile i32 %v0, ptr @g2
58 ; CHECK: memh(##g1) = r{{[0-9]+}}
59 define void @f5(i64 %a0) #0 {
61 %v0 = trunc i64 %a0 to i16
62 store volatile i16 %v0, ptr @g1
67 ; CHECK: memb(##g0) = r{{[0-9]+}}
68 define void @f6(i64 %a0) #0 {
70 %v0 = trunc i64 %a0 to i8
71 store volatile i8 %v0, ptr @g0
75 attributes #0 = { nounwind }