1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -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=5 \
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
14 ; This test shows that GlobalDataMinSize is set to 0 when SmallDataLimit module
15 ; flag is set to zero, and that the global-merge-min-data-size option overrides
16 ; 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(.L_MergedGlobals)
22 ; SMALL-DATA-NEXT: sw a0, %lo(.L_MergedGlobals)(a1)
23 ; SMALL-DATA-NEXT: addi a1, a1, %lo(.L_MergedGlobals)
24 ; SMALL-DATA-NEXT: sw a0, 4(a1)
25 ; SMALL-DATA-NEXT: sw a0, 8(a1)
26 ; SMALL-DATA-NEXT: sw a0, 12(a1)
27 ; SMALL-DATA-NEXT: ret
31 ; MINSIZE-NEXT: lui a1, %hi(ig1)
32 ; MINSIZE-NEXT: sw a0, %lo(ig1)(a1)
33 ; MINSIZE-NEXT: lui a1, %hi(ig2)
34 ; MINSIZE-NEXT: sw a0, %lo(ig2)(a1)
35 ; MINSIZE-NEXT: lui a1, %hi(eg1)
36 ; MINSIZE-NEXT: sw a0, %lo(eg1)(a1)
37 ; MINSIZE-NEXT: lui a1, %hi(eg2)
38 ; MINSIZE-NEXT: sw a0, %lo(eg2)(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 0}