1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/test/CodeGen/Hexagon/sdata-load-size.ll
Krzysztof Parzyszek 9eb0f854d8 [Hexagon] Do not reduce load size for globals in small-data
Small-data (i.e. GP-relative) loads and stores allow 16-bit scaled
offset. For a load of a value of type T, the small-data area is
equivalent to an array "T sdata[65536]". This implies that objects
of smaller sizes need to be closer to the beginning of sdata,
while larger objects may be farther away, or otherwise the offset
may be insufficient to reach it. Similarly, an object of a larger
size should not be accessed via a load of a smaller size.

llvm-svn: 345975
2018-11-02 14:17:47 +00:00

20 lines
512 B
LLVM

; RUN: llc -march=hexagon -hexagon-small-data-threshold=8 < %s | FileCheck %s
; CHECK: = memd(gp+#g0)
; If an object will be placed in .sdata, do not shrink any references to it.
; In this case, g0 must be loaded via memd.
target triple = "hexagon"
@g0 = common global i64 0, align 8
define i32 @f0() #0 {
entry:
%v0 = load i64, i64* @g0, align 8
%v1 = trunc i64 %v0 to i8
%v2 = zext i8 %v1 to i32
ret i32 %v2
}
attributes #0 = { nounwind "target-cpu"="hexagonv60" "target-features"="+small-data" }