| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -msve-vector-bits=256 -march=armv8.2-a+sve -fdump-tree-optimized" } */ |
| 3 |
|
| 4 |
unsigned int |
| 5 |
f1 (unsigned int a, unsigned int b, unsigned int c) { |
| 6 |
unsigned int d = a * b; |
| 7 |
return d + ((c + d) >> 1); |
| 8 |
} |
| 9 |
|
| 10 |
unsigned int |
| 11 |
g1 (unsigned int a, unsigned int b, unsigned int c) { |
| 12 |
return a * b + c; |
| 13 |
} |
| 14 |
|
| 15 |
__Uint32x4_t |
| 16 |
f2 (__Uint32x4_t a, __Uint32x4_t b, __Uint32x4_t c) { |
| 17 |
__Uint32x4_t d = a * b; |
| 18 |
return d + ((c + d) >> 1); |
| 19 |
} |
| 20 |
|
| 21 |
__Uint32x4_t |
| 22 |
g2 (__Uint32x4_t a, __Uint32x4_t b, __Uint32x4_t c) { |
| 23 |
return a * b + c; |
| 24 |
} |
| 25 |
|
| 26 |
typedef unsigned int vec __attribute__((vector_size(32))); vec |
| 27 |
f3 (vec a, vec b, vec c) |
| 28 |
{ |
| 29 |
vec d = a * b; |
| 30 |
return d + ((c + d) >> 1); |
| 31 |
} |
| 32 |
|
| 33 |
vec |
| 34 |
g3 (vec a, vec b, vec c) |
| 35 |
{ |
| 36 |
return a * b + c; |
| 37 |
} |
| 38 |
|
| 39 |
/* { dg-final { scan-tree-dump-times {\.FMA } 1 "optimized" } } */ |