The e5500 and e6500 implement cmpb, prtyw and prtyd. Check matching-byte masks and parity results, including the separate word results in a 64-bit register and parity based on the low bit of each byte.
Use inputs with odd parity in bits above each byte's low bit to reject implementations that compute parity over all bits. Add the test to the existing Book E matrix for e5500 and e6500 in 64-bit mode. Signed-off-by: Bin Meng <[email protected]> --- tests/tcg/ppc/system/byte-parity.S | 33 ++++++++++++++++++++++++++++++ tests/tcg/ppc64/system/meson.build | 1 + 2 files changed, 34 insertions(+) create mode 100644 tests/tcg/ppc/system/byte-parity.S diff --git a/tests/tcg/ppc/system/byte-parity.S b/tests/tcg/ppc/system/byte-parity.S new file mode 100644 index 0000000000..f4d434c881 --- /dev/null +++ b/tests/tcg/ppc/system/byte-parity.S @@ -0,0 +1,33 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * + * Copyright (c) 2026 Process Mission + */ + +#include "macros.inc" + + .text + .globl test_main +test_main: + load_value r9, 0x1122334455667788 + load_value r10, 0x1122994455660088 + cmpb r11, r9, r10 + check_value r11, 0xffff00ffffff00ff + + .macro parity value, word, doubleword + load_value r9, \value + prtyw r11, r9 + check_value r11, \word +#ifdef _LP64 + prtyd r11, r9 + check_value r11, \doubleword +#endif + .endm + + /* Parity uses the least significant bit of each byte */ + parity 0x0101010100010000, 1, 1 + parity 0x0001010100010000, 0x100000001, 0 + parity 0x8080808002020202, 0, 0 + parity 0x0000000000000080, 0, 0 + parity 0x8000000000000000, 0, 0 + b pass diff --git a/tests/tcg/ppc64/system/meson.build b/tests/tcg/ppc64/system/meson.build index ca398860e3..ffa3060f05 100644 --- a/tests/tcg/ppc64/system/meson.build +++ b/tests/tcg/ppc64/system/meson.build @@ -6,6 +6,7 @@ ppc64_system_cflags = ppc_system_cflags + ['-m64'] tests = [] foreach cpu: ['e5500', 'e6500'] sources = ppc_system_sources + sources += ['byte-parity.S'] foreach src: sources tests += { '../ppc/system/' + src: { -- 2.53.0
