Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/base/binop_vx_constraint-121.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-march=rv32gcv -mabi=ilp32 -O3" } */
3 #include "riscv_vector.h"
4
5 void f1 (void * in, void *out, int32_t x)
6 {
7 vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
8 vint32m1_t v2 = __riscv_vle32_v_i32m1_tu (v, in, 4);
9 vint32m1_t v3 = __riscv_vmulh_vx_i32m1 (v2, 0, 4);
10 __riscv_vse32_v_i32m1 (out, v3, 4);
11 }
12
13 void f2 (void * in, void *out, int32_t x)
14 {
15 vint64m1_t v = __riscv_vle64_v_i64m1 (in, 4);
16 vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in, 4);
17 vint64m1_t v3 = __riscv_vmulh_vx_i64m1 (v2, 0, 4);
18 __riscv_vse64_v_i64m1 (out, v3, 4);
19 }
20
21 void f3 (void * in, void *out, int32_t x)
22 {
23 vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
24 vint32m1_t v2 = __riscv_vle32_v_i32m1_tu (v, in, 4);
25 vint32m1_t v3 = __riscv_vdiv_vx_i32m1 (v2, 0, 4);
26 __riscv_vse32_v_i32m1 (out, v3, 4);
27 }
28
29 void f4 (void * in, void *out, int32_t x)
30 {
31 vint64m1_t v = __riscv_vle64_v_i64m1 (in, 4);
32 vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in, 4);
33 vint64m1_t v3 = __riscv_vdiv_vx_i64m1 (v2, 0, 4);
34 __riscv_vse64_v_i64m1 (out, v3, 4);
35 }
36
37 void f5 (void * in, void *out, int32_t x)
38 {
39 vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
40 vint32m1_t v2 = __riscv_vle32_v_i32m1_tu (v, in, 4);
41 vint32m1_t v3 = __riscv_vrem_vx_i32m1 (v2, 0, 4);
42 __riscv_vse32_v_i32m1 (out, v3, 4);
43 }
44
45 void f6 (void * in, void *out, int32_t x)
46 {
47 vint64m1_t v = __riscv_vle64_v_i64m1 (in, 4);
48 vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in, 4);
49 vint64m1_t v3 = __riscv_vrem_vx_i64m1 (v2, 0, 4);
50 __riscv_vse64_v_i64m1 (out, v3, 4);
51 }
52
53 /* { dg-final { scan-assembler-times {vmulh\.vx\s+v[0-9]+,\s*v[0-9]+,zero} 2 } } */
54 /* { dg-final { scan-assembler-times {vdiv\.vx\s+v[0-9]+,\s*v[0-9]+,zero} 2 } } */
55 /* { dg-final { scan-assembler-times {vrem\.vx\s+v[0-9]+,\s*v[0-9]+,zero} 2 } } */