{"id":816182,"url":"http://patchwork.ozlabs.org/api/patches/816182/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/87wp4tzh4y.fsf@linaro.org/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/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":"<87wp4tzh4y.fsf@linaro.org>","list_archive_url":null,"date":"2017-09-20T12:30:53","name":"Make more use of simplify_gen_binary","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"d054b579ef99321d92a18081565920916eeabf40","submitter":{"id":5450,"url":"http://patchwork.ozlabs.org/api/people/5450/?format=json","name":"Richard Sandiford","email":"richard.sandiford@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/87wp4tzh4y.fsf@linaro.org/mbox/","series":[{"id":4104,"url":"http://patchwork.ozlabs.org/api/series/4104/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=4104","date":"2017-09-20T12:30:53","name":"Make more use of simplify_gen_binary","version":1,"mbox":"http://patchwork.ozlabs.org/series/4104/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816182/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816182/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-462586-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-462586-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=\"loqjLITN\"; 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 3xxzct3NmPz9s82\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 22:31:16 +1000 (AEST)","(qmail 72893 invoked by alias); 20 Sep 2017 12:31:09 -0000","(qmail 72816 invoked by uid 89); 20 Sep 2017 12:31:03 -0000","from mail-wm0-f45.google.com (HELO mail-wm0-f45.google.com)\n\t(74.125.82.45) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 20 Sep 2017 12:31:01 +0000","by mail-wm0-f45.google.com with SMTP id e71so6725162wmg.4 for\n\t<gcc-patches@gcc.gnu.org>; Wed, 20 Sep 2017 05:31:00 -0700 (PDT)","from localhost (92.40.248.127.threembb.co.uk. [92.40.248.127]) by\n\tsmtp.gmail.com with ESMTPSA id\n\t29sm1796991wrz.77.2017.09.20.05.30.55 for\n\t<gcc-patches@gcc.gnu.org> (version=TLS1_2\n\tcipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tWed, 20 Sep 2017 05:30:55 -0700 (PDT)"],"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; q=dns; s=\n\tdefault; b=oZRL6C0S+5NOM7J8a0yn4txdQ1HU8Xp+3iR1e0MDqjyyMYMZyMtn+\n\t2VS8gfFxFuXCspKNUwL458WDmvp0FF+xO6dBVUL3Vu7CVaCi+l9hVS4G01r5Urnr\n\tDion+97TaHUU0Zzq/QXCkBw84S5ygRrfPtx7ASakDNLuhlgNDjXn4w=","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; s=\n\tdefault; bh=XLTM4eCrN6gl+ffp+Z2J81qowng=; b=loqjLITNUZ1xBwVetJDQ\n\tR0cLlmpJ7NZAbfNnh6Hd2+6pFEt58BVHg8y/Oi7O72iNVk4BKY4lS2NuHXnOOzQY\n\tNFUIyH6kEgqDteTFjOFAa4v/kDbrGeVk6le+7lf8seImwYTCzHDO5l+QClrlgSyz\n\tjr7Ynyq9bDEc1alN8jHsV1M=","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.0 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS,\n\tRCVD_IN_DNSWL_NONE,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=choosing","X-HELO":"mail-wm0-f45.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:from:to:mail-followup-to:subject:date:message-id\n\t:user-agent:mime-version;\n\tbh=NBLVi/ZU0jbb+oB3g0z84KH9rpAviIXcIB5l5FgKkgA=;\n\tb=bfDz8Y87QhKyi9TT2Po+GrEOiISjYx1i8+yi/xGnNG+yG4a32lC0hzNrMWaKG78Aiw\n\tbt6k7G6nNFw1VEFqRenHv2dvJPmyZIv65WAWVNCmbseYhJ0Icnf5EpKiEgZ7e0K4gxLu\n\tMwADX6jGuzO70JwpgbLTmLwg/PM1z3R0j1YywZ/37r4tP3lyUgm/XnaYdvol47Ppp7rM\n\ttfCAygJKq2THZOx77jdZFkHdOBCnH90KzaOrNNwkTF31MWLFw7R+I8cwmunUvzWTa0c+\n\tobzaZc581PV1R5Ssfhi4Ock7Fp4mqXr/OQWcog6AEOU/1zcZw9LlB/knd+PKbF3tAqMi\n\tDq+A==","X-Gm-Message-State":"AHPjjUiz+/FG/t5lNVN6XEnF6aotS5bOrFQmb7CprcZ2LE5128/rNREX\t61s48zIdLfkY5osogqQpv0KTDvtoneM=","X-Google-Smtp-Source":"AOwi7QDNP3uZ2MBV2Zm1RjHmOJ1V7rfy18sdGkGZLNPuKw+J8LxcXVH7E+9Hk3ui02Nlsf/uiJKYaQ==","X-Received":"by 10.28.173.1 with SMTP id w1mr3817220wme.3.1505910657137;\n\tWed, 20 Sep 2017 05:30:57 -0700 (PDT)","From":"Richard Sandiford <richard.sandiford@linaro.org>","To":"gcc-patches@gcc.gnu.org","Mail-Followup-To":"gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org","Subject":"Make more use of simplify_gen_binary","Date":"Wed, 20 Sep 2017 13:30:53 +0100","Message-ID":"<87wp4tzh4y.fsf@linaro.org>","User-Agent":"Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)","MIME-Version":"1.0","Content-Type":"text/plain"},"content":"This patch replaces various places that previously used:\n\n  if (GET_CODE (y) == CONST_INT)\n    ... plus_constant (..., x, [-]INTVAL (y)) ...\n  else\n    ... gen_rtx_PLUS/MINUS (..., x, y) ...\n\nwith single calls to simplify_gen_binary.  This allows\nthem to handle polynomial integers as well as constants.\n\nTested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linus-gnu.\nOK to install?\n\nRichard\n\n\n2017-09-20  Richard Sandiford  <richard.sandiford@linaro.org>\n\t    Alan Hayward  <alan.hayward@arm.com>\n\t    David Sherwood  <david.sherwood@arm.com>\n\ngcc/\n\t* calls.c (compute_argument_addresses): Use simplify_gen_binary\n\trather than choosing between plus_constant and gen_rtx_<CODE>.\n\t* expr.c (emit_push_insn): Likewise.\n\t(expand_expr_real_2): Likewise.","diff":"Index: gcc/calls.c\n===================================================================\n--- gcc/calls.c\t2017-09-12 14:27:14.515326027 +0100\n+++ gcc/calls.c\t2017-09-20 13:28:58.742856729 +0100\n@@ -2197,11 +2197,7 @@ compute_argument_addresses (struct arg_d\n \t  if (POINTER_BOUNDS_P (args[i].tree_value))\n \t    continue;\n \n-\t  if (CONST_INT_P (offset))\n-\t    addr = plus_constant (Pmode, arg_reg, INTVAL (offset));\n-\t  else\n-\t    addr = gen_rtx_PLUS (Pmode, arg_reg, offset);\n-\n+\t  addr = simplify_gen_binary (PLUS, Pmode, arg_reg, offset);\n \t  addr = plus_constant (Pmode, addr, arg_offset);\n \n \t  if (args[i].partial != 0)\n@@ -2231,11 +2227,7 @@ compute_argument_addresses (struct arg_d\n \t    }\n \t  set_mem_align (args[i].stack, align);\n \n-\t  if (CONST_INT_P (slot_offset))\n-\t    addr = plus_constant (Pmode, arg_reg, INTVAL (slot_offset));\n-\t  else\n-\t    addr = gen_rtx_PLUS (Pmode, arg_reg, slot_offset);\n-\n+\t  addr = simplify_gen_binary (PLUS, Pmode, arg_reg, slot_offset);\n \t  addr = plus_constant (Pmode, addr, arg_offset);\n \n \t  if (args[i].partial != 0)\nIndex: gcc/expr.c\n===================================================================\n--- gcc/expr.c\t2017-09-18 14:58:24.371655718 +0100\n+++ gcc/expr.c\t2017-09-20 13:28:58.743765039 +0100\n@@ -4541,15 +4541,8 @@ emit_push_insn (rtx x, machine_mode mode\n       else\n #endif\n \t{\n-\t  if (CONST_INT_P (args_so_far))\n-\t    addr\n-\t      = memory_address (mode,\n-\t\t\t\tplus_constant (Pmode, args_addr,\n-\t\t\t\t\t       INTVAL (args_so_far)));\n-\t  else\n-\t    addr = memory_address (mode, gen_rtx_PLUS (Pmode, args_addr,\n-\t\t\t\t\t\t       args_so_far));\n-\t  dest = gen_rtx_MEM (mode, addr);\n+\t  addr = simplify_gen_binary (PLUS, Pmode, args_addr, args_so_far);\n+\t  dest = gen_rtx_MEM (mode, memory_address (mode, addr));\n \n \t  /* We do *not* set_mem_attributes here, because incoming arguments\n \t     may overlap with sibling call outgoing arguments and we cannot\n@@ -8565,14 +8558,7 @@ #define REDUCE_BIT_FIELD(expr)\t(reduce_b\n \t{\n \t  expand_operands (treeop0, treeop1,\n \t\t\t   NULL_RTX, &op0, &op1, modifier);\n-\n-\t  /* If the last operand is a CONST_INT, use plus_constant of\n-\t     the negated constant.  Else make the MINUS.  */\n-\t  if (CONST_INT_P (op1))\n-\t    return REDUCE_BIT_FIELD (plus_constant (mode, op0,\n-\t\t\t\t\t\t    -INTVAL (op1)));\n-\t  else\n-\t    return REDUCE_BIT_FIELD (gen_rtx_MINUS (mode, op0, op1));\n+\t  return simplify_gen_binary (MINUS, mode, op0, op1);\n \t}\n \n       /* No sense saving up arithmetic to be done\n","prefixes":[]}