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