1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
4 define void @tiny_memset_to_rep_stos(ptr %ptr) minsize nounwind {
5 ; CHECK-LABEL: tiny_memset_to_rep_stos:
6 ; CHECK: # %bb.0: # %entry
7 ; CHECK-NEXT: andq $0, (%rdi)
10 call void @llvm.memset.p0.i32(ptr align 4 %ptr, i8 0, i32 8, i1 false)
14 define void @small_memset_to_rep_stos(ptr %ptr) minsize nounwind {
15 ; CHECK-LABEL: small_memset_to_rep_stos:
16 ; CHECK: # %bb.0: # %entry
17 ; CHECK-NEXT: pushq $32
18 ; CHECK-NEXT: popq %rcx
19 ; CHECK-NEXT: xorl %eax, %eax
20 ; CHECK-NEXT: rep;stosl %eax, %es:(%rdi)
23 call void @llvm.memset.p0.i32(ptr align 4 %ptr, i8 0, i32 128, i1 false)
27 define void @medium_memset_to_rep_stos(ptr %ptr) minsize nounwind {
28 ; CHECK-LABEL: medium_memset_to_rep_stos:
29 ; CHECK: # %bb.0: # %entry
30 ; CHECK-NEXT: pushq %rax
31 ; CHECK-NEXT: movl $512, %edx # imm = 0x200
32 ; CHECK-NEXT: xorl %esi, %esi
33 ; CHECK-NEXT: callq memset@PLT
34 ; CHECK-NEXT: popq %rax
37 call void @llvm.memset.p0.i32(ptr align 4 %ptr, i8 0, i32 512, i1 false)
41 define void @large_memset_to_rep_stos(ptr %ptr) minsize nounwind {
42 ; CHECK-LABEL: large_memset_to_rep_stos:
43 ; CHECK: # %bb.0: # %entry
44 ; CHECK-NEXT: pushq %rax
45 ; CHECK-NEXT: movl $4096, %edx # imm = 0x1000
46 ; CHECK-NEXT: xorl %esi, %esi
47 ; CHECK-NEXT: callq memset@PLT
48 ; CHECK-NEXT: popq %rax
51 call void @llvm.memset.p0.i32(ptr align 4 %ptr, i8 0, i32 4096, i1 false)
55 define void @huge_memset_to_rep_stos(ptr %ptr) minsize nounwind {
56 ; CHECK-LABEL: huge_memset_to_rep_stos:
57 ; CHECK: # %bb.0: # %entry
58 ; CHECK-NEXT: pushq %rax
59 ; CHECK-NEXT: movl $8192, %edx # imm = 0x2000
60 ; CHECK-NEXT: xorl %esi, %esi
61 ; CHECK-NEXT: callq memset@PLT
62 ; CHECK-NEXT: popq %rax
65 call void @llvm.memset.p0.i32(ptr align 4 %ptr, i8 0, i32 8192, i1 false)
69 define void @odd_length_memset_to_rep_stos(ptr %ptr) minsize nounwind {
70 ; CHECK-LABEL: odd_length_memset_to_rep_stos:
71 ; CHECK: # %bb.0: # %entry
72 ; CHECK-NEXT: pushq %rax
73 ; CHECK-NEXT: movl $255, %edx
74 ; CHECK-NEXT: xorl %esi, %esi
75 ; CHECK-NEXT: callq memset@PLT
76 ; CHECK-NEXT: popq %rax
79 call void @llvm.memset.p0.i32(ptr align 4 %ptr, i8 0, i32 255, i1 false)
83 define void @align_1_memset_to_rep_stos(ptr %ptr) minsize nounwind {
84 ; CHECK-LABEL: align_1_memset_to_rep_stos:
85 ; CHECK: # %bb.0: # %entry
86 ; CHECK-NEXT: pushq %rax
87 ; CHECK-NEXT: movl $256, %edx # imm = 0x100
88 ; CHECK-NEXT: xorl %esi, %esi
89 ; CHECK-NEXT: callq memset@PLT
90 ; CHECK-NEXT: popq %rax
93 call void @llvm.memset.p0.i32(ptr align 1 %ptr, i8 0, i32 256, i1 false)
97 define void @align_2_memset_to_rep_stos(ptr %ptr) minsize nounwind {
98 ; CHECK-LABEL: align_2_memset_to_rep_stos:
99 ; CHECK: # %bb.0: # %entry
100 ; CHECK-NEXT: pushq %rax
101 ; CHECK-NEXT: movl $256, %edx # imm = 0x100
102 ; CHECK-NEXT: xorl %esi, %esi
103 ; CHECK-NEXT: callq memset@PLT
104 ; CHECK-NEXT: popq %rax
107 call void @llvm.memset.p0.i32(ptr align 2 %ptr, i8 0, i32 256, i1 false)
111 define void @align_4_memset_to_rep_stos(ptr %ptr) minsize nounwind {
112 ; CHECK-LABEL: align_4_memset_to_rep_stos:
113 ; CHECK: # %bb.0: # %entry
114 ; CHECK-NEXT: pushq %rax
115 ; CHECK-NEXT: movl $256, %edx # imm = 0x100
116 ; CHECK-NEXT: xorl %esi, %esi
117 ; CHECK-NEXT: callq memset@PLT
118 ; CHECK-NEXT: popq %rax
121 call void @llvm.memset.p0.i32(ptr align 4 %ptr, i8 0, i32 256, i1 false)
125 define void @align_8_memset_to_rep_stos(ptr %ptr) minsize nounwind {
126 ; CHECK-LABEL: align_8_memset_to_rep_stos:
127 ; CHECK: # %bb.0: # %entry
128 ; CHECK-NEXT: pushq %rax
129 ; CHECK-NEXT: movl $256, %edx # imm = 0x100
130 ; CHECK-NEXT: xorl %esi, %esi
131 ; CHECK-NEXT: callq memset@PLT
132 ; CHECK-NEXT: popq %rax
135 call void @llvm.memset.p0.i32(ptr align 8 %ptr, i8 0, i32 256, i1 false)
139 declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1)