From patchwork Mon Nov 6 08:33:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2" X-Patchwork-Id: 161879 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2514963vqu; Mon, 6 Nov 2023 00:33:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IHPjxW5BGMhjg+Gq+bYBaPBcUuyqIJxaWR81+VZ33QyhbB9hj/632xc4OIRpnsytEh373Ke X-Received: by 2002:a05:6214:c81:b0:66d:a1d3:fd94 with SMTP id r1-20020a0562140c8100b0066da1d3fd94mr35028834qvr.19.1699259626641; Mon, 06 Nov 2023 00:33:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699259626; cv=pass; d=google.com; s=arc-20160816; b=jyvwFfnu/aN4YzpuOQaRvKEOklwAhwMdwyVlkJ0wTtjGmLTK/GgioI+J/ITdFYza5x cto513tSVx4fcDYr0G5g0GnjxQ4KCTgtatX2Cd3IqVT0EKKLbcUwLOKgNpupuLPy7VNb PjgCzpe3uslNqAXayYx1HfDUzJqlv+DXg2jlUePYM4OG+gzHKpSZhchWqUPZris3THC6 1lwNhP5EdzsLCyh23dZ8N+z6JnRRL+YaZeYme/wHKcKxSud7IMET3FG36zZIKSbAU5vH POa6Q+Y6RnrSHzULuZyk7o2Ydfxc1qLO8LCn45Hw2Tlvy6Mo5poT3oN04HzwRhWGvnYW xchQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=e6/X02NUw3e5hwrx+83EANPJM56upLaeD/MeUUBwAgQ=; fh=yqBQmCEeFYB2Wjmf8l8QkV/dOy5iKwSEx/iU/FYQjxU=; b=mlweq+T75w4yOnEzVoBIUjtNmWdlTiJcIhxMmROgeORRvH2kJE6aTLN1U9Yqk0jPKx 34eL+dPX+M5TuvpQsgUd62NDFfrBgGcfSQx+O4FAQhuSx/T56nyqMdOFiTR3r8mvOi0S OWmCfXa19O7vAd0GAdIYMSoXx0HQ0VLVkBcB2gedsBgrASG/8MylTH14ZfSUL9LUttW4 9u7dpgb8IXlLmgsfxs2bZzNvUVDrwdelS6HDChDPvCuCBlGoKZmdLID6wr7Zi3xDLCee G13CK2ghDdv1NrlyzasH4sXw/31obhlJwKBau34/ZvHmQtw6TVFtar7AVVgV7WMv9DJD PH7g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YIFS9NbN; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id o9-20020a056214180900b0066d11e05b4asi5202883qvw.282.2023.11.06.00.33.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 00:33:46 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YIFS9NbN; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6537D385770A for ; Mon, 6 Nov 2023 08:33:46 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by sourceware.org (Postfix) with ESMTPS id 6F5EE3858CDA for ; Mon, 6 Nov 2023 08:33:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6F5EE3858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6F5EE3858CDA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=134.134.136.100 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699259597; cv=none; b=V8zuZ+wT4s/BwLAFQWG9UocnRCxCmZjDgqW2kAQMoyfiiSYWTlzJFBFzyzTmC/LZgqR1J5UhMnKqxbV6FK50+9nV65gQVmIsZprBBFuQIxUi7AMuSddaALlkqpTlsgUNwzv3B/zXa3t9Tlwc3638XZjxs/Mk24Aum+vYLFfq91A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699259597; c=relaxed/simple; bh=dWwAaPM93qJuZ2YCH+2H6/x1p5ge5VIjIZdTYFMe9U0=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=R29TOx7Q3n2hB3wHd6o1tMgCeYBHAVFJEgpI5uEyvcreN0VYpDmVIB9AgUpcsslmSTfFOr0qUUWc0q34vP4b52md2nTjs2maAsJYILliFmCRYYaIedDlPQ/RGK+iOwuffB8CaKgz4GU+M89ws4EUnUCuYIrrJqttnMLOtlrcL9I= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699259587; x=1730795587; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=dWwAaPM93qJuZ2YCH+2H6/x1p5ge5VIjIZdTYFMe9U0=; b=YIFS9NbNtewhqyH+Re7qXEORLlumYcJWcnovgv7gROIsB1IEayWO52V2 84AJQyThHhFHMmKKtM0UhYoTaMfW4Ng7HP3yC2SMeqAZGzTTTckxxqgDJ s/Xf2zmMXQFWtj4NBavbadvDIaDDiFq0grwcw2Cg8waCK6FRbZRIgrXNK Y4aTFeE6gTYFzJEYWq5JpO0N9j4I/alF3xihEOcYFXJbj2eeX4Gw7RPbe Lf3+E5ESGW007UEJ25RYff/KdCI2T1WPpqCmco+Z0Cfc0X1ERN0UZCdCP iG+2wByNOsd1Jg6V4Ydry1MZwhmhdjp+KzaG/fUVgoC8etgiGWghsRBaK Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10885"; a="455714274" X-IronPort-AV: E=Sophos;i="6.03,280,1694761200"; d="scan'208";a="455714274" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2023 00:33:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,280,1694761200"; d="scan'208";a="3559317" Received: from shvmail02.sh.intel.com ([10.239.244.9]) by fmviesa002.fm.intel.com with ESMTP; 06 Nov 2023 00:33:04 -0800 Received: from pli-ubuntu.sh.intel.com (pli-ubuntu.sh.intel.com [10.239.159.47]) by shvmail02.sh.intel.com (Postfix) with ESMTP id A260110057F7; Mon, 6 Nov 2023 16:33:03 +0800 (CST) From: pan2.li@intel.com To: gcc-patches@gcc.gnu.org Cc: juzhe.zhong@rivai.ai, pan2.li@intel.com, yanzhang.wang@intel.com, kito.cheng@gmail.com Subject: [PATCH v1] RISC-V: Adjust FP rint round tests for RV32 Date: Mon, 6 Nov 2023 16:33:02 +0800 Message-Id: <20231106083302.2361300-1-pan2.li@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781802862497454561 X-GMAIL-MSGID: 1781802862497454561 From: Pan Li The FP rint test cases for RV32 need some additional adjust for types and data. This patch would like to fix this which is missed in FP rint support PATCH for RV32 only by mistake. Please note the math-llrintf-run-0.c will trigger one ICE in the vsetvl pass in RV32 only. ./riscv32-unknown-elf-gcc -march=rv32gcv -mabi=ilp32d \ -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math \ gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c \ -o test.elf -lm Then there will have ICE similar as below, and will file bugzilla for it. config/riscv/riscv-v.cc:4314 65 | } | ^ 0x1fa5223 riscv_vector::validate_change_or_fail(rtx_def*, rtx_def**, rtx_def*, bool) /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-v.cc:4314 0x1fb1aa2 pre_vsetvl::remove_avl_operand() /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3342 0x1fb18c1 pre_vsetvl::cleaup() /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3308 0x1fb216d pass_vsetvl::lazy_vsetvl() /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3480 0x1fb2214 pass_vsetvl::execute(function*) /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3504 gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/unop/math-irint-run-0.c: Adjust test cases. * gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c: Ditto. * gcc.target/riscv/rvv/autovec/unop/math-lrint-rv32-run-0.c: Ditto. Signed-off-by: Pan Li Signed-off-by: Pan Li --- .../riscv/rvv/autovec/unop/math-irint-run-0.c | 94 +++++++++--------- .../rvv/autovec/unop/math-llrintf-run-0.c | 98 ++++++++++--------- .../rvv/autovec/unop/math-lrint-rv32-run-0.c | 88 ++++++++--------- 3 files changed, 141 insertions(+), 139 deletions(-) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-irint-run-0.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-irint-run-0.c index 43bc0849695..aae1d95c2b6 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-irint-run-0.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-irint-run-0.c @@ -5,59 +5,59 @@ #define ARRAY_SIZE 128 -float in[ARRAY_SIZE]; -long out[ARRAY_SIZE]; -long ref[ARRAY_SIZE]; +double in[ARRAY_SIZE]; +int out[ARRAY_SIZE]; +int ref[ARRAY_SIZE]; -TEST_UNARY_CALL_CVT (float, long, __builtin_lrintf) -TEST_ASSERT (long) +TEST_UNARY_CALL_CVT (double, int, __builtin_irint) +TEST_ASSERT (int) -TEST_INIT_CVT (float, 1.2, long, __builtin_lrintf (1.2), 1) -TEST_INIT_CVT (float, -1.2, long, __builtin_lrintf (-1.2), 2) -TEST_INIT_CVT (float, 0.5, long, __builtin_lrintf (0.5), 3) -TEST_INIT_CVT (float, -0.5, long, __builtin_lrintf (-0.5), 4) -TEST_INIT_CVT (float, 0.1, long, __builtin_lrintf (0.1), 5) -TEST_INIT_CVT (float, -0.1, long, __builtin_lrintf (-0.1), 6) -TEST_INIT_CVT (float, 3.0, long, __builtin_lrintf (3.0), 7) -TEST_INIT_CVT (float, -3.0, long, __builtin_lrintf (-3.0), 8) -TEST_INIT_CVT (float, 4503599627370495.5, long, __builtin_lrintf (4503599627370495.5), 9) -TEST_INIT_CVT (float, 4503599627370497.0, long, __builtin_lrintf (4503599627370497.0), 10) -TEST_INIT_CVT (float, -4503599627370495.5, long, __builtin_lrintf (-4503599627370495.5), 11) -TEST_INIT_CVT (float, -4503599627370496.0, long, __builtin_lrintf (-4503599627370496.0), 12) -TEST_INIT_CVT (float, 0.0, long, __builtin_lrintf (-0.0), 13) -TEST_INIT_CVT (float, -0.0, long, __builtin_lrintf (-0.0), 14) -TEST_INIT_CVT (float, 9223372036854774784.0, long, __builtin_lrintf (9223372036854774784.0), 15) -TEST_INIT_CVT (float, 9223372036854775808.0, long, __builtin_lrintf (9223372036854775808.0), 16) -TEST_INIT_CVT (float, -9223372036854775808.0, long, __builtin_lrintf (-9223372036854775808.0), 17) -TEST_INIT_CVT (float, -9223372036854777856.0, long, __builtin_lrintf (-9223372036854777856.0), 18) -TEST_INIT_CVT (float, __builtin_inf (), long, __builtin_lrintf (__builtin_inf ()), 19) -TEST_INIT_CVT (float, -__builtin_inf (), long, __builtin_lrintf (-__builtin_inf ()), 20) -TEST_INIT_CVT (float, __builtin_nan (""), long, 0x7fffffffffffffff, 21) +TEST_INIT_CVT (double, 1.2, int, __builtin_irint (1.2), 1) +TEST_INIT_CVT (double, -1.2, int, __builtin_irint (-1.2), 2) +TEST_INIT_CVT (double, 0.5, int, __builtin_irint (0.5), 3) +TEST_INIT_CVT (double, -0.5, int, __builtin_irint (-0.5), 4) +TEST_INIT_CVT (double, 0.1, int, __builtin_irint (0.1), 5) +TEST_INIT_CVT (double, -0.1, int, __builtin_irint (-0.1), 6) +TEST_INIT_CVT (double, 3.0, int, __builtin_irint (3.0), 7) +TEST_INIT_CVT (double, -3.0, int, __builtin_irint (-3.0), 8) +TEST_INIT_CVT (double, 4503599627370495.5, int, __builtin_irint (4503599627370495.5), 9) +TEST_INIT_CVT (double, 4503599627370497.0, int, __builtin_irint (4503599627370497.0), 10) +TEST_INIT_CVT (double, -4503599627370495.5, int, __builtin_irint (-4503599627370495.5), 11) +TEST_INIT_CVT (double, -4503599627370496.0, int, __builtin_irint (-4503599627370496.0), 12) +TEST_INIT_CVT (double, 0.0, int, __builtin_irint (-0.0), 13) +TEST_INIT_CVT (double, -0.0, int, __builtin_irint (-0.0), 14) +TEST_INIT_CVT (double, 9223372036854774784.0, int, __builtin_irint (9223372036854774784.0), 15) +TEST_INIT_CVT (double, 9223372036854775808.0, int, __builtin_irint (9223372036854775808.0), 16) +TEST_INIT_CVT (double, -9223372036854775808.0, int, __builtin_irint (-9223372036854775808.0), 17) +TEST_INIT_CVT (double, -9223372036854777856.0, int, __builtin_irint (-9223372036854777856.0), 18) +TEST_INIT_CVT (double, __builtin_inf (), int, __builtin_irint (__builtin_inf ()), 19) +TEST_INIT_CVT (double, -__builtin_inf (), int, __builtin_irint (-__builtin_inf ()), 20) +TEST_INIT_CVT (double, __builtin_nan (""), int, 0x7fffffff, 21) int main () { - RUN_TEST_CVT (float, long, 1, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 2, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 3, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 4, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 5, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 6, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 7, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 8, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 9, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 10, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 11, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 12, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 13, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 14, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 15, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 16, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 17, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 18, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 19, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 20, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 21, __builtin_lrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 1, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 2, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 3, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 4, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 5, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 6, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 7, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 8, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 9, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 10, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 11, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 12, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 13, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 14, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 15, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 16, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 17, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 18, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 19, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 20, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 21, __builtin_irint, in, out, ref, ARRAY_SIZE); return 0; } diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c index 43bc0849695..e9394df0e44 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c @@ -1,63 +1,65 @@ /* { dg-do run { target { riscv_v } } } */ /* { dg-additional-options "-std=c99 -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math" } */ +#include #include "test-math.h" #define ARRAY_SIZE 128 float in[ARRAY_SIZE]; -long out[ARRAY_SIZE]; -long ref[ARRAY_SIZE]; - -TEST_UNARY_CALL_CVT (float, long, __builtin_lrintf) -TEST_ASSERT (long) - -TEST_INIT_CVT (float, 1.2, long, __builtin_lrintf (1.2), 1) -TEST_INIT_CVT (float, -1.2, long, __builtin_lrintf (-1.2), 2) -TEST_INIT_CVT (float, 0.5, long, __builtin_lrintf (0.5), 3) -TEST_INIT_CVT (float, -0.5, long, __builtin_lrintf (-0.5), 4) -TEST_INIT_CVT (float, 0.1, long, __builtin_lrintf (0.1), 5) -TEST_INIT_CVT (float, -0.1, long, __builtin_lrintf (-0.1), 6) -TEST_INIT_CVT (float, 3.0, long, __builtin_lrintf (3.0), 7) -TEST_INIT_CVT (float, -3.0, long, __builtin_lrintf (-3.0), 8) -TEST_INIT_CVT (float, 4503599627370495.5, long, __builtin_lrintf (4503599627370495.5), 9) -TEST_INIT_CVT (float, 4503599627370497.0, long, __builtin_lrintf (4503599627370497.0), 10) -TEST_INIT_CVT (float, -4503599627370495.5, long, __builtin_lrintf (-4503599627370495.5), 11) -TEST_INIT_CVT (float, -4503599627370496.0, long, __builtin_lrintf (-4503599627370496.0), 12) -TEST_INIT_CVT (float, 0.0, long, __builtin_lrintf (-0.0), 13) -TEST_INIT_CVT (float, -0.0, long, __builtin_lrintf (-0.0), 14) -TEST_INIT_CVT (float, 9223372036854774784.0, long, __builtin_lrintf (9223372036854774784.0), 15) -TEST_INIT_CVT (float, 9223372036854775808.0, long, __builtin_lrintf (9223372036854775808.0), 16) -TEST_INIT_CVT (float, -9223372036854775808.0, long, __builtin_lrintf (-9223372036854775808.0), 17) -TEST_INIT_CVT (float, -9223372036854777856.0, long, __builtin_lrintf (-9223372036854777856.0), 18) -TEST_INIT_CVT (float, __builtin_inf (), long, __builtin_lrintf (__builtin_inf ()), 19) -TEST_INIT_CVT (float, -__builtin_inf (), long, __builtin_lrintf (-__builtin_inf ()), 20) -TEST_INIT_CVT (float, __builtin_nan (""), long, 0x7fffffffffffffff, 21) +int64_t out[ARRAY_SIZE]; +int64_t ref[ARRAY_SIZE]; + +TEST_UNARY_CALL_CVT (float, int64_t, __builtin_llrintf) +TEST_ASSERT (int64_t) + + +TEST_INIT_CVT (float, 1.2, int64_t, __builtin_llrintf (1.2), 1) +TEST_INIT_CVT (float, -1.2, int64_t, __builtin_llrintf (-1.2), 2) +TEST_INIT_CVT (float, 0.5, int64_t, __builtin_llrintf (0.5), 3) +TEST_INIT_CVT (float, -0.5, int64_t, __builtin_llrintf (-0.5), 4) +TEST_INIT_CVT (float, 0.1, int64_t, __builtin_llrintf (0.1), 5) +TEST_INIT_CVT (float, -0.1, int64_t, __builtin_llrintf (-0.1), 6) +TEST_INIT_CVT (float, 3.0, int64_t, __builtin_llrintf (3.0), 7) +TEST_INIT_CVT (float, -3.0, int64_t, __builtin_llrintf (-3.0), 8) +TEST_INIT_CVT (float, 2147483520.0, int64_t, __builtin_llrintf (2147483520.0), 9) +TEST_INIT_CVT (float, 2147483648.0, int64_t, __builtin_llrintf (2147483648.0), 10) +TEST_INIT_CVT (float, -2147483648.0, int64_t, __builtin_llrintf (-2147483648.0), 11) +TEST_INIT_CVT (float, -2147483904.0, int64_t, __builtin_llrintf (-2147483904.0), 12) +TEST_INIT_CVT (float, 0.0, int64_t, __builtin_llrintf (-0.0), 13) +TEST_INIT_CVT (float, -0.0, int64_t, __builtin_llrintf (-0.0), 14) +TEST_INIT_CVT (float, 9223372036854775807.0, int64_t, __builtin_llrintf (9223372036854775807.0), 15) +TEST_INIT_CVT (float, 9223373136366403584.0, int64_t, __builtin_llrintf (9223373136366403584.0), 16) +TEST_INIT_CVT (float, -9223372036854775807.0, int64_t, __builtin_llrintf (-9223372036854775807.0), 17) +TEST_INIT_CVT (float, -9223373136366403584.0, int64_t, __builtin_llrintf (-9223373136366403584.0), 18) +TEST_INIT_CVT (float, __builtin_inf (), int64_t, __builtin_llrintf (__builtin_inff ()), 19) +TEST_INIT_CVT (float, -__builtin_inf (), int64_t, __builtin_llrintf (-__builtin_inff ()), 20) +TEST_INIT_CVT (float, __builtin_nanf (""), int64_t, 0x7fffffffffffffff, 21) int main () { - RUN_TEST_CVT (float, long, 1, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 2, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 3, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 4, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 5, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 6, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 7, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 8, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 9, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 10, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 11, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 12, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 13, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 14, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 15, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 16, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 17, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 18, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 19, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 20, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 21, __builtin_lrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 1, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 2, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 3, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 4, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 5, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 6, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 7, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 8, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 9, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 10, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 11, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 12, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 13, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 14, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 15, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 16, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 17, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 18, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 19, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 20, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 21, __builtin_llrintf, in, out, ref, ARRAY_SIZE); return 0; } diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lrint-rv32-run-0.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lrint-rv32-run-0.c index c1c8cc32588..e195f479f7b 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lrint-rv32-run-0.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lrint-rv32-run-0.c @@ -5,59 +5,59 @@ #define ARRAY_SIZE 128 -float in[ARRAY_SIZE]; +double in[ARRAY_SIZE]; long out[ARRAY_SIZE]; long ref[ARRAY_SIZE]; -TEST_UNARY_CALL_CVT (float, long, __builtin_lrintf) +TEST_UNARY_CALL_CVT (double, long, __builtin_lrint) TEST_ASSERT (long) -TEST_INIT_CVT (float, 1.2, long, __builtin_lrintf (1.2), 1) -TEST_INIT_CVT (float, -1.2, long, __builtin_lrintf (-1.2), 2) -TEST_INIT_CVT (float, 0.5, long, __builtin_lrintf (0.5), 3) -TEST_INIT_CVT (float, -0.5, long, __builtin_lrintf (-0.5), 4) -TEST_INIT_CVT (float, 0.1, long, __builtin_lrintf (0.1), 5) -TEST_INIT_CVT (float, -0.1, long, __builtin_lrintf (-0.1), 6) -TEST_INIT_CVT (float, 3.0, long, __builtin_lrintf (3.0), 7) -TEST_INIT_CVT (float, -3.0, long, __builtin_lrintf (-3.0), 8) -TEST_INIT_CVT (float, 4503599627370495.5, long, __builtin_lrintf (4503599627370495.5), 9) -TEST_INIT_CVT (float, 4503599627370497.0, long, __builtin_lrintf (4503599627370497.0), 10) -TEST_INIT_CVT (float, -4503599627370495.5, long, __builtin_lrintf (-4503599627370495.5), 11) -TEST_INIT_CVT (float, -4503599627370496.0, long, __builtin_lrintf (-4503599627370496.0), 12) -TEST_INIT_CVT (float, 0.0, long, __builtin_lrintf (-0.0), 13) -TEST_INIT_CVT (float, -0.0, long, __builtin_lrintf (-0.0), 14) -TEST_INIT_CVT (float, 9223372036854774784.0, long, __builtin_lrintf (9223372036854774784.0), 15) -TEST_INIT_CVT (float, 9223372036854775808.0, long, __builtin_lrintf (9223372036854775808.0), 16) -TEST_INIT_CVT (float, -9223372036854775808.0, long, __builtin_lrintf (-9223372036854775808.0), 17) -TEST_INIT_CVT (float, -9223372036854777856.0, long, __builtin_lrintf (-9223372036854777856.0), 18) -TEST_INIT_CVT (float, __builtin_inf (), long, __builtin_lrintf (__builtin_inf ()), 19) -TEST_INIT_CVT (float, -__builtin_inf (), long, __builtin_lrintf (-__builtin_inf ()), 20) -TEST_INIT_CVT (float, __builtin_nan (""), long, 0x7fffffffffffffff, 21) +TEST_INIT_CVT (double, 1.2, long, __builtin_lrint (1.2), 1) +TEST_INIT_CVT (double, -1.2, long, __builtin_lrint (-1.2), 2) +TEST_INIT_CVT (double, 0.5, long, __builtin_lrint (0.5), 3) +TEST_INIT_CVT (double, -0.5, long, __builtin_lrint (-0.5), 4) +TEST_INIT_CVT (double, 0.1, long, __builtin_lrint (0.1), 5) +TEST_INIT_CVT (double, -0.1, long, __builtin_lrint (-0.1), 6) +TEST_INIT_CVT (double, 3.0, long, __builtin_lrint (3.0), 7) +TEST_INIT_CVT (double, -3.0, long, __builtin_lrint (-3.0), 8) +TEST_INIT_CVT (double, 4503599627370495.5, long, __builtin_lrint (4503599627370495.5), 9) +TEST_INIT_CVT (double, 4503599627370497.0, long, __builtin_lrint (4503599627370497.0), 10) +TEST_INIT_CVT (double, -4503599627370495.5, long, __builtin_lrint (-4503599627370495.5), 11) +TEST_INIT_CVT (double, -4503599627370496.0, long, __builtin_lrint (-4503599627370496.0), 12) +TEST_INIT_CVT (double, 0.0, long, __builtin_lrint (-0.0), 13) +TEST_INIT_CVT (double, -0.0, long, __builtin_lrint (-0.0), 14) +TEST_INIT_CVT (double, 9223372036854774784.0, long, __builtin_lrint (9223372036854774784.0), 15) +TEST_INIT_CVT (double, 9223372036854775808.0, long, __builtin_lrint (9223372036854775808.0), 16) +TEST_INIT_CVT (double, -9223372036854775808.0, long, __builtin_lrint (-9223372036854775808.0), 17) +TEST_INIT_CVT (double, -9223372036854777856.0, long, __builtin_lrint (-9223372036854777856.0), 18) +TEST_INIT_CVT (double, __builtin_inf (), long, __builtin_lrint (__builtin_inf ()), 19) +TEST_INIT_CVT (double, -__builtin_inf (), long, __builtin_lrint (-__builtin_inf ()), 20) +TEST_INIT_CVT (double, __builtin_nan (""), long, 0x7fffffff, 21) int main () { - RUN_TEST_CVT (float, long, 1, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 2, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 3, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 4, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 5, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 6, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 7, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 8, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 9, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 10, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 11, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 12, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 13, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 14, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 15, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 16, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 17, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 18, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 19, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 20, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 21, __builtin_lrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 1, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 2, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 3, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 4, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 5, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 6, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 7, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 8, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 9, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 10, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 11, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 12, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 13, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 14, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 15, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 16, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 17, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 18, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 19, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 20, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 21, __builtin_lrint, in, out, ref, ARRAY_SIZE); return 0; }