Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_mulh-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d -mrvv-vector-bits=scalable -fno-vect-cost-model" } */
3
4 #include <stdint-gcc.h>
5
6 #define DEF_LOOP(TYPE, WTYPE) \
7 void __attribute__ ((noipa)) \
8 test_##TYPE##_##WTYPE (TYPE *__restrict a, TYPE *__restrict b, \
9 TYPE *__restrict c, TYPE *__restrict pred, int n) \
10 { \
11 for (int i = 0; i < n; ++i) \
12 c[i] = pred[i] \
13 ? (TYPE) (((WTYPE) a[i] * (WTYPE) b[i]) >> sizeof (TYPE) * 8) \
14 : c[i]; \
15 }
16
17 #define TEST_ALL(T) \
18 T (int8_t, int16_t) \
19 T (int16_t, int32_t) \
20 T (int32_t, int64_t) \
21 T (uint8_t, uint16_t) \
22 T (uint16_t, uint32_t) \
23 T (uint32_t, uint64_t)
24
25 TEST_ALL (DEF_LOOP)
26
27 /* { dg-final { scan-assembler-times {\tvmulh\.vv\tv[0-9]+,v[0-9]+,v[0-9]+,v0.t} 3 } } */
28 /* { dg-final { scan-assembler-times {\tvmulhu\.vv\tv[0-9]+,v[0-9]+,v[0-9]+,v0.t} 3 } } */
29 /* { dg-final { scan-assembler-not {\tvmerge\.vvm\t} } } */