1/* This file contains the vector save and restore routines. 2 * 3 * Copyright (C) 2004-2020 Free Software Foundation, Inc. 4 * 5 * This file is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License as published by the 7 * Free Software Foundation; either version 3, or (at your option) any 8 * later version. 9 * 10 * This file is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * General Public License for more details. 14 * 15 * Under Section 7 of GPL version 3, you are granted additional 16 * permissions described in the GCC Runtime Library Exception, version 17 * 3.1, as published by the Free Software Foundation. 18 * 19 * You should have received a copy of the GNU General Public License and 20 * a copy of the GCC Runtime Library Exception along with this program; 21 * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 * <http://www.gnu.org/licenses/>. 23 */ 24 25/* Vector save/restore routines for Darwin. Note that each vector 26 save/restore requires 2 instructions (8 bytes.) 27 28 THE SAVE AND RESTORE ROUTINES CAN HAVE ONLY ONE GLOBALLY VISIBLE 29 ENTRY POINT - callers have to jump to "saveFP+60" to save f29..f31, 30 for example. For FP reg saves/restores, it takes one instruction 31 (4 bytes) to do the operation; for Vector regs, 2 instructions are 32 required (8 bytes.). */ 33 34/* With some assemblers, we need the correct machine directive to get the 35 right CPU type / subtype in the file header. */ 36#if __ppc64__ 37 .machine ppc64 38#else 39 .machine ppc7400 40#endif 41 .text 42 .align 2 43 44.private_extern saveVEC 45saveVEC: 46 li r11,-192 47 stvx v20,r11,r0 48 li r11,-176 49 stvx v21,r11,r0 50 li r11,-160 51 stvx v22,r11,r0 52 li r11,-144 53 stvx v23,r11,r0 54 li r11,-128 55 stvx v24,r11,r0 56 li r11,-112 57 stvx v25,r11,r0 58 li r11,-96 59 stvx v26,r11,r0 60 li r11,-80 61 stvx v27,r11,r0 62 li r11,-64 63 stvx v28,r11,r0 64 li r11,-48 65 stvx v29,r11,r0 66 li r11,-32 67 stvx v30,r11,r0 68 li r11,-16 69 stvx v31,r11,r0 70 blr 71 72.private_extern restVEC 73restVEC: 74 li r11,-192 75 lvx v20,r11,r0 76 li r11,-176 77 lvx v21,r11,r0 78 li r11,-160 79 lvx v22,r11,r0 80 li r11,-144 81 lvx v23,r11,r0 82 li r11,-128 83 lvx v24,r11,r0 84 li r11,-112 85 lvx v25,r11,r0 86 li r11,-96 87 lvx v26,r11,r0 88 li r11,-80 89 lvx v27,r11,r0 90 li r11,-64 91 lvx v28,r11,r0 92 li r11,-48 93 lvx v29,r11,r0 94 li r11,-32 95 lvx v30,r11,r0 96 li r11,-16 97 lvx v31,r11,r0 98 blr 99 100/* saveVEC_vr11 -- as saveVEC but VRsave is returned in R11. */ 101 102.private_extern saveVEC_vr11 103saveVEC_vr11: 104 li r11,-192 105 stvx v20,r11,r0 106 li r11,-176 107 stvx v21,r11,r0 108 li r11,-160 109 stvx v22,r11,r0 110 li r11,-144 111 stvx v23,r11,r0 112 li r11,-128 113 stvx v24,r11,r0 114 li r11,-112 115 stvx v25,r11,r0 116 li r11,-96 117 stvx v26,r11,r0 118 li r11,-80 119 stvx v27,r11,r0 120 li r11,-64 121 stvx v28,r11,r0 122 li r11,-48 123 stvx v29,r11,r0 124 li r11,-32 125 stvx v30,r11,r0 126 li r11,-16 127 stvx v31,r11,r0 128 mfspr r11,VRsave 129 blr 130 131/* As restVec, but the original VRsave value passed in R10. */ 132 133.private_extern restVEC_vr10 134restVEC_vr10: 135 li r11,-192 136 lvx v20,r11,r0 137 li r11,-176 138 lvx v21,r11,r0 139 li r11,-160 140 lvx v22,r11,r0 141 li r11,-144 142 lvx v23,r11,r0 143 li r11,-128 144 lvx v24,r11,r0 145 li r11,-112 146 lvx v25,r11,r0 147 li r11,-96 148 lvx v26,r11,r0 149 li r11,-80 150 lvx v27,r11,r0 151 li r11,-64 152 lvx v28,r11,r0 153 li r11,-48 154 lvx v29,r11,r0 155 li r11,-32 156 lvx v30,r11,r0 157 li r11,-16 158 lvx v31,r11,r0 159 /* restore VRsave from R10. */ 160 mtspr VRsave,r10 161 blr 162