1 /* Copyright 2002 Andi Kleen, SuSE Labs */
3 #include <linux/linkage.h>
4 #include <asm/dwarf2.h>
7 * ISO C memset - set a memory block to a byte value.
13 * rax original destination
23 /* expand byte value */
25 movabs $0x0101010101010101,%rax
26 mulq %rsi /* with rax, clobbers rdx */
41 /* expand byte value */
43 movabs $0x0101010101010101,%rax
44 mul %rcx /* with rax, clobbers rdx */
51 .Lafter_bad_alignment:
71 /* Handle tail in loops. The loops should be faster than hard
72 to predict jump tables. */
105 movq %rax,(%rdi) /* unaligned store */
110 jmp .Lafter_bad_alignment
116 /* Some CPUs run faster using the string instructions.
117 It is also a lot simpler. Use this when possible */
119 #include <asm/cpufeature.h>
121 .section .altinstr_replacement,"ax"
122 1: .byte 0xeb /* jmp <disp8> */
123 .byte (memset_c - memset) - (2f - 1b) /* offset */
126 .section .altinstructions,"a"
130 .byte X86_FEATURE_REP_GOOD
131 .byte .Lfinal - memset