From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 012083858D3C; Wed, 8 Nov 2023 07:17:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 012083858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1699427839; bh=/JubVyI54dqs9A7lrpNp10TA6hOdmoOgjWJL0TgyJDU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XnZwXq0FvNJT7d8ESWBhAsDYjKl0KbtNSJLO+bk949y/8JgILuN+KxnB0sR6zYDwf Bamic6ysFSniVzB6Rsg+/OoeMuY/aVKKPKmfdM5HPWw4Qbv861YWvU4VZXtRB3jRh1 /HO/CzdMiWiu4p4Fo6a+cVba2oqX0IZFFqUrqdC0= From: "pan2.li at intel dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/112432] Internal-fn: The [i|l|ll]rint family don't support FLOATN Date: Wed, 08 Nov 2023 07:17:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pan2.li at intel dot com X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112432 --- Comment #2 from Li Pan --- (In reply to Richard Biener from comment #1) > Is there a corresponding C API? We don't have "generic" versions in > builtins.def either (with _VAR). >=20 > That said, what's the testcase here? I found some FLOATN like api from glibc doc, when given N is 16. long int lrintfN (_FloatN x); long int lroundfN (_FloatN x); https://www.gnu.org/software/libc/manual/2.38/html_mono/libc.html The context comes from the autovec for the lrintf and lrintf16. For example= as below void test_lrintf16 (long *out, _Float16 *in, unsigned count) { for (unsigned i =3D 0; i < count; i++) out[i] =3D __builtin_lrintf16 (in[i]); } void test_lrintf (long *out, float *in, unsigned count) { for (unsigned i =3D 0; i < count; i++) out[i] =3D __builtin_lrintf (in[i]); } We may have similar rtl code when compile with "-march=3Drv64gcv_zvfh_zfh -mabi=3Dlp64d -O3 -ftree-vectorize -ffast-math". void test_lrintf16 (long *out, _Float16 *in, unsigned count) { # ivtmp.8_28 =3D PHI =20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 # ivtmp.9_25 =3D PHI _22 =3D (void *) ivtmp.8_28; _4 =3D MEM[(_Float16 *)_22]; _7 =3D __builtin_lrintf16 (_4); _21 =3D (void *) ivtmp.9_25; MEM[(long int *)_21] =3D _7; ivtmp.8_27 =3D ivtmp.8_28 + 2; ivtmp.9_24 =3D ivtmp.9_25 + 8; } void test_lrintf (long *out, float *in, unsigned count) { # ivtmp.37_32 =3D PHI # ivtmp.40_26 =3D PHI _23 =3D (void *) ivtmp.37_32; vect__4.21_40 =3D MEM [(float *)_23]; vect__7.22_41 =3D .LRINT (vect__4.21_40); // Expand lrint= _22 =3D (void *) ivtmp.40_26; MEM [(long int *)_22] =3D vect__7.22_41; ivtmp.37_48 =3D ivtmp.37_32 + 64; ivtmp.40_25 =3D ivtmp.40_26 + 128; }=