1 ; RUN: llc -march=hexagon -hexagon-small-data-threshold=0 < %s | FileCheck %s
2 ; Disable small-data, or otherwise g3 will end up in .sdata. While that is
3 ; not a problem, this test was originally written with the g3 not being in
4 ; there, so keep it that way.
6 %s.0 = type { i32, i32, i32, i32, i32, i32 }
7 %s.1 = type { i64, i64, i64, i64, i64, i64 }
8 %s.2 = type { i16, i16, i16, i16, i16, i16 }
9 %s.3 = type { i8, i8, i8, i8, i8, i8 }
11 @g0 = external global %s.0
12 @g1 = external global %s.1
13 @g2 = external global %s.2
14 @g3 = external global %s.3
17 ; CHECK: [[REG1:(r[0-9]+)]] = {{[#]+}}g0
18 ; CHECK: r{{[0-9]+}} = memw([[REG1]]+#{{[0-9]+}})
20 ; CHECK: dealloc_return
23 %v0 = alloca %s.0, align 4
24 %v1 = bitcast %s.0* %v0 to i8*
25 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %v1, i8* align 4 bitcast (%s.0* @g0 to i8*), i32 24, i1 false)
26 call void @f1(%s.0* %v0) #0
30 declare void @f1(%s.0*)
33 ; CHECK: [[REG2:(r[0-9]+)]] = {{[#]+}}g1
34 ; CHECK: r{{[0-9]+}}:{{[0-9]+}} = memd([[REG2]]+#{{[0-9]+}})
35 ; CHECK: dealloc_return
38 %v0 = alloca %s.1, align 8
39 %v1 = bitcast %s.1* %v0 to i8*
40 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %v1, i8* align 8 bitcast (%s.1* @g1 to i8*), i32 48, i1 false)
41 call void @f3(%s.1* %v0) #0
45 declare void @f3(%s.1*)
48 ; CHECK: [[REG1:(r[0-9]+)]] = {{[#]+}}g2
49 ; CHECK: r{{[0-9]+}} = mem{{u?}}h([[REG1]]+#{{[0-9]+}})
51 ; CHECK: dealloc_return
54 %v0 = alloca %s.2, align 2
55 %v1 = bitcast %s.2* %v0 to i8*
56 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 2 %v1, i8* align 2 bitcast (%s.2* @g2 to i8*), i32 12, i1 false)
57 call void @f5(%s.2* %v0) #0
61 declare void @f5(%s.2*)
64 ; CHECK: [[REG1:(r[0-9]+)]] = {{[#]+}}g3
65 ; CHECK: r{{[0-9]+}} = mem{{u?}}b([[REG1]]+#{{[0-9]+}})
67 ; CHECK: dealloc_return
70 %v0 = alloca %s.3, align 1
71 %v1 = getelementptr inbounds %s.3, %s.3* %v0, i32 0, i32 0
72 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %v1, i8* align 1 getelementptr inbounds (%s.3, %s.3* @g3, i32 0, i32 0), i32 6, i1 false)
73 call void @f7(%s.3* %v0) #0
77 declare void @f7(%s.3*)
79 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i1) #1
81 attributes #0 = { nounwind }
82 attributes #1 = { argmemonly nounwind }