~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/u-boot/arch/avr32/lib/memset.S

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2004-2006 Atmel Corporation
 
3
 *
 
4
 * SPDX-License-Identifier:     GPL-2.0+
 
5
 */
 
6
 
 
7
        /*
 
8
         * r12: void *b
 
9
         * r11: int c
 
10
         * r10: size_t len
 
11
         *
 
12
         * Returns b in r12
 
13
         */
 
14
        .section .text.memset, "ax", @progbits
 
15
 
 
16
        .global memset
 
17
        .type   memset, @function
 
18
        .align  2
 
19
memset:
 
20
        mov     r9, r12
 
21
        mov     r8, r12
 
22
        or      r11, r11, r11 << 8
 
23
        andl    r9, 3, COH
 
24
        brne    1f
 
25
 
 
26
2:      or      r11, r11, r11 << 16
 
27
        sub     r10, 4
 
28
        brlt    5f
 
29
 
 
30
        /* Let's do some real work */
 
31
4:      st.w    r8++, r11
 
32
        sub     r10, 4
 
33
        brge    4b
 
34
 
 
35
        /*
 
36
         * When we get here, we've got less than 4 bytes to set. r10
 
37
         * might be negative.
 
38
         */
 
39
5:      sub     r10, -4
 
40
        reteq   r12
 
41
 
 
42
        /* Fastpath ends here, exactly 32 bytes from memset */
 
43
 
 
44
        /* Handle unaligned count or pointer */
 
45
        bld     r10, 1
 
46
        brcc    6f
 
47
        st.b    r8++, r11
 
48
        st.b    r8++, r11
 
49
        bld     r10, 0
 
50
        retcc   r12
 
51
6:      st.b    r8++, r11
 
52
        mov     pc, lr
 
53
 
 
54
        /* Handle unaligned pointer */
 
55
1:      sub     r10, 4
 
56
        brlt    5b
 
57
        add     r10, r9
 
58
        lsl     r9, 1
 
59
        add     pc, r9
 
60
        st.b    r8++, r11
 
61
        st.b    r8++, r11
 
62
        st.b    r8++, r11
 
63
        rjmp    2b
 
64
 
 
65
        .size   memset, . - memset