1 /* { dg-do run } */
2 /* { dg-require-effective-target avx512bw } */
3 /* { dg-require-effective-target avx512vl } */
4 /* { dg-options "-O2 -mavx512bw -mavx512vl" } */
5 
6 #ifndef CHECK
7 #define CHECK "avx512f-helper.h"
8 #endif
9 
10 #include CHECK
11 
12 #ifndef TEST
13 #define TEST avx512bw_test
14 #endif
15 
16 #include "avx512vl-pr95488-1.c"
17 
18 #define TEST_MULB(typeV, typeS, N, fn)		\
19 do						\
20   {						\
21     typeV v1, v2, res;				\
22     int i,j;					\
23     typeS s1[N], s2[N], exp[N];		\
24 						\
25     for (i = 0; i < N; i++)			\
26       {					\
27 	s1[i] = i * i;				\
28 	s2[i] = i + 20;			\
29       }					\
30     for (i = 0; i < N; i++)			\
31       exp[i] = s1[i] * s2[i];			\
32     v1 = *(typeV *)s1;				\
33     v2 = *(typeV *)s2;				\
34     res = fn (v1, v2);				\
35     for (j = 0; j < N; j++)			\
36       {					\
37 	if (res[j] != exp[j])			\
38 	  abort();				\
39       }					\
40   }						\
41 while (0)
42 
43 static void
TEST(void)44 TEST (void)
45 {
46   TEST_MULB(v8qi, char, 8, mul_128);
47   TEST_MULB(v8uqi, unsigned char, 8, umul_128);
48   TEST_MULB(v16qi, char, 16, mul_256);
49   TEST_MULB(v16uqi, unsigned char, 16, umul_256);
50 }
51