diff --git a/tests/tcg/ppc64/Makefile.target b/tests/tcg/ppc64/Makefile.target index 0368007028c9a..24be2ded1fefc 100644 --- a/tests/tcg/ppc64/Makefile.target +++ b/tests/tcg/ppc64/Makefile.target @@ -10,11 +10,14 @@ 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") diff --git a/tests/tcg/ppc64le/Makefile.target b/tests/tcg/ppc64le/Makefile.target index 480ff0898d7ea..8640c9aba32f7 100644 --- a/tests/tcg/ppc64le/Makefile.target +++ b/tests/tcg/ppc64le/Makefile.target @@ -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 diff --git a/tests/tcg/ppc64le/vmsumcud.c b/tests/tcg/ppc64le/vmsumcud.c new file mode 100644 index 0000000000000..6988585bbb33a --- /dev/null +++ b/tests/tcg/ppc64le/vmsumcud.c @@ -0,0 +1,47 @@ +#include +#include +#include +#include +#include + +#define XSTR(x) #x +#define STR(x) XSTR(x) +#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; +}