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
15 .section .altinstr_replacement, "ax", @progbits
22 /* expand byte value */
24 movabs $0x0101010101010101,%rax
25 mulq %rsi /* with rax, clobbers rdx */
40 /* expand byte value */
42 movabs $0x0101010101010101,%rax
43 mul %rcx /* with rax, clobbers rdx */
50 .Lafter_bad_alignment:
70 /* Handle tail in loops. The loops should be faster than hard
71 to predict jump tables. */
104 movq %rax,(%rdi) /* unaligned store */
109 jmp .Lafter_bad_alignment
115 /* Some CPUs run faster using the string instructions.
116 It is also a lot simpler. Use this when possible */
118 #include <asm/cpufeature.h>
120 .section .altinstructions,"a"
124 .word X86_FEATURE_REP_GOOD
125 .byte .Lfinal - memset
126 .byte .Lmemset_e - .Lmemset_c