]>
Commit | Line | Data |
---|---|---|
3baddb72 | 1 | /* Set a block of memory to some byte value. For SUN4V Niagara-4. |
2b778ceb | 2 | Copyright (C) 2012-2021 Free Software Foundation, Inc. |
3baddb72 DM |
3 | This file is part of the GNU C Library. |
4 | Contributed by David S. Miller (davem@davemloft.net) | |
5 | ||
6 | The GNU C Library is free software; you can redistribute it and/or | |
7 | modify it under the terms of the GNU Lesser General Public | |
8 | License as published by the Free Software Foundation; either | |
9 | version 2.1 of the License, or (at your option) any later version. | |
10 | ||
11 | The GNU C Library is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | Lesser General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU Lesser General Public | |
17 | License along with the GNU C Library; if not, see | |
5a82c748 | 18 | <https://www.gnu.org/licenses/>. */ |
3baddb72 DM |
19 | |
20 | #include <sysdep.h> | |
21 | ||
22 | #define ASI_BLK_INIT_QUAD_LDD_P 0xe2 | |
23 | ||
4f41c682 | 24 | #if IS_IN (libc) |
3baddb72 DM |
25 | |
26 | .register %g2, #scratch | |
27 | .register %g3, #scratch | |
28 | ||
29 | .text | |
30 | .align 32 | |
31 | ||
32 | ENTRY(__memset_niagara4) | |
33 | andcc %o1, 0xff, %o4 | |
34 | be,pt %icc, 1f | |
35 | mov %o2, %o1 | |
36 | sllx %o4, 8, %g1 | |
37 | or %g1, %o4, %o2 | |
38 | sllx %o2, 16, %g1 | |
39 | or %g1, %o2, %o2 | |
40 | sllx %o2, 32, %g1 | |
41 | ba,pt %icc, 1f | |
42 | or %g1, %o2, %o4 | |
43 | END(__memset_niagara4) | |
44 | ||
45 | .align 32 | |
46 | ENTRY(__bzero_niagara4) | |
47 | clr %o4 | |
48 | 1: cmp %o1, 16 | |
49 | ble %icc, .Ltiny | |
50 | mov %o0, %o3 | |
51 | sub %g0, %o0, %g1 | |
52 | and %g1, 0x7, %g1 | |
53 | brz,pt %g1, .Laligned8 | |
54 | sub %o1, %g1, %o1 | |
55 | 1: stb %o4, [%o0 + 0x00] | |
56 | subcc %g1, 1, %g1 | |
57 | bne,pt %icc, 1b | |
58 | add %o0, 1, %o0 | |
59 | .Laligned8: | |
60 | cmp %o1, 64 + (64 - 8) | |
61 | ble .Lmedium | |
62 | sub %g0, %o0, %g1 | |
63 | andcc %g1, (64 - 1), %g1 | |
64 | brz,pn %g1, .Laligned64 | |
65 | sub %o1, %g1, %o1 | |
66 | 1: stx %o4, [%o0 + 0x00] | |
67 | subcc %g1, 8, %g1 | |
68 | bne,pt %icc, 1b | |
69 | add %o0, 0x8, %o0 | |
70 | .Laligned64: | |
71 | andn %o1, 64 - 1, %g1 | |
72 | sub %o1, %g1, %o1 | |
73 | brnz,pn %o4, .Lnon_bzero_loop | |
74 | mov 0x20, %g2 | |
75 | 1: stxa %o4, [%o0 + %g0] ASI_BLK_INIT_QUAD_LDD_P | |
76 | subcc %g1, 0x40, %g1 | |
77 | stxa %o4, [%o0 + %g2] ASI_BLK_INIT_QUAD_LDD_P | |
78 | bne,pt %icc, 1b | |
79 | add %o0, 0x40, %o0 | |
80 | .Lpostloop: | |
81 | cmp %o1, 8 | |
82 | bl,pn %icc, .Ltiny | |
83 | membar #StoreStore|#StoreLoad | |
84 | .Lmedium: | |
85 | andn %o1, 0x7, %g1 | |
86 | sub %o1, %g1, %o1 | |
87 | 1: stx %o4, [%o0 + 0x00] | |
88 | subcc %g1, 0x8, %g1 | |
89 | bne,pt %icc, 1b | |
90 | add %o0, 0x08, %o0 | |
91 | andcc %o1, 0x4, %g1 | |
92 | be,pt %icc, .Ltiny | |
93 | sub %o1, %g1, %o1 | |
94 | stw %o4, [%o0 + 0x00] | |
95 | add %o0, 0x4, %o0 | |
96 | .Ltiny: | |
97 | cmp %o1, 0 | |
98 | be,pn %icc, .Lexit | |
99 | 1: subcc %o1, 1, %o1 | |
100 | stb %o4, [%o0 + 0x00] | |
101 | bne,pt %icc, 1b | |
102 | add %o0, 1, %o0 | |
103 | .Lexit: | |
104 | retl | |
105 | mov %o3, %o0 | |
106 | .Lnon_bzero_loop: | |
107 | mov 0x08, %g3 | |
108 | mov 0x28, %o5 | |
109 | 1: stxa %o4, [%o0 + %g0] ASI_BLK_INIT_QUAD_LDD_P | |
110 | subcc %g1, 0x40, %g1 | |
111 | stxa %o4, [%o0 + %g2] ASI_BLK_INIT_QUAD_LDD_P | |
112 | stxa %o4, [%o0 + %g3] ASI_BLK_INIT_QUAD_LDD_P | |
113 | stxa %o4, [%o0 + %o5] ASI_BLK_INIT_QUAD_LDD_P | |
114 | add %o0, 0x10, %o0 | |
115 | stxa %o4, [%o0 + %g0] ASI_BLK_INIT_QUAD_LDD_P | |
116 | stxa %o4, [%o0 + %g2] ASI_BLK_INIT_QUAD_LDD_P | |
117 | stxa %o4, [%o0 + %g3] ASI_BLK_INIT_QUAD_LDD_P | |
118 | stxa %o4, [%o0 + %o5] ASI_BLK_INIT_QUAD_LDD_P | |
119 | bne,pt %icc, 1b | |
120 | add %o0, 0x30, %o0 | |
121 | ba,a,pt %icc, .Lpostloop | |
122 | END(__bzero_niagara4) | |
123 | ||
124 | #endif |