Skip to content

Commit

Permalink
[apps] Update vcpop tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mp-17 committed Nov 15, 2024
1 parent cc60372 commit d24493d
Showing 1 changed file with 59 additions and 4 deletions.
63 changes: 59 additions & 4 deletions apps/riscv-tests/isa/rv64uv/vcpop.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,79 @@ void TEST_CASE1(void) {
VLOAD_32(v0, 5, 0, 0, 0);
volatile uint32_t scalar = 1337;
volatile uint32_t OUP[] = {0, 0, 0, 0};
__asm__ volatile("vpopc.m %[A], v2, v0.t \n"
asm volatile("vpopc.m %[A], v2, v0.t \n"
"sw %[A], (%1) \n"
:
: [A] "r"(scalar), "r"(OUP));
XCMP(1, OUP[0], 2);

VSET(16, e32, m1);
VLOAD_32(v8, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F);
VLOAD_32(v0, 0xffffffffffffffff, 0xfffffffffffffff7, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xefffffffffffffff);
VSET(1024, e8, m8);
asm volatile("vpopc.m %[A], v8, v0.t \n"
"sw %[A], (%1) \n"
:
: [A] "r"(scalar), "r"(OUP));
XCMP(2, OUP[0], 159);
}

// unmasked
void TEST_CASE2(void) {
VSET(4, e32, m1);
VLOAD_32(v2, 0xF, 0, 0, 0);
VLOAD_32(v2, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F);
volatile uint32_t scalar = 1337;
volatile uint32_t OUP[] = {0, 0, 0, 0};
__asm__ volatile("vpopc.m %[A], v2 \n"
VSET(128, e32, m1);
asm volatile("vpopc.m %[A], v2 \n"
"sw %[A], (%1) \n"
:
: [A] "r"(scalar), "r"(OUP));
XCMP(3, OUP[0], 40);

VSET(8, e32, m1);
VLOAD_32(v0, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F);
VSET(256, e8, m8);
asm volatile("vpopc.m %[A], v0 \n"
"sw %[A], (%1) \n"
:
: [A] "r"(scalar), "r"(OUP));
XCMP(4, OUP[0], 80);

VSET(16, e32, m1);
VLOAD_32(v0, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F);
VSET(1024, e8, m8);
asm volatile("vpopc.m %[A], v0 \n"
"sw %[A], (%1) \n"
:
: [A] "r"(scalar), "r"(OUP));
XCMP(5, OUP[0], 160);

VSET(8, e32, m1);
VLOAD_32(v2, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F);
VSET(256, e8, m1);
asm volatile("vpopc.m %[A], v2 \n"
"sw %[A], (%1) \n"
:
: [A] "r"(scalar), "r"(OUP));
XCMP(6, OUP[0], 80);

VSET(2, e32, m1);
VLOAD_8(v2, 0xFF, 0x88);
VSET(16, e16, m1);
asm volatile("vcpop.m %[A], v2 \n"
"sw %[A], (%1) \n"
:
: [A] "r"(scalar), "r"(OUP));
XCMP(7, OUP[0], 10);

VSET(4, e32, m1);
VLOAD_32(v2, 0xF, 0, 0, 0);
asm volatile("vpopc.m %[A], v2 \n"
"sw %[A], (%1) \n"
:
: [A] "r"(scalar), "r"(OUP));
XCMP(2, OUP[0], 4);
XCMP(8, OUP[0], 4);
}

int main(void) {
Expand Down

0 comments on commit d24493d

Please sign in to comment.