2 * linux/arch/m32r/lib/memset.S
4 * Copyright (C) 2001,2002 Hiroyuki Kondo, and Hirokazu Takata
5 * Copyright (C) 2004 Hirokazu Takata
7 * void *memset(void *dst, int val, int len);
19 #ifdef CONFIG_ISA_DUAL_ISSUE
29 word_align_check: /* len >= 4 */
33 neg r3, r3 /* r3 = -(r3 - 4) */
35 stb r1, @r4 || addi r4, #1
36 addi r2, #-1 || addi r3, #-1
41 and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */
43 or r1, r3 || addi r4, #-4
45 or r1, r3 || addi r2, #-4
47 st r1, @+r4 || addi r2, #-4
48 bgtz r2, word_set_loop
49 bnez r2, byte_set_wrap
53 qword_align_check: /* len >= 16 */
55 bnez r3, word_align_check
57 and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */
59 or r1, r3 || addi r4, #-4
61 or r1, r3 || ldi r5, #16
63 ld r3, @(4,r4) /* cache line allocate */
64 st r1, @+r4 || addi r2, #-16
65 st r1, @+r4 || cmpu r2, r5
68 bnc qword_set_loop || cmpz r2
82 #if defined(CONFIG_ISA_M32R2)
84 addi r2, #-1 || stb r1, @r4+
86 #elif defined(CONFIG_ISA_M32R)
88 addi r2, #-1 || stb r1, @r4
92 #error unknown isa configuration
97 #else /* not CONFIG_ISA_DUAL_ISSUE */
104 bnc qword_align_check
107 word_align_check: /* len >= 4 */
111 neg r3, r3 /* r3 = -(r3 - 4) */
121 and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */
131 bgtz r2, word_set_loop
132 bnez r2, byte_set_wrap
136 qword_align_check: /* len >= 16 */
138 bnez r3, word_align_check
140 and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */
147 ld r3, @(4,r4) /* cache line allocate */
155 bnez r2, set_remainder
176 #endif /* not CONFIG_ISA_DUAL_ISSUE */