1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv64 -riscv-force-enable-global-merge-external-globals \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s -check-prefix=SMALL-DATA
4 ; RUN: llc -mtriple=riscv64 -global-merge-min-data-size=0 \
5 ; RUN: -riscv-force-enable-global-merge-external-globals -verify-machineinstrs < %s \
6 ; RUN: | FileCheck %s -check-prefix=MINSIZE
8 @ig1 = internal global i32 0, align 4
9 @ig2 = internal global i32 0, align 4
11 @eg1 = dso_local global i32 0, align 4
12 @eg2 = dso_local global i32 0, align 4
14 ; This test shows that GlobalDataMinSize is set to SmallDataLimit + 1 when
15 ; SmallDataLimit module flag is set as non-zero, and that global-merge-min-data-size
16 ; overrides the small data limit.
18 define void @f1(i32 %a) nounwind {
19 ; SMALL-DATA-LABEL: f1:
20 ; SMALL-DATA: # %bb.0:
21 ; SMALL-DATA-NEXT: lui a1, %hi(ig1)
22 ; SMALL-DATA-NEXT: sw a0, %lo(ig1)(a1)
23 ; SMALL-DATA-NEXT: lui a1, %hi(ig2)
24 ; SMALL-DATA-NEXT: sw a0, %lo(ig2)(a1)
25 ; SMALL-DATA-NEXT: lui a1, %hi(eg1)
26 ; SMALL-DATA-NEXT: sw a0, %lo(eg1)(a1)
27 ; SMALL-DATA-NEXT: lui a1, %hi(eg2)
28 ; SMALL-DATA-NEXT: sw a0, %lo(eg2)(a1)
29 ; SMALL-DATA-NEXT: ret
33 ; MINSIZE-NEXT: lui a1, %hi(.L_MergedGlobals)
34 ; MINSIZE-NEXT: sw a0, %lo(.L_MergedGlobals)(a1)
35 ; MINSIZE-NEXT: addi a1, a1, %lo(.L_MergedGlobals)
36 ; MINSIZE-NEXT: sw a0, 4(a1)
37 ; MINSIZE-NEXT: sw a0, 8(a1)
38 ; MINSIZE-NEXT: sw a0, 12(a1)
40 store i32 %a, ptr @ig1, align 4
41 store i32 %a, ptr @ig2, align 4
42 store i32 %a, ptr @eg1, align 4
43 store i32 %a, ptr @eg2, align 4
48 !llvm.module.flags = !{!0}
49 !0 = !{i32 8, !"SmallDataLimit", i32 8}