~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/lib/raid6/neon.uc

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /lib/raid6/neon.uc (Version linux-6.11.5) and /lib/raid6/neon.uc (Version linux-4.10.17)


  1 /* -------------------------------------------      1 /* -----------------------------------------------------------------------
  2  *                                                  2  *
  3  *   neon.uc - RAID-6 syndrome calculation usi      3  *   neon.uc - RAID-6 syndrome calculation using ARM NEON instructions
  4  *                                                  4  *
  5  *   Copyright (C) 2012 Rob Herring                 5  *   Copyright (C) 2012 Rob Herring
  6  *   Copyright (C) 2015 Linaro Ltd. <ard.bieshe      6  *   Copyright (C) 2015 Linaro Ltd. <ard.biesheuvel@linaro.org>
  7  *                                                  7  *
  8  *   Based on altivec.uc:                           8  *   Based on altivec.uc:
  9  *     Copyright 2002-2004 H. Peter Anvin - Al      9  *     Copyright 2002-2004 H. Peter Anvin - All Rights Reserved
 10  *                                                 10  *
 11  *   This program is free software; you can re     11  *   This program is free software; you can redistribute it and/or modify
 12  *   it under the terms of the GNU General Pub     12  *   it under the terms of the GNU General Public License as published by
 13  *   the Free Software Foundation, Inc., 53 Te     13  *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
 14  *   Boston MA 02111-1307, USA; either version     14  *   Boston MA 02111-1307, USA; either version 2 of the License, or
 15  *   (at your option) any later version; incor     15  *   (at your option) any later version; incorporated herein by reference.
 16  *                                                 16  *
 17  * -------------------------------------------     17  * ----------------------------------------------------------------------- */
 18                                                    18 
 19 /*                                                 19 /*
 20  * neon$#.c                                        20  * neon$#.c
 21  *                                                 21  *
 22  * $#-way unrolled NEON intrinsics math RAID-6     22  * $#-way unrolled NEON intrinsics math RAID-6 instruction set
 23  *                                                 23  *
 24  * This file is postprocessed using unroll.awk     24  * This file is postprocessed using unroll.awk
 25  */                                                25  */
 26                                                    26 
 27 #include <arm_neon.h>                              27 #include <arm_neon.h>
 28 #include "neon.h"                              << 
 29                                                    28 
 30 typedef uint8x16_t unative_t;                      29 typedef uint8x16_t unative_t;
 31                                                    30 
                                                   >>  31 #define NBYTES(x) ((unative_t){x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x})
 32 #define NSIZE   sizeof(unative_t)                  32 #define NSIZE   sizeof(unative_t)
 33                                                    33 
 34 /*                                                 34 /*
 35  * The SHLBYTE() operation shifts each byte le     35  * The SHLBYTE() operation shifts each byte left by 1, *not*
 36  * rolling over into the next byte                 36  * rolling over into the next byte
 37  */                                                37  */
 38 static inline unative_t SHLBYTE(unative_t v)       38 static inline unative_t SHLBYTE(unative_t v)
 39 {                                                  39 {
 40         return vshlq_n_u8(v, 1);                   40         return vshlq_n_u8(v, 1);
 41 }                                                  41 }
 42                                                    42 
 43 /*                                                 43 /*
 44  * The MASK() operation returns 0xFF in any by     44  * The MASK() operation returns 0xFF in any byte for which the high
 45  * bit is 1, 0x00 for any byte for which the h     45  * bit is 1, 0x00 for any byte for which the high bit is 0.
 46  */                                                46  */
 47 static inline unative_t MASK(unative_t v)          47 static inline unative_t MASK(unative_t v)
 48 {                                                  48 {
 49         return (unative_t)vshrq_n_s8((int8x16_ !!  49         const uint8x16_t temp = NBYTES(0);
 50 }                                              !!  50         return (unative_t)vcltq_s8((int8x16_t)v, (int8x16_t)temp);
 51                                                << 
 52 static inline unative_t PMUL(unative_t v, unat << 
 53 {                                              << 
 54         return (unative_t)vmulq_p8((poly8x16_t << 
 55 }                                                  51 }
 56                                                    52 
 57 void raid6_neon$#_gen_syndrome_real(int disks,     53 void raid6_neon$#_gen_syndrome_real(int disks, unsigned long bytes, void **ptrs)
 58 {                                                  54 {
 59         uint8_t **dptr = (uint8_t **)ptrs;         55         uint8_t **dptr = (uint8_t **)ptrs;
 60         uint8_t *p, *q;                            56         uint8_t *p, *q;
 61         int d, z, z0;                              57         int d, z, z0;
 62                                                    58 
 63         register unative_t wd$$, wq$$, wp$$, w     59         register unative_t wd$$, wq$$, wp$$, w1$$, w2$$;
 64         const unative_t x1d = vdupq_n_u8(0x1d) !!  60         const unative_t x1d = NBYTES(0x1d);
 65                                                    61 
 66         z0 = disks - 3;         /* Highest dat     62         z0 = disks - 3;         /* Highest data disk */
 67         p = dptr[z0+1];         /* XOR parity      63         p = dptr[z0+1];         /* XOR parity */
 68         q = dptr[z0+2];         /* RS syndrome     64         q = dptr[z0+2];         /* RS syndrome */
 69                                                    65 
 70         for ( d = 0 ; d < bytes ; d += NSIZE*$     66         for ( d = 0 ; d < bytes ; d += NSIZE*$# ) {
 71                 wq$$ = wp$$ = vld1q_u8(&dptr[z     67                 wq$$ = wp$$ = vld1q_u8(&dptr[z0][d+$$*NSIZE]);
 72                 for ( z = z0-1 ; z >= 0 ; z--      68                 for ( z = z0-1 ; z >= 0 ; z-- ) {
 73                         wd$$ = vld1q_u8(&dptr[     69                         wd$$ = vld1q_u8(&dptr[z][d+$$*NSIZE]);
 74                         wp$$ = veorq_u8(wp$$,      70                         wp$$ = veorq_u8(wp$$, wd$$);
 75                         w2$$ = MASK(wq$$);         71                         w2$$ = MASK(wq$$);
 76                         w1$$ = SHLBYTE(wq$$);      72                         w1$$ = SHLBYTE(wq$$);
 77                                                    73 
 78                         w2$$ = vandq_u8(w2$$,      74                         w2$$ = vandq_u8(w2$$, x1d);
 79                         w1$$ = veorq_u8(w1$$,      75                         w1$$ = veorq_u8(w1$$, w2$$);
 80                         wq$$ = veorq_u8(w1$$,      76                         wq$$ = veorq_u8(w1$$, wd$$);
 81                 }                                  77                 }
 82                 vst1q_u8(&p[d+NSIZE*$$], wp$$)     78                 vst1q_u8(&p[d+NSIZE*$$], wp$$);
 83                 vst1q_u8(&q[d+NSIZE*$$], wq$$)     79                 vst1q_u8(&q[d+NSIZE*$$], wq$$);
 84         }                                          80         }
 85 }                                                  81 }
 86                                                    82 
 87 void raid6_neon$#_xor_syndrome_real(int disks,     83 void raid6_neon$#_xor_syndrome_real(int disks, int start, int stop,
 88                                     unsigned l     84                                     unsigned long bytes, void **ptrs)
 89 {                                                  85 {
 90         uint8_t **dptr = (uint8_t **)ptrs;         86         uint8_t **dptr = (uint8_t **)ptrs;
 91         uint8_t *p, *q;                            87         uint8_t *p, *q;
 92         int d, z, z0;                              88         int d, z, z0;
 93                                                    89 
 94         register unative_t wd$$, wq$$, wp$$, w     90         register unative_t wd$$, wq$$, wp$$, w1$$, w2$$;
 95         const unative_t x1d = vdupq_n_u8(0x1d) !!  91         const unative_t x1d = NBYTES(0x1d);
 96                                                    92 
 97         z0 = stop;              /* P/Q right s     93         z0 = stop;              /* P/Q right side optimization */
 98         p = dptr[disks-2];      /* XOR parity      94         p = dptr[disks-2];      /* XOR parity */
 99         q = dptr[disks-1];      /* RS syndrome     95         q = dptr[disks-1];      /* RS syndrome */
100                                                    96 
101         for ( d = 0 ; d < bytes ; d += NSIZE*$     97         for ( d = 0 ; d < bytes ; d += NSIZE*$# ) {
102                 wq$$ = vld1q_u8(&dptr[z0][d+$$     98                 wq$$ = vld1q_u8(&dptr[z0][d+$$*NSIZE]);
103                 wp$$ = veorq_u8(vld1q_u8(&p[d+     99                 wp$$ = veorq_u8(vld1q_u8(&p[d+$$*NSIZE]), wq$$);
104                                                   100 
105                 /* P/Q data pages */              101                 /* P/Q data pages */
106                 for ( z = z0-1 ; z >= start ;     102                 for ( z = z0-1 ; z >= start ; z-- ) {
107                         wd$$ = vld1q_u8(&dptr[    103                         wd$$ = vld1q_u8(&dptr[z][d+$$*NSIZE]);
108                         wp$$ = veorq_u8(wp$$,     104                         wp$$ = veorq_u8(wp$$, wd$$);
109                         w2$$ = MASK(wq$$);        105                         w2$$ = MASK(wq$$);
110                         w1$$ = SHLBYTE(wq$$);     106                         w1$$ = SHLBYTE(wq$$);
111                                                   107 
112                         w2$$ = vandq_u8(w2$$,     108                         w2$$ = vandq_u8(w2$$, x1d);
113                         w1$$ = veorq_u8(w1$$,     109                         w1$$ = veorq_u8(w1$$, w2$$);
114                         wq$$ = veorq_u8(w1$$,     110                         wq$$ = veorq_u8(w1$$, wd$$);
115                 }                                 111                 }
116                 /* P/Q left side optimization     112                 /* P/Q left side optimization */
117                 for ( z = start-1 ; z >= 3 ; z !! 113                 for ( z = start-1 ; z >= 0 ; z-- ) {
118                         w2$$ = vshrq_n_u8(wq$$ << 
119                         w1$$ = vshlq_n_u8(wq$$ << 
120                                                << 
121                         w2$$ = PMUL(w2$$, x1d) << 
122                         wq$$ = veorq_u8(w1$$,  << 
123                 }                              << 
124                                                << 
125                 switch (z) {                   << 
126                 case 2:                        << 
127                         w2$$ = vshrq_n_u8(wq$$ << 
128                         w1$$ = vshlq_n_u8(wq$$ << 
129                                                << 
130                         w2$$ = PMUL(w2$$, x1d) << 
131                         wq$$ = veorq_u8(w1$$,  << 
132                         break;                 << 
133                 case 1:                        << 
134                         w2$$ = vshrq_n_u8(wq$$ << 
135                         w1$$ = vshlq_n_u8(wq$$ << 
136                                                << 
137                         w2$$ = PMUL(w2$$, x1d) << 
138                         wq$$ = veorq_u8(w1$$,  << 
139                         break;                 << 
140                 case 0:                        << 
141                         w2$$ = MASK(wq$$);        114                         w2$$ = MASK(wq$$);
142                         w1$$ = SHLBYTE(wq$$);     115                         w1$$ = SHLBYTE(wq$$);
143                                                   116 
144                         w2$$ = vandq_u8(w2$$,     117                         w2$$ = vandq_u8(w2$$, x1d);
145                         wq$$ = veorq_u8(w1$$,     118                         wq$$ = veorq_u8(w1$$, w2$$);
146                 }                                 119                 }
147                 w1$$ = vld1q_u8(&q[d+NSIZE*$$]    120                 w1$$ = vld1q_u8(&q[d+NSIZE*$$]);
148                 wq$$ = veorq_u8(wq$$, w1$$);      121                 wq$$ = veorq_u8(wq$$, w1$$);
149                                                   122 
150                 vst1q_u8(&p[d+NSIZE*$$], wp$$)    123                 vst1q_u8(&p[d+NSIZE*$$], wp$$);
151                 vst1q_u8(&q[d+NSIZE*$$], wq$$)    124                 vst1q_u8(&q[d+NSIZE*$$], wq$$);
152         }                                         125         }
153 }                                                 126 }
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php