1 /* { dg-require-effective-target vect_int } */
2 /* { dg-additional-options "-fdump-tree-optimized" } */
9 #define SIGNEDNESS unsigned
15 void __attribute__ ((noipa
))
16 f (SIGNEDNESS
char *restrict a
, SIGNEDNESS
char *restrict b
,
17 SIGNEDNESS
char *restrict c
)
19 for (__INTPTR_TYPE__ i
= 0; i
< N
; ++i
)
20 a
[i
] = (b
[i
] + c
[i
] + BIAS
) >> 1;
23 #define BASE1 ((SIGNEDNESS int) -1 < 0 ? -126 : 4)
24 #define BASE2 ((SIGNEDNESS int) -1 < 0 ? -101 : 26)
31 SIGNEDNESS
char a
[N
], b
[N
], c
[N
];
32 for (int i
= 0; i
< N
; ++i
)
36 asm volatile ("" ::: "memory");
40 for (int i
= 0; i
< N
; ++i
)
41 if (a
[i
] != ((BASE1
+ BASE2
+ i
* 9 + BIAS
) >> 1))
46 /* { dg-final { scan-tree-dump "vect_recog_average_pattern: detected" "vect" } } */
47 /* { dg-final { scan-tree-dump {\.AVG_FLOOR} "vect" { target vect_avg_qi } } } */
48 /* { dg-final { scan-tree-dump-not {vector\([^\n]*short} "optimized" { target vect_avg_qi } } } */
49 /* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" { target vect_avg_qi } } } */