|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685 |
- /***************************************************************************
- Copyright (c) 2022, The OpenBLAS Project
- All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- 3. Neither the name of the OpenBLAS project nor the names of
- its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBLAS PROJECT OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
- #include "common.h"
-
- #if !defined(DOUBLE)
- #define VSETVL(n) vsetvl_e32m2(n)
- #define FLOAT_V_T vfloat32m2_t
- #define VLEV_FLOAT vle32_v_f32m2
- #define VSEV_FLOAT vse32_v_f32m2
- #define VFMVVF_FLOAT vfmv_v_f_f32m2
- #define VFMACCVF_FLOAT vfmacc_vf_f32m2
- #define VFMULVF_FLOAT vfmul_vf_f32m2
- #else
- #define VSETVL(n) vsetvl_e64m2(n)
- #define FLOAT_V_T vfloat64m2_t
- #define VLEV_FLOAT vle64_v_f64m2
- #define VSEV_FLOAT vse64_v_f64m2
- #define VFMVVF_FLOAT vfmv_v_f_f64m2
- #define VFMACCVF_FLOAT vfmacc_vf_f64m2
- #define VFMULVF_FLOAT vfmul_vf_f64m2
- #endif
-
-
- // Optimizes the implementation in ../generic/trmmkernel_8x8.c
-
-
- int CNAME(BLASLONG bm,BLASLONG bn,BLASLONG bk,FLOAT alpha,FLOAT* ba,FLOAT* bb,FLOAT* C,BLASLONG ldc ,BLASLONG offset)
- {
- //fprintf(stderr, "%s, %s, bm=%4ld bn=%4ld bk=%4ld alpha=%f ldc=%ld\n", __FILE__, __FUNCTION__, bm, bn, bk, alpha, ldc);
-
- BLASLONG i,j,k;
- FLOAT *C0,*C1,*C2,*C3,*C4,*C5,*C6,*C7,*ptrba,*ptrbb;
-
- FLOAT_V_T va0, va1, va2, va3, va4, va5, va6, va7;
- FLOAT_V_T vres0, vres1, vres2, vres3, vres4, vres5, vres6, vres7;
- size_t vl;
-
- BLASLONG off, temp;
-
- #if !defined(LEFT)
- off = -offset;
- #else
- off = 0;
- #endif
- for (j = bn/8; j > 0; j--)
- {
- C0 = C;
- C1 = C0+ldc;
- C2 = C1+ldc;
- C3 = C2+ldc;
- C4 = C3+ldc;
- C5 = C4+ldc;
- C6 = C5+ldc;
- C7 = C6+ldc;
-
- #if defined(TRMMKERNEL) && defined(LEFT)
- off = offset;
- #endif
-
- ptrba = ba;
-
- for (i = bm; i > 0; i -= vl)
- {
- vl = VSETVL(i);
-
- #if (defined(LEFT) && defined(TRANSA)) || (!defined(LEFT) && !defined(TRANSA))
- ptrbb = bb;
- #else
- ptrba += off*vl;
- ptrbb = bb + off*8;
- #endif
-
- vres0 = VFMVVF_FLOAT(0.0, vl);
- vres1 = VFMVVF_FLOAT(0.0, vl);
- vres2 = VFMVVF_FLOAT(0.0, vl);
- vres3 = VFMVVF_FLOAT(0.0, vl);
- vres4 = VFMVVF_FLOAT(0.0, vl);
- vres5 = VFMVVF_FLOAT(0.0, vl);
- vres6 = VFMVVF_FLOAT(0.0, vl);
- vres7 = VFMVVF_FLOAT(0.0, vl);
-
- #if (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
- temp = bk-off;
- #elif defined(LEFT)
- temp = off+vl; // number of values in A
- #else
- temp = off+8; // number of values in B
- #endif
-
- for (k = temp/8; k > 0; k--) {
- va0 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
- va1 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va0, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va0, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va0, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va0, vl);
- vres4 = VFMACCVF_FLOAT(vres4, *(ptrbb + 4), va0, vl);
- vres5 = VFMACCVF_FLOAT(vres5, *(ptrbb + 5), va0, vl);
- vres6 = VFMACCVF_FLOAT(vres6, *(ptrbb + 6), va0, vl);
- vres7 = VFMACCVF_FLOAT(vres7, *(ptrbb + 7), va0, vl);
- ptrbb += 8;
- va2 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va1, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va1, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va1, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va1, vl);
- vres4 = VFMACCVF_FLOAT(vres4, *(ptrbb + 4), va1, vl);
- vres5 = VFMACCVF_FLOAT(vres5, *(ptrbb + 5), va1, vl);
- vres6 = VFMACCVF_FLOAT(vres6, *(ptrbb + 6), va1, vl);
- vres7 = VFMACCVF_FLOAT(vres7, *(ptrbb + 7), va1, vl);
- ptrbb += 8;
- va3 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va2, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va2, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va2, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va2, vl);
- vres4 = VFMACCVF_FLOAT(vres4, *(ptrbb + 4), va2, vl);
- vres5 = VFMACCVF_FLOAT(vres5, *(ptrbb + 5), va2, vl);
- vres6 = VFMACCVF_FLOAT(vres6, *(ptrbb + 6), va2, vl);
- vres7 = VFMACCVF_FLOAT(vres7, *(ptrbb + 7), va2, vl);
- ptrbb += 8;
- va4 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va3, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va3, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va3, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va3, vl);
- vres4 = VFMACCVF_FLOAT(vres4, *(ptrbb + 4), va3, vl);
- vres5 = VFMACCVF_FLOAT(vres5, *(ptrbb + 5), va3, vl);
- vres6 = VFMACCVF_FLOAT(vres6, *(ptrbb + 6), va3, vl);
- vres7 = VFMACCVF_FLOAT(vres7, *(ptrbb + 7), va3, vl);
- ptrbb += 8;
- va5 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va4, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va4, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va4, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va4, vl);
- vres4 = VFMACCVF_FLOAT(vres4, *(ptrbb + 4), va4, vl);
- vres5 = VFMACCVF_FLOAT(vres5, *(ptrbb + 5), va4, vl);
- vres6 = VFMACCVF_FLOAT(vres6, *(ptrbb + 6), va4, vl);
- vres7 = VFMACCVF_FLOAT(vres7, *(ptrbb + 7), va4, vl);
- ptrbb += 8;
- va6 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va5, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va5, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va5, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va5, vl);
- vres4 = VFMACCVF_FLOAT(vres4, *(ptrbb + 4), va5, vl);
- vres5 = VFMACCVF_FLOAT(vres5, *(ptrbb + 5), va5, vl);
- vres6 = VFMACCVF_FLOAT(vres6, *(ptrbb + 6), va5, vl);
- vres7 = VFMACCVF_FLOAT(vres7, *(ptrbb + 7), va5, vl);
- ptrbb += 8;
- va7 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va6, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va6, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va6, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va6, vl);
- vres4 = VFMACCVF_FLOAT(vres4, *(ptrbb + 4), va6, vl);
- vres5 = VFMACCVF_FLOAT(vres5, *(ptrbb + 5), va6, vl);
- vres6 = VFMACCVF_FLOAT(vres6, *(ptrbb + 6), va6, vl);
- vres7 = VFMACCVF_FLOAT(vres7, *(ptrbb + 7), va6, vl);
- ptrbb += 8;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va7, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va7, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va7, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va7, vl);
- vres4 = VFMACCVF_FLOAT(vres4, *(ptrbb + 4), va7, vl);
- vres5 = VFMACCVF_FLOAT(vres5, *(ptrbb + 5), va7, vl);
- vres6 = VFMACCVF_FLOAT(vres6, *(ptrbb + 6), va7, vl);
- vres7 = VFMACCVF_FLOAT(vres7, *(ptrbb + 7), va7, vl);
- ptrbb += 8;
- }
-
- for (k = temp&7; k > 0; k--) {
- va0 = VLEV_FLOAT(ptrba, vl); // M:8 (should be vlen);
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va0, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va0, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va0, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va0, vl);
- vres4 = VFMACCVF_FLOAT(vres4, *(ptrbb + 4), va0, vl);
- vres5 = VFMACCVF_FLOAT(vres5, *(ptrbb + 5), va0, vl);
- vres6 = VFMACCVF_FLOAT(vres6, *(ptrbb + 6), va0, vl);
- vres7 = VFMACCVF_FLOAT(vres7, *(ptrbb + 7), va0, vl);
-
- ptrbb += 8;
- ptrba += vl;
- }
-
- va0 = VFMULVF_FLOAT(vres0, alpha, vl);
- VSEV_FLOAT(C0, va0, vl);
-
- va1 = VFMULVF_FLOAT(vres1, alpha, vl);
- VSEV_FLOAT(C1, va1, vl);
-
- va2 = VFMULVF_FLOAT(vres2, alpha, vl);
- VSEV_FLOAT(C2, va2, vl);
-
- va3 = VFMULVF_FLOAT(vres3, alpha, vl);
- VSEV_FLOAT(C3, va3, vl);
-
- va4 = VFMULVF_FLOAT(vres4, alpha, vl);
- VSEV_FLOAT(C4, va4, vl);
-
- va5 = VFMULVF_FLOAT(vres5, alpha, vl);
- VSEV_FLOAT(C5, va5, vl);
-
- va6 = VFMULVF_FLOAT(vres6, alpha, vl);
- VSEV_FLOAT(C6, va6, vl);
-
- va7 = VFMULVF_FLOAT(vres7, alpha, vl);
- VSEV_FLOAT(C7, va7, vl);
-
-
- #if ( defined(LEFT) && defined(TRANSA)) || (!defined(LEFT) && !defined(TRANSA))
- temp = bk - off;
- #ifdef LEFT
- temp -= vl; // number of values in A
- #else
- temp -= 8; // number of values in B
- #endif
- ptrba += temp*vl;
- ptrbb += temp*8;
- #endif
-
- #ifdef LEFT
- off += vl; // number of values in A
- #endif
-
- C0 += vl;
- C1 += vl;
- C2 += vl;
- C3 += vl;
- C4 += vl;
- C5 += vl;
- C6 += vl;
- C7 += vl;
- }
-
- #if defined(TRMMKERNEL) && !defined(LEFT)
- off += 8;
- #endif
-
- bb += (bk<<3);
- C += (ldc<<3);
- }
-
- if (bn & 4)
- {
- C0 = C;
- C1 = C0+ldc;
- C2 = C1+ldc;
- C3 = C2+ldc;
-
- #if defined(TRMMKERNEL) && defined(LEFT)
- off = offset;
- #endif
- ptrba = ba;
-
- for (i = bm; i > 0; i -= vl)
- {
- vl = VSETVL(i);
- #if (defined(LEFT) && defined(TRANSA)) || (!defined(LEFT) && !defined(TRANSA))
- ptrbb = bb;
- #else
- ptrba += off*vl;
- ptrbb = bb + off*4;
- #endif
-
- vres0 = VFMVVF_FLOAT(0.0, vl);
- vres1 = VFMVVF_FLOAT(0.0, vl);
- vres2 = VFMVVF_FLOAT(0.0, vl);
- vres3 = VFMVVF_FLOAT(0.0, vl);
-
-
- #if (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
- temp = bk-off;
- #elif defined(LEFT)
- temp = off+vl; // number of values in A
- #else
- temp = off+4; // number of values in B
- #endif
-
- for (k = temp/8; k > 0; k--) {
- va0 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
- va1 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va0, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va0, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va0, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va0, vl);
- ptrbb += 4;
- va2 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va1, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va1, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va1, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va1, vl);
- ptrbb += 4;
- va3 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va2, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va2, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va2, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va2, vl);
- ptrbb += 4;
- va4 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va3, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va3, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va3, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va3, vl);
- ptrbb += 4;
- va5 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va4, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va4, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va4, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va4, vl);
- ptrbb += 4;
- va6 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va5, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va5, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va5, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va5, vl);
- ptrbb += 4;
- va7 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va6, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va6, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va6, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va6, vl);
- ptrbb += 4;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va7, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va7, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va7, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va7, vl);
- ptrbb += 4;
- }
-
- // K remainder
- for (k = temp&7; k > 0; k--) {
- va0 = VLEV_FLOAT(ptrba, vl);
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va0, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va0, vl);
- vres2 = VFMACCVF_FLOAT(vres2, *(ptrbb + 2), va0, vl);
- vres3 = VFMACCVF_FLOAT(vres3, *(ptrbb + 3), va0, vl);
-
- ptrbb += 4;
- ptrba += vl;
- }
-
- va0 = VFMULVF_FLOAT(vres0, alpha, vl);
- VSEV_FLOAT(C0, va0, vl);
-
- va1 = VFMULVF_FLOAT(vres1, alpha, vl);
- VSEV_FLOAT(C1, va1, vl);
-
- va2 = VFMULVF_FLOAT(vres2, alpha, vl);
- VSEV_FLOAT(C2, va2, vl);
-
- va3 = VFMULVF_FLOAT(vres3, alpha, vl);
- VSEV_FLOAT(C3, va3, vl);
-
- #if ( defined(LEFT) && defined(TRANSA)) || (!defined(LEFT) && !defined(TRANSA))
- temp = bk - off;
- #ifdef LEFT
- temp -= vl; // number of values in A
- #else
- temp -= 4; // number of values in B
- #endif
- ptrba += temp*vl;
- ptrbb += temp*4;
- #endif
-
- #ifdef LEFT
- off += vl; // number of values in A
- #endif
-
- C0 += vl;
- C1 += vl;
- C2 += vl;
- C3 += vl;
- }
-
- #if defined(TRMMKERNEL) && !defined(LEFT)
- off += 4;
- #endif
-
- bb += (bk<<2);
- C += (ldc<<2);
- }
-
- if (bn & 2)
- {
- C0 = C;
- C1 = C0+ldc;
-
- #if defined(TRMMKERNEL) && defined(LEFT)
- off = offset;
- #endif
-
- ptrba = ba;
-
- for (i = bm; i > 0; i -= vl)
- {
- vl = VSETVL(i);
-
- #if (defined(LEFT) && defined(TRANSA)) || (!defined(LEFT) && !defined(TRANSA))
- ptrbb = bb;
- #else
- ptrba += off*vl;
- ptrbb = bb + off*2;
- #endif
-
- vres0 = VFMVVF_FLOAT(0.0, vl);
- vres1 = VFMVVF_FLOAT(0.0, vl);
-
-
- #if (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
- temp = bk-off;
- #elif defined(LEFT)
- temp = off+vl; // number of values in A
- #else
- temp = off+2; // number of values in B
- #endif
-
- for (k = temp/8; k > 0; k--) {
- va0 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
- va1 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va0, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va0, vl);
- ptrbb += 2;
- va2 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va1, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va1, vl);
- ptrbb += 2;
- va3 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va2, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va2, vl);
- ptrbb += 2;
- va4 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va3, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va3, vl);
- ptrbb += 2;
- va5 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va4, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va4, vl);
- ptrbb += 2;
- va6 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va5, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va5, vl);
- ptrbb += 2;
- va7 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va6, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va6, vl);
- ptrbb += 2;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va7, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va7, vl);
- ptrbb += 2;
- }
-
- // K remainder
- for (k = temp&7; k > 0; k--) {
- va0 = VLEV_FLOAT(ptrba, vl);
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va0, vl);
- vres1 = VFMACCVF_FLOAT(vres1, *(ptrbb + 1), va0, vl);
-
- ptrbb += 2;
- ptrba += vl;
- }
- va0 = VFMULVF_FLOAT(vres0, alpha, vl);
- VSEV_FLOAT(C0, va0, vl);
-
- va1 = VFMULVF_FLOAT(vres1, alpha, vl);
- VSEV_FLOAT(C1, va1, vl);
-
- #if ( defined(LEFT) && defined(TRANSA)) || (!defined(LEFT) && !defined(TRANSA))
- temp = bk - off;
- #ifdef LEFT
- temp -= vl; // number of values in A
- #else
- temp -= 2; // number of values in B
- #endif
- ptrba += temp*vl;
- ptrbb += temp*2;
- #endif
-
- #ifdef LEFT
- off += vl; // number of values in A
- #endif
-
- C0 += vl;
- C1 += vl;
- }
-
- #if defined(TRMMKERNEL) && !defined(LEFT)
- off += 2;
- #endif
-
- bb += (bk<<1);
- C += (ldc<<1);
- }
-
- if (bn & 1)
- {
- C0 = C;
-
- #if defined(TRMMKERNEL) && defined(LEFT)
- off = offset;
- #endif
-
- ptrba = ba;
-
- for (i = bm; i > 0; i -= vl)
- {
- vl = VSETVL(i);
- #if (defined(LEFT) && defined(TRANSA)) || (!defined(LEFT) && !defined(TRANSA))
- ptrbb = bb;
- #else
- ptrba += off*vl;
- ptrbb = bb + off*1;
- #endif
-
- vres0 = VFMVVF_FLOAT(0.0, vl);
-
- #if (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
- temp = bk-off;
- #elif defined(LEFT)
- temp = off+vl; // number of values in A
- #else
- temp = off+1; // number of values in B
- #endif
-
- for (k = temp/8; k > 0; k--) {
- va0 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
- va1 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va0, vl);
- ptrbb += 1;
- va2 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va1, vl);
- ptrbb += 1;
- va3 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va2, vl);
- ptrbb += 1;
- va4 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va3, vl);
- ptrbb += 1;
- va5 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va4, vl);
- ptrbb += 1;
- va6 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va5, vl);
- ptrbb += 1;
- va7 = VLEV_FLOAT(ptrba, vl);
- ptrba += vl;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va6, vl);
- ptrbb += 1;
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va7, vl);
- ptrbb += 1;
- }
-
- // K remainder
- for (k = temp&7; k > 0; k--) {
- va0 = VLEV_FLOAT(ptrba, vl);
-
- vres0 = VFMACCVF_FLOAT(vres0, *(ptrbb + 0), va0, vl);
-
- ptrbb += 1;
- ptrba += vl;
- }
- va0 = VFMULVF_FLOAT(vres0, alpha, vl);
- VSEV_FLOAT(C0, va0, vl);
-
- #if ( defined(LEFT) && defined(TRANSA)) || (!defined(LEFT) && !defined(TRANSA))
- temp = bk - off;
- #ifdef LEFT
- temp -= vl; // number of values in A
- #else
- temp -= 1; // number of values in B
- #endif
- ptrba += temp*vl;
- ptrbb += temp*1;
- #endif
-
- #ifdef LEFT
- off += vl; // number of values in A
- #endif
-
- C0 += vl;
- }
-
- #if defined(TRMMKERNEL) && !defined(LEFT)
- off += 1;
- #endif
-
- bb += (bk);
- C += (ldc);
- }
- return 0;
- }
-
|