aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-04-20 21:54:24 -0700
committerRichard Henderson <richard.henderson@linaro.org>2022-04-20 21:54:24 -0700
commitb1efff6bf031a93b5b8bf3912ddc720cc1653a61 (patch)
treeec136bdbf0359cd45ed1c83082bc7ee84cf969b8 /tests/unit
parent9c125d17e9402c232c46610802e5931b3639d77b (diff)
parent2d94af4b16c40758eee3a8591307ae173090d4ad (diff)
downloadqemu-b1efff6bf031a93b5b8bf3912ddc720cc1653a61.zip
qemu-b1efff6bf031a93b5b8bf3912ddc720cc1653a61.tar.gz
qemu-b1efff6bf031a93b5b8bf3912ddc720cc1653a61.tar.bz2
Merge tag 'pull-ppc-20220420-2' of https://gitlab.com/danielhb/qemu into staging
ppc patch queue for 2022-04-20 First batch of ppc patches for QEMU 7.1: - skiboot firmware version bump - pseries: add 2M DDW pagesize - pseries: make virtual hypervisor code TCG only - powernv: introduce GPIO lines for PSIHB device - powernv: remove PCIE root bridge LSI - target/ppc: alternative softfloat 128 bit integer support - assorted fixes # -----BEGIN PGP SIGNATURE----- # # iHUEABYKAB0WIQQX6/+ZI9AYAK8oOBk82cqW3gMxZAUCYmB/ngAKCRA82cqW3gMx # ZE10AP4wPeJQ3fxXb5ylVtL4qkJaLWy6VrJBQSKSb5YEA0fhegEA9ZufpnENQePU # gZF0eFAQK/DbSnDyvRQVpGcJM0K1UgI= # =nVRw # -----END PGP SIGNATURE----- # gpg: Signature made Wed 20 Apr 2022 02:48:14 PM PDT # gpg: using EDDSA key 17EBFF9923D01800AF2838193CD9CA96DE033164 # gpg: Can't check signature: No public key * tag 'pull-ppc-20220420-2' of https://gitlab.com/danielhb/qemu: (23 commits) hw/ppc: change indentation to spaces from TABs target/ppc: Add two missing register callbacks on POWER10 ppc/pnv: Remove LSI on the PCIE host bridge pcie: Don't try triggering a LSI when not defined ppc/vof: Fix uninitialized string tracing hw/ppc/ppc405_boards: Initialize g_autofree pointer target/ppc: implement xscvqp[su]qz target/ppc: implement xscv[su]qqp softfloat: add float128_to_int128 softfloat: add float128_to_uint128 softfloat: add int128_to_float128 softfloat: add uint128_to_float128 qemu/int128: add int128_urshift target/ppc: Improve KVM hypercall trace spapr: Move nested KVM hypercalls under a TCG only config. spapr: Move hypercall_register_softmmu ppc/pnv: Remove useless checks in set_irq handlers ppc/pnv: Remove PnvPsiClas::irq_set ppc/pnv: Remove PnvOCC::psi link ppc/pnv: Remove PnvLpcController::psi link ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test-int128.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/unit/test-int128.c b/tests/unit/test-int128.c
index b86a3c7..25db245 100644
--- a/tests/unit/test-int128.c
+++ b/tests/unit/test-int128.c
@@ -206,6 +206,55 @@ static void test_rshift(void)
test_rshift_one(0xFFFE8000U, 0, 0xFFFFFFFFFFFFFFFEULL, 0x8000000000000000ULL);
}
+static void __attribute__((__noinline__)) ATTRIBUTE_NOCLONE
+test_urshift_one(uint32_t x, int n, uint64_t h, uint64_t l)
+{
+ Int128 a = expand(x);
+ Int128 r = int128_urshift(a, n);
+ g_assert_cmpuint(int128_getlo(r), ==, l);
+ g_assert_cmpuint(int128_gethi(r), ==, h);
+}
+
+static void test_urshift(void)
+{
+ test_urshift_one(0x00010000U, 64, 0x0000000000000000ULL,
+ 0x0000000000000001ULL);
+ test_urshift_one(0x80010000U, 64, 0x0000000000000000ULL,
+ 0x8000000000000001ULL);
+ test_urshift_one(0x7FFE0000U, 64, 0x0000000000000000ULL,
+ 0x7FFFFFFFFFFFFFFEULL);
+ test_urshift_one(0xFFFE0000U, 64, 0x0000000000000000ULL,
+ 0xFFFFFFFFFFFFFFFEULL);
+ test_urshift_one(0x00010000U, 60, 0x0000000000000000ULL,
+ 0x0000000000000010ULL);
+ test_urshift_one(0x80010000U, 60, 0x0000000000000008ULL,
+ 0x0000000000000010ULL);
+ test_urshift_one(0x00018000U, 60, 0x0000000000000000ULL,
+ 0x0000000000000018ULL);
+ test_urshift_one(0x80018000U, 60, 0x0000000000000008ULL,
+ 0x0000000000000018ULL);
+ test_urshift_one(0x7FFE0000U, 60, 0x0000000000000007ULL,
+ 0xFFFFFFFFFFFFFFE0ULL);
+ test_urshift_one(0xFFFE0000U, 60, 0x000000000000000FULL,
+ 0xFFFFFFFFFFFFFFE0ULL);
+ test_urshift_one(0x7FFE8000U, 60, 0x0000000000000007ULL,
+ 0xFFFFFFFFFFFFFFE8ULL);
+ test_urshift_one(0xFFFE8000U, 60, 0x000000000000000FULL,
+ 0xFFFFFFFFFFFFFFE8ULL);
+ test_urshift_one(0x00018000U, 0, 0x0000000000000001ULL,
+ 0x8000000000000000ULL);
+ test_urshift_one(0x80018000U, 0, 0x8000000000000001ULL,
+ 0x8000000000000000ULL);
+ test_urshift_one(0x7FFE0000U, 0, 0x7FFFFFFFFFFFFFFEULL,
+ 0x0000000000000000ULL);
+ test_urshift_one(0xFFFE0000U, 0, 0xFFFFFFFFFFFFFFFEULL,
+ 0x0000000000000000ULL);
+ test_urshift_one(0x7FFE8000U, 0, 0x7FFFFFFFFFFFFFFEULL,
+ 0x8000000000000000ULL);
+ test_urshift_one(0xFFFE8000U, 0, 0xFFFFFFFFFFFFFFFEULL,
+ 0x8000000000000000ULL);
+}
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@@ -219,5 +268,6 @@ int main(int argc, char **argv)
g_test_add_func("/int128/int128_ge", test_ge);
g_test_add_func("/int128/int128_gt", test_gt);
g_test_add_func("/int128/int128_rshift", test_rshift);
+ g_test_add_func("/int128/int128_urshift", test_urshift);
return g_test_run();
}