From patchwork Fri Oct 13 16:24:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 825597 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ftQ3Yj/O"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yDD5g0fxbz9sRm for ; Sat, 14 Oct 2017 03:42:15 +1100 (AEDT) Received: from localhost ([::1]:51122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e332L-00008p-3z for incoming@patchwork.ozlabs.org; Fri, 13 Oct 2017 12:42:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e32sW-0000XU-LD for qemu-devel@nongnu.org; Fri, 13 Oct 2017 12:32:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e32sV-0002Eo-S6 for qemu-devel@nongnu.org; Fri, 13 Oct 2017 12:32:04 -0400 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:56887) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e32sV-0002Ds-Ml for qemu-devel@nongnu.org; Fri, 13 Oct 2017 12:32:03 -0400 Received: by mail-wm0-x236.google.com with SMTP id l68so22848263wmd.5 for ; Fri, 13 Oct 2017 09:32:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nMItd6ppJG4aBRKRJCZvCu1LGWnUChKl21uE6WyTYsM=; b=ftQ3Yj/ObfoUA6zuznR+2Kk1IbRay9rODjvbuqtGMs7KUcNY1sAlXF9+8y2EcxjJp1 JgpNzVIIenPpV6LTWl+KpR5uBs/iaGVHWiq5I0SFADCdFeSqyR8w9Ed31z2kaeeTWv+1 PaRDaUIeg5hNPaPIZKptR53YnJF1C54sMmZJI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nMItd6ppJG4aBRKRJCZvCu1LGWnUChKl21uE6WyTYsM=; b=boz7J6MZmwCFqD/jnFxmjhZw/AGkOF/DkOd4mQb2roYd73bePbYt0/cRyuHSXP40ZX QLj5RWgSfga/9y2ya4DO+le5aBqV7NFowlnduF2iTpkUddi7LlFvg3Ibnqy0fn9P4Y/M CQrkzN24zrxMzt4x0Vk4tDlT1iggRzx65t4+3DF15n4jz6I6L7ZrTHmVud24EdElOCzU NvdvifQmLSYZFYT7Ph4fiWW+G7DgJBNSC1PHUR0eXKr1mJNizsP/7q3xpXV+rJdhx1PX H3rLztIHzZYuJjp7tmvluDFNKmgDvnyXcYuv+7yO9RNLXnYt6B4r/msdS8kr8pDMvk3e wjFg== X-Gm-Message-State: AMCzsaXYJJeBNKnEsRJJTxUwcZ/AMs+hMkLGtn5/BN58224/n6z475Gu MJP8Ou13pcjquMVQchBCr5SnXg== X-Google-Smtp-Source: ABhQp+QibdNXCgwMG8/4sF8p63jO+m4PJ4an87WqhN2fPRiRAvywIcRg/IamvFU3ZzhRs8Ee7/UXWw== X-Received: by 10.28.146.20 with SMTP id u20mr2136494wmd.49.1507912321829; Fri, 13 Oct 2017 09:32:01 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g26sm1978426wra.14.2017.10.13.09.31.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Oct 2017 09:31:58 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 8B69A3E138C; Fri, 13 Oct 2017 17:24:40 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: richard.henderson@linaro.org Date: Fri, 13 Oct 2017 17:24:37 +0100 Message-Id: <20171013162438.32458-30-alex.bennee@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171013162438.32458-1-alex.bennee@linaro.org> References: <20171013162438.32458-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::236 Subject: [Qemu-devel] [RFC PATCH 29/30] tests/test-softfloat: add f16_to_int16 conversion test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alex Bennée --- tests/test-softfloat.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/test-softfloat.c b/tests/test-softfloat.c index d7b740e1cb..e1f356572d 100644 --- a/tests/test-softfloat.c +++ b/tests/test-softfloat.c @@ -16,6 +16,31 @@ typedef struct { uint8_t final_exception_flags; } f16_test_data; +static void test_f16_convert_to_int(void) +{ + int i; + float16 out; + float_status flags, *fp = &flags; + f16_test_data test_data[] = { + /* from risu fcvtps v23.4h, v16.4h */ + { { .float_rounding_mode = float_round_up}, 0xa619, 0xb860, 0 }, + { { .float_rounding_mode = float_round_up}, 0x83c0, 0xff91, 0 }, + { { .float_rounding_mode = float_round_up}, 0x6966, 0x0001, 0 }, + { { .float_rounding_mode = float_round_up}, 0x06b1, 0x0001, 0 }, + }; + + for (i = 0; i < ARRAY_SIZE(test_data); ++i) { + flags = test_data[i].initial_status; + out = float16_to_int16(test_data[i].in, fp); + + if (!(test_data[i].out == out)) { + fprintf(stderr, "%s[%d]: expected %#04x got %#04x\n", + __func__, i, test_data[i].out, out); + g_test_fail(); + } + } +} + static void test_f16_round_to_int(void) { int i; @@ -54,5 +79,6 @@ int main(int argc, char *argv[]) { g_test_init(&argc, &argv, NULL); g_test_add_func("/softfloat/f16/round_to_int", test_f16_round_to_int); + g_test_add_func("/softfloat/f16/convert_to_int", test_f16_convert_to_int); return g_test_run(); }