123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- #include <arm_neon.h>
- typedef uint8x16_t unative_t;
- #define NBYTES(x) ((unative_t){x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x})
- #define NSIZE sizeof(unative_t)
- static inline unative_t SHLBYTE(unative_t v)
- {
- return vshlq_n_u8(v, 1);
- }
- static inline unative_t MASK(unative_t v)
- {
- const uint8x16_t temp = NBYTES(0);
- return (unative_t)vcltq_s8((int8x16_t)v, (int8x16_t)temp);
- }
- void raid6_neon$#_gen_syndrome_real(int disks, unsigned long bytes, void **ptrs)
- {
- uint8_t **dptr = (uint8_t **)ptrs;
- uint8_t *p, *q;
- int d, z, z0;
- register unative_t wd$$, wq$$, wp$$, w1$$, w2$$;
- const unative_t x1d = NBYTES(0x1d);
- z0 = disks - 3;
- p = dptr[z0+1];
- q = dptr[z0+2];
- for ( d = 0 ; d < bytes ; d += NSIZE*$# ) {
- wq$$ = wp$$ = vld1q_u8(&dptr[z0][d+$$*NSIZE]);
- for ( z = z0-1 ; z >= 0 ; z-- ) {
- wd$$ = vld1q_u8(&dptr[z][d+$$*NSIZE]);
- wp$$ = veorq_u8(wp$$, wd$$);
- w2$$ = MASK(wq$$);
- w1$$ = SHLBYTE(wq$$);
- w2$$ = vandq_u8(w2$$, x1d);
- w1$$ = veorq_u8(w1$$, w2$$);
- wq$$ = veorq_u8(w1$$, wd$$);
- }
- vst1q_u8(&p[d+NSIZE*$$], wp$$);
- vst1q_u8(&q[d+NSIZE*$$], wq$$);
- }
- }
- void raid6_neon$#_xor_syndrome_real(int disks, int start, int stop,
- unsigned long bytes, void **ptrs)
- {
- uint8_t **dptr = (uint8_t **)ptrs;
- uint8_t *p, *q;
- int d, z, z0;
- register unative_t wd$$, wq$$, wp$$, w1$$, w2$$;
- const unative_t x1d = NBYTES(0x1d);
- z0 = stop;
- p = dptr[disks-2];
- q = dptr[disks-1];
- for ( d = 0 ; d < bytes ; d += NSIZE*$# ) {
- wq$$ = vld1q_u8(&dptr[z0][d+$$*NSIZE]);
- wp$$ = veorq_u8(vld1q_u8(&p[d+$$*NSIZE]), wq$$);
-
- for ( z = z0-1 ; z >= start ; z-- ) {
- wd$$ = vld1q_u8(&dptr[z][d+$$*NSIZE]);
- wp$$ = veorq_u8(wp$$, wd$$);
- w2$$ = MASK(wq$$);
- w1$$ = SHLBYTE(wq$$);
- w2$$ = vandq_u8(w2$$, x1d);
- w1$$ = veorq_u8(w1$$, w2$$);
- wq$$ = veorq_u8(w1$$, wd$$);
- }
-
- for ( z = start-1 ; z >= 0 ; z-- ) {
- w2$$ = MASK(wq$$);
- w1$$ = SHLBYTE(wq$$);
- w2$$ = vandq_u8(w2$$, x1d);
- wq$$ = veorq_u8(w1$$, w2$$);
- }
- w1$$ = vld1q_u8(&q[d+NSIZE*$$]);
- wq$$ = veorq_u8(wq$$, w1$$);
- vst1q_u8(&p[d+NSIZE*$$], wp$$);
- vst1q_u8(&q[d+NSIZE*$$], wq$$);
- }
- }
|