summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/riscv/rvv/base/binop_vx_constraint-121.c
blob: 4d2de91bc1485a514eb13255a6ec387cabbfe058 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* { dg-do compile } */
/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3" } */
#include "riscv_vector.h"

void f1 (void * in, void *out, int32_t x)
{
    vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
    vint32m1_t v2 = __riscv_vle32_v_i32m1_tu (v, in, 4);
    vint32m1_t v3 = __riscv_vmulh_vx_i32m1 (v2, 0, 4);
    __riscv_vse32_v_i32m1 (out, v3, 4);
}

void f2 (void * in, void *out, int32_t x)
{
    vint64m1_t v = __riscv_vle64_v_i64m1 (in, 4);
    vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in, 4);
    vint64m1_t v3 = __riscv_vmulh_vx_i64m1 (v2, 0, 4);
    __riscv_vse64_v_i64m1 (out, v3, 4);
}

void f3 (void * in, void *out, int32_t x)
{
    vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
    vint32m1_t v2 = __riscv_vle32_v_i32m1_tu (v, in, 4);
    vint32m1_t v3 = __riscv_vdiv_vx_i32m1 (v2, 0, 4);
    __riscv_vse32_v_i32m1 (out, v3, 4);
}

void f4 (void * in, void *out, int32_t x)
{
    vint64m1_t v = __riscv_vle64_v_i64m1 (in, 4);
    vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in, 4);
    vint64m1_t v3 = __riscv_vdiv_vx_i64m1 (v2, 0, 4);
    __riscv_vse64_v_i64m1 (out, v3, 4);
}

void f5 (void * in, void *out, int32_t x)
{
    vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
    vint32m1_t v2 = __riscv_vle32_v_i32m1_tu (v, in, 4);
    vint32m1_t v3 = __riscv_vrem_vx_i32m1 (v2, 0, 4);
    __riscv_vse32_v_i32m1 (out, v3, 4);
}

void f6 (void * in, void *out, int32_t x)
{
    vint64m1_t v = __riscv_vle64_v_i64m1 (in, 4);
    vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in, 4);
    vint64m1_t v3 = __riscv_vrem_vx_i64m1 (v2, 0, 4);
    __riscv_vse64_v_i64m1 (out, v3, 4);
}

/* { dg-final { scan-assembler-times {vmulh\.vx\s+v[0-9]+,\s*v[0-9]+,zero} 2 } } */
/* { dg-final { scan-assembler-times {vdiv\.vx\s+v[0-9]+,\s*v[0-9]+,zero} 2 } } */
/* { dg-final { scan-assembler-times {vrem\.vx\s+v[0-9]+,\s*v[0-9]+,zero} 2 } } */