Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions tests/tcg/ppc64/Makefile.target
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,28 @@ PPC64_TESTS=bcdsub non_signalling_xscv
endif
$(PPC64_TESTS): CFLAGS += -mpower8-vector

PPC64_TESTS += byte_reverse
PPC64_TESTS += mtfsf
PPC64_TESTS += byte_reverse mtfsf vmsumcud
ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_POWER10),)
run-byte_reverse: QEMU_OPTS+=-cpu POWER10
run-plugin-byte_reverse-with-%: QEMU_OPTS+=-cpu POWER10

vmsumcud: CFLAGS += -mcpu=power10
run-vmsumcud: QEMU_OPTS+=-cpu POWER10
run-plugin-vmsumcud-with-%: QEMU_OPTS+=-cpu POWER10
else
byte_reverse:
$(call skip-test, "BUILD of $@", "missing compiler support")
run-byte_reverse:
$(call skip-test, "RUN of byte_reverse", "not built")
run-plugin-byte_reverse-with-%:
$(call skip-test, "RUN of byte_reverse ($*)", "not built")

vmsumcud:
$(call skip-test, "BUILD of $@", "missing compiler support")
run-vmsumcud:
$(call skip-test, "RUN of vmsumcud", "not built")
run-plugin-vmsumcud-with-%:
$(call skip-test, "RUN of vmsumcud ($*)", "not built")
endif

PPC64_TESTS += signal_save_restore_xer
Expand Down
6 changes: 5 additions & 1 deletion tests/tcg/ppc64le/Makefile.target
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ endif
$(PPC64LE_TESTS): CFLAGS += -mpower8-vector

ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_POWER10),)
PPC64LE_TESTS += byte_reverse
PPC64LE_TESTS += byte_reverse vmsumcud
endif
byte_reverse: CFLAGS += -mcpu=power10
run-byte_reverse: QEMU_OPTS+=-cpu POWER10
run-plugin-byte_reverse-with-%: QEMU_OPTS+=-cpu POWER10

vmsumcud: CFLAGS += -mcpu=power10
run-vmsumcud: QEMU_OPTS+=-cpu POWER10
run-plugin-vmsumcud-with-%: QEMU_OPTS+=-cpu POWER10

PPC64LE_TESTS += mtfsf
PPC64LE_TESTS += signal_save_restore_xer

Expand Down
45 changes: 45 additions & 0 deletions tests/tcg/ppc64le/vmsumcud.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include <assert.h>
#include <limits.h>
#include <unistd.h>
#include <signal.h>
#include <stdint.h>

#define I128(a, b) ((__int128)(a) << 64 | (b))

#define TEST(INSN, A, B, C, EXP) \
do { \
__uint128_t a = A, b = B, c = C; \
__uint128_t t; \
\
asm(INSN " %0, %1, %2, %3" : "=v"(t) : "v"(a), "v"(b), "v"(c));\
\
assert(t == EXP); \
} while (0)

int main(void)
{
struct sigaction action;

action.sa_handler = _exit;
sigaction(SIGABRT, &action, NULL);

TEST("vmsumcud", I128(0xffffffffffffffffULL, 0xffffffffffffffffULL),
I128(0xffffffffffffffffULL, 0xffffffffffffffffULL),
I128(0xffffffffffffffffULL, 0xffffffffffffffffULL),
I128(0x0, 0x2));
TEST("vmsumudm", I128(0xffffffffffffffffULL, 0xffffffffffffffffULL),
I128(0xffffffffffffffffULL, 0xffffffffffffffffULL),
I128(0xffffffffffffffffULL, 0xffffffffffffffffULL),
I128(0xfffffffffffffffcULL, 0x1));

TEST("vmsumcud", I128(0x7a5dc79113085e5eULL, 0x85992739e89cd5c5ULL),
I128(0xdf4875aeec5f3e50ULL, 0xb438c5a12aa9859fULL),
I128(0x466a40ee1b83303cULL, 0xf15e03137f41eb8aULL),
I128(0x0, 0x1));
TEST("vmsumudm", I128(0x7a5dc79113085e5eULL, 0x85992739e89cd5c5ULL),
I128(0xdf4875aeec5f3e50ULL, 0xb438c5a12aa9859fULL),
I128(0x466a40ee1b83303cULL, 0xf15e03137f41eb8aULL),
I128(0x0f31e49e57d1bdf8ULL, 0x13c42b548b214b45ULL));

return 0;
}