{"id":825838,"url":"http://patchwork.ozlabs.org/api/1.2/patches/825838/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20171014164835.GA103233@adacore.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.2/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20171014164835.GA103233@adacore.com>","list_archive_url":null,"date":"2017-10-14T16:48:35","name":"[Ada] Fix performance regression of Ada.Numerics on 32-bit Windows","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"da358d3b977276c3a5c578dc5d5ebdd8eb7732be","submitter":{"id":64226,"url":"http://patchwork.ozlabs.org/api/1.2/people/64226/?format=json","name":"Pierre-Marie de Rodat","email":"derodat@adacore.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20171014164835.GA103233@adacore.com/mbox/","series":[{"id":8201,"url":"http://patchwork.ozlabs.org/api/1.2/series/8201/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=8201","date":"2017-10-14T16:48:35","name":"[Ada] Fix performance regression of Ada.Numerics on 32-bit Windows","version":1,"mbox":"http://patchwork.ozlabs.org/series/8201/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/825838/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/825838/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-464220-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-464220-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"BRKOwBqZ\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yDrC00ZMdz9t3Z\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 15 Oct 2017 03:48:59 +1100 (AEDT)","(qmail 3804 invoked by alias); 14 Oct 2017 16:48:48 -0000","(qmail 2798 invoked by uid 89); 14 Oct 2017 16:48:38 -0000","from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tSat, 14 Oct 2017 16:48:37 +0000","from localhost (localhost.localdomain [127.0.0.1])\tby\n\tfiltered-rock.gnat.com (Postfix) with ESMTP id DA0A156213;\n\tSat, 14 Oct 2017 12:48:35 -0400 (EDT)","from rock.gnat.com ([127.0.0.1])\tby localhost (rock.gnat.com\n\t[127.0.0.1]) (amavisd-new, port 10024)\twith LMTP id\n\tw9QHiJE61jXh; Sat, 14 Oct 2017 12:48:35 -0400 (EDT)","from tron.gnat.com (tron.gnat.com\n\t[IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294])\tby rock.gnat.com\n\t(Postfix) with ESMTP id C7B8A56079;\n\tSat, 14 Oct 2017 12:48:35 -0400 (EDT)","by tron.gnat.com (Postfix, from userid 4862)\tid C6B4A319;\n\tSat, 14 Oct 2017 12:48:35 -0400 (EDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:mime-version:content-type; q=dns;\n\ts=default; b=MKg2w7WvPsomFgz+MdI0EIofhIy88Yf+Gc6XpC1i71d4H0FS7H\n\t0OdHyjEAwLwv7O/yOn0DO75a9lLWiEzaVVDl3Dk3XntJDpeaLjmLqP3nx9adGIBo\n\toXEdD7W5GL1UgJagR3Ejh3VtGhut5FvS2rKk2hZ9ZGwGrcsMe8P2CU760=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:mime-version:content-type; s=\n\tdefault; bh=kJ3nF4Lm3nfEIYkKl8BGWwDGK90=; b=BRKOwBqZ1TkD+zO3i8Xy\n\tDTPunAnbHPQwJHectEulztgKC+Y0FuTtaewhLHN53Q/jlDX3XDIQ0zdpWqVsKLfi\n\tk4NbqEywPFt+AtQzpV4J3QvQWIIAOI/TUmDKUkyN/nOiHRMO9YUM+PlLx5eSKTbk\n\thOXklTQghT3K4s9P78nKKoM=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2,\n\tGIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=3039,\n\tH*Ad:U*ebotcazou, Ent, sk:ebotcaz","X-HELO":"rock.gnat.com","Date":"Sat, 14 Oct 2017 12:48:35 -0400","From":"Pierre-Marie de Rodat <derodat@adacore.com>","To":"gcc-patches@gcc.gnu.org","Cc":"Eric Botcazou <ebotcazou@adacore.com>","Subject":"[Ada] Fix performance regression of Ada.Numerics on 32-bit Windows","Message-ID":"<20171014164835.GA103233@adacore.com>","MIME-Version":"1.0","Content-Type":"multipart/mixed; boundary=\"Q68bSM7Ycu6FN28Q\"","Content-Disposition":"inline","User-Agent":"Mutt/1.5.23 (2014-03-12)","X-IsSubscribed":"yes"},"content":"This fixes a run-time performance regression recently introduced on 32-bit\nWindows for Ada.Numerics by an unrelated change that exposed an old defect of\nthe compiler on 32-bit Windows, namely that the Long_Long_Float type has got a\nwrong alignment of 8 instead of the expected 4.\n\nThe following package:\n\npackage P is\n   LLF : Long_Long_Float;\nend P;\n\nmust yield the following output when compiled with -gnatR2 on 32-bit Windows:\n\nRepresentation information for unit P (spec)\n--------------------------------------------\n\nfor Llf'Size use 96;\nfor Llf'Alignment use 4;\n\nTested on x86_64-pc-linux-gnu, committed on trunk\n\n2017-10-14  Eric Botcazou  <ebotcazou@adacore.com>\n\n\t* cstand.adb (Build_Float_Type): Move down Siz parameter, add Align\n\tparameter and set the alignment of the type to Align.\n\t(Copy_Float_Type): Adjust call to Build_Float_Type.\n\t(Register_Float_Type): Add pragma Unreferenced for Precision.  Adjust\n\tcall to Build_Float_Type and do not set RM_Size and Alignment.","diff":"Index: cstand.adb\n===================================================================\n--- cstand.adb\t(revision 253753)\n+++ cstand.adb\t(working copy)\n@@ -62,15 +62,22 @@\n    -----------------------\n \n    procedure Build_Float_Type\n-     (E    : Entity_Id;\n-      Siz  : Int;\n-      Rep  : Float_Rep_Kind;\n-      Digs : Int);\n+     (E     : Entity_Id;\n+      Digs  : Int;\n+      Rep   : Float_Rep_Kind;\n+      Siz   : Int;\n+      Align : Int);\n    --  Procedure to build standard predefined float base type. The first\n-   --  parameter is the entity for the type, and the second parameter is the\n-   --  size in bits. The third parameter indicates the kind of representation\n-   --  to be used. The fourth parameter is the digits value. Each type\n+   --  parameter is the entity for the type. The second parameter is the\n+   --  digits value. The third parameter indicates the representation to\n+   --  be used for the type. The fourth parameter is the size in bits.\n+   --  The fifth parameter is the alignment in storage units. Each type\n    --  is added to the list of predefined floating point types.\n+   --\n+   --  Note that both RM_Size and Esize are set to the specified size, i.e.\n+   --  we do not set the RM_Size to the precision passed by the back end.\n+   --  This is consistent with the semantics of 'Size specified in the RM\n+   --  because we cannot pack components of the type tighter than this size.\n \n    procedure Build_Signed_Integer_Type (E : Entity_Id; Siz : Nat);\n    --  Procedure to build standard predefined signed integer subtype. The\n@@ -189,10 +196,11 @@\n    ----------------------\n \n    procedure Build_Float_Type\n-     (E    : Entity_Id;\n-      Siz  : Int;\n-      Rep  : Float_Rep_Kind;\n-      Digs : Int)\n+     (E     : Entity_Id;\n+      Digs  : Int;\n+      Rep   : Float_Rep_Kind;\n+      Siz   : Int;\n+      Align : Int)\n    is\n    begin\n       Set_Type_Definition (Parent (E),\n@@ -201,10 +209,10 @@\n \n       Set_Ekind                      (E, E_Floating_Point_Type);\n       Set_Etype                      (E, E);\n-      Set_Float_Rep (E, Rep);\n+      Init_Digits_Value              (E, Digs);\n+      Set_Float_Rep                  (E, Rep);\n       Init_Size                      (E, Siz);\n-      Set_Elem_Alignment             (E);\n-      Init_Digits_Value              (E, Digs);\n+      Set_Alignment                  (E, UI_From_Int (Align));\n       Set_Float_Bounds               (E);\n       Set_Is_Frozen                  (E);\n       Set_Is_Public                  (E);\n@@ -295,8 +303,9 @@\n \n    procedure Copy_Float_Type (To : Entity_Id; From : Entity_Id) is\n    begin\n-      Build_Float_Type (To, UI_To_Int (Esize (From)), Float_Rep (From),\n-                        UI_To_Int (Digits_Value (From)));\n+      Build_Float_Type\n+        (To, UI_To_Int (Digits_Value (From)), Float_Rep (From),\n+         UI_To_Int (Esize (From)), UI_To_Int (Alignment (From)));\n    end Copy_Float_Type;\n \n    ----------------------\n@@ -2065,15 +2074,17 @@\n       Size      : Positive;\n       Alignment : Natural)\n    is\n+      pragma Unreferenced (Precision);\n+      --  See Build_Float_Type for the rationale\n+\n       Ent : constant Entity_Id := New_Standard_Entity;\n \n    begin\n       Set_Defining_Identifier (New_Node (N_Full_Type_Declaration, Stloc), Ent);\n       Make_Name (Ent, Name);\n       Set_Scope (Ent, Standard_Standard);\n-      Build_Float_Type (Ent, Int (Size), Float_Rep, Pos (Digs));\n-      Set_RM_Size (Ent, UI_From_Int (Int (Precision)));\n-      Set_Alignment (Ent, UI_From_Int (Int (Alignment / 8)));\n+      Build_Float_Type\n+        (Ent, Pos (Digs), Float_Rep, Int (Size), Int (Alignment / 8));\n \n       if No (Back_End_Float_Types) then\n          Back_End_Float_Types := New_Elmt_List;\n","prefixes":["Ada"]}