From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4CC763858D38; Fri, 12 Jan 2024 23:38:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4CC763858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705102733; bh=yhCEhKXWvaKUt4uBSM2OT6GlRJ03fJ9JzfKfHTnCEag=; h=From:To:Subject:Date:From; b=L/ta9v+2s93bwbrtCyuXd2oXmU/17O+CIRF14/nJz9LjMd6RWxQIHFF7wOio1nfqL vXGa8ip90zDkyzjM4NKh6BWArROPHjC9lURHIGmuX33m5yNdMc8GFVKaod0eOHUgvL A3k+EzwCSsHzXKYZWZghUp1/93YhdFOqr9FFBPgM= From: "newbie-02 at gmx dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/113365] New: LONG DOUBLE: denormals: assigning a constant: factor 100 slow, Date: Fri, 12 Jan 2024 23:38:52 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: newbie-02 at gmx dot de X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: 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=3D113365 Bug ID: 113365 Summary: LONG DOUBLE: denormals: assigning a constant: factor 100 slow, Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: newbie-02 at gmx dot de Target Milestone: --- Created attachment 57062 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D57062&action=3Dedit Snippet demonstrating the problem. Filed that at 'sourceware', and they responded 'likely gcc'.=20 See subject, assigning 3.3E-4932 to a variable takes 100 times longer than 3.4E-4932.=20 Boiled it into the attached file which here produces the following output:= =20 ````=20=20 Assigning a long double denormal constant to a long double variable seems v= ery slow:=20 The '+ ( argc - 1 )' part is an attempt to block compiler cheating by compi= le time assigning.=20 First column is the time used for 1000000 iterations. Factor ~100 looks odd= to me.=20 0.231966; 3.6451995318824746025284E-4951; x2l =3D ( LDBL_MIN_DEN + ( argc -= 1 ) )=20 0.002198; 3.5000000000000000001381E-4932; x2l =3D ( 3.5e-4932l + ( argc - 1= ) )=20 0.002153; 3.4000000000000000000716E-4932; x2l =3D ( 3.4e-4932l + ( argc - 1= ) )=20 0.002115; 3.3621031431120935062627E-4932; x2l =3D ( 3.3621031431120935063E-= 4932l + ( argc - 1 ) )=20 Note the break here, above are 'normal, below 'denormal' values.=20 0.209994; 3.3621031431120935058982E-4932; x2l =3D ( 3.362103143112093506E-4= 932l + ( argc - 1 ) )=20 0.207378; 3.3000000000000000000052E-4932; x2l =3D ( 3.3e-4932l + ( argc - 1= ) )=20 0.205288; 3.1999999999999999999388E-4932; x2l =3D ( 3.2e-4932l + ( argc - 1= ) )=20 Not observed without the '+ ( argc - 1 )' part, assume compiler cheating.=20 0.002090; 3.6451995318824746025284E-4951; x2l =3D ( LDBL_MIN_DEN )=20 0.001863; 3.5000000000000000001381E-4932; x2l =3D ( 3.5e-4932l )=20 0.001814; 3.4000000000000000000716E-4932; x2l =3D ( 3.4e-4932l )=20 0.001865; 3.3621031431120935062627E-4932; x2l =3D ( 3.3621031431120935063E-= 4932l )=20 0.001811; 3.3621031431120935058982E-4932; x2l =3D ( 3.362103143112093506E-4= 932l )=20 0.001868; 3.3000000000000000000052E-4932; x2l =3D ( 3.3e-4932l )=20 0.001926; 3.1999999999999999999388E-4932; x2l =3D ( 3.2e-4932l )=20 Not observed when assigning long double values around double normal / denor= mal break.=20 0.063401; 4.9406564584124654417657E-324; x2l =3D ( DBL_MIN_DEN + ( argc - 1= ) )=20 0.002173; 2.3999999999999999999368E-308; x2l =3D ( 2.4e-308l + ( argc - 1 )= )=20 0.002116; 2.3000000000000000000299E-308; x2l =3D ( 2.3e-308l + ( argc - 1 )= )=20 0.002124; 2.2250738585072013999772E-308; x2l =3D ( 2.2250738585072014E-308l= + ( argc - 1 ) )=20 0.002272; 2.2250738585072009999964E-308; x2l =3D ( 2.225073858507201E-308l = + ( argc - 1 ) )=20 0.002590; 2.2000000000000000000024E-308; x2l =3D ( 2.2e-308l + ( argc - 1 )= )=20 0.002082; 2.0999999999999999999749E-308; x2l =3D ( 2.1e-308l + ( argc - 1 )= )=20 But! affecting evaluation of denormal double constants! Here penalty factor 'only' ~30.=20 0.062303; 4.9406564584124654417657E-324; x2l =3D ( DBL_MIN_DEN + ( argc - 1= ) )=20 0.002470; 2.4000000000000000788233E-308; x2l =3D ( 2.4e-308 + ( argc - 1 ) = )=20 0.002405; 2.2999999999999998902644E-308; x2l =3D ( 2.3e-308 + ( argc - 1 ) = )=20 0.002234; 2.2250738585072013830902E-308; x2l =3D ( 2.2250738585072014E-308 = + ( argc - 1 ) )=20 0.063479; 2.2250738585072008890246E-308; x2l =3D ( 2.225073858507201E-308 += ( argc - 1 ) )=20 0.062954; 2.2000000000000001957711E-308; x2l =3D ( 2.2e-308 + ( argc - 1 ) = )=20 0.062987; 2.1000000000000000072122E-308; x2l =3D ( 2.1e-308 + ( argc - 1 ) = )=20 No such problem when assigning to double variable.=20 0.001588; 4.940656458412465442E-324; x2d =3D ( DBL_MIN_DEN + ( argc - 1 ) )= =20 0.001528; 2.400000000000000079E-308; x2d =3D ( 2.4e-308 + ( argc - 1 ) )=20 0.001557; 2.299999999999999890E-308; x2d =3D ( 2.3e-308 + ( argc - 1 ) )=20 0.001582; 2.225073858507201383E-308; x2d =3D ( 2.2250738585072014E-308 + ( = argc - 1 ) )=20 0.001528; 2.225073858507200889E-308; x2d =3D ( 2.225073858507201E-308 + ( a= rgc - 1 ) )=20 0.001544; 2.200000000000000196E-308; x2d =3D ( 2.2e-308 + ( argc - 1 ) )=20 0.001483; 2.100000000000000007E-308; x2d =3D ( 2.1e-308 + ( argc - 1 ) )=20 Can't tell if hardware, compiler, library whatever.=20 Assume evaluation of constant when read.=20 ````=