Files
gcc/gcc/testsuite/gcc.dg/vect/vect-reduc-cond-1.c
Andrew Pinski f069bacbf5 testsuite/vec: Fix vect-reduc-cond-[12].c for non vect_condition targets [PR121153]
I missed this when I added the two testcase vect-reduc-cond-[12].c. These testcases
require support of vectorization of `a ? b : c` which some targets (e.g. sparc) does
not support.

Pushed as obvious after a quick test.

	PR testsuite/121153
gcc/testsuite/ChangeLog:

	* gcc.dg/vect/vect-reduc-cond-1.c: Require vect_condition.
	* gcc.dg/vect/vect-reduc-cond-2.c: Likewise.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-07-18 10:07:34 -07:00

61 lines
1001 B
C

/* { dg-require-effective-target vect_int } */
/* { dg-require-effective-target vect_condition } */
#include <stdarg.h>
#include "tree-vect.h"
/* PR tree-optimization/119920 */
#define N 32
unsigned int ub[N];
/* Test vectorization of reduction of unsigned-int. */
__attribute__ ((noinline, noipa))
void init(void)
{
#pragma GCC novector
for(int i = 0;i < N; i++)
ub[i] = i;
}
__attribute__ ((noinline, noipa))
void main1 (unsigned int b, unsigned int c)
{
int i;
unsigned int usum = 0;
init();
/* Summation. */
for (i = 0; i < N; i++) {
if ( ub[i] < N/2 )
{
usum += b;
}
else
{
usum += c;
}
}
/* check results: */
/* __builtin_printf("%d : %d\n", usum, (N/2*b + N/2*c)); */
if (usum != N/2*b + N/2*c)
abort ();
}
int main (void)
{
check_vect ();
main1 (0, 0);
main1 (1, 1);
main1 (10, 1);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { vect_no_int_add } } } } */