Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/810050/?format=api
{ "id": 810050, "url": "http://patchwork.ozlabs.org/api/1.2/patches/810050/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/4454405.H4XkRasZJl@polaris/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.2/projects/17/?format=api", "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": "<4454405.H4XkRasZJl@polaris>", "list_archive_url": null, "date": "2017-09-05T09:28:23", "name": "[Ada] Get rid of call to int->fp conversion routine", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "4feacc52b8b3251ab10bebafb29b3b92b66731ef", "submitter": { "id": 4365, "url": "http://patchwork.ozlabs.org/api/1.2/people/4365/?format=api", "name": "Eric Botcazou", "email": "ebotcazou@adacore.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/4454405.H4XkRasZJl@polaris/mbox/", "series": [ { "id": 1533, "url": "http://patchwork.ozlabs.org/api/1.2/series/1533/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=1533", "date": "2017-09-05T09:28:23", "name": "[Ada] Get rid of call to int->fp conversion routine", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/1533/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/810050/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/810050/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-return-461469-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-461469-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=\"ramMUHg6\"; 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 3xmhGz6bM5z9s0g\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 5 Sep 2017 19:28:43 +1000 (AEST)", "(qmail 51229 invoked by alias); 5 Sep 2017 09:28:33 -0000", "(qmail 51213 invoked by uid 89); 5 Sep 2017 09:28:32 -0000", "from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210)\n\tby sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with\n\tESMTP; Tue, 05 Sep 2017 09:28:26 +0000", "from localhost (localhost [127.0.0.1])\tby\n\tfiltered-smtp.eu.adacore.com (Postfix) with ESMTP id\n\tBD3FB822CA\tfor <gcc-patches@gcc.gnu.org>;\n\tTue, 5 Sep 2017 11:28:24 +0200 (CEST)", "from smtp.eu.adacore.com ([127.0.0.1])\tby localhost\n\t(smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port\n\t10024)\twith ESMTP id Z6t5kA-xIstY for <gcc-patches@gcc.gnu.org>;\n\tTue, 5 Sep 2017 11:28:24 +0200 (CEST)", "from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net\n\t[88.161.99.133])\t(using TLSv1.2 with cipher\n\tECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\t(No client\n\tcertificate requested)\tby smtp.eu.adacore.com (Postfix) with\n\tESMTPSA id 85D3582266\tfor <gcc-patches@gcc.gnu.org>;\n\tTue, 5 Sep 2017 11:28:24 +0200 (CEST)" ], "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:from\n\t:to:subject:date:message-id:mime-version:content-type\n\t:content-transfer-encoding; q=dns; s=default; b=PvNmyu5dR+G+x6+h\n\tImSw6DH6qmOSzTu4+SzgR5Tzb+co1ZNULvR7445R3J41/1LOXsQqN0xyx53SritT\n\tolgWAfKmrbNlEt96EHalyLWuy6mQPvYJ402AfvLqVC/D7CmselwmpTh4ODW0J/Fr\n\tE3Enkhc0aLtMTKjAFuOdDTq+Rlk=", "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:from\n\t:to:subject:date:message-id:mime-version:content-type\n\t:content-transfer-encoding; s=default; bh=F38S843Pfluc3uCrIFwpMo\n\tsN1nY=; b=ramMUHg6Dt9tNiQgt4IVs3PtGn/2lOOPleWi+Krb4nlD4wP8zaczDn\n\tv3vMU24xJrRxBDA9ZhNyw2SoPxckajrW8moP+zkf/T2csF2VT/cWAiDvAbV9NFSD\n\tcdaaDTTRnaRojTIpUoNpVWssDf3tAPp8XciKcVba09AVG0LCZ/Q8w=", "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=-10.9 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=spoiling", "X-HELO": "smtp.eu.adacore.com", "From": "Eric Botcazou <ebotcazou@adacore.com>", "To": "gcc-patches@gcc.gnu.org", "Subject": "[Ada] Get rid of call to int->fp conversion routine", "Date": "Tue, 05 Sep 2017 11:28:23 +0200", "Message-ID": "<4454405.H4XkRasZJl@polaris>", "User-Agent": "KMail/4.14.10 (Linux/3.16.7-53-desktop; KDE/4.14.9; x86_64; ; )", "MIME-Version": "1.0", "Content-Type": "multipart/mixed; boundary=\"nextPart9647810.M3Z9f5dEmm\"", "Content-Transfer-Encoding": "7Bit" }, "content": "Tested on x86_64-suse-linux, applied on mainline.\n\n\n2017-09-05 Eric Botcazou <ebotcazou@adacore.com>\n\n\t* gcc-interface/trans.c (convert_with_check): Use a custom base type\n\tif the base type of the expression has a different machine mode.\n\tRename a couple of parameters and local variable.", "diff": "Index: gcc-interface/trans.c\n===================================================================\n--- gcc-interface/trans.c\t(revision 251704)\n+++ gcc-interface/trans.c\t(working copy)\n@@ -9252,63 +9252,71 @@ emit_check (tree gnu_cond, tree gnu_expr\n \f\n /* Return an expression that converts GNU_EXPR to GNAT_TYPE, doing overflow\n checks if OVERFLOW_P is true and range checks if RANGE_P is true.\n- GNAT_TYPE is known to be an integral type. If TRUNCATE_P true, do a\n- float to integer conversion with truncation; otherwise round.\n- GNAT_NODE is the GNAT node conveying the source location for which the\n- error should be signaled. */\n+ If TRUNCATE_P true, do a float-to-integer conversion with truncation,\n+ otherwise round. GNAT_NODE is the GNAT node conveying the source location\n+ for which the error should be signaled. */\n \n static tree\n-convert_with_check (Entity_Id gnat_type, tree gnu_expr, bool overflowp,\n-\t\t bool rangep, bool truncatep, Node_Id gnat_node)\n+convert_with_check (Entity_Id gnat_type, tree gnu_expr, bool overflow_p,\n+\t\t bool range_p, bool truncate_p, Node_Id gnat_node)\n {\n tree gnu_type = get_unpadded_type (gnat_type);\n- tree gnu_in_type = TREE_TYPE (gnu_expr);\n- tree gnu_in_basetype = get_base_type (gnu_in_type);\n tree gnu_base_type = get_base_type (gnu_type);\n+ tree gnu_in_type = TREE_TYPE (gnu_expr);\n+ tree gnu_in_base_type = get_base_type (gnu_in_type);\n tree gnu_result = gnu_expr;\n \n /* If we are not doing any checks, the output is an integral type and the\n input is not a floating-point type, just do the conversion. This is\n required for packed array types and is simpler in all cases anyway. */\n- if (!rangep\n- && !overflowp\n+ if (!range_p\n+ && !overflow_p\n && INTEGRAL_TYPE_P (gnu_base_type)\n- && !FLOAT_TYPE_P (gnu_in_type))\n+ && !FLOAT_TYPE_P (gnu_in_base_type))\n return convert (gnu_type, gnu_expr);\n \n- /* First convert the expression to its base type. This\n- will never generate code, but makes the tests below much simpler.\n- But don't do this if converting from an integer type to an unconstrained\n- array type since then we need to get the bounds from the original\n- (unpacked) type. */\n+ /* If the mode of the input base type is larger, then converting to it below\n+ may pessimize the final conversion step, for example generate a libcall\n+ instead of a simple instruction, so use a narrower type in this case. */\n+ if (TYPE_MODE (gnu_in_base_type) != TYPE_MODE (gnu_in_type)\n+ && !(TREE_CODE (gnu_in_type) == INTEGER_TYPE\n+\t && TYPE_BIASED_REPRESENTATION_P (gnu_in_type)))\n+ gnu_in_base_type = gnat_type_for_mode (TYPE_MODE (gnu_in_type),\n+\t\t\t\t\t TYPE_UNSIGNED (gnu_in_type));\n+\n+ /* First convert the expression to the base type. This will never generate\n+ code, but makes the tests below simpler. But don't do this if converting\n+ from an integer type to an unconstrained array type since then we need to\n+ get the bounds from the original (unpacked) type. */\n if (TREE_CODE (gnu_type) != UNCONSTRAINED_ARRAY_TYPE)\n- gnu_result = convert (gnu_in_basetype, gnu_result);\n+ gnu_result = convert (gnu_in_base_type, gnu_result);\n \n- /* If overflow checks are requested, we need to be sure the result will\n- fit in the output base type. But don't do this if the input\n- is integer and the output floating-point. */\n- if (overflowp\n- && !(FLOAT_TYPE_P (gnu_base_type) && INTEGRAL_TYPE_P (gnu_in_basetype)))\n+ /* If overflow checks are requested, we need to be sure the result will fit\n+ in the output base type. But don't do this if the input is integer and\n+ the output floating-point. */\n+ if (overflow_p\n+ && !(FLOAT_TYPE_P (gnu_base_type) && INTEGRAL_TYPE_P (gnu_in_base_type)))\n {\n /* Ensure GNU_EXPR only gets evaluated once. */\n tree gnu_input = gnat_protect_expr (gnu_result);\n tree gnu_cond = boolean_false_node;\n- tree gnu_in_lb = TYPE_MIN_VALUE (gnu_in_basetype);\n- tree gnu_in_ub = TYPE_MAX_VALUE (gnu_in_basetype);\n+ tree gnu_in_lb = TYPE_MIN_VALUE (gnu_in_base_type);\n+ tree gnu_in_ub = TYPE_MAX_VALUE (gnu_in_base_type);\n tree gnu_out_lb = TYPE_MIN_VALUE (gnu_base_type);\n tree gnu_out_ub = TYPE_MAX_VALUE (gnu_base_type);\n \n /* Convert the lower bounds to signed types, so we're sure we're\n \t comparing them properly. Likewise, convert the upper bounds\n \t to unsigned types. */\n- if (INTEGRAL_TYPE_P (gnu_in_basetype) && TYPE_UNSIGNED (gnu_in_basetype))\n+ if (INTEGRAL_TYPE_P (gnu_in_base_type)\n+\t && TYPE_UNSIGNED (gnu_in_base_type))\n \tgnu_in_lb\n-\t = convert (gnat_signed_type_for (gnu_in_basetype), gnu_in_lb);\n+\t = convert (gnat_signed_type_for (gnu_in_base_type), gnu_in_lb);\n \n- if (INTEGRAL_TYPE_P (gnu_in_basetype)\n-\t && !TYPE_UNSIGNED (gnu_in_basetype))\n+ if (INTEGRAL_TYPE_P (gnu_in_base_type)\n+\t && !TYPE_UNSIGNED (gnu_in_base_type))\n \tgnu_in_ub\n-\t = convert (gnat_unsigned_type_for (gnu_in_basetype), gnu_in_ub);\n+\t = convert (gnat_unsigned_type_for (gnu_in_base_type), gnu_in_ub);\n \n if (INTEGRAL_TYPE_P (gnu_base_type) && TYPE_UNSIGNED (gnu_base_type))\n \tgnu_out_lb\n@@ -9328,7 +9336,7 @@ convert_with_check (Entity_Id gnat_type,\n \t Note that we have to do the comparison which would *fail* in the\n \t case of an error since if it's an FP comparison and one of the\n \t values is a NaN or Inf, the comparison will fail. */\n- if (INTEGRAL_TYPE_P (gnu_in_basetype)\n+ if (INTEGRAL_TYPE_P (gnu_in_base_type)\n \t ? tree_int_cst_lt (gnu_in_lb, gnu_out_lb)\n \t : (FLOAT_TYPE_P (gnu_base_type)\n \t ? real_less (&TREE_REAL_CST (gnu_in_lb),\n@@ -9337,10 +9345,10 @@ convert_with_check (Entity_Id gnat_type,\n \tgnu_cond\n \t = invert_truthvalue\n \t (build_binary_op (GE_EXPR, boolean_type_node,\n-\t\t\t gnu_input, convert (gnu_in_basetype,\n+\t\t\t gnu_input, convert (gnu_in_base_type,\n \t\t\t\t\t\t gnu_out_lb)));\n \n- if (INTEGRAL_TYPE_P (gnu_in_basetype)\n+ if (INTEGRAL_TYPE_P (gnu_in_base_type)\n \t ? tree_int_cst_lt (gnu_out_ub, gnu_in_ub)\n \t : (FLOAT_TYPE_P (gnu_base_type)\n \t ? real_less (&TREE_REAL_CST (gnu_out_ub),\n@@ -9351,7 +9359,7 @@ convert_with_check (Entity_Id gnat_type,\n \t\t\t invert_truthvalue\n \t\t\t (build_binary_op (LE_EXPR, boolean_type_node,\n \t\t\t\t\t gnu_input,\n-\t\t\t\t\t convert (gnu_in_basetype,\n+\t\t\t\t\t convert (gnu_in_base_type,\n \t\t\t\t\t\t\tgnu_out_ub))));\n \n if (!integer_zerop (gnu_cond))\n@@ -9362,8 +9370,8 @@ convert_with_check (Entity_Id gnat_type,\n /* Now convert to the result base type. If this is a non-truncating\n float-to-integer conversion, round. */\n if (INTEGRAL_TYPE_P (gnu_base_type)\n- && FLOAT_TYPE_P (gnu_in_basetype)\n- && !truncatep)\n+ && FLOAT_TYPE_P (gnu_in_base_type)\n+ && !truncate_p)\n {\n REAL_VALUE_TYPE half_minus_pred_half, pred_half;\n tree gnu_conv, gnu_zero, gnu_comp, calc_type;\n@@ -9375,7 +9383,7 @@ convert_with_check (Entity_Id gnat_type,\n \t precision from spoiling this property, use the widest hardware\n \t floating-point type if FP_ARITH_MAY_WIDEN is true. */\n calc_type\n-\t= fp_arith_may_widen ? longest_float_type_node : gnu_in_basetype;\n+\t= fp_arith_may_widen ? longest_float_type_node : gnu_in_base_type;\n \n /* Compute the exact value calc_type'Pred (0.5) at compile time. */\n fmt = REAL_MODE_FORMAT (TYPE_MODE (calc_type));\n@@ -9400,7 +9408,7 @@ convert_with_check (Entity_Id gnat_type,\n \t to be scheduled in parallel with retrieval of the constant and\n \t conversion of the input to the calc_type (if necessary). */\n \n- gnu_zero = build_real (gnu_in_basetype, dconst0);\n+ gnu_zero = build_real (gnu_in_base_type, dconst0);\n gnu_result = gnat_protect_expr (gnu_result);\n gnu_conv = convert (calc_type, gnu_result);\n gnu_comp\n@@ -9422,9 +9430,10 @@ convert_with_check (Entity_Id gnat_type,\n \n /* Finally, do the range check if requested. Note that if the result type\n is a modular type, the range check is actually an overflow check. */\n- if (rangep\n- || (TREE_CODE (gnu_base_type) == INTEGER_TYPE\n-\t && TYPE_MODULAR_P (gnu_base_type) && overflowp))\n+ if (range_p\n+ || (overflow_p\n+\t && TREE_CODE (gnu_base_type) == INTEGER_TYPE\n+\t && TYPE_MODULAR_P (gnu_base_type)))\n gnu_result = emit_range_check (gnu_result, gnat_type, gnat_node);\n \n return convert (gnu_type, gnu_result);\n", "prefixes": [ "Ada" ] }