1 /* Copyright 2002 Andi Kleen, SuSE Labs */
3 * ISO C memset - set a memory block to a byte value.
9 * rax original destination
19 /* expand byte value */
21 movabs $0x0101010101010101,%rax
22 mul %rcx /* with rax, clobbers rdx */
28 .Lafter_bad_alignment:
48 /* Handle tail in loops. The loops should be faster than hard
49 to predict jump tables. */
81 movq %rax,(%rdi) /* unaligned store */
86 jmp .Lafter_bad_alignment
88 /* Some CPUs run faster using the string instructions.
89 It is also a lot simpler. Use this when possible */
91 #include <asm/cpufeature.h>
93 .section .altinstructions,"a"
97 .byte X86_FEATURE_REP_GOOD
98 .byte memset_c_end-memset_c
99 .byte memset_c_end-memset_c
102 .section .altinstr_replacement,"ax"
113 /* expand byte value */
115 movabs $0x0101010101010101,%rax
116 mulq %rsi /* with rax, clobbers rdx */