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