summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/riscv/zknh-sha256.c
blob: 54329aa6af2e40977dbfa56463e9cfc90999abc2 (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
/* { dg-do compile } */
/* { dg-options "-O2 -march=rv64gc_zknh -mabi=lp64" } */
/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */

long foo1(long rs1)
{
    return __builtin_riscv_sha256sig0(rs1);
}

long foo2(long rs1)
{
    return __builtin_riscv_sha256sig1(rs1);
}

long foo3(long rs1)
{
    return __builtin_riscv_sha256sum0(rs1);
}

long foo4(long rs1)
{
    return __builtin_riscv_sha256sum1(rs1);
}

/* { dg-final { scan-assembler-times "sha256sig0" 1 } } */
/* { dg-final { scan-assembler-times "sha256sig1" 1 } } */
/* { dg-final { scan-assembler-times "sha256sum0" 1 } } */
/* { dg-final { scan-assembler-times "sha256sum1" 1 } } */