{"id":816179,"url":"http://patchwork.ozlabs.org/api/patches/816179/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/877ewt1ry3.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":"<877ewt1ry3.fsf@linaro.org>","list_archive_url":null,"date":"2017-09-20T12:21:24","name":"SUBREG_PROMOTED_VAR_P handling in expand_direct_optab_fn","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"6c99678287c9133d9f22ccd12680a662b9c947f8","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/877ewt1ry3.fsf@linaro.org/mbox/","series":[{"id":4101,"url":"http://patchwork.ozlabs.org/api/series/4101/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=4101","date":"2017-09-20T12:21:24","name":"SUBREG_PROMOTED_VAR_P handling in expand_direct_optab_fn","version":1,"mbox":"http://patchwork.ozlabs.org/series/4101/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816179/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816179/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-462581-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-462581-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=\"T/JJwOvq\"; 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 3xxzPf2ds5z9t2V\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 22:21:42 +1000 (AEST)","(qmail 31866 invoked by alias); 20 Sep 2017 12:21:35 -0000","(qmail 31831 invoked by uid 89); 20 Sep 2017 12:21:34 -0000","from mail-wr0-f172.google.com (HELO mail-wr0-f172.google.com)\n\t(209.85.128.172) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 20 Sep 2017 12:21:32 +0000","by mail-wr0-f172.google.com with SMTP id u96so2008796wrb.6 for\n\t<gcc-patches@gcc.gnu.org>; Wed, 20 Sep 2017 05:21:32 -0700 (PDT)","from localhost (92.40.248.127.threembb.co.uk. [92.40.248.127]) by\n\tsmtp.gmail.com with ESMTPSA id\n\to65sm1529508wmd.8.2017.09.20.05.21.29 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:21:29 -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=Tpn/bAEvCQ/KSyZHnMfaQ4vwygTqJVadj4VB1opxE3586fuuZec6o\n\tDF5vwFX0eMlo27p7VRpMlxdCz7DRMqpBRPG8WnDcH7/uoYlqSl6t7mjboM59M65j\n\tUmWLjGg/c57cHRVutMJrlbAIrhwnUtfrjleLQP/34ofiAybSLZGPg0=","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=ERIQYnmKJr1O5HwDXaPAJ7YNPEU=; b=T/JJwOvqg3runi21gFyo\n\tw6c2VE0nJaVFtEnX4TPZ+s+NO59XQngfq+WKbN+VYL1Ed4f/DqT90Hl2Yd+ETzpF\n\tsqxnC8eD/d6zBiSn914dOy6zB/QTIz54vyQjE6dqPZG3MWYTZ2M5KdGrHI8WeIp9\n\tFALn/GruPBwZJAMyPCH+n2g=","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.3 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1476","X-HELO":"mail-wr0-f172.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=Ue2iY2uSwU1ueFyp9CJcZQ4QOtUTxfs33CHnlNAvk0Q=;\n\tb=jFPvYFsNbK/th+JWrMkx45r2IBaHJZql//Iw15kaCDfJzW0Ny/DuhY7wK9zKkST9+H\n\tVIkRRhUQ3wW5iEnD5xnUvYwZ4AVQTFXUCD6z5aTTgew1gW7rZwvXyBW3zihChGgYoER8\n\t6AOOydZe6cAAsNPPjLdvBblfnpeoMXtRrmbUxTnlm2tFCXedhBiSrK32fSPVE9NtQ7Na\n\tDMJz6XCXLDIyCQg5siVob6Sc7/pgzeMoYrpy8rT6fYjH8diXk/HuuJBdkXkKIISgiC10\n\tZkNebnc/5Di9DMWPevcLcmsZTYO7lFSh0pUyh+4z5X1zD1mwiazaZmxOzs7ceZnbfSyc\n\tgtmw==","X-Gm-Message-State":"AHPjjUhABjlt9pW5M5NDQGLKinYqHR6Put1QIHUhX0hmGP7kXasv6+ZM\tuz9T87bA86iMg80Z43oWYoa4sWagpX0=","X-Google-Smtp-Source":"AOwi7QBxXQHXDb2NXYH2DhqcfN49jf4SQvVEVyhsosjudrpPw7eCYbqeiEBzA8Gh+AKyt8erKfAdhw==","X-Received":"by 10.223.154.120 with SMTP id\n\tz111mr4332657wrb.260.1505910090515;\n\tWed, 20 Sep 2017 05:21:30 -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":"SUBREG_PROMOTED_VAR_P handling in expand_direct_optab_fn","Date":"Wed, 20 Sep 2017 13:21:24 +0100","Message-ID":"<877ewt1ry3.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 is needed by the later SVE LAST reductions, where an 8-bit\nor 16-bit result is zero- rather than sign-extended to 32 bits.\nI think it could occur in other situations too.\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* internal-fn.c (expand_direct_optab_fn): Don't assign directly\n\tto a SUBREG_PROMOTED_VAR.","diff":"Index: gcc/internal-fn.c\n===================================================================\n--- gcc/internal-fn.c\t2017-08-30 12:18:46.627041352 +0100\n+++ gcc/internal-fn.c\t2017-09-20 13:19:54.460290742 +0100\n@@ -2606,7 +2606,15 @@ expand_direct_optab_fn (internal_fn fn,\n   tree lhs = gimple_call_lhs (stmt);\n   tree lhs_type = TREE_TYPE (lhs);\n   rtx lhs_rtx = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);\n-  create_output_operand (&ops[0], lhs_rtx, insn_data[icode].operand[0].mode);\n+\n+  /* Do not assign directly to a promoted subreg, since there is no\n+     guarantee that the instruction will leave the upper bits of the\n+     register in the state required by SUBREG_PROMOTED_SIGN.  */\n+  rtx dest = lhs_rtx;\n+  if (GET_CODE (dest) == SUBREG && SUBREG_PROMOTED_VAR_P (dest))\n+    dest = NULL_RTX;\n+\n+  create_output_operand (&ops[0], dest, insn_data[icode].operand[0].mode);\n \n   for (unsigned int i = 0; i < nargs; ++i)\n     {\n","prefixes":[]}