From 8d5d21b0f17278671d8005c2eab304d8c8e289de Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Tue, 15 Oct 2013 19:20:50 +0200 Subject: [PATCH] Removes RAID computation processing 128 bytes block. --- raid.c | 65 +++++------------------------------------------------- raid.h | 1 - selftest.c | 1 - speed.c | 8 ------- 4 files changed, 6 insertions(+), 69 deletions(-) diff --git a/raid.c b/raid.c index 864e9588..8a7da86d 100644 --- a/raid.c +++ b/raid.c @@ -140,6 +140,11 @@ void raid5_mmx(unsigned char** vbuf, unsigned data, unsigned size) /* * RAID5 SSE2 implementation + * + * Note that we don't have the corresponding x64 sse2ext function using more + * registers because processing a block of 64 bytes already fills + * the typical cache block, and processing 128 bytes doesn't increase + * performance. */ void raid5_sse2(unsigned char** vbuf, unsigned data, unsigned size) { @@ -175,61 +180,6 @@ void raid5_sse2(unsigned char** vbuf, unsigned data, unsigned size) } #endif -#if defined(__x86_64__) -/* - * RAID5 SSE2 implementation - * Note that it uses 16 registers, meaning that x64 is required. - */ -void raid5_sse2ext(unsigned char** vbuf, unsigned data, unsigned size) -{ - unsigned char* p; - int d, l; - unsigned o; - - l = data - 1; - p = vbuf[data]; - - for(o=0;o=0;--d) { - asm volatile("movdqa %0,%%xmm8" : : "m" (vbuf[d][o])); - asm volatile("movdqa %0,%%xmm9" : : "m" (vbuf[d][o+16])); - asm volatile("movdqa %0,%%xmm10" : : "m" (vbuf[d][o+32])); - asm volatile("movdqa %0,%%xmm11" : : "m" (vbuf[d][o+48])); - asm volatile("movdqa %0,%%xmm12" : : "m" (vbuf[d][o+64])); - asm volatile("movdqa %0,%%xmm13" : : "m" (vbuf[d][o+80])); - asm volatile("movdqa %0,%%xmm14" : : "m" (vbuf[d][o+96])); - asm volatile("movdqa %0,%%xmm15" : : "m" (vbuf[d][o+112])); - asm volatile("pxor %xmm8,%xmm0"); - asm volatile("pxor %xmm9,%xmm1"); - asm volatile("pxor %xmm10,%xmm2"); - asm volatile("pxor %xmm11,%xmm3"); - asm volatile("pxor %xmm12,%xmm4"); - asm volatile("pxor %xmm13,%xmm5"); - asm volatile("pxor %xmm14,%xmm6"); - asm volatile("pxor %xmm15,%xmm7"); - } - asm volatile("movntdq %%xmm0,%0" : "=m" (p[o])); - asm volatile("movntdq %%xmm1,%0" : "=m" (p[o+16])); - asm volatile("movntdq %%xmm2,%0" : "=m" (p[o+32])); - asm volatile("movntdq %%xmm3,%0" : "=m" (p[o+48])); - asm volatile("movntdq %%xmm4,%0" : "=m" (p[o+64])); - asm volatile("movntdq %%xmm5,%0" : "=m" (p[o+80])); - asm volatile("movntdq %%xmm6,%0" : "=m" (p[o+96])); - asm volatile("movntdq %%xmm7,%0" : "=m" (p[o+112])); - } - - asm volatile("sfence" : : : "memory"); -} -#endif - /** * Multiply each byte of a uint32 by 2 in the GF(2^8). */ @@ -2909,18 +2859,16 @@ void raid_init(void) } if (cpu_has_sse2()) { + raid5_gen = raid5_sse2; #if defined(__x86_64__) if (cpu_has_slowextendedreg()) { - raid5_gen = raid5_sse2; raid6_gen = raid6_sse2; } else { - raid5_gen = raid5_sse2ext; raid6_gen = raid6_sse2ext; } raidTP_gen = raidTP_sse2ext; raidQP_gen = raidQP_sse2ext; #else - raid5_gen = raid5_sse2; raid6_gen = raid6_sse2; raidTP_gen = raidTP_sse2; raidQP_gen = raidQP_sse2; @@ -2973,7 +2921,6 @@ static struct raid_func { #endif #if defined(__x86_64__) - { "sse2ext", raid5_sse2ext }, { "sse2ext", raid6_sse2ext }, { "sse2ext", raidTP_sse2ext }, { "sse2ext", raidQP_sse2ext }, diff --git a/raid.h b/raid.h index 09ca1adb..3eb06b86 100644 --- a/raid.h +++ b/raid.h @@ -94,7 +94,6 @@ void raid5_int32(unsigned char** vbuf, unsigned data, unsigned size); void raid5_int64(unsigned char** vbuf, unsigned data, unsigned size); void raid5_mmx(unsigned char** vbuf, unsigned data, unsigned size); void raid5_sse2(unsigned char** vbuf, unsigned data, unsigned size); -void raid5_sse2ext(unsigned char** vbuf, unsigned data, unsigned size); void raid6_int32(unsigned char** vbuf, unsigned data, unsigned size); void raid6_int64(unsigned char** vbuf, unsigned data, unsigned size); void raid6_mmx(unsigned char** vbuf, unsigned data, unsigned size); diff --git a/selftest.c b/selftest.c index ff5c0988..312943f9 100644 --- a/selftest.c +++ b/selftest.c @@ -358,7 +358,6 @@ static void gentest(unsigned diskmax, unsigned block_size) map[mac++] = raidTP_sse2; map[mac++] = raidQP_sse2; #if defined(__x86_64__) - map[mac++] = raid5_sse2ext; map[mac++] = raid6_sse2ext; map[mac++] = raidTP_sse2ext; map[mac++] = raidQP_sse2ext; diff --git a/speed.c b/speed.c index 2f0a54a1..9b91b48e 100644 --- a/speed.c +++ b/speed.c @@ -215,14 +215,6 @@ void speed(void) } SPEED_STOP printf("RAID5 sse2 %"PRIu64" [MB/s]\n", ds / dt); - -#if defined(__x86_64__) - SPEED_START { - raid5_sse2ext(buffer, diskmax, block_size); - } SPEED_STOP - - printf("RAID5 sse2ext %"PRIu64" [MB/s]\n", ds / dt); -#endif } #endif