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);
21 #ifdef CONFIG_ISA_DUAL_ISSUE
31 word_align_check: /* len >= 4 */
35 neg r3, r3 /* r3 = -(r3 - 4) */
37 stb r1, @r4 || addi r4, #1
38 addi r2, #-1 || addi r3, #-1
43 and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */
45 or r1, r3 || addi r4, #-4
47 or r1, r3 || addi r2, #-4
49 st r1, @+r4 || addi r2, #-4
50 bgtz r2, word_set_loop
51 bnez r2, byte_set_wrap
55 qword_align_check: /* len >= 16 */
57 bnez r3, word_align_check
59 and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */
61 or r1, r3 || addi r4, #-4
63 or r1, r3 || ldi r5, #16
65 ld r3, @(4,r4) /* cache line allocate */
66 st r1, @+r4 || addi r2, #-16
67 st r1, @+r4 || cmpu r2, r5
70 bnc qword_set_loop || cmpz r2
84 #if defined(CONFIG_ISA_M32R2)
86 addi r2, #-1 || stb r1, @r4+
88 #elif defined(CONFIG_ISA_M32R)
90 addi r2, #-1 || stb r1, @r4
94 #error unknown isa configuration
99 #else /* not CONFIG_ISA_DUAL_ISSUE */
106 bnc qword_align_check
109 word_align_check: /* len >= 4 */
113 neg r3, r3 /* r3 = -(r3 - 4) */
123 and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */
133 bgtz r2, word_set_loop
134 bnez r2, byte_set_wrap
138 qword_align_check: /* len >= 16 */
140 bnez r3, word_align_check
142 and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */
149 ld r3, @(4,r4) /* cache line allocate */
157 bnez r2, set_remainder
178 #endif /* not CONFIG_ISA_DUAL_ISSUE */