Debian Codegraph @

gcc/testsuite/gcc.target/i386/vect-pr82426.c

raw
1 /* i?86 does not have V2SF, x32 does though. */
2 /* { dg-do compile { target { ! ia32 } } } */
3 /* { dg-options "-O3 -mavx -mfma" } */
4
5 struct Matrix
6 {
7 float m11;
8 float m12;
9 float m21;
10 float m22;
11 float dx;
12 float dy;
13 };
14
15 struct Matrix multiply(const struct Matrix *a, const struct Matrix *b)
16 {
17 struct Matrix out;
18 out.m11 = a->m11*b->m11 + a->m12*b->m21;
19 out.m12 = a->m11*b->m12 + a->m12*b->m22;
20 out.m21 = a->m21*b->m11 + a->m22*b->m21;
21 out.m22 = a->m21*b->m12 + a->m22*b->m22;
22
23 out.dx = a->dx*b->m11 + a->dy*b->m21 + b->dx;
24 out.dy = a->dx*b->m12 + a->dy*b->m22 + b->dy;
25 return out;
26 }
27
28 /* The whole kernel should be vectorized with V4SF and V2SF operations. */
29 /* { dg-final { scan-assembler-times "vadd" 1 } } */
30 /* { dg-final { scan-assembler-times "vmul" 2 } } */
31 /* { dg-final { scan-assembler-times "vfma" 2 } } */