; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=riscv32 -riscv-enable-global-merge -verify-machineinstrs < %s \
; RUN: | FileCheck %s -check-prefix=SMALL-DATA
; RUN: llc -mtriple=riscv64 -riscv-enable-global-merge -global-merge-min-data-size=5 \
; RUN: -verify-machineinstrs < %s | FileCheck %s -check-prefix=MINSIZE
@ig1 = internal global i32 0, align 4
@ig2 = internal global i32 0, align 4
@eg1 = dso_local global i32 0, align 4
@eg2 = dso_local global i32 0, align 4
; This test shows that GlobalDataMinSize is set to 0 when SmallDataLimit module
; flag is set to zero, and that the global-merge-min-data-size option overrides
; the small data limit.
define void @f1(i32 %a) nounwind {
; SMALL-DATA-LABEL: f1:
; SMALL-DATA: # %bb.0:
; SMALL-DATA-NEXT: lui a1, %hi(.L_MergedGlobals)
; SMALL-DATA-NEXT: sw a0, %lo(.L_MergedGlobals)(a1)
; SMALL-DATA-NEXT: addi a1, a1, %lo(.L_MergedGlobals)
; SMALL-DATA-NEXT: sw a0, 4(a1)
; SMALL-DATA-NEXT: sw a0, 8(a1)
; SMALL-DATA-NEXT: sw a0, 12(a1)
; SMALL-DATA-NEXT: ret
;
; MINSIZE-LABEL: f1:
; MINSIZE: # %bb.0:
; MINSIZE-NEXT: lui a1, %hi(ig1)
; MINSIZE-NEXT: sw a0, %lo(ig1)(a1)
; MINSIZE-NEXT: lui a1, %hi(ig2)
; MINSIZE-NEXT: sw a0, %lo(ig2)(a1)
; MINSIZE-NEXT: lui a1, %hi(eg1)
; MINSIZE-NEXT: sw a0, %lo(eg1)(a1)
; MINSIZE-NEXT: lui a1, %hi(eg2)
; MINSIZE-NEXT: sw a0, %lo(eg2)(a1)
; MINSIZE-NEXT: ret
store i32 %a, ptr @ig1, align 4
store i32 %a, ptr @ig2, align 4
store i32 %a, ptr @eg1, align 4
store i32 %a, ptr @eg2, align 4
ret void
}
!llvm.module.flags = !{!0}
!0 = !{i32 8, !"SmallDataLimit", i32 0}