2 /* { dg-options "-O2 -mavx512bw -DAVX512BW" } */
3 /* { dg-require-effective-target avx512bw } */
5 #include "avx512f-helper.h"
7 #define SIZE (AVX512F_LEN / 16)
8 #include "avx512f-mask-type.h"
11 CALC (unsigned short *dst
, unsigned char *src1
, unsigned char *src2
,
14 int i
, j
, k
, part
, power
;
15 unsigned char tmp
[2 * SIZE
];;
17 for (i
= 0; i
< 2 * SIZE
; i
+= 16)
19 for (j
= 0; j
< 4; j
++)
22 for (k
= 0; k
< j
; k
++)
24 part
= (imm
& (3 * power
)) >> (2 * j
);
25 for (k
= 0; k
< 4; k
++)
26 tmp
[i
+ 4 * j
+ k
] = src2
[i
+ 4 * part
+ k
];
30 for (i
= 0; i
< SIZE
; i
+= 4)
32 dst
[i
] = dst
[i
+ 1] = dst
[i
+ 2] = dst
[i
+ 3] = 0;
33 for (j
= 0; j
< 4; j
++)
35 dst
[i
] += abs (src1
[2 * i
+ j
] - tmp
[2 * i
+ j
]);
36 dst
[i
+ 1] += abs (src1
[2 * i
+ j
] - tmp
[2 * i
+ j
+ 1]);
37 dst
[i
+ 2] += abs (src1
[2 * i
+ j
+ 4] - tmp
[2 * i
+ j
+ 2]);
38 dst
[i
+ 3] += abs (src1
[2 * i
+ j
+ 4] - tmp
[2 * i
+ j
+ 3]);
47 UNION_TYPE (AVX512F_LEN
, i_w
) res1
, res2
, res3
;
48 UNION_TYPE (AVX512F_LEN
, i_b
) src1
, src2
;
49 MASK_TYPE mask
= MASK_VALUE
;
50 unsigned short res_ref
[SIZE
];
54 for (i
= 0; i
< 2*SIZE
; i
++)
56 src1
.a
[i
] = 1 + 34 * i
* sign
;
61 for (i
= 0; i
< SIZE
; i
++)
62 res2
.a
[i
] = DEFAULT_VALUE
;
64 res1
.x
= INTRINSIC (_dbsad_epu8
) (src1
.x
, src2
.x
, imm
);
65 res2
.x
= INTRINSIC (_mask_dbsad_epu8
) (res2
.x
, mask
, src1
.x
, src2
.x
, imm
);
66 res3
.x
= INTRINSIC (_maskz_dbsad_epu8
) (mask
, src1
.x
, src2
.x
, imm
);
68 CALC (res_ref
, src1
.a
, src2
.a
, imm
);
70 if (UNION_CHECK (AVX512F_LEN
, i_w
) (res1
, res_ref
))
73 MASK_MERGE (i_w
) (res_ref
, mask
, SIZE
);
74 if (UNION_CHECK (AVX512F_LEN
, i_w
) (res2
, res_ref
))
77 MASK_ZERO (i_w
) (res_ref
, mask
, SIZE
);
78 if (UNION_CHECK (AVX512F_LEN
, i_w
) (res3
, res_ref
))