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);
17 #include <linux/config.h>
22 #ifdef CONFIG_ISA_DUAL_ISSUE
32 word_align_check: /* len >= 4 */
36 neg r3, r3 /* r3 = -(r3 - 4) */
38 stb r1, @r4 || addi r4, #1
39 addi r2, #-1 || addi r3, #-1
44 and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */
46 or r1, r3 || addi r4, #-4
48 or r1, r3 || addi r2, #-4
50 st r1, @+r4 || addi r2, #-4
51 bgtz r2, word_set_loop
52 bnez r2, byte_set_wrap
56 qword_align_check: /* len >= 16 */
58 bnez r3, word_align_check
60 and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */
62 or r1, r3 || addi r4, #-4
64 or r1, r3 || ldi r5, #16
66 ld r3, @(4,r4) /* cache line allocate */
67 st r1, @+r4 || addi r2, #-16
68 st r1, @+r4 || cmpu r2, r5
71 bnc qword_set_loop || cmpz r2
85 #if defined(CONFIG_ISA_M32R2)
87 addi r2, #-1 || stb r1, @r4+
89 #elif defined(CONFIG_ISA_M32R)
91 addi r2, #-1 || stb r1, @r4
95 #error unknown isa configuration
100 #else /* not CONFIG_ISA_DUAL_ISSUE */
107 bnc qword_align_check
110 word_align_check: /* len >= 4 */
114 neg r3, r3 /* r3 = -(r3 - 4) */
124 and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */
134 bgtz r2, word_set_loop
135 bnez r2, byte_set_wrap
139 qword_align_check: /* len >= 16 */
141 bnez r3, word_align_check
143 and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */
150 ld r3, @(4,r4) /* cache line allocate */
158 bnez r2, set_remainder
179 #endif /* not CONFIG_ISA_DUAL_ISSUE */