| 1 | /* |
| 2 | |
| 3 | BLIS |
| 4 | An object-based framework for developing high-performance BLAS-like |
| 5 | libraries. |
| 6 | |
| 7 | Copyright (C) 2023, The University of Texas at Austin |
| 8 | |
| 9 | Redistribution and use in source and binary forms, with or without |
| 10 | modification, are permitted provided that the following conditions are |
| 11 | met: |
| 12 | - Redistributions of source code must retain the above copyright |
| 13 | notice, this list of conditions and the following disclaimer. |
| 14 | - Redistributions in binary form must reproduce the above copyright |
| 15 | notice, this list of conditions and the following disclaimer in the |
| 16 | documentation and/or other materials provided with the distribution. |
| 17 | - Neither the name(s) of the copyright holder(s) nor the names of its |
| 18 | contributors may be used to endorse or promote products derived |
| 19 | from this software without specific prior written permission. |
| 20 | |
| 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 24 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 25 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 27 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 28 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 29 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 32 | |
| 33 | */ |
| 34 | |
| 35 | |
| 36 | // 128-bit RISC-V is assumed to support the __riscv_xlen test macro |
| 37 | #if __riscv_xlen == 128 // false if !defined(__riscv_xlen) |
| 38 | |
| 39 | lq s7, 112(sp) |
| 40 | lq s6, 96(sp) |
| 41 | lq s5, 80(sp) |
| 42 | lq s4, 64(sp) |
| 43 | lq s3, 48(sp) |
| 44 | lq s2, 32(sp) |
| 45 | lq s1, 16(sp) |
| 46 | lq s0, 0(sp) |
| 47 | addi sp, sp, 128 |
| 48 | |
| 49 | // 64-bit RISC-V can be indicated by either __riscv_xlen == 64 or |
| 50 | // RISCV_SIZE == 64, to support toolchains which do not currently |
| 51 | // support __riscv_xlen. If a macro is undefined, it is considered 0. |
| 52 | #elif __riscv_xlen == 64 || RISCV_SIZE == 64 |
| 53 | |
| 54 | ld s7, 56(sp) |
| 55 | ld s6, 48(sp) |
| 56 | ld s5, 40(sp) |
| 57 | ld s4, 32(sp) |
| 58 | ld s3, 24(sp) |
| 59 | ld s2, 16(sp) |
| 60 | ld s1, 8(sp) |
| 61 | ld s0, 0(sp) |
| 62 | addi sp, sp, 64 |
| 63 | |
| 64 | #else |
| 65 | // else 32-bit RISC-V is assumed |
| 66 | |
| 67 | lw s7, 28(sp) |
| 68 | lw s6, 24(sp) |
| 69 | lw s5, 20(sp) |
| 70 | lw s4, 16(sp) |
| 71 | lw s3, 12(sp) |
| 72 | lw s2, 8(sp) |
| 73 | lw s1, 4(sp) |
| 74 | lw s0, 0(sp) |
| 75 | addi sp, sp, 32 |
| 76 | |
| 77 | #endif |