1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
4 ; Check that multiple instances of 64-bit constants encodable as
5 ; 32-bit immediates are merged for code size savings.
7 ; Immediates with multiple users should not be pulled into instructions when
8 ; optimizing for code size (but 8-bit immediates are exceptions).
10 define i1 @imm_multiple_users(i64 %a, ptr %b) optsize {
11 ; CHECK-LABEL: imm_multiple_users:
13 ; CHECK-NEXT: movq $-1, (%rsi)
14 ; CHECK-NEXT: cmpq $-1, %rdi
15 ; CHECK-NEXT: sete %al
17 store i64 -1, ptr %b, align 8
18 %cmp = icmp eq i64 %a, -1
22 define i1 @imm_multiple_users_pgso(i64 %a, ptr %b) !prof !14 {
23 ; CHECK-LABEL: imm_multiple_users_pgso:
25 ; CHECK-NEXT: movq $-1, (%rsi)
26 ; CHECK-NEXT: cmpq $-1, %rdi
27 ; CHECK-NEXT: sete %al
29 store i64 -1, ptr %b, align 8
30 %cmp = icmp eq i64 %a, -1
34 declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1)
36 ; Inlined memsets requiring multiple same-sized stores should be lowered using
37 ; the register, rather than immediate, form of stores when optimizing for
39 define void @memset_zero(ptr noalias nocapture %D) optsize {
40 ; CHECK-LABEL: memset_zero:
42 ; CHECK-NEXT: xorl %eax, %eax
43 ; CHECK-NEXT: movq %rax, 7(%rdi)
44 ; CHECK-NEXT: movq %rax, (%rdi)
46 tail call void @llvm.memset.p0.i64(ptr %D, i8 0, i64 15, i1 false)
50 define void @memset_zero_pgso(ptr noalias nocapture %D) !prof !14 {
51 ; CHECK-LABEL: memset_zero_pgso:
53 ; CHECK-NEXT: xorl %eax, %eax
54 ; CHECK-NEXT: movq %rax, 7(%rdi)
55 ; CHECK-NEXT: movq %rax, (%rdi)
57 tail call void @llvm.memset.p0.i64(ptr %D, i8 0, i64 15, i1 false)
61 !llvm.module.flags = !{!0}
62 !0 = !{i32 1, !"ProfileSummary", !1}
63 !1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
64 !2 = !{!"ProfileFormat", !"InstrProf"}
65 !3 = !{!"TotalCount", i64 10000}
66 !4 = !{!"MaxCount", i64 10}
67 !5 = !{!"MaxInternalCount", i64 1}
68 !6 = !{!"MaxFunctionCount", i64 1000}
69 !7 = !{!"NumCounts", i64 3}
70 !8 = !{!"NumFunctions", i64 3}
71 !9 = !{!"DetailedSummary", !10}
72 !10 = !{!11, !12, !13}
73 !11 = !{i32 10000, i64 100, i32 1}
74 !12 = !{i32 999000, i64 100, i32 1}
75 !13 = !{i32 999999, i64 1, i32 2}
76 !14 = !{!"function_entry_count", i64 0}