1/* 2 * Copyright (c) 2023, Google Inc. All rights reserved 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining 5 * a copy of this software and associated documentation files 6 * (the "Software"), to deal in the Software without restriction, 7 * including without limitation the rights to use, copy, modify, merge, 8 * publish, distribute, sublicense, and/or sell copies of the Software, 9 * and to permit persons to whom the Software is furnished to do so, 10 * subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be 13 * included in all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 */ 23 24#include <asm.h> 25#include <arch/asm_macros.h> 26 27.arch armv8-a+sve 28 29 30FUNCTION(clobber_sve_asm) 31 MOV x9, x0 32 33 // Clobber Registers 34 mov z0.b, w9 35 mov z1.b, w9 36 mov z2.b, w9 37 mov z3.b, w9 38 mov z4.b, w9 39 mov z5.b, w9 40 mov z6.b, w9 41 mov z7.b, w9 42 mov z8.b, w9 43 mov z9.b, w9 44 mov z10.b, w9 45 mov z11.b, w9 46 mov z12.b, w9 47 mov z13.b, w9 48 mov z14.b, w9 49 mov z15.b, w9 50 mov z16.b, w9 51 mov z17.b, w9 52 mov z18.b, w9 53 mov z19.b, w9 54 mov z20.b, w9 55 mov z21.b, w9 56 mov z22.b, w9 57 mov z23.b, w9 58 mov z24.b, w9 59 mov z25.b, w9 60 mov z26.b, w9 61 mov z27.b, w9 62 mov z28.b, w9 63 mov z29.b, w9 64 mov z30.b, w9 65 mov z31.b, w9 66 67 ptrue p0.B 68 ptrue p1.B 69 ptrue p2.B 70 ptrue p3.B 71 ptrue p4.B 72 ptrue p5.B 73 ptrue p6.B 74 ptrue p7.B 75 ptrue p8.B 76 ptrue p9.B 77 ptrue p10.B 78 ptrue p11.B 79 ptrue p12.B 80 ptrue p13.B 81 ptrue p14.B 82 ptrue p15.B 83 84 // If sve is available return #0x0 'NO Error' 85 mov x0, #0 86 ret 87 88FUNCTION(load_sve_asm) 89 mov x9, x0 // base address array 90 mov x8, #0 // offset 91 mov x7, x1 // offset increment 92 93 ST1B z0.b, p0, [x9, x8] 94 95 ADD x8, x8, x7 96 ST1B z1.b, p0, [x9, x8] 97 98 ADD x8, x8, x7 99 ST1B z2.b, p0, [x9, x8] 100 101 ADD x8, x8, x7 102 ST1B z3.b, p0, [x9, x8] 103 104 ADD x8, x8, x7 105 ST1B z4.b, p0, [x9, x8] 106 107 ADD x8, x8, x7 108 ST1B z5.b, p0, [x9, x8] 109 110 ADD x8, x8, x7 111 ST1B z6.b, p0, [x9, x8] 112 113 ADD x8, x8, x7 114 ST1B z7.b, p0, [x9, x8] 115 116 ADD x8, x8, x7 117 ST1B z8.b, p0, [x9, x8] 118 119 ADD x8, x8, x7 120 ST1B z9.b, p0, [x9, x8] 121 122 ADD x8, x8, x7 123 ST1B z10.b, p0, [x9, x8] 124 125 ADD x8, x8, x7 126 ST1B z11.b, p0, [x9, x8] 127 128 ADD x8, x8, x7 129 ST1B z12.b, p0, [x9, x8] 130 131 ADD x8, x8, x7 132 ST1B z13.b, p0, [x9, x8] 133 134 ADD x8, x8, x7 135 ST1B z14.b, p0, [x9, x8] 136 137 ADD x8, x8, x7 138 ST1B z15.b, p0, [x9, x8] 139 140 ADD x8, x8, x7 141 ST1B z16.b, p0, [x9, x8] 142 143 ADD x8, x8, x7 144 ST1B z17.b, p0, [x9, x8] 145 146 ADD x8, x8, x7 147 ST1B z18.b, p0, [x9, x8] 148 149 ADD x8, x8, x7 150 ST1B z19.b, p0, [x9, x8] 151 152 ADD x8, x8, x7 153 ST1B z20.b, p0, [x9, x8] 154 155 ADD x8, x8, x7 156 ST1B z21.b, p0, [x9, x8] 157 158 ADD x8, x8, x7 159 ST1B z22.b, p0, [x9, x8] 160 161 ADD x8, x8, x7 162 ST1B z23.b, p0, [x9, x8] 163 164 ADD x8, x8, x7 165 ST1B z24.b, p0, [x9, x8] 166 167 ADD x8, x8, x7 168 ST1B z25.b, p0, [x9, x8] 169 170 ADD x8, x8, x7 171 ST1B z26.b, p0, [x9, x8] 172 173 ADD x8, x8, x7 174 ST1B z27.b, p0, [x9, x8] 175 176 ADD x8, x8, x7 177 ST1B z28.b, p0, [x9, x8] 178 179 ADD x8, x8, x7 180 ST1B z29.b, p0, [x9, x8] 181 182 ADD x8, x8, x7 183 ST1B z30.b, p0, [x9, x8] 184 185 ADD x8, x8, x7 186 ST1B z31.b, p0, [x9, x8] 187 188 mov x0, #0 189 ret 190