Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.target/i386/pr94308.c @ 152:2b5abeee2509
update gcc11
author | anatofuz |
---|---|
date | Mon, 25 May 2020 07:50:57 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
145:1830386684a0 | 152:2b5abeee2509 |
---|---|
1 /* PR target/94308 */ | |
2 /* { dg-do compile } */ | |
3 /* { dg-options "-O2 -mfpmath=sse -mavx2 -mfma" } */ | |
4 | |
5 #include <x86intrin.h> | |
6 | |
7 void | |
8 foo (float *x, const float *y, const float *z, unsigned int w) | |
9 { | |
10 unsigned int a; | |
11 const unsigned int b = w / 8; | |
12 const float *c = y; | |
13 const float *d = z; | |
14 __m256 e = _mm256_setzero_ps (); | |
15 __m256 f, g; | |
16 for (a = 0; a < b; a++) | |
17 { | |
18 f = _mm256_loadu_ps (c); | |
19 g = _mm256_loadu_ps (d); | |
20 c += 8; | |
21 d += 8; | |
22 e = _mm256_fmadd_ps (f, g, e); | |
23 } | |
24 __attribute__ ((aligned (32))) float h[8]; | |
25 _mm256_storeu_ps (h, e); | |
26 _mm256_zeroupper (); | |
27 float i = h[0] + h[1] + h[2] + h[3] + h[4] + h[5] + h[6] + h[7]; | |
28 for (a = b * 8; a < w; a++) | |
29 i += (*c++) * (*d++); | |
30 *x = i; | |
31 } |