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: 115803 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp936058qgn; Fri, 13 Oct 2017 09:43:17 -0700 (PDT) X-Received: by 10.55.75.15 with SMTP id y15mr2608782qka.321.1507912997537; Fri, 13 Oct 2017 09:43:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507912997; cv=none; d=google.com; s=arc-20160816; b=bdfry9opBGHDmFdQo2SA/Umy51+TRDSaNewidZnfzysagjYzjJcTfrmmALDUwP2dxD qscZjM2cR0c0N3ouMjCmQu/V9NOhk7yILDdvUEZpATibMghwjpVolE0PhOCzzH7oXxHv 2/Xs2KKxPcqzn9qcuwMxLheWbsYYOzoVc6gg1ufupDYf9qKajsT/u+liXLGKeR3lYHXu lkw/QLmZN5eoZyPSIsPxZl/B16QtoH8JsbTXd4ABxD+I0c08c3iJpwjv4xlxzs7N5PVC qnx00qR+YRHt2Js4R1W8THEqBsaZ5mmanqaJRTHdqeClKrqCgWC+8NTeryeKkWfTyGjj oEpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=nMItd6ppJG4aBRKRJCZvCu1LGWnUChKl21uE6WyTYsM=; b=MMD2Rlb2Km4DwJDchTzinkAK6K+u25g+HC3XxWGOFRGPApqCUgKPRzvk61Nw4AWEcA uph1mqhOZEFeP/cmZXxXP7xrT56Z5swpS8jzajGuRSPqFt1cXM0lefKgHDb/jMN2QkMn BgevTFcNxyUdgUSEYhI2Lmrxz/877y6maHi2aTOTxPQAYY3ZvztvuZeK3Vripk/2FS33 hwXAQUxoKBrGuVnXn3EzepHbHahD+bkIU4ui+fN+1NLCmLh/te7I4chWeiJYtag1gv5/ +s2LybYEKMd91KR7jpfJAwONqFnuEJph1XHHaoG9WwEUwNQpuex1EQmypZ0I4GeHN9Vg EZFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ftQ3Yj/O; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id w53si1146459qtc.98.2017.10.13.09.43.17 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 13 Oct 2017 09:43:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ftQ3Yj/O; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51126 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e333L-0000yu-7r for patch@linaro.org; Fri, 13 Oct 2017 12:43:15 -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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alex Bennée --- tests/test-softfloat.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) -- 2.14.1 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(); }