[{"id":1771962,"web_url":"http://patchwork.ozlabs.org/comment/1771962/","msgid":"<FDB20764-7B41-4630-B4C6-3DEAFCE53C58@gmail.com>","list_archive_url":null,"date":"2017-09-20T15:05:36","subject":"Re: Don't query the frontend for unsupported types","submitter":{"id":1765,"url":"http://patchwork.ozlabs.org/api/people/1765/","name":"Richard Biener","email":"richard.guenther@gmail.com"},"content":"On September 20, 2017 2:36:03 PM GMT+02:00, Richard Sandiford <richard.sandiford@linaro.org> wrote:\n>When forcing a constant of mode MODE into memory, force_const_mem\n>asks the frontend to provide the type associated with that mode.\n>In principle type_for_mode is allowed to return null, and although\n>one use site correctly handled that, the other didn't.\n>\n>I think there's agreement that it's bogus to use type_for_mode for\n>this kind of thing, since it forces frontends to handle types that\n>don't exist in that language.  See e.g. http://gcc.gnu.org/PR46805\n>where the Go frontend was forced to handle vector types even though\n>Go doesn't have vector types.\n>\n>Also, the frontends use code like:\n>\n>  else if (VECTOR_MODE_P (mode))\n>    {\n>      machine_mode inner_mode = GET_MODE_INNER (mode);\n>      tree inner_type = c_common_type_for_mode (inner_mode, unsignedp);\n>      if (inner_type != NULL_TREE)\n>        return build_vector_type_for_mode (inner_type, mode);\n>    }\n>\n>and there's no guarantee that every vector mode M used by backend\n>rtl has an associated vector type whose TYPE_MODE is M.  I think\n>really the type_for_mode hook should only return trees that _do_ have\n>the requested TYPE_MODE, but PR46805 linked above shows that this is\n>likely to have too many knock-on consequences.  It doesn't make sense\n>for force_const_mem to ask about vector modes that aren't valid for\n>vector types, so this patch handles the condition there instead.\n>\n>This is needed for SVE multi-register modes, which are modelled as\n>vector modes but are not usable as vector types.\n>\n>Tested on aarch64-linux-gnu, x86_64-linux-gnu and\n>powerpc64le-linus-gnu.\n>OK to install?\n\nI think we should get rid of the use entirely. \n\nRichard. \n\n>Richard\n>\n>\n>2017-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>\n>gcc/\n>\t* varasm.c (force_const_mem): Don't ask the front end about\n>\tvector modes that are not supported as vector types by the target.\n>\n>Index: gcc/varasm.c\n>===================================================================\n>--- gcc/varasm.c\t2017-09-12 14:28:56.402824780 +0100\n>+++ gcc/varasm.c\t2017-09-20 13:33:15.942547232 +0100\n>@@ -3785,10 +3785,17 @@ force_const_mem (machine_mode mode, rtx\n>   desc = ggc_alloc<constant_descriptor_rtx> ();\n>   *slot = desc;\n> \n>+  tree type = NULL_TREE;\n>+  if (mode != VOIDmode\n>+      /* Don't ask the frontend about vector modes if there cannot be\n>a\n>+\t VECTOR_TYPE whose TYPE_MODE is MODE.  */\n>+      && (!VECTOR_MODE_P (mode)\n>+\t  || targetm.vector_mode_supported_p (mode)))\n>+    type = lang_hooks.types.type_for_mode (mode, 0);\n>+\n>   /* Align the location counter as required by EXP's data type.  */\n>   align = GET_MODE_ALIGNMENT (mode == VOIDmode ? word_mode : mode);\n> \n>-  tree type = lang_hooks.types.type_for_mode (mode, 0);\n>   if (type != NULL_TREE)\n>     align = CONSTANT_ALIGNMENT (make_tree (type, x), align);\n> \n>@@ -3832,7 +3839,8 @@ force_const_mem (machine_mode mode, rtx\n> \n>   /* Construct the MEM.  */\n>   desc->mem = def = gen_const_mem (mode, symbol);\n>-  set_mem_attributes (def, lang_hooks.types.type_for_mode (mode, 0),\n>1);\n>+  if (type)\n>+    set_mem_attributes (def, type, 1);\n>   set_mem_align (def, align);\n> \n>   /* If we're dropping a label to the constant pool, make sure we","headers":{"Return-Path":"<gcc-patches-return-462609-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-462609-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=\"dktTS48n\"; 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 3xy3344Gjsz9sNr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 01:05:52 +1000 (AEST)","(qmail 104211 invoked by alias); 20 Sep 2017 15:05:45 -0000","(qmail 104202 invoked by uid 89); 20 Sep 2017 15:05:45 -0000","from mail-wm0-f44.google.com (HELO mail-wm0-f44.google.com)\n\t(74.125.82.44) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 20 Sep 2017 15:05:43 +0000","by mail-wm0-f44.google.com with SMTP id e71so8092694wmg.4 for\n\t<gcc-patches@gcc.gnu.org>; Wed, 20 Sep 2017 08:05:42 -0700 (PDT)","from android-97b5c0ce9bfced28.fritz.box\n\t(p5494E583.dip0.t-ipconnect.de. [84.148.229.131]) by\n\tsmtp.gmail.com with ESMTPSA id\n\tp78sm1920845wma.11.2017.09.20.08.05.39 (version=TLS1_2\n\tcipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 20 Sep 2017 08:05:40 -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:date\n\t:in-reply-to:references:mime-version:content-type\n\t:content-transfer-encoding:subject:to:from:message-id; q=dns; s=\n\tdefault; b=TlIPswjDHEtRGkOEm0zQofL8cuhtgrWYyk+n7odwI0+Ue5tkPW4ZD\n\tMTFWW1OI2uutzEcRRQWXDSx84nxfviBA7lxMoIJwNpwfeR8tvTfZA3eN8BhERV1Y\n\t/0byaYAD0IfDRRmEElBRyKMn6poXHyNCUahy0OKKzhwDFmkFWggdR8=","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:in-reply-to:references:mime-version:content-type\n\t:content-transfer-encoding:subject:to:from:message-id; s=\n\tdefault; bh=JGYmgybLmejZRGJyGIrQbKLNy3g=; b=dktTS48nLyeLJUbHyI2O\n\tzV9G/P1Hft95qVnTK8eUQptYdMQSO3aVUIyQX7ylfiN8kqxSJ4chaLNPlsLVJEm4\n\tFqzWOFCoCjBgXt/84fDEDXZzqK3g9BvZ59ORrplr9zchTU6aQndL4fouQpd+T4Au\n\tCzsGoDKshVfKfAoRB62ZHN4=","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.8 required=5.0 tests=AWL, BAYES_00,\n\tFREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mail-wm0-f44.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:date:user-agent:in-reply-to:references\n\t:mime-version:content-transfer-encoding:subject:to:from:message-id;\n\tbh=MAL86jxMh24KAHO9s3+bnKMwpQdn1ajOyHO+lUGiong=;\n\tb=INLEd3owBqAnz3HSF/ZDTofyzxWHda5sRbUUaqqXO1cYXh4vyC6cuGCCEN2Uut+Rrf\n\t8gSXsnnbScrZccjXjfCWH//9asCHmteCRRG5PKe/5OtTlzWGqXto/LQ12hH9QzZhxTCF\n\tlp1on7uV5P65ELdKQvA4FRRlQp5CBjOEKiAUtdd3u4QtnbtxAhDjC0vlvxLxMw8eZa81\n\tAOJSwrGUvCOPlja3ShNuvxGOhejbBbxYcOZnpile/QCkUORu10CpvvZ1NH/wjUtu2cuo\n\t7N9ZWA6FPGDNrAaOxSWuwAw78CgDmnPDCm+QuoghgJxodSu455pTFyxakPTV9jnE42y9\n\th3iw==","X-Gm-Message-State":"AHPjjUie92IvkIakzglQH3mZ6C+5iNaYkEBOfEeH1oxeUF1h32MIBHmF\tmbtTObmo8mHk3ZUyVpOIORxZicSw","X-Google-Smtp-Source":"AOwi7QCCgqTXG49cz2td2vn4jhqmUjPwZfXLMu9ehmaFsgj7AH16LeKbfXfBfjUWuJ1ghPiTM5HNWw==","X-Received":"by 10.28.94.138 with SMTP id s132mr4036758wmb.0.1505919940789;\n\tWed, 20 Sep 2017 08:05:40 -0700 (PDT)","Date":"Wed, 20 Sep 2017 17:05:36 +0200","User-Agent":"K-9 Mail for Android","In-Reply-To":"<87shfhzgwc.fsf@linaro.org>","References":"<87shfhzgwc.fsf@linaro.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","Subject":"Re: Don't query the frontend for unsupported types","To":"gcc-patches@gcc.gnu.org, Richard Sandiford <richard.sandiford@linaro.org>","From":"Richard Biener <richard.guenther@gmail.com>","Message-ID":"<FDB20764-7B41-4630-B4C6-3DEAFCE53C58@gmail.com>","X-IsSubscribed":"yes"}},{"id":1772789,"web_url":"http://patchwork.ozlabs.org/comment/1772789/","msgid":"<874lrw5hxk.fsf@linaro.org>","list_archive_url":null,"date":"2017-09-21T12:56:23","subject":"Re: Don't query the frontend for unsupported types","submitter":{"id":5450,"url":"http://patchwork.ozlabs.org/api/people/5450/","name":"Richard Sandiford","email":"richard.sandiford@linaro.org"},"content":"Richard Biener <richard.guenther@gmail.com> writes:\n> On September 20, 2017 2:36:03 PM GMT+02:00, Richard Sandiford\n> <richard.sandiford@linaro.org> wrote:\n>>When forcing a constant of mode MODE into memory, force_const_mem\n>>asks the frontend to provide the type associated with that mode.\n>>In principle type_for_mode is allowed to return null, and although\n>>one use site correctly handled that, the other didn't.\n>>\n>>I think there's agreement that it's bogus to use type_for_mode for\n>>this kind of thing, since it forces frontends to handle types that\n>>don't exist in that language.  See e.g. http://gcc.gnu.org/PR46805\n>>where the Go frontend was forced to handle vector types even though\n>>Go doesn't have vector types.\n>>\n>>Also, the frontends use code like:\n>>\n>>  else if (VECTOR_MODE_P (mode))\n>>    {\n>>      machine_mode inner_mode = GET_MODE_INNER (mode);\n>>      tree inner_type = c_common_type_for_mode (inner_mode, unsignedp);\n>>      if (inner_type != NULL_TREE)\n>>        return build_vector_type_for_mode (inner_type, mode);\n>>    }\n>>\n>>and there's no guarantee that every vector mode M used by backend\n>>rtl has an associated vector type whose TYPE_MODE is M.  I think\n>>really the type_for_mode hook should only return trees that _do_ have\n>>the requested TYPE_MODE, but PR46805 linked above shows that this is\n>>likely to have too many knock-on consequences.  It doesn't make sense\n>>for force_const_mem to ask about vector modes that aren't valid for\n>>vector types, so this patch handles the condition there instead.\n>>\n>>This is needed for SVE multi-register modes, which are modelled as\n>>vector modes but are not usable as vector types.\n>>\n>>Tested on aarch64-linux-gnu, x86_64-linux-gnu and\n>>powerpc64le-linus-gnu.\n>>OK to install?\n>\n> I think we should get rid of the use entirely.\n\nI first read this as not using type_for_mode at all in force_const_mem,\nwhich sounded like a good thing :-)  I tried it overnight on the usual\nat-least-one-target-per-CPU set and diffing the before and after\nassembly for the testsuite.  And it looks like i686 relies on this\nto get an alignment of 16 rather than 4 for XFmode constants:\nGET_MODE_ALIGNMENT (XFmode) == 32 (as requested by i386-modes.def),\nbut i386's CONSTANT_ALIGNMENT increases it to 128 for static constants.\n\nBut now I wonder if you meant we should just get rid of:\n\n  set_mem_attributes (def, lang_hooks.types.type_for_mode (mode, 0), 1);\n\nand keep the other call to type_for_mode, as below.\n\nThanks,\nRichard\n\n\n2017-09-21  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* varasm.c (force_const_mem): Don't ask the front end about\n\tvector modes that are not supported as vector types by the target.\n\tRemove call to set_mem_attributes.\n\nIndex: gcc/varasm.c\n===================================================================\n--- gcc/varasm.c\t2017-09-21 11:17:14.726201207 +0100\n+++ gcc/varasm.c\t2017-09-21 13:54:22.209159021 +0100\n@@ -3785,10 +3785,17 @@ force_const_mem (machine_mode mode, rtx\n   desc = ggc_alloc<constant_descriptor_rtx> ();\n   *slot = desc;\n \n+  tree type = NULL_TREE;\n+  if (mode != VOIDmode\n+      /* Don't ask the frontend about vector modes if there cannot be a\n+\t VECTOR_TYPE whose TYPE_MODE is MODE.  */\n+      && (!VECTOR_MODE_P (mode)\n+\t  || targetm.vector_mode_supported_p (mode)))\n+    type = lang_hooks.types.type_for_mode (mode, 0);\n+\n   /* Align the location counter as required by EXP's data type.  */\n   align = GET_MODE_ALIGNMENT (mode == VOIDmode ? word_mode : mode);\n \n-  tree type = lang_hooks.types.type_for_mode (mode, 0);\n   if (type != NULL_TREE)\n     align = CONSTANT_ALIGNMENT (make_tree (type, x), align);\n \n@@ -3832,7 +3839,6 @@ force_const_mem (machine_mode mode, rtx\n \n   /* Construct the MEM.  */\n   desc->mem = def = gen_const_mem (mode, symbol);\n-  set_mem_attributes (def, lang_hooks.types.type_for_mode (mode, 0), 1);\n   set_mem_align (def, align);\n \n   /* If we're dropping a label to the constant pool, make sure we","headers":{"Return-Path":"<gcc-patches-return-462698-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-462698-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=\"E+c/Haze\"; 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 3xyc812JjWz9t43\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 22:57:04 +1000 (AEST)","(qmail 4150 invoked by alias); 21 Sep 2017 12:56:32 -0000","(qmail 3892 invoked by uid 89); 21 Sep 2017 12:56:31 -0000","from mail-wm0-f54.google.com (HELO mail-wm0-f54.google.com)\n\t(74.125.82.54) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tThu, 21 Sep 2017 12:56:28 +0000","by mail-wm0-f54.google.com with SMTP id m72so1585281wmc.1 for\n\t<gcc-patches@gcc.gnu.org>; Thu, 21 Sep 2017 05:56:28 -0700 (PDT)","from localhost (92.40.248.110.threembb.co.uk. [92.40.248.110]) by\n\tsmtp.gmail.com with ESMTPSA id\n\tm4sm969010wrb.35.2017.09.21.05.56.25 (version=TLS1_2\n\tcipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tThu, 21 Sep 2017 05:56:25 -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:cc:subject:references:date:in-reply-to:message-id\n\t:mime-version:content-type; q=dns; s=default; b=mGiHkzMBJ4ptcbAc\n\tOT3MXLzRkDnio1PvoqvEnq3RXN0UZ96SZ9ufNzk/HJUd+gFIiQtg3sAYoars6+24\n\tSDfqSSp1g6s95MYGpNN442ArhToS6WXHrgf+LZjNcPw++5YGOKAH7X1u8E8gvRSR\n\tGuCnOq4BJFXKjjHsQfK9d8lFKmQ=","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:cc:subject:references:date:in-reply-to:message-id\n\t:mime-version:content-type; s=default; bh=9Xb0oEcqzz9+10qi1mZ4wK\n\tkd0m0=; b=E+c/HazeWUvHFS8yonQ+9wKxhJB46u0X3gRaBUoSB6Y6vvxm78kwT3\n\tRf5RFJj6KxMINfqqbNbByT0qE8iohj6uPuVbj9FISOpDy0c564W+tDkeHh5Xazhs\n\tzuEhqkVV9NwWJrFL1djIWwRqVc+HAwORXMUsax3TgCsKpZbNXMhPk=","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=sounded","X-HELO":"mail-wm0-f54.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:cc:subject:references\n\t:date:in-reply-to:message-id:user-agent:mime-version;\n\tbh=m3VUgzIE1EfUE/QlVKIJkYOby0OBhrDuJeimybA9eFM=;\n\tb=J4ytu1c+IlJFSmSBqwldda7yzqiMBXUR4hsCzKK3+rM5B7hymQK6wX781E+qZFgWV6\n\t2kQ63ng79psjaffKN6Waz/yLH3gD7VsOoxcJvkGQRw4RBLU8n6xe5CndiomqjdOSXEnz\n\t5KJ7YUcLeO1A2kuUizsXD4xxI7OQWpCNQFuuFromMw94FkB19gvEP8nBYmYqqMo8QOUr\n\ti8pDBcos+3ko8+LTLhT8Tw3JEh4mDe175ilStQaafhgpxCj6h3YBCFl9Ctzb5zGsQAtt\n\tR8r6RfdMyKYDJXGgiN6SxwZDAlrcL4zfRy4UKot+4Kfy/BJPdSKlEOZW2MwieFgxcd7w\n\txNVA==","X-Gm-Message-State":"AHPjjUiie1Dl8UTrdEP8lzeBh/TRU+myqCs4geaxKHUgcSB4RavMLz2T\tY99ht6N7GZ3ccAZXZQeAyt3QoxyM9uQ=","X-Google-Smtp-Source":"AOwi7QDPz99r/3xKVi17T9gy1tJUc0r287RiN4w8BNRmmWfJLYRvjvL0yCb7JZzeKhTJuGuNu53KSw==","X-Received":"by 10.28.35.22 with SMTP id j22mr997288wmj.68.1505998586391;\n\tThu, 21 Sep 2017 05:56:26 -0700 (PDT)","From":"Richard Sandiford <richard.sandiford@linaro.org>","To":"Richard Biener <richard.guenther@gmail.com>","Mail-Followup-To":"Richard Biener <richard.guenther@gmail.com>,\n\tgcc-patches@gcc.gnu.org, richard.sandiford@linaro.org","Cc":"gcc-patches@gcc.gnu.org","Subject":"Re: Don't query the frontend for unsupported types","References":"<87shfhzgwc.fsf@linaro.org>\t<FDB20764-7B41-4630-B4C6-3DEAFCE53C58@gmail.com>","Date":"Thu, 21 Sep 2017 13:56:23 +0100","In-Reply-To":"<FDB20764-7B41-4630-B4C6-3DEAFCE53C58@gmail.com>\n\t(Richard\tBiener's message of \"Wed, 20 Sep 2017 17:05:36 +0200\")","Message-ID":"<874lrw5hxk.fsf@linaro.org>","User-Agent":"Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)","MIME-Version":"1.0","Content-Type":"text/plain"}},{"id":1772900,"web_url":"http://patchwork.ozlabs.org/comment/1772900/","msgid":"<CAFiYyc35uOLn4E1qVR+4PERDL3vumapyZt3OiLGxn8MXGWANrQ@mail.gmail.com>","list_archive_url":null,"date":"2017-09-21T15:03:21","subject":"Re: Don't query the frontend for unsupported types","submitter":{"id":1765,"url":"http://patchwork.ozlabs.org/api/people/1765/","name":"Richard Biener","email":"richard.guenther@gmail.com"},"content":"On Thu, Sep 21, 2017 at 2:56 PM, Richard Sandiford\n<richard.sandiford@linaro.org> wrote:\n> Richard Biener <richard.guenther@gmail.com> writes:\n>> On September 20, 2017 2:36:03 PM GMT+02:00, Richard Sandiford\n>> <richard.sandiford@linaro.org> wrote:\n>>>When forcing a constant of mode MODE into memory, force_const_mem\n>>>asks the frontend to provide the type associated with that mode.\n>>>In principle type_for_mode is allowed to return null, and although\n>>>one use site correctly handled that, the other didn't.\n>>>\n>>>I think there's agreement that it's bogus to use type_for_mode for\n>>>this kind of thing, since it forces frontends to handle types that\n>>>don't exist in that language.  See e.g. http://gcc.gnu.org/PR46805\n>>>where the Go frontend was forced to handle vector types even though\n>>>Go doesn't have vector types.\n>>>\n>>>Also, the frontends use code like:\n>>>\n>>>  else if (VECTOR_MODE_P (mode))\n>>>    {\n>>>      machine_mode inner_mode = GET_MODE_INNER (mode);\n>>>      tree inner_type = c_common_type_for_mode (inner_mode, unsignedp);\n>>>      if (inner_type != NULL_TREE)\n>>>        return build_vector_type_for_mode (inner_type, mode);\n>>>    }\n>>>\n>>>and there's no guarantee that every vector mode M used by backend\n>>>rtl has an associated vector type whose TYPE_MODE is M.  I think\n>>>really the type_for_mode hook should only return trees that _do_ have\n>>>the requested TYPE_MODE, but PR46805 linked above shows that this is\n>>>likely to have too many knock-on consequences.  It doesn't make sense\n>>>for force_const_mem to ask about vector modes that aren't valid for\n>>>vector types, so this patch handles the condition there instead.\n>>>\n>>>This is needed for SVE multi-register modes, which are modelled as\n>>>vector modes but are not usable as vector types.\n>>>\n>>>Tested on aarch64-linux-gnu, x86_64-linux-gnu and\n>>>powerpc64le-linus-gnu.\n>>>OK to install?\n>>\n>> I think we should get rid of the use entirely.\n>\n> I first read this as not using type_for_mode at all in force_const_mem,\n> which sounded like a good thing :-)\n\nThat's what I meant ;)  A mode doesn't really have a type...\n\n  I tried it overnight on the usual\n> at-least-one-target-per-CPU set and diffing the before and after\n> assembly for the testsuite.  And it looks like i686 relies on this\n> to get an alignment of 16 rather than 4 for XFmode constants:\n> GET_MODE_ALIGNMENT (XFmode) == 32 (as requested by i386-modes.def),\n> but i386's CONSTANT_ALIGNMENT increases it to 128 for static constants.\n\nThen the issue is that CONSTANT_ALIGNMENT takes a tree and not a mode...\neven worse than type_for_mode is a use of make_tree!  Incidentially\nix86_constant_alignment _does_ look at the mode in the end...\n\n> But now I wonder if you meant we should just get rid of:\n>\n>   set_mem_attributes (def, lang_hooks.types.type_for_mode (mode, 0), 1);\n>\n> and keep the other call to type_for_mode, as below.\n\nWell, that one is easy to remove indeed.  I think assigning an alias-set\nbased on the mode of a constant is bogus anyway.\n\nRichard.\n\n> Thanks,\n> Richard\n>\n>\n> 2017-09-21  Richard Sandiford  <richard.sandiford@linaro.org>\n>             Alan Hayward  <alan.hayward@arm.com>\n>             David Sherwood  <david.sherwood@arm.com>\n>\n> gcc/\n>         * varasm.c (force_const_mem): Don't ask the front end about\n>         vector modes that are not supported as vector types by the target.\n>         Remove call to set_mem_attributes.\n>\n> Index: gcc/varasm.c\n> ===================================================================\n> --- gcc/varasm.c        2017-09-21 11:17:14.726201207 +0100\n> +++ gcc/varasm.c        2017-09-21 13:54:22.209159021 +0100\n> @@ -3785,10 +3785,17 @@ force_const_mem (machine_mode mode, rtx\n>    desc = ggc_alloc<constant_descriptor_rtx> ();\n>    *slot = desc;\n>\n> +  tree type = NULL_TREE;\n> +  if (mode != VOIDmode\n> +      /* Don't ask the frontend about vector modes if there cannot be a\n> +        VECTOR_TYPE whose TYPE_MODE is MODE.  */\n> +      && (!VECTOR_MODE_P (mode)\n> +         || targetm.vector_mode_supported_p (mode)))\n> +    type = lang_hooks.types.type_for_mode (mode, 0);\n> +\n>    /* Align the location counter as required by EXP's data type.  */\n>    align = GET_MODE_ALIGNMENT (mode == VOIDmode ? word_mode : mode);\n>\n> -  tree type = lang_hooks.types.type_for_mode (mode, 0);\n>    if (type != NULL_TREE)\n>      align = CONSTANT_ALIGNMENT (make_tree (type, x), align);\n>\n> @@ -3832,7 +3839,6 @@ force_const_mem (machine_mode mode, rtx\n>\n>    /* Construct the MEM.  */\n>    desc->mem = def = gen_const_mem (mode, symbol);\n> -  set_mem_attributes (def, lang_hooks.types.type_for_mode (mode, 0), 1);\n>    set_mem_align (def, align);\n>\n>    /* If we're dropping a label to the constant pool, make sure we","headers":{"Return-Path":"<gcc-patches-return-462716-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-462716-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=\"VFg5qUST\"; 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 3xyfy16k04z9t3v\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 22 Sep 2017 01:03:37 +1000 (AEST)","(qmail 127681 invoked by alias); 21 Sep 2017 15:03:27 -0000","(qmail 127480 invoked by uid 89); 21 Sep 2017 15:03:27 -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\tThu, 21 Sep 2017 15:03:24 +0000","by mail-wm0-f45.google.com with SMTP id q124so2729831wmb.0 for\n\t<gcc-patches@gcc.gnu.org>; Thu, 21 Sep 2017 08:03:24 -0700 (PDT)","by 10.80.143.34 with HTTP; Thu, 21 Sep 2017 08:03:21 -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\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:content-type; q=dns; s=default; b=hgRj4p5WYSpEEiTRz7\n\tlDpt/n3g/L/t8gjzBOOcF7ye2xMHqYv45LNToYWBoXtfeAZqDnHLZ6ruVnknKmFo\n\tH24NkROajJDX95m8gh82o9vQgbOPt1lA69MwR/51LqnAGAYGcHrIpSN/ftR1N8RF\n\tUPK1fhDJyii9JiHRS0QvYlgUw=","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\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:content-type; s=default; bh=ROK92g45UkRz4YD9/4VU5IQO\n\t+1I=; b=VFg5qUSTcFMo/8AZneUOhC9clSqL9LkXgSS5ZJ6CQNCZwIXXSv2RNdyW\n\te2zJ3drriTF6/Ag5RbFwcccGW8r5y+OsBB2gw7+EAmjNRXISV10QYbcSTIgR2roL\n\tQMX1bKzwtlmNQVjqPa0XdPtYrosW+REuo3IJrJyBPqtlS8NIb+w=","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.5 required=5.0 tests=AWL, BAYES_00,\n\tFREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=","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:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to;\n\tbh=w9fIBg4Ef9/zLx3UDSJbKOZcI0GP9VnDHU8XM79azok=;\n\tb=JLR6nkXvVsMjHc4GTEW9NO7L4ifz623wfhYp0/ECPWDONsNl7dFUVnzraovaZ0YMxk\n\tcLcatFMuod3yfYeGlrAxdYfgm3nU+ZlAKIR4mSAjsDxL2vVGtsbkjuKnKJDcu6Hkqs8p\n\t2olS3S06aqCt4FRTG2xBaZ84I2QpaHdEqvfZHbRvrpKCbci+qkkM4NBIDfdbemv1/voi\n\teMhKHbeVzsXS6dRyp8aU+usmsGGrtl0kiHlDK29zA63jFaVJ5ql+ozHj/qet5PAvXN3O\n\tQKOYwBihSRyJOkGmbqmgqKyMF4Ds7zEyummroHGp62LpLAd5gt6ISwIFLFxDNJOaF+Ny\n\t+V7w==","X-Gm-Message-State":"AHPjjUhZh4gW1OYiVCz2PUb94SaRavcqlI8PGMJQPp9J0+H2UFXkhnO1\trfzkttadPTSFy0lWtKt8++wAFjsC4E0UD/eeeQo=","X-Google-Smtp-Source":"AOwi7QCyLnV37p089Cz9xDBo0kc2TY02xazS0Xs3O5YGCQYZuatP/yXOQk0GBdgtb+KHUo3Drd9ihW5m2/plPAmTfo8=","X-Received":"by 10.80.240.21 with SMTP id r21mr1518462edl.142.1506006202274;\n\tThu, 21 Sep 2017 08:03:22 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<874lrw5hxk.fsf@linaro.org>","References":"<87shfhzgwc.fsf@linaro.org>\n\t<FDB20764-7B41-4630-B4C6-3DEAFCE53C58@gmail.com>\n\t<874lrw5hxk.fsf@linaro.org>","From":"Richard Biener <richard.guenther@gmail.com>","Date":"Thu, 21 Sep 2017 17:03:21 +0200","Message-ID":"<CAFiYyc35uOLn4E1qVR+4PERDL3vumapyZt3OiLGxn8MXGWANrQ@mail.gmail.com>","Subject":"Re: Don't query the frontend for unsupported types","To":"Richard Biener <richard.guenther@gmail.com>,\n\tGCC Patches <gcc-patches@gcc.gnu.org>,\n\tRichard Sandiford <richard.sandiford@linaro.org>","Content-Type":"text/plain; charset=\"UTF-8\"","X-IsSubscribed":"yes"}},{"id":1773752,"web_url":"http://patchwork.ozlabs.org/comment/1773752/","msgid":"<87zi9mptv6.fsf@linaro.org>","list_archive_url":null,"date":"2017-09-22T16:42:53","subject":"Re: Don't query the frontend for unsupported types","submitter":{"id":5450,"url":"http://patchwork.ozlabs.org/api/people/5450/","name":"Richard Sandiford","email":"richard.sandiford@linaro.org"},"content":"Richard Biener <richard.guenther@gmail.com> writes:\n> On Thu, Sep 21, 2017 at 2:56 PM, Richard Sandiford\n> <richard.sandiford@linaro.org> wrote:\n>> Richard Biener <richard.guenther@gmail.com> writes:\n>>> On September 20, 2017 2:36:03 PM GMT+02:00, Richard Sandiford\n>>> <richard.sandiford@linaro.org> wrote:\n>>>>When forcing a constant of mode MODE into memory, force_const_mem\n>>>>asks the frontend to provide the type associated with that mode.\n>>>>In principle type_for_mode is allowed to return null, and although\n>>>>one use site correctly handled that, the other didn't.\n>>>>\n>>>>I think there's agreement that it's bogus to use type_for_mode for\n>>>>this kind of thing, since it forces frontends to handle types that\n>>>>don't exist in that language.  See e.g. http://gcc.gnu.org/PR46805\n>>>>where the Go frontend was forced to handle vector types even though\n>>>>Go doesn't have vector types.\n>>>>\n>>>>Also, the frontends use code like:\n>>>>\n>>>>  else if (VECTOR_MODE_P (mode))\n>>>>    {\n>>>>      machine_mode inner_mode = GET_MODE_INNER (mode);\n>>>>      tree inner_type = c_common_type_for_mode (inner_mode, unsignedp);\n>>>>      if (inner_type != NULL_TREE)\n>>>>        return build_vector_type_for_mode (inner_type, mode);\n>>>>    }\n>>>>\n>>>>and there's no guarantee that every vector mode M used by backend\n>>>>rtl has an associated vector type whose TYPE_MODE is M.  I think\n>>>>really the type_for_mode hook should only return trees that _do_ have\n>>>>the requested TYPE_MODE, but PR46805 linked above shows that this is\n>>>>likely to have too many knock-on consequences.  It doesn't make sense\n>>>>for force_const_mem to ask about vector modes that aren't valid for\n>>>>vector types, so this patch handles the condition there instead.\n>>>>\n>>>>This is needed for SVE multi-register modes, which are modelled as\n>>>>vector modes but are not usable as vector types.\n>>>>\n>>>>Tested on aarch64-linux-gnu, x86_64-linux-gnu and\n>>>>powerpc64le-linus-gnu.\n>>>>OK to install?\n>>>\n>>> I think we should get rid of the use entirely.\n>>\n>> I first read this as not using type_for_mode at all in force_const_mem,\n>> which sounded like a good thing :-)\n>\n> That's what I meant ;)  A mode doesn't really have a type...\n>\n>   I tried it overnight on the usual\n>> at-least-one-target-per-CPU set and diffing the before and after\n>> assembly for the testsuite.  And it looks like i686 relies on this\n>> to get an alignment of 16 rather than 4 for XFmode constants:\n>> GET_MODE_ALIGNMENT (XFmode) == 32 (as requested by i386-modes.def),\n>> but i386's CONSTANT_ALIGNMENT increases it to 128 for static constants.\n>\n> Then the issue is that CONSTANT_ALIGNMENT takes a tree and not a mode...\n> even worse than type_for_mode is a use of make_tree!  Incidentially\n> ix86_constant_alignment _does_ look at the mode in the end...\n\nOK, I guess this means another target hook conversion.  The patch\nbelow converts CONSTANT_ALIGNMENT with its current interface.\nThe definition:\n\n  #define CONSTANT_ALIGNMENT(EXP, ALIGN) \\\n    (TREE_CODE (EXP) == STRING_CST \\\n     && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n\nwas very common, so the patch adds a canned definition for that,\ncalled constant_alignment_word_strings.  Some ports had a variation\nthat used a port-local FASTEST_ALIGNMENT instead of BITS_PER_WORD;\nthe patch uses constant_alignment_word_strings if FASTEST_ALIGNMENT\nwas always BITS_PER_WORD and a port-local hook function otherwise.\n\nTested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.\nAlso tested by comparing the testsuite assembly output on at least one\ntarget per CPU directory.  I don't think this comes under Jeff's\npreapproval due to the constant_alignment_word_strings thing, so:\nOK to install?\n\nIf so, then I'll follow up with a separate hook for rtl modes, which\nvarasm, default_constant_alignment and constant_alignment_word_strings\ncan all use.\n\nThanks,\nRichard\n\n\n2017-09-22  Richard Sandiford  <richard.sandiford@linaro.org>\n\ngcc/\n\t* target.def (constant_alignment): New hook.\n\t* defaults.h (CONSTANT_ALIGNMENT): Delete.\n\t* doc/tm.texi.in (CONSTANT_ALIGNMENT): Replace with...\n\t(TARGET_CONSTANT_ALIGNMENT): ...this new hook.\n\t* doc/tm.texi: Regenerate.\n\t* targhooks.h (default_constant_alignment): Declare.\n\t(constant_alignment_word_strings): Likewise.\n\t* targhooks.c (default_constant_alignment): New function.\n\t(constant_alignment_word_strings): Likewise.\n\t* builtins.c (get_object_alignment_2): Use targetm.constant_alignment\n\tinstead of CONSTANT_ALIGNMENT.\n\t* varasm.c (align_variable, get_variable_align, build_constant_desc)\n\t(force_const_mem): Likewise.\n\t* config/aarch64/aarch64.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/aarch64/aarch64.c (aarch64_constant_alignment): New function.\n\t(aarch64_classify_address): Call it instead of CONSTANT_ALIGNMENT.\n\t(TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t* config/alpha/alpha.h (CONSTANT_ALIGNMENT): Delete commented-out\n\tdefinition.\n\t* config/arc/arc.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/arc/arc.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/arm/arm.h (CONSTANT_ALIGNMENT_FACTOR): Delete.\n\t(CONSTANT_ALIGNMENT): Likewise.\n\t* config/arm/arm.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t(arm_constant_alignment): New function.\n\t* config/bfin/bfin.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/bfin/bfin.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/cr16/cr16.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/cr16/cr16.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/cris/cris.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/cris/cris.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t(cris_constant_alignment): New function.\n\t* config/epiphany/epiphany.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/epiphany/epiphany.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t(epiphany_constant_alignment): New function.\n\t* config/fr30/fr30.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/fr30/fr30.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/frv/frv.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/frv/frv.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/ft32/ft32.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/ft32/ft32.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/i386/i386.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/i386/i386-protos.h (ix86_constant_alignment): Delete.\n\t* config/i386/i386.c (ix86_constant_alignment): Make static.\n\tUse the same interface as the target hook.\n\t(TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t* config/ia64/ia64.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/ia64/ia64.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/iq2000/iq2000.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/iq2000/iq2000.c (iq2000_constant_alignment): New function.\n\t(TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t* config/lm32/lm32.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/lm32/lm32.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/m32r/m32r.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/m32r/m32r.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/mcore/mcore.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/mcore/mcore.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/microblaze/microblaze.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/microblaze/microblaze.c (microblaze_constant_alignment):\n\tNew function.\n\t(TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t* config/mips/mips.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/mips/mips.c (mips_constant_alignment): New function.\n\t(TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t* config/mmix/mmix.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/mmix/mmix-protos.h (mmix_constant_alignment): Delete.\n\t* config/mmix/mmix.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t(mmix_constant_alignment): Make static.  Use the same interface\n\tas the target hook.\n\t* config/moxie/moxie.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/moxie/moxie.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/nios2/nios2.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/nios2/nios2.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/pa/pa.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/pa/pa.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/powerpcspe/powerpcspe.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/powerpcspe/powerpcspe.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t(rs6000_constant_alignment): New function.\n\t* config/riscv/riscv.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/riscv/riscv.c (riscv_constant_alignment): New function.\n\t(TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t* config/rs6000/rs6000.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/rs6000/rs6000.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t(rs6000_constant_alignment): New function.\n\t* config/s390/s390.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/s390/s390.c (s390_constant_alignment): New function.\n\t(TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t* config/sh/sh.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/sh/sh.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/sparc/sparc.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/sparc/sparc.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t(sparc_constant_alignment): New function.\n\t* config/spu/spu.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/spu/spu.c (spu_constant_alignment): New function.\n\t(TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t* config/stormy16/stormy16.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/stormy16/stormy16.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/tilegx/tilegx.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/tilegx/tilegx.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/tilepro/tilepro.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/tilepro/tilepro.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n\tconstant_alignment_word_strings.\n\t* config/visium/visium.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/visium/visium.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t(visium_constant_alignment): New function.\n\t* config/xtensa/xtensa.h (CONSTANT_ALIGNMENT): Delete.\n\t* config/xtensa/xtensa.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n\t(xtensa_constant_alignment): New function.\n\t* system.h (CONSTANT_ALIGNMENT): Poison.\n\nIndex: gcc/target.def\n===================================================================\n--- gcc/target.def\t2017-09-22 17:31:56.428954480 +0100\n+++ gcc/target.def\t2017-09-22 17:37:26.791614385 +0100\n@@ -3335,6 +3335,21 @@ HOOK_VECTOR_END (addr_space)\n #undef HOOK_PREFIX\n #define HOOK_PREFIX \"TARGET_\"\n \n+DEFHOOK\n+(constant_alignment,\n+ \"This hook returns the alignment in bits of a constant that is being\\n\\\n+placed in memory.  @var{constant} is the constant and @var{basic_align}\\n\\\n+is the alignment that the object would ordinarily have.\\n\\\n+\\n\\\n+The default definition just returns @var{basic_align}.\\n\\\n+\\n\\\n+The typical use of this hook is to increase alignment for string\\n\\\n+constants to be word aligned so that @code{strcpy} calls that copy\\n\\\n+constants can be done inline.  The function\\n\\\n+@code{constant_alignment_word_strings} provides such a definition.\",\n+ HOST_WIDE_INT, (const_tree constant, HOST_WIDE_INT basic_align),\n+ default_constant_alignment)\n+\n /* True if MODE is valid for the target.  By \"valid\", we mean able to\n    be manipulated in non-trivial ways.  In particular, this means all\n    the arithmetic is supported.  */\nIndex: gcc/defaults.h\n===================================================================\n--- gcc/defaults.h\t2017-09-12 14:27:14.524325620 +0100\n+++ gcc/defaults.h\t2017-09-22 17:37:26.788614385 +0100\n@@ -1265,10 +1265,6 @@ #define WORD_REGISTER_OPERATIONS 0\n #define LOAD_EXTEND_OP(M) UNKNOWN\n #endif\n \n-#ifndef CONSTANT_ALIGNMENT\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN) ALIGN\n-#endif\n-\n #ifndef INITIAL_FRAME_ADDRESS_RTX\n #define INITIAL_FRAME_ADDRESS_RTX NULL\n #endif\nIndex: gcc/doc/tm.texi.in\n===================================================================\n--- gcc/doc/tm.texi.in\t2017-09-22 17:31:36.934389276 +0100\n+++ gcc/doc/tm.texi.in\t2017-09-22 17:37:26.790614385 +0100\n@@ -1050,19 +1050,7 @@ must be aligned to 16 byte boundaries.\n If this macro is not defined, then @var{basic-align} is used.\n @end defmac\n \n-@defmac CONSTANT_ALIGNMENT (@var{constant}, @var{basic-align})\n-If defined, a C expression to compute the alignment given to a constant\n-that is being placed in memory.  @var{constant} is the constant and\n-@var{basic-align} is the alignment that the object would ordinarily\n-have.  The value of this macro is used instead of that alignment to\n-align the object.\n-\n-The default definition just returns @var{basic-align}.\n-\n-The typical use of this macro is to increase alignment for string\n-constants to be word aligned so that @code{strcpy} calls that copy\n-constants can be done inline.\n-@end defmac\n+@hook TARGET_CONSTANT_ALIGNMENT\n \n @defmac LOCAL_ALIGNMENT (@var{type}, @var{basic-align})\n If defined, a C expression to compute the alignment for a variable in\nIndex: gcc/doc/tm.texi\n===================================================================\n--- gcc/doc/tm.texi\t2017-09-22 17:31:56.428006577 +0100\n+++ gcc/doc/tm.texi\t2017-09-22 17:37:26.789614385 +0100\n@@ -1102,19 +1102,18 @@ must be aligned to 16 byte boundaries.\n If this macro is not defined, then @var{basic-align} is used.\n @end defmac\n \n-@defmac CONSTANT_ALIGNMENT (@var{constant}, @var{basic-align})\n-If defined, a C expression to compute the alignment given to a constant\n-that is being placed in memory.  @var{constant} is the constant and\n-@var{basic-align} is the alignment that the object would ordinarily\n-have.  The value of this macro is used instead of that alignment to\n-align the object.\n+@deftypefn {Target Hook} HOST_WIDE_INT TARGET_CONSTANT_ALIGNMENT (const_tree @var{constant}, HOST_WIDE_INT @var{basic_align})\n+This hook returns the alignment in bits of a constant that is being\n+placed in memory.  @var{constant} is the constant and @var{basic_align}\n+is the alignment that the object would ordinarily have.\n \n-The default definition just returns @var{basic-align}.\n+The default definition just returns @var{basic_align}.\n \n-The typical use of this macro is to increase alignment for string\n+The typical use of this hook is to increase alignment for string\n constants to be word aligned so that @code{strcpy} calls that copy\n-constants can be done inline.\n-@end defmac\n+constants can be done inline.  The function\n+@code{constant_alignment_word_strings} provides such a definition.\n+@end deftypefn\n \n @defmac LOCAL_ALIGNMENT (@var{type}, @var{basic-align})\n If defined, a C expression to compute the alignment for a variable in\nIndex: gcc/targhooks.h\n===================================================================\n--- gcc/targhooks.h\t2017-09-22 17:31:36.935337179 +0100\n+++ gcc/targhooks.h\t2017-09-22 17:37:26.791614385 +0100\n@@ -93,6 +93,9 @@ extern int default_builtin_vectorization\n \n extern tree default_builtin_reciprocal (tree);\n \n+extern HOST_WIDE_INT default_constant_alignment (const_tree, HOST_WIDE_INT);\n+extern HOST_WIDE_INT constant_alignment_word_strings (const_tree,\n+\t\t\t\t\t\t      HOST_WIDE_INT);\n extern HOST_WIDE_INT default_vector_alignment (const_tree);\n \n extern HOST_WIDE_INT default_preferred_vector_alignment (const_tree);\nIndex: gcc/targhooks.c\n===================================================================\n--- gcc/targhooks.c\t2017-09-22 17:31:36.935337179 +0100\n+++ gcc/targhooks.c\t2017-09-22 17:37:26.791614385 +0100\n@@ -1165,6 +1165,25 @@ tree default_mangle_decl_assembler_name\n    return id;\n }\n \n+/* The default implementation of TARGET_CONSTANT_ALIGNMENT.  */\n+\n+HOST_WIDE_INT\n+default_constant_alignment (const_tree, HOST_WIDE_INT align)\n+{\n+  return align;\n+}\n+\n+/* An implementation of TARGET_CONSTANT_ALIGNMENT that aligns strings\n+   to at least BITS_PER_WORD but otherwise makes no changes.  */\n+\n+HOST_WIDE_INT\n+constant_alignment_word_strings (const_tree exp, HOST_WIDE_INT align)\n+{\n+  if (TREE_CODE (exp) == STRING_CST)\n+    return MAX (align, BITS_PER_WORD);\n+  return align;\n+}\n+\n /* Default to natural alignment for vector types.  */\n HOST_WIDE_INT\n default_vector_alignment (const_tree type)\nIndex: gcc/builtins.c\n===================================================================\n--- gcc/builtins.c\t2017-09-05 20:56:49.744887619 +0100\n+++ gcc/builtins.c\t2017-09-22 17:37:26.746614388 +0100\n@@ -283,7 +283,7 @@ get_object_alignment_2 (tree exp, unsign\n       exp = DECL_INITIAL (exp);\n       align = TYPE_ALIGN (TREE_TYPE (exp));\n       if (CONSTANT_CLASS_P (exp))\n-\talign = (unsigned) CONSTANT_ALIGNMENT (exp, align);\n+\talign = targetm.constant_alignment (exp, align);\n \n       known_alignment = true;\n     }\n@@ -359,7 +359,7 @@ get_object_alignment_2 (tree exp, unsign\n          wrapped inside a CONST_DECL.  */\n       align = TYPE_ALIGN (TREE_TYPE (exp));\n       if (CONSTANT_CLASS_P (exp))\n-\talign = (unsigned) CONSTANT_ALIGNMENT (exp, align);\n+\talign = targetm.constant_alignment (exp, align);\n \n       known_alignment = true;\n     }\nIndex: gcc/varasm.c\n===================================================================\n--- gcc/varasm.c\t2017-09-21 22:34:52.782138953 +0100\n+++ gcc/varasm.c\t2017-09-22 17:37:26.792614385 +0100\n@@ -1055,7 +1055,7 @@ align_variable (tree decl, bool dont_out\n \t      && (in_lto_p || DECL_INITIAL (decl) != error_mark_node))\n \t    {\n \t      unsigned int const_align\n-\t\t= CONSTANT_ALIGNMENT (DECL_INITIAL (decl), align);\n+\t\t= targetm.constant_alignment (DECL_INITIAL (decl), align);\n \t      /* Don't increase alignment too much for TLS variables - TLS\n \t\t space is too precious.  */\n \t      if (! DECL_THREAD_LOCAL_P (decl) || const_align <= BITS_PER_WORD)\n@@ -1106,8 +1106,8 @@ get_variable_align (tree decl)\n \t     to mark offlined constructors.  */\n \t  && (in_lto_p || DECL_INITIAL (decl) != error_mark_node))\n \t{\n-\t  unsigned int const_align = CONSTANT_ALIGNMENT (DECL_INITIAL (decl),\n-\t\t\t\t\t\t\t align);\n+\t  unsigned int const_align\n+\t    = targetm.constant_alignment (DECL_INITIAL (decl), align);\n \t  /* Don't increase alignment too much for TLS variables - TLS space\n \t     is too precious.  */\n \t  if (! DECL_THREAD_LOCAL_P (decl) || const_align <= BITS_PER_WORD)\n@@ -3326,12 +3326,10 @@ build_constant_desc (tree exp)\n      Instead we set the flag that will be recognized in make_decl_rtl.  */\n   DECL_IN_CONSTANT_POOL (decl) = 1;\n   DECL_INITIAL (decl) = desc->value;\n-  /* ??? CONSTANT_ALIGNMENT hasn't been updated for vector types on most\n-     architectures so use DATA_ALIGNMENT as well, except for strings.  */\n+  /* ??? targetm.constant_alignment hasn't been updated for vector types on\n+     most architectures so use DATA_ALIGNMENT as well, except for strings.  */\n   if (TREE_CODE (exp) == STRING_CST)\n-    {\n-      SET_DECL_ALIGN (decl, CONSTANT_ALIGNMENT (exp, DECL_ALIGN (decl)));\n-    }\n+    SET_DECL_ALIGN (decl, targetm.constant_alignment (exp, DECL_ALIGN (decl)));\n   else\n     align_variable (decl, 0);\n \n@@ -3790,7 +3788,7 @@ force_const_mem (machine_mode mode, rtx\n \n   tree type = lang_hooks.types.type_for_mode (mode, 0);\n   if (type != NULL_TREE)\n-    align = CONSTANT_ALIGNMENT (make_tree (type, x), align);\n+    align = targetm.constant_alignment (make_tree (type, x), align);\n \n   pool->offset += (align / BITS_PER_UNIT) - 1;\n   pool->offset &= ~ ((align / BITS_PER_UNIT) - 1);\nIndex: gcc/config/aarch64/aarch64.h\n===================================================================\n--- gcc/config/aarch64/aarch64.h\t2017-09-21 22:35:16.977238356 +0100\n+++ gcc/config/aarch64/aarch64.h\t2017-09-22 17:37:26.747614388 +0100\n@@ -90,14 +90,6 @@ #define LONG_DOUBLE_TYPE_SIZE\t128\n    port.  */\n #define TARGET_PTRMEMFUNC_VBIT_LOCATION ptrmemfunc_vbit_in_delta\n \n-/* Make strings word-aligned so that strcpy from constants will be\n-   faster.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)\t\t\\\n-  ((TREE_CODE (EXP) == STRING_CST\t\t\\\n-    && !optimize_size\t\t\t\t\\\n-    && (ALIGN) < BITS_PER_WORD)\t\t\t\\\n-   ? BITS_PER_WORD : ALIGN)\n-\n /* Align definitions of arrays, unions and structures so that\n    initializations and copies can be made more efficient.  This is not\n    ABI-changing, so it only affects places where we can see the\nIndex: gcc/config/aarch64/aarch64.c\n===================================================================\n--- gcc/config/aarch64/aarch64.c\t2017-09-22 17:35:22.483794044 +0100\n+++ gcc/config/aarch64/aarch64.c\t2017-09-22 17:37:26.747614388 +0100\n@@ -1142,6 +1142,17 @@ aarch64_hard_regno_caller_save_mode (uns\n     return choose_hard_reg_mode (regno, nregs, false);\n }\n \n+/* Implement TARGET_CONSTANT_ALIGNMENT.  Make strings word-aligned so\n+   that strcpy from constants will be faster.  */\n+\n+static HOST_WIDE_INT\n+aarch64_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n+{\n+  if (TREE_CODE (exp) == STRING_CST && !optimize_size)\n+    return MAX (align, BITS_PER_WORD);\n+  return align;\n+}\n+\n /* Return true if calls to DECL should be treated as\n    long-calls (ie called via a register).  */\n static bool\n@@ -4622,7 +4633,7 @@ aarch64_classify_address (struct aarch64\n \t\t{\n \t\t  tree exp = SYMBOL_REF_DECL (sym);\n \t\t  align = TYPE_ALIGN (TREE_TYPE (exp));\n-\t\t  align = CONSTANT_ALIGNMENT (exp, align);\n+\t\t  align = aarch64_constant_alignment (exp, align);\n \t\t}\n \t      else if (SYMBOL_REF_DECL (sym))\n \t\talign = DECL_ALIGN (SYMBOL_REF_DECL (sym));\n@@ -15687,6 +15698,9 @@ #define TARGET_MODES_TIEABLE_P aarch64_m\n #define TARGET_HARD_REGNO_CALL_PART_CLOBBERED \\\n   aarch64_hard_regno_call_part_clobbered\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT aarch64_constant_alignment\n+\n #if CHECKING_P\n #undef TARGET_RUN_TARGET_SELFTESTS\n #define TARGET_RUN_TARGET_SELFTESTS selftest::aarch64_run_selftests\nIndex: gcc/config/alpha/alpha.h\n===================================================================\n--- gcc/config/alpha/alpha.h\t2017-09-15 14:47:33.167333414 +0100\n+++ gcc/config/alpha/alpha.h\t2017-09-22 17:37:26.748614388 +0100\n@@ -289,7 +289,6 @@ #define MINIMUM_ATOMIC_ALIGNMENT ((unsig\n /* ??? Only if block-move stuff knows about different source/destination\n    alignment.  */\n #if 0\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN) MAX ((ALIGN), BITS_PER_WORD)\n #define DATA_ALIGNMENT(EXP, ALIGN) MAX ((ALIGN), BITS_PER_WORD)\n #endif\n \nIndex: gcc/config/arc/arc.h\n===================================================================\n--- gcc/config/arc/arc.h\t2017-09-15 14:47:33.167333414 +0100\n+++ gcc/config/arc/arc.h\t2017-09-22 17:37:26.749614388 +0100\n@@ -271,13 +271,6 @@ #define BIGGEST_ALIGNMENT 32\n /* The best alignment to use in cases where we have a choice.  */\n #define FASTEST_ALIGNMENT 32\n \n-/* Make strings word-aligned so strcpy from constants will be faster.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n-  ((TREE_CODE (EXP) == STRING_CST\t\\\n-    && (ALIGN) < FASTEST_ALIGNMENT)\t\\\n-   ? FASTEST_ALIGNMENT : (ALIGN))\n-\n-\n /* Make arrays of chars word-aligned for the same reasons.  */\n #define LOCAL_ALIGNMENT(TYPE, ALIGN)             \\\n   (TREE_CODE (TYPE) == ARRAY_TYPE               \\\nIndex: gcc/config/arc/arc.c\n===================================================================\n--- gcc/config/arc/arc.c\t2017-09-12 14:29:25.225531070 +0100\n+++ gcc/config/arc/arc.c\t2017-09-22 17:37:26.749614388 +0100\n@@ -10657,6 +10657,9 @@ arc_use_anchors_for_symbol_p (const_rtx\n #undef TARGET_USE_ANCHORS_FOR_SYMBOL_P\n #define TARGET_USE_ANCHORS_FOR_SYMBOL_P arc_use_anchors_for_symbol_p\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \n #include \"gt-arc.h\"\nIndex: gcc/config/arm/arm.h\n===================================================================\n--- gcc/config/arm/arm.h\t2017-09-22 17:22:08.191305805 +0100\n+++ gcc/config/arm/arm.h\t2017-09-22 17:37:26.752614387 +0100\n@@ -592,15 +592,6 @@ #define MALLOC_ABI_ALIGNMENT  BIGGEST_AL\n #define BIGGEST_FIELD_ALIGNMENT 64\n #endif\n \n-/* Make strings word-aligned so strcpy from constants will be faster.  */\n-#define CONSTANT_ALIGNMENT_FACTOR (TARGET_THUMB || ! arm_tune_xscale ? 1 : 2)\n-\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)\t\t\t\t\\\n-   ((TREE_CODE (EXP) == STRING_CST\t\t\t\t\\\n-     && !optimize_size\t\t\t\t\t\t\\\n-     && (ALIGN) < BITS_PER_WORD * CONSTANT_ALIGNMENT_FACTOR)\t\\\n-    ? BITS_PER_WORD * CONSTANT_ALIGNMENT_FACTOR : (ALIGN))\n-\n /* Align definitions of arrays, unions and structures so that\n    initializations and copies can be made more efficient.  This is not\n    ABI-changing, so it only affects places where we can see the\nIndex: gcc/config/arm/arm.c\n===================================================================\n--- gcc/config/arm/arm.c\t2017-09-22 17:35:22.486794044 +0100\n+++ gcc/config/arm/arm.c\t2017-09-22 17:37:26.751614388 +0100\n@@ -316,6 +316,7 @@ static opt_scalar_float_mode arm_floatn_\n static unsigned int arm_hard_regno_nregs (unsigned int, machine_mode);\n static bool arm_hard_regno_mode_ok (unsigned int, machine_mode);\n static bool arm_modes_tieable_p (machine_mode, machine_mode);\n+static HOST_WIDE_INT arm_constant_alignment (const_tree, HOST_WIDE_INT);\n \f\n /* Table of machine attributes.  */\n static const struct attribute_spec arm_attribute_table[] =\n@@ -795,6 +796,9 @@ #define TARGET_MODES_TIEABLE_P arm_modes\n \n #undef TARGET_CAN_CHANGE_MODE_CLASS\n #define TARGET_CAN_CHANGE_MODE_CLASS arm_can_change_mode_class\n+\n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT arm_constant_alignment\n \f\n /* Obstack for minipool constant handling.  */\n static struct obstack minipool_obstack;\n@@ -31276,6 +31280,18 @@ arm_can_change_mode_class (machine_mode\n   return true;\n }\n \n+/* Implement TARGET_CONSTANT_ALIGNMENT.  Make strings word-aligned so\n+   strcpy from constants will be faster.  */\n+\n+static HOST_WIDE_INT\n+arm_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n+{\n+  unsigned int factor = (TARGET_THUMB || ! arm_tune_xscale ? 1 : 2);\n+  if (TREE_CODE (exp) == STRING_CST && !optimize_size)\n+    return MAX (align, BITS_PER_WORD * factor);\n+  return align;\n+}\n+\n #if CHECKING_P\n namespace selftest {\n \nIndex: gcc/config/bfin/bfin.h\n===================================================================\n--- gcc/config/bfin/bfin.h\t2017-09-15 14:47:33.168333307 +0100\n+++ gcc/config/bfin/bfin.h\t2017-09-22 17:37:26.753614387 +0100\n@@ -321,11 +321,6 @@ #define ACCUMULATE_OUTGOING_ARGS 1\n \n #define LOCAL_ALIGNMENT(TYPE, ALIGN) bfin_local_alignment ((TYPE), (ALIGN))\n \n-/* Make strings word-aligned so strcpy from constants will be faster.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n-  (TREE_CODE (EXP) == STRING_CST        \\\n-   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))    \n-\n #define TRAMPOLINE_SIZE (TARGET_FDPIC ? 30 : 18)\n \f\n /* Definitions for register eliminations.\nIndex: gcc/config/bfin/bfin.c\n===================================================================\n--- gcc/config/bfin/bfin.c\t2017-09-12 14:29:25.228530938 +0100\n+++ gcc/config/bfin/bfin.c\t2017-09-22 17:37:26.752614387 +0100\n@@ -5882,4 +5882,7 @@ #define TARGET_HARD_REGNO_MODE_OK bfin_h\n #undef TARGET_MODES_TIEABLE_P\n #define TARGET_MODES_TIEABLE_P bfin_modes_tieable_p\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\nIndex: gcc/config/cr16/cr16.h\n===================================================================\n--- gcc/config/cr16/cr16.h\t2017-09-15 14:47:33.168333307 +0100\n+++ gcc/config/cr16/cr16.h\t2017-09-22 17:37:26.753614387 +0100\n@@ -114,11 +114,6 @@ #define DATA_ALIGNMENT(TYPE, ALIGN)\n      && ((ALIGN) < BITS_PER_WORD))               \\\n      ? (BITS_PER_WORD) : (ALIGN))\n \n-/* In CR16 strings are word-aligned; strcpy from constants will be faster.  */\n-#define CONSTANT_ALIGNMENT(CONSTANT, ALIGN)                            \\\n-  (((TREE_CODE (CONSTANT) == STRING_CST) && ((ALIGN) < BITS_PER_WORD)) \\\n-     ? (BITS_PER_WORD) : (ALIGN))\n-\n #define STRICT_ALIGNMENT 0\n \n #define PCC_BITFIELD_TYPE_MATTERS 1\nIndex: gcc/config/cr16/cr16.c\n===================================================================\n--- gcc/config/cr16/cr16.c\t2017-09-12 14:29:25.229530894 +0100\n+++ gcc/config/cr16/cr16.c\t2017-09-22 17:37:26.753614387 +0100\n@@ -200,6 +200,9 @@ #define TARGET_REGISTER_MOVE_COST \tcr16_\n #undef TARGET_MEMORY_MOVE_COST\n #define TARGET_MEMORY_MOVE_COST \tcr16_memory_move_cost\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT\tconstant_alignment_word_strings\n+\n /* Table of machine attributes.  */\n static const struct attribute_spec cr16_attribute_table[] = {\n   /* ISRs have special prologue and epilogue requirements.  */\nIndex: gcc/config/cris/cris.h\n===================================================================\n--- gcc/config/cris/cris.h\t2017-09-15 14:47:33.169333199 +0100\n+++ gcc/config/cris/cris.h\t2017-09-22 17:37:26.754614387 +0100\n@@ -368,17 +368,6 @@ #define DATA_ALIGNMENT(TYPE, BASIC_ALIGN\n      ? (BASIC_ALIGN < 32 ? 32 : BASIC_ALIGN)\t\t\t\\\n      : (BASIC_ALIGN < 16 ? 16 : BASIC_ALIGN)) : BASIC_ALIGN)\n \n-/* Note that CONSTANT_ALIGNMENT has the effect of making gcc believe that\n-   ALL references to constant stuff (in code segment, like strings) has\n-   this alignment.  That is a rather rushed assumption.  Luckily we do not\n-   care about the \"alignment\" operand to builtin memcpy (only place where\n-   it counts), so it doesn't affect any bad spots.  */\n-#define CONSTANT_ALIGNMENT(CONSTANT, BASIC_ALIGN)\t\t\\\n- (TARGET_CONST_ALIGN\t\t\t\t\t\t\\\n-  ? (TARGET_ALIGN_BY_32\t\t\t\t\t\t\\\n-     ? (BASIC_ALIGN < 32 ? 32 : BASIC_ALIGN)\t\t\t\\\n-     : (BASIC_ALIGN < 16 ? 16 : BASIC_ALIGN)) : BASIC_ALIGN)\n-\n /* FIXME: Define LOCAL_ALIGNMENT for word and dword or arrays and\n    structures (if -mstack-align=), and check that it is good.  */\n \nIndex: gcc/config/cris/cris.c\n===================================================================\n--- gcc/config/cris/cris.c\t2017-09-12 14:29:25.229530894 +0100\n+++ gcc/config/cris/cris.c\t2017-09-22 17:37:26.754614387 +0100\n@@ -165,6 +165,7 @@ static bool cris_function_value_regno_p\n static void cris_file_end (void);\n static unsigned int cris_hard_regno_nregs (unsigned int, machine_mode);\n static bool cris_hard_regno_mode_ok (unsigned int, machine_mode);\n+static HOST_WIDE_INT cris_constant_alignment (const_tree, HOST_WIDE_INT);\n \n /* This is the parsed result of the \"-max-stack-stackframe=\" option.  If\n    it (still) is zero, then there was no such option given.  */\n@@ -287,6 +288,9 @@ #define TARGET_HARD_REGNO_NREGS cris_har\n #undef TARGET_HARD_REGNO_MODE_OK\n #define TARGET_HARD_REGNO_MODE_OK cris_hard_regno_mode_ok\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT cris_constant_alignment\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \n /* Helper for cris_load_multiple_op and cris_ret_movem_op.  */\n@@ -4325,6 +4329,23 @@ cris_hard_regno_mode_ok (unsigned int re\n \t      || (regno != CRIS_MOF_REGNUM && regno != CRIS_ACR_REGNUM)));\n }\n \n+/* Implement TARGET_CONSTANT_ALIGNMENT.  Note that this hook has the\n+   effect of making gcc believe that ALL references to constant stuff\n+   (in code segment, like strings) have this alignment.  That is a rather\n+   rushed assumption.  Luckily we do not care about the \"alignment\"\n+   operand to builtin memcpy (only place where it counts), so it doesn't\n+   affect any bad spots.  */\n+\n+static HOST_WIDE_INT\n+cris_constant_alignment (const_tree, HOST_WIDE_INT basic_align)\n+{\n+  if (!TARGET_CONST_ALIGN)\n+    return basic_align;\n+  if (TARGET_ALIGN_BY_32)\n+    return MAX (basic_align, 32);\n+  return MAX (basic_align, 16);\n+}\n+\n #if 0\n /* Various small functions to replace macros.  Only called from a\n    debugger.  They might collide with gcc functions or system functions,\nIndex: gcc/config/epiphany/epiphany.h\n===================================================================\n--- gcc/config/epiphany/epiphany.h\t2017-09-15 14:47:33.169333199 +0100\n+++ gcc/config/epiphany/epiphany.h\t2017-09-22 17:37:26.754614387 +0100\n@@ -147,12 +147,6 @@ #define FASTEST_ALIGNMENT 64\n \n #define MALLOC_ABI_ALIGNMENT BIGGEST_ALIGNMENT\n \n-/* Make strings dword-aligned so strcpy from constants will be faster.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n-  ((TREE_CODE (EXP) == STRING_CST\t\\\n-    && (ALIGN) < FASTEST_ALIGNMENT)\t\\\n-   ? FASTEST_ALIGNMENT : (ALIGN))\n-\n /* Make arrays of chars dword-aligned for the same reasons.\n    Also, align arrays of SImode items.  */\n #define DATA_ALIGNMENT(TYPE, ALIGN)\t\t\\\nIndex: gcc/config/epiphany/epiphany.c\n===================================================================\n--- gcc/config/epiphany/epiphany.c\t2017-09-04 11:49:42.897500726 +0100\n+++ gcc/config/epiphany/epiphany.c\t2017-09-22 17:37:26.754614387 +0100\n@@ -173,6 +173,9 @@ #define TARGET_ASM_ALIGNED_SI_OP \"\\t.wor\n \n #undef TARGET_HARD_REGNO_MODE_OK\n #define TARGET_HARD_REGNO_MODE_OK epiphany_hard_regno_mode_ok\n+\n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT epiphany_constant_alignment\n \f\n bool\n epiphany_is_interrupt_p (tree decl)\n@@ -3014,4 +3017,15 @@ epiphany_start_function (FILE *file, con\n   ASM_OUTPUT_FUNCTION_LABEL (file, name, decl);\n }\n \n+\n+/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n+\n+static HOST_WIDE_INT\n+epiphany_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n+{\n+  if (TREE_CODE (exp) == STRING_CST)\n+    return MAX (align, FASTEST_ALIGNMENT);\n+  return align;\n+}\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\nIndex: gcc/config/fr30/fr30.h\n===================================================================\n--- gcc/config/fr30/fr30.h\t2017-09-15 14:47:33.169333199 +0100\n+++ gcc/config/fr30/fr30.h\t2017-09-22 17:37:26.755614387 +0100\n@@ -88,10 +88,6 @@ #define DATA_ALIGNMENT(TYPE, ALIGN)\t\t\\\n    && TYPE_MODE (TREE_TYPE (TYPE)) == QImode\t\\\n    && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n \n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n-  (TREE_CODE (EXP) == STRING_CST\t\\\n-   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n-\n #define STRICT_ALIGNMENT 1\n \n #define PCC_BITFIELD_TYPE_MATTERS 1\nIndex: gcc/config/fr30/fr30.c\n===================================================================\n--- gcc/config/fr30/fr30.c\t2017-08-10 14:36:08.721447283 +0100\n+++ gcc/config/fr30/fr30.c\t2017-09-22 17:37:26.754614387 +0100\n@@ -190,6 +190,9 @@ #define TARGET_ASM_TRAMPOLINE_TEMPLATE f\n #undef TARGET_TRAMPOLINE_INIT\n #define TARGET_TRAMPOLINE_INIT fr30_trampoline_init\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \f\n \nIndex: gcc/config/frv/frv.h\n===================================================================\n--- gcc/config/frv/frv.h\t2017-09-15 14:47:33.169333199 +0100\n+++ gcc/config/frv/frv.h\t2017-09-22 17:37:26.756614387 +0100\n@@ -351,20 +351,6 @@ #define DATA_ALIGNMENT(TYPE, ALIGN)\t\t\\\n    && TYPE_MODE (TREE_TYPE (TYPE)) == QImode\t\\\n    && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n \n-/* If defined, a C expression to compute the alignment given to a constant that\n-   is being placed in memory.  CONSTANT is the constant and ALIGN is the\n-   alignment that the object would ordinarily have.  The value of this macro is\n-   used instead of that alignment to align the object.\n-\n-   If this macro is not defined, then ALIGN is used.\n-\n-   The typical use of this macro is to increase alignment for string constants\n-   to be word aligned so that `strcpy' calls that copy constants can be done\n-   inline.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n-  (TREE_CODE (EXP) == STRING_CST\t\\\n-   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n-\n /* Define this macro to be the value 1 if instructions will fail to work if\n    given data not on the nominal alignment.  If instructions will merely go\n    slower in that case, define this macro as 0.  */\nIndex: gcc/config/frv/frv.c\n===================================================================\n--- gcc/config/frv/frv.c\t2017-09-12 14:29:25.231530806 +0100\n+++ gcc/config/frv/frv.c\t2017-09-22 17:37:26.756614387 +0100\n@@ -523,6 +523,8 @@ #define TARGET_HARD_REGNO_NREGS frv_hard\n #define TARGET_HARD_REGNO_MODE_OK frv_hard_regno_mode_ok\n #undef TARGET_MODES_TIEABLE_P\n #define TARGET_MODES_TIEABLE_P frv_modes_tieable_p\n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n \n struct gcc_target targetm = TARGET_INITIALIZER;\n \nIndex: gcc/config/ft32/ft32.h\n===================================================================\n--- gcc/config/ft32/ft32.h\t2017-09-15 14:47:33.169333199 +0100\n+++ gcc/config/ft32/ft32.h\t2017-09-22 17:37:26.756614387 +0100\n@@ -354,12 +354,6 @@ #define PCC_BITFIELD_TYPE_MATTERS\n    is GET_MODE_SIZE(DImode).  */\n #define MAX_FIXED_MODE_SIZE 32\n \n-/* Make strings word-aligned so strcpy from constants will be faster.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n-  ((TREE_CODE (EXP) == STRING_CST       \\\n-    && (ALIGN) < FASTEST_ALIGNMENT)     \\\n-   ? FASTEST_ALIGNMENT : (ALIGN))\n-\n /* Set this nonzero if move instructions will actually fail to work\n    when given unaligned data.  */\n #define STRICT_ALIGNMENT 1\nIndex: gcc/config/ft32/ft32.c\n===================================================================\n--- gcc/config/ft32/ft32.c\t2017-08-30 12:18:46.608141057 +0100\n+++ gcc/config/ft32/ft32.c\t2017-09-22 17:37:26.756614387 +0100\n@@ -940,6 +940,9 @@ ft32_elf_encode_section_info (tree decl,\n     }\n }\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \n #include \"gt-ft32.h\"\nIndex: gcc/config/i386/i386.h\n===================================================================\n--- gcc/config/i386/i386.h\t2017-09-21 11:53:16.598005975 +0100\n+++ gcc/config/i386/i386.h\t2017-09-22 17:37:26.761614387 +0100\n@@ -848,20 +848,6 @@ #define ADJUST_FIELD_ALIGN(FIELD, TYPE,\n   x86_field_alignment ((TYPE), (COMPUTED))\n #endif\n \n-/* If defined, a C expression to compute the alignment given to a\n-   constant that is being placed in memory.  EXP is the constant\n-   and ALIGN is the alignment that the object would ordinarily have.\n-   The value of this macro is used instead of that alignment to align\n-   the object.\n-\n-   If this macro is not defined, then ALIGN is used.\n-\n-   The typical use of this macro is to increase alignment for string\n-   constants to be word aligned so that `strcpy' calls that copy\n-   constants can be done inline.  */\n-\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN) ix86_constant_alignment ((EXP), (ALIGN))\n-\n /* If defined, a C expression to compute the alignment for a static\n    variable.  TYPE is the data type, and ALIGN is the alignment that\n    the object would ordinarily have.  The value of this macro is used\nIndex: gcc/config/i386/i386-protos.h\n===================================================================\n--- gcc/config/i386/i386-protos.h\t2017-09-15 13:56:20.266148661 +0100\n+++ gcc/config/i386/i386-protos.h\t2017-09-22 17:37:26.756614387 +0100\n@@ -209,7 +209,6 @@ extern unsigned int ix86_local_alignment\n \t\t\t\t\t  unsigned int);\n extern unsigned int ix86_minimum_alignment (tree, machine_mode,\n \t\t\t\t\t    unsigned int);\n-extern int ix86_constant_alignment (tree, int);\n extern tree ix86_handle_shared_attribute (tree *, tree, tree, int, bool *);\n extern tree ix86_handle_selectany_attribute (tree *, tree, tree, int, bool *);\n extern int x86_field_alignment (tree, int);\nIndex: gcc/config/i386/i386.c\n===================================================================\n--- gcc/config/i386/i386.c\t2017-09-22 17:31:56.418527551 +0100\n+++ gcc/config/i386/i386.c\t2017-09-22 17:37:26.760614387 +0100\n@@ -31555,14 +31555,10 @@ ix86_sched_init_global (FILE *, int, int\n }\n \n \f\n-/* Compute the alignment given to a constant that is being placed in memory.\n-   EXP is the constant and ALIGN is the alignment that the object would\n-   ordinarily have.\n-   The value of this function is used instead of that alignment to align\n-   the object.  */\n+/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n \n-int\n-ix86_constant_alignment (tree exp, int align)\n+static HOST_WIDE_INT\n+ix86_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n {\n   if (TREE_CODE (exp) == REAL_CST || TREE_CODE (exp) == VECTOR_CST\n       || TREE_CODE (exp) == INTEGER_CST)\n@@ -53601,6 +53597,9 @@ #define TARGET_HARD_REGNO_CALL_PART_CLOB\n #undef TARGET_CAN_CHANGE_MODE_CLASS\n #define TARGET_CAN_CHANGE_MODE_CLASS ix86_can_change_mode_class\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT ix86_constant_alignment\n+\n #if CHECKING_P\n #undef TARGET_RUN_TARGET_SELFTESTS\n #define TARGET_RUN_TARGET_SELFTESTS selftest::ix86_run_selftests\nIndex: gcc/config/ia64/ia64.h\n===================================================================\n--- gcc/config/ia64/ia64.h\t2017-09-15 14:47:33.170333092 +0100\n+++ gcc/config/ia64/ia64.h\t2017-09-22 17:37:26.762614387 +0100\n@@ -185,15 +185,6 @@ #define DATA_ALIGNMENT(TYPE, ALIGN)\t\t\\\n    && TYPE_MODE (TREE_TYPE (TYPE)) == QImode\t\\\n    && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n \n-/* If defined, a C expression to compute the alignment given to a constant that\n-   is being placed in memory.  CONSTANT is the constant and ALIGN is the\n-   alignment that the object would ordinarily have.  The value of this macro is\n-   used instead of that alignment to align the object.  */\n-\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n-  (TREE_CODE (EXP) == STRING_CST\t\\\n-   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n-\n #define STRICT_ALIGNMENT 1\n \n /* Define this if you wish to imitate the way many other C compilers handle\nIndex: gcc/config/ia64/ia64.c\n===================================================================\n--- gcc/config/ia64/ia64.c\t2017-09-22 17:31:56.419475454 +0100\n+++ gcc/config/ia64/ia64.c\t2017-09-22 17:37:26.762614387 +0100\n@@ -672,6 +672,9 @@ #define TARGET_MODES_TIEABLE_P ia64_mode\n #undef TARGET_CAN_CHANGE_MODE_CLASS\n #define TARGET_CAN_CHANGE_MODE_CLASS ia64_can_change_mode_class\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \f\n /* Returns TRUE iff the target attribute indicated by ATTR_ID takes a plain\nIndex: gcc/config/iq2000/iq2000.h\n===================================================================\n--- gcc/config/iq2000/iq2000.h\t2017-09-15 14:47:33.170333092 +0100\n+++ gcc/config/iq2000/iq2000.h\t2017-09-22 17:37:26.763614387 +0100\n@@ -96,10 +96,6 @@ #define DATA_ALIGNMENT(TYPE, ALIGN)\n \t|| TREE_CODE (TYPE) == UNION_TYPE\t\t\t\t\\\n \t|| TREE_CODE (TYPE) == RECORD_TYPE)) ? BITS_PER_WORD : (ALIGN))\n \n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)\t\t\t\t\t\\\n-  ((TREE_CODE (EXP) == STRING_CST  || TREE_CODE (EXP) == CONSTRUCTOR)\t\\\n-   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n-\n #define EMPTY_FIELD_BOUNDARY 32\n \n #define STRUCTURE_SIZE_BOUNDARY 8\nIndex: gcc/config/iq2000/iq2000.c\n===================================================================\n--- gcc/config/iq2000/iq2000.c\t2017-09-04 11:50:24.548966298 +0100\n+++ gcc/config/iq2000/iq2000.c\t2017-09-22 17:37:26.762614387 +0100\n@@ -180,6 +180,7 @@ static void iq2000_print_operand_address\n static bool iq2000_print_operand_punct_valid_p (unsigned char code);\n static bool iq2000_hard_regno_mode_ok (unsigned int, machine_mode);\n static bool iq2000_modes_tieable_p (machine_mode, machine_mode);\n+static HOST_WIDE_INT iq2000_constant_alignment (const_tree, HOST_WIDE_INT);\n \n #undef  TARGET_INIT_BUILTINS\n #define TARGET_INIT_BUILTINS \t\tiq2000_init_builtins\n@@ -264,6 +265,9 @@ #define TARGET_HARD_REGNO_MODE_OK\tiq2000\n #undef  TARGET_MODES_TIEABLE_P\n #define TARGET_MODES_TIEABLE_P\t\tiq2000_modes_tieable_p\n \n+#undef  TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT\tiq2000_constant_alignment\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \f\n /* Return nonzero if we split the address into high and low parts.  */\n@@ -3532,4 +3536,14 @@ iq2000_modes_tieable_p (machine_mode mod\n \t      || GET_MODE_CLASS (mode2) == MODE_COMPLEX_FLOAT));\n }\n \n+/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n+\n+static HOST_WIDE_INT\n+iq2000_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n+{\n+  if (TREE_CODE (exp) == STRING_CST || TREE_CODE (exp) == CONSTRUCTOR)\n+    return MAX (align, BITS_PER_WORD);\n+  return align;\n+}\n+\n #include \"gt-iq2000.h\"\nIndex: gcc/config/lm32/lm32.h\n===================================================================\n--- gcc/config/lm32/lm32.h\t2017-09-15 14:47:33.171332984 +0100\n+++ gcc/config/lm32/lm32.h\t2017-09-22 17:37:26.763614387 +0100\n@@ -99,11 +99,6 @@ #define STRICT_ALIGNMENT 1\n \n #define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT\n \n-/* Make strings word-aligned so strcpy from constants will be faster.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n-  (TREE_CODE (EXP) == STRING_CST\t\\\n-   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n-\n /* Make arrays and structures word-aligned to allow faster copying etc.  */\n #define DATA_ALIGNMENT(TYPE, ALIGN)\t\t\t\t\t\\\n   ((((ALIGN) < BITS_PER_WORD)\t\t\t\t\t\t\\\nIndex: gcc/config/lm32/lm32.c\n===================================================================\n--- gcc/config/lm32/lm32.c\t2017-09-05 20:56:49.753937121 +0100\n+++ gcc/config/lm32/lm32.c\t2017-09-22 17:37:26.763614387 +0100\n@@ -113,6 +113,9 @@ #define TARGET_HARD_REGNO_MODE_OK lm32_h\n #undef TARGET_MODES_TIEABLE_P\n #define TARGET_MODES_TIEABLE_P lm32_modes_tieable_p\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \n /* Current frame information calculated by lm32_compute_frame_size.  */\nIndex: gcc/config/m32r/m32r.h\n===================================================================\n--- gcc/config/m32r/m32r.h\t2017-09-15 14:47:33.171332984 +0100\n+++ gcc/config/m32r/m32r.h\t2017-09-22 17:37:26.766614387 +0100\n@@ -260,12 +260,6 @@ #define BIGGEST_ALIGNMENT 32\n /* The best alignment to use in cases where we have a choice.  */\n #define FASTEST_ALIGNMENT 32\n \n-/* Make strings word-aligned so strcpy from constants will be faster.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)\t\\\n-  ((TREE_CODE (EXP) == STRING_CST\t\\\n-    && (ALIGN) < FASTEST_ALIGNMENT)\t\\\n-   ? FASTEST_ALIGNMENT : (ALIGN))\n-\n /* Make arrays of chars word-aligned for the same reasons.  */\n #define DATA_ALIGNMENT(TYPE, ALIGN)\t\t\t\t\t\\\n   (TREE_CODE (TYPE) == ARRAY_TYPE\t\t\t\t\t\\\nIndex: gcc/config/m32r/m32r.c\n===================================================================\n--- gcc/config/m32r/m32r.c\t2017-09-04 11:50:08.518432217 +0100\n+++ gcc/config/m32r/m32r.c\t2017-09-22 17:37:26.765614387 +0100\n@@ -217,6 +217,9 @@ #define TARGET_HARD_REGNO_MODE_OK m32r_h\n #undef TARGET_MODES_TIEABLE_P\n #define TARGET_MODES_TIEABLE_P m32r_modes_tieable_p\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \f\n /* Called by m32r_option_override to initialize various things.  */\nIndex: gcc/config/mcore/mcore.h\n===================================================================\n--- gcc/config/mcore/mcore.h\t2017-09-15 14:47:33.171332984 +0100\n+++ gcc/config/mcore/mcore.h\t2017-09-22 17:37:26.766614387 +0100\n@@ -148,12 +148,6 @@ #define\tPCC_BITFIELD_TYPE_MATTERS\t1\n    is GET_MODE_SIZE(DImode).  */\n #define MAX_FIXED_MODE_SIZE 32\n \n-/* Make strings word-aligned so strcpy from constants will be faster.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n-  ((TREE_CODE (EXP) == STRING_CST\t\\\n-    && (ALIGN) < FASTEST_ALIGNMENT)\t\\\n-   ? FASTEST_ALIGNMENT : (ALIGN))\n-\n /* Make arrays of chars word-aligned for the same reasons.  */\n #define DATA_ALIGNMENT(TYPE, ALIGN)\t\t\\\n   (TREE_CODE (TYPE) == ARRAY_TYPE\t\t\\\nIndex: gcc/config/mcore/mcore.c\n===================================================================\n--- gcc/config/mcore/mcore.c\t2017-09-04 11:50:08.519332606 +0100\n+++ gcc/config/mcore/mcore.c\t2017-09-22 17:37:26.766614387 +0100\n@@ -248,6 +248,9 @@ #define TARGET_HARD_REGNO_MODE_OK mcore_\n #undef TARGET_MODES_TIEABLE_P\n #define TARGET_MODES_TIEABLE_P mcore_modes_tieable_p\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \f\n /* Adjust the stack and return the number of bytes taken to do it.  */\nIndex: gcc/config/microblaze/microblaze.h\n===================================================================\n--- gcc/config/microblaze/microblaze.h\t2017-09-15 14:47:33.172332877 +0100\n+++ gcc/config/microblaze/microblaze.h\t2017-09-22 17:37:26.767614387 +0100\n@@ -234,12 +234,6 @@ #define SIZE_TYPE \"unsigned int\"\n #undef PTRDIFF_TYPE\n #define PTRDIFF_TYPE \"int\"\n \n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)\t\t\t\t\t\\\n-  ((TREE_CODE (EXP) == STRING_CST  || TREE_CODE (EXP) == CONSTRUCTOR)\t\\\n-   && (ALIGN) < BITS_PER_WORD\t\t\t\t\t\t\\\n-\t? BITS_PER_WORD\t\t\t\t\t\t\t\\\n-\t: (ALIGN))\n-\n #define DATA_ALIGNMENT(TYPE, ALIGN)\t\t\t\t\t\\\n   ((((ALIGN) < BITS_PER_WORD)\t\t\t\t\t\t\\\n     && (TREE_CODE (TYPE) == ARRAY_TYPE\t\t\t\t\t\\\nIndex: gcc/config/microblaze/microblaze.c\n===================================================================\n--- gcc/config/microblaze/microblaze.c\t2017-09-05 20:56:49.754842071 +0100\n+++ gcc/config/microblaze/microblaze.c\t2017-09-22 17:37:26.767614387 +0100\n@@ -3800,6 +3800,16 @@ microblaze_machine_dependent_reorg (void\n       return;\n     }\n }\n+\n+/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n+\n+static HOST_WIDE_INT\n+microblaze_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n+{\n+  if (TREE_CODE (exp) == STRING_CST || TREE_CODE (exp) == CONSTRUCTOR)\n+    return MAX (align, BITS_PER_WORD);\n+  return align;\n+}\n \f\n #undef TARGET_ENCODE_SECTION_INFO\n #define TARGET_ENCODE_SECTION_INFO      microblaze_encode_section_info\n@@ -3904,6 +3914,9 @@ #define TARGET_HARD_REGNO_MODE_OK microb\n #undef TARGET_MODES_TIEABLE_P\n #define TARGET_MODES_TIEABLE_P microblaze_modes_tieable_p\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT microblaze_constant_alignment\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \f\n #include \"gt-microblaze.h\"\nIndex: gcc/config/mips/mips.h\n===================================================================\n--- gcc/config/mips/mips.h\t2017-09-15 14:47:33.174332662 +0100\n+++ gcc/config/mips/mips.h\t2017-09-22 17:37:26.769614386 +0100\n@@ -1636,22 +1636,6 @@ #define STRICT_ALIGNMENT 1\n \n #define PCC_BITFIELD_TYPE_MATTERS 1\n \n-/* If defined, a C expression to compute the alignment given to a\n-   constant that is being placed in memory.  CONSTANT is the constant\n-   and ALIGN is the alignment that the object would ordinarily have.\n-   The value of this macro is used instead of that alignment to align\n-   the object.\n-\n-   If this macro is not defined, then ALIGN is used.\n-\n-   The typical use of this macro is to increase alignment for string\n-   constants to be word aligned so that `strcpy' calls that copy\n-   constants can be done inline.  */\n-\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)\t\t\t\t\t\\\n-  ((TREE_CODE (EXP) == STRING_CST  || TREE_CODE (EXP) == CONSTRUCTOR)\t\\\n-   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n-\n /* If defined, a C expression to compute the alignment for a static\n    variable.  TYPE is the data type, and ALIGN is the alignment that\n    the object would ordinarily have.  The value of this macro is used\nIndex: gcc/config/mips/mips.c\n===================================================================\n--- gcc/config/mips/mips.c\t2017-09-22 17:31:56.421371259 +0100\n+++ gcc/config/mips/mips.c\t2017-09-22 17:37:26.769614386 +0100\n@@ -22336,6 +22336,16 @@ mips_truly_noop_truncation (unsigned int\n {\n   return !TARGET_64BIT || inprec <= 32 || outprec > 32;\n }\n+\n+/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n+\n+static HOST_WIDE_INT\n+mips_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n+{\n+  if (TREE_CODE (exp) == STRING_CST || TREE_CODE (exp) == CONSTRUCTOR)\n+    return MAX (align, BITS_PER_WORD);\n+  return align;\n+}\n \f\n /* Initialize the GCC target structure.  */\n #undef TARGET_ASM_ALIGNED_HI_OP\n@@ -22634,6 +22644,9 @@ #define TARGET_CAN_CHANGE_MODE_CLASS mip\n #undef TARGET_TRULY_NOOP_TRUNCATION\n #define TARGET_TRULY_NOOP_TRUNCATION mips_truly_noop_truncation\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT mips_constant_alignment\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \f\n #include \"gt-mips.h\"\nIndex: gcc/config/mmix/mmix.h\n===================================================================\n--- gcc/config/mmix/mmix.h\t2017-09-15 14:47:33.174332662 +0100\n+++ gcc/config/mmix/mmix.h\t2017-09-22 17:37:26.770614386 +0100\n@@ -167,9 +167,6 @@ #define MAX_OFILE_ALIGNMENT (32768 * 8)\n #define DATA_ABI_ALIGNMENT(TYPE, BASIC_ALIGN) \\\n  mmix_data_alignment (TYPE, BASIC_ALIGN)\n \n-#define CONSTANT_ALIGNMENT(CONSTANT, BASIC_ALIGN) \\\n- mmix_constant_alignment (CONSTANT, BASIC_ALIGN)\n-\n #define LOCAL_ALIGNMENT(TYPE, BASIC_ALIGN) \\\n  mmix_local_alignment (TYPE, BASIC_ALIGN)\n \nIndex: gcc/config/mmix/mmix-protos.h\n===================================================================\n--- gcc/config/mmix/mmix-protos.h\t2017-02-23 19:54:26.000000000 +0000\n+++ gcc/config/mmix/mmix-protos.h\t2017-09-22 17:37:26.769614386 +0100\n@@ -47,7 +47,6 @@ extern unsigned mmix_dbx_register_number\n extern int mmix_use_simple_return (void);\n extern void mmix_make_decl_one_only (tree);\n extern int mmix_data_alignment (tree, int);\n-extern int mmix_constant_alignment (tree, int);\n extern unsigned mmix_local_alignment (tree, unsigned);\n extern void mmix_asm_output_pool_prologue (FILE *, const char *, tree, int);\n extern void mmix_asm_output_aligned_common (FILE *, const char *, int, int);\nIndex: gcc/config/mmix/mmix.c\n===================================================================\n--- gcc/config/mmix/mmix.c\t2017-08-30 12:08:01.655417455 +0100\n+++ gcc/config/mmix/mmix.c\t2017-09-22 17:37:26.770614386 +0100\n@@ -168,6 +168,7 @@ static void mmix_print_operand (FILE *,\n static void mmix_print_operand_address (FILE *, machine_mode, rtx);\n static bool mmix_print_operand_punct_valid_p (unsigned char);\n static void mmix_conditional_register_usage (void);\n+static HOST_WIDE_INT mmix_constant_alignment (const_tree, HOST_WIDE_INT);\n \n /* Target structure macros.  Listed by node.  See `Using and Porting GCC'\n    for a general description.  */\n@@ -282,6 +283,9 @@ #define TARGET_TRAMPOLINE_INIT mmix_tram\n #undef TARGET_OPTION_OVERRIDE\n #define TARGET_OPTION_OVERRIDE mmix_option_override\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT mmix_constant_alignment\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \n /* Functions that are expansions for target macros.\n@@ -334,10 +338,10 @@ mmix_data_alignment (tree type ATTRIBUTE\n   return basic_align;\n }\n \n-/* CONSTANT_ALIGNMENT.  */\n+/* Implement tARGET_CONSTANT_ALIGNMENT.  */\n \n-int\n-mmix_constant_alignment (tree constant ATTRIBUTE_UNUSED, int basic_align)\n+static HOST_WIDE_INT\n+mmix_constant_alignment (const_tree, HOST_WIDE_INT basic_align)\n {\n   if (basic_align < 32)\n     return 32;\nIndex: gcc/config/moxie/moxie.h\n===================================================================\n--- gcc/config/moxie/moxie.h\t2017-09-15 14:47:33.175332555 +0100\n+++ gcc/config/moxie/moxie.h\t2017-09-22 17:37:26.770614386 +0100\n@@ -317,12 +317,6 @@ #define\tPCC_BITFIELD_TYPE_MATTERS\t1\n    is GET_MODE_SIZE(DImode).  */\n #define MAX_FIXED_MODE_SIZE 32\n \n-/* Make strings word-aligned so strcpy from constants will be faster.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n-  ((TREE_CODE (EXP) == STRING_CST\t\\\n-    && (ALIGN) < FASTEST_ALIGNMENT)\t\\\n-   ? FASTEST_ALIGNMENT : (ALIGN))\n-\n /* Make arrays of chars word-aligned for the same reasons.  */\n #define DATA_ALIGNMENT(TYPE, ALIGN)\t\t\\\n   (TREE_CODE (TYPE) == ARRAY_TYPE\t\t\\\nIndex: gcc/config/moxie/moxie.c\n===================================================================\n--- gcc/config/moxie/moxie.c\t2017-08-10 14:36:08.735446777 +0100\n+++ gcc/config/moxie/moxie.c\t2017-09-22 17:37:26.770614386 +0100\n@@ -667,6 +667,9 @@ #define TARGET_PRINT_OPERAND moxie_print\n #undef  TARGET_PRINT_OPERAND_ADDRESS\n #define TARGET_PRINT_OPERAND_ADDRESS moxie_print_operand_address\n \n+#undef  TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \n #include \"gt-moxie.h\"\nIndex: gcc/config/nios2/nios2.h\n===================================================================\n--- gcc/config/nios2/nios2.h\t2017-09-15 14:47:33.175332555 +0100\n+++ gcc/config/nios2/nios2.h\t2017-09-22 17:37:26.771614386 +0100\n@@ -92,10 +92,6 @@ #define STACK_BOUNDARY 32\n #define PREFERRED_STACK_BOUNDARY 32\n #define MAX_FIXED_MODE_SIZE 64\n \n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)                          \\\n-  ((TREE_CODE (EXP) == STRING_CST)                              \\\n-   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n-\n #define LABEL_ALIGN(LABEL) nios2_label_align (LABEL)\n \n /* Layout of source language data types.  */\nIndex: gcc/config/nios2/nios2.c\n===================================================================\n--- gcc/config/nios2/nios2.c\t2017-09-04 11:50:24.551667467 +0100\n+++ gcc/config/nios2/nios2.c\t2017-09-22 17:37:26.771614386 +0100\n@@ -5116,6 +5116,9 @@ #define TARGET_ASM_OUTPUT_MI_THUNK nios2\n #undef TARGET_MACHINE_DEPENDENT_REORG\n #define TARGET_MACHINE_DEPENDENT_REORG nios2_reorg\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \n #include \"gt-nios2.h\"\nIndex: gcc/config/pa/pa.h\n===================================================================\n--- gcc/config/pa/pa.h\t2017-09-15 14:47:33.176332447 +0100\n+++ gcc/config/pa/pa.h\t2017-09-22 17:37:26.772614386 +0100\n@@ -309,11 +309,6 @@ #define BIGGEST_ALIGNMENT (2 * BITS_PER_\n    atomic operations.  */\n #define MALLOC_ABI_ALIGNMENT (TARGET_SOM ? 64 : 128)\n \n-/* Get around hp-ux assembler bug, and make strcpy of constants fast.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)\t\t\\\n-  (TREE_CODE (EXP) == STRING_CST\t\t\\\n-   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n-\n /* Make arrays of chars word-aligned for the same reasons.  */\n #define DATA_ALIGNMENT(TYPE, ALIGN)\t\t\\\n   (TREE_CODE (TYPE) == ARRAY_TYPE\t\t\\\nIndex: gcc/config/pa/pa.c\n===================================================================\n--- gcc/config/pa/pa.c\t2017-09-15 13:56:20.276148823 +0100\n+++ gcc/config/pa/pa.c\t2017-09-22 17:37:26.772614386 +0100\n@@ -425,6 +425,9 @@ #define TARGET_MODES_TIEABLE_P pa_modes_\n #undef TARGET_CAN_CHANGE_MODE_CLASS\n #define TARGET_CAN_CHANGE_MODE_CLASS pa_can_change_mode_class\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \f\n /* Parse the -mfixed-range= option string.  */\nIndex: gcc/config/powerpcspe/powerpcspe.h\n===================================================================\n--- gcc/config/powerpcspe/powerpcspe.h\t2017-09-15 14:47:33.176332447 +0100\n+++ gcc/config/powerpcspe/powerpcspe.h\t2017-09-22 17:37:26.775614386 +0100\n@@ -978,14 +978,6 @@ enum data_align { align_abi, align_opt,\n #define LOCAL_ALIGNMENT(TYPE, ALIGN)\t\t\t\t\\\n   rs6000_data_alignment (TYPE, ALIGN, align_both)\n \n-/* Make strings word-aligned so strcpy from constants will be faster.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)                           \\\n-  (TREE_CODE (EXP) == STRING_CST\t                         \\\n-   && (STRICT_ALIGNMENT || !optimize_size)                       \\\n-   && (ALIGN) < BITS_PER_WORD                                    \\\n-   ? BITS_PER_WORD                                               \\\n-   : (ALIGN))\n-\n /* Make arrays of chars word-aligned for the same reasons.  */\n #define DATA_ALIGNMENT(TYPE, ALIGN) \\\n   rs6000_data_alignment (TYPE, ALIGN, align_opt)\nIndex: gcc/config/powerpcspe/powerpcspe.c\n===================================================================\n--- gcc/config/powerpcspe/powerpcspe.c\t2017-09-22 17:31:56.424214967 +0100\n+++ gcc/config/powerpcspe/powerpcspe.c\t2017-09-22 17:37:26.775614386 +0100\n@@ -1984,6 +1984,9 @@ #define TARGET_SLOW_UNALIGNED_ACCESS rs6\n \n #undef TARGET_CAN_CHANGE_MODE_CLASS\n #define TARGET_CAN_CHANGE_MODE_CLASS rs6000_can_change_mode_class\n+\n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT rs6000_constant_alignment\n \f\n \n /* Processor table.  */\n@@ -43752,6 +43755,17 @@ rs6000_optab_supported_p (int op, machin\n       return true;\n     }\n }\n+\n+/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n+\n+static HOST_WIDE_INT\n+rs6000_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n+{\n+  if (TREE_CODE (exp) == STRING_CST\n+      && (STRICT_ALIGNMENT || !optimize_size))\n+    return MAX (align, BITS_PER_WORD);\n+  return align;\n+}\n \f\n struct gcc_target targetm = TARGET_INITIALIZER;\n \nIndex: gcc/config/riscv/riscv.h\n===================================================================\n--- gcc/config/riscv/riscv.h\t2017-09-15 14:47:33.176332447 +0100\n+++ gcc/config/riscv/riscv.h\t2017-09-22 17:37:26.776614386 +0100\n@@ -152,22 +152,6 @@ #define STRICT_ALIGNMENT TARGET_STRICT_A\n \n #define PCC_BITFIELD_TYPE_MATTERS 1\n \n-/* If defined, a C expression to compute the alignment given to a\n-   constant that is being placed in memory.  CONSTANT is the constant\n-   and ALIGN is the alignment that the object would ordinarily have.\n-   The value of this macro is used instead of that alignment to align\n-   the object.\n-\n-   If this macro is not defined, then ALIGN is used.\n-\n-   The typical use of this macro is to increase alignment for string\n-   constants to be word aligned so that `strcpy' calls that copy\n-   constants can be done inline.  */\n-\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)\t\t\t\t\t\\\n-  ((TREE_CODE (EXP) == STRING_CST  || TREE_CODE (EXP) == CONSTRUCTOR)\t\\\n-   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n-\n /* If defined, a C expression to compute the alignment for a static\n    variable.  TYPE is the data type, and ALIGN is the alignment that\n    the object would ordinarily have.  The value of this macro is used\nIndex: gcc/config/riscv/riscv.c\n===================================================================\n--- gcc/config/riscv/riscv.c\t2017-09-15 13:56:20.282148920 +0100\n+++ gcc/config/riscv/riscv.c\t2017-09-22 17:37:26.776614386 +0100\n@@ -3995,6 +3995,17 @@ riscv_can_change_mode_class (machine_mod\n   return !reg_classes_intersect_p (FP_REGS, rclass);\n }\n \n+\n+/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n+\n+static HOST_WIDE_INT\n+riscv_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n+{\n+  if (TREE_CODE (exp) == STRING_CST || TREE_CODE (exp) == CONSTRUCTOR)\n+    return MAX (align, BITS_PER_WORD);\n+  return align;\n+}\n+\n /* Initialize the GCC target structure.  */\n #undef TARGET_ASM_ALIGNED_HI_OP\n #define TARGET_ASM_ALIGNED_HI_OP \"\\t.half\\t\"\n@@ -4142,6 +4153,9 @@ #define TARGET_SECONDARY_MEMORY_NEEDED r\n #undef TARGET_CAN_CHANGE_MODE_CLASS\n #define TARGET_CAN_CHANGE_MODE_CLASS riscv_can_change_mode_class\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT riscv_constant_alignment\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \n #include \"gt-riscv.h\"\nIndex: gcc/config/rs6000/rs6000.h\n===================================================================\n--- gcc/config/rs6000/rs6000.h\t2017-09-15 14:47:33.177332340 +0100\n+++ gcc/config/rs6000/rs6000.h\t2017-09-22 17:37:26.779614386 +0100\n@@ -950,14 +950,6 @@ enum data_align { align_abi, align_opt,\n #define LOCAL_ALIGNMENT(TYPE, ALIGN)\t\t\t\t\\\n   rs6000_data_alignment (TYPE, ALIGN, align_both)\n \n-/* Make strings word-aligned so strcpy from constants will be faster.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)                           \\\n-  (TREE_CODE (EXP) == STRING_CST\t                         \\\n-   && (STRICT_ALIGNMENT || !optimize_size)                       \\\n-   && (ALIGN) < BITS_PER_WORD                                    \\\n-   ? BITS_PER_WORD                                               \\\n-   : (ALIGN))\n-\n /* Make arrays of chars word-aligned for the same reasons.  */\n #define DATA_ALIGNMENT(TYPE, ALIGN) \\\n   rs6000_data_alignment (TYPE, ALIGN, align_opt)\nIndex: gcc/config/rs6000/rs6000.c\n===================================================================\n--- gcc/config/rs6000/rs6000.c\t2017-09-22 17:31:56.427058675 +0100\n+++ gcc/config/rs6000/rs6000.c\t2017-09-22 17:37:26.779614386 +0100\n@@ -1974,6 +1974,9 @@ #define TARGET_SLOW_UNALIGNED_ACCESS rs6\n \n #undef TARGET_CAN_CHANGE_MODE_CLASS\n #define TARGET_CAN_CHANGE_MODE_CLASS rs6000_can_change_mode_class\n+\n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT rs6000_constant_alignment\n \f\n \n /* Processor table.  */\n@@ -39128,6 +39131,17 @@ rs6000_optab_supported_p (int op, machin\n       return true;\n     }\n }\n+\n+/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n+\n+static HOST_WIDE_INT\n+rs6000_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n+{\n+  if (TREE_CODE (exp) == STRING_CST\n+      && (STRICT_ALIGNMENT || !optimize_size))\n+    return MAX (align, BITS_PER_WORD);\n+  return align;\n+}\n \f\n struct gcc_target targetm = TARGET_INITIALIZER;\n \nIndex: gcc/config/s390/s390.h\n===================================================================\n--- gcc/config/s390/s390.h\t2017-09-15 14:47:33.178332233 +0100\n+++ gcc/config/s390/s390.h\t2017-09-22 17:37:26.781614386 +0100\n@@ -315,7 +315,6 @@ #define BIGGEST_ALIGNMENT 64\n #define EMPTY_FIELD_BOUNDARY 32\n \n /* Alignment on even addresses for LARL instruction.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN)\n #define DATA_ABI_ALIGNMENT(TYPE, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN)\n \n /* Alignment is not required by the hardware.  */\nIndex: gcc/config/s390/s390.c\n===================================================================\n--- gcc/config/s390/s390.c\t2017-09-21 11:53:16.508848803 +0100\n+++ gcc/config/s390/s390.c\t2017-09-22 17:37:26.781614386 +0100\n@@ -15906,6 +15906,15 @@ s390_vector_alignment (const_tree type)\n   return MIN (64, tree_to_shwi (TYPE_SIZE (type)));\n }\n \n+/* Implement TARGET_CONSTANT_ALIGNMENT.  Alignment on even addresses for\n+   LARL instruction.  */\n+\n+static HOST_WIDE_INT\n+s390_constant_alignment (const_tree, HOST_WIDE_INT align)\n+{\n+  return MAX (align, 16);\n+}\n+\n #ifdef HAVE_AS_MACHINE_MACHINEMODE\n /* Implement TARGET_ASM_FILE_START.  */\n static void\n@@ -16325,6 +16334,9 @@ #define TARGET_OPTION_RESTORE s390_funct\n #undef TARGET_CAN_CHANGE_MODE_CLASS\n #define TARGET_CAN_CHANGE_MODE_CLASS s390_can_change_mode_class\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT s390_constant_alignment\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \n #include \"gt-s390.h\"\nIndex: gcc/config/sh/sh.h\n===================================================================\n--- gcc/config/sh/sh.h\t2017-09-15 14:47:33.178332233 +0100\n+++ gcc/config/sh/sh.h\t2017-09-22 17:37:26.782614386 +0100\n@@ -462,12 +462,6 @@ #define BIGGEST_ALIGNMENT  (TARGET_ALIGN\n /* The best alignment to use in cases where we have a choice.  */\n #define FASTEST_ALIGNMENT (32)\n \n-/* Make strings word-aligned so strcpy from constants will be faster.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)\t\\\n-  ((TREE_CODE (EXP) == STRING_CST\t\\\n-    && (ALIGN) < FASTEST_ALIGNMENT)\t\\\n-    ? FASTEST_ALIGNMENT : (ALIGN))\n-\n /* get_mode_alignment assumes complex values are always held in multiple\n    registers, but that is not the case on the SH; CQImode and CHImode are\n    held in a single integer register.  */\nIndex: gcc/config/sh/sh.c\n===================================================================\n--- gcc/config/sh/sh.c\t2017-09-15 13:56:20.288149017 +0100\n+++ gcc/config/sh/sh.c\t2017-09-22 17:37:26.782614386 +0100\n@@ -657,6 +657,9 @@ #define TARGET_MODES_TIEABLE_P sh_modes_\n #undef TARGET_CAN_CHANGE_MODE_CLASS\n #define TARGET_CAN_CHANGE_MODE_CLASS sh_can_change_mode_class\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \f\n \nIndex: gcc/config/sparc/sparc.h\n===================================================================\n--- gcc/config/sparc/sparc.h\t2017-09-15 14:47:33.178332233 +0100\n+++ gcc/config/sparc/sparc.h\t2017-09-22 17:37:26.784614385 +0100\n@@ -579,12 +579,6 @@ #define MAX_FIXED_MODE_SIZE GET_MODE_BIT\n #define STACK_SAVEAREA_MODE(LEVEL) \\\n   ((LEVEL) == SAVE_NONLOCAL ? (TARGET_ARCH64 ? TImode : DImode) : Pmode)\n \n-/* Make strings word-aligned so strcpy from constants will be faster.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n-  ((TREE_CODE (EXP) == STRING_CST\t\\\n-    && (ALIGN) < FASTEST_ALIGNMENT)\t\\\n-   ? FASTEST_ALIGNMENT : (ALIGN))\n-\n /* Make arrays of chars word-aligned for the same reasons.  */\n #define DATA_ALIGNMENT(TYPE, ALIGN)\t\t\\\n   (TREE_CODE (TYPE) == ARRAY_TYPE\t\t\\\nIndex: gcc/config/sparc/sparc.c\n===================================================================\n--- gcc/config/sparc/sparc.c\t2017-09-21 11:53:16.532263818 +0100\n+++ gcc/config/sparc/sparc.c\t2017-09-22 17:37:26.784614385 +0100\n@@ -684,6 +684,7 @@ static bool sparc_hard_regno_mode_ok (un\n static bool sparc_modes_tieable_p (machine_mode, machine_mode);\n static bool sparc_can_change_mode_class (machine_mode, machine_mode,\n \t\t\t\t\t reg_class_t);\n+static HOST_WIDE_INT sparc_constant_alignment (const_tree, HOST_WIDE_INT);\n \f\n #ifdef SUBTARGET_ATTRIBUTE_TABLE\n /* Table of valid machine attributes.  */\n@@ -925,6 +926,9 @@ #define TARGET_MODES_TIEABLE_P sparc_mod\n #undef TARGET_CAN_CHANGE_MODE_CLASS\n #define TARGET_CAN_CHANGE_MODE_CLASS sparc_can_change_mode_class\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT sparc_constant_alignment\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \n /* Return the memory reference contained in X if any, zero otherwise.  */\n@@ -13429,4 +13433,14 @@ sparc_can_change_mode_class (machine_mod\n   return true;\n }\n \n+/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n+\n+static HOST_WIDE_INT\n+sparc_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n+{\n+  if (TREE_CODE (exp) == STRING_CST)\n+    return MAX (align, FASTEST_ALIGNMENT);\n+  return align;\n+}\n+\n #include \"gt-sparc.h\"\nIndex: gcc/config/spu/spu.h\n===================================================================\n--- gcc/config/spu/spu.h\t2017-09-15 15:37:22.133931616 +0100\n+++ gcc/config/spu/spu.h\t2017-09-22 17:37:26.785614385 +0100\n@@ -96,7 +96,6 @@ #define MINIMUM_ATOMIC_ALIGNMENT 128\n    on the stack.  (Except a bug (?) allows some stack objects to be\n    unaligned.)  */\n #define DATA_ALIGNMENT(TYPE,ALIGN) ((ALIGN) > 128 ? (ALIGN) : 128)\n-#define CONSTANT_ALIGNMENT(TYPE,ALIGN) ((ALIGN) > 128 ? (ALIGN) : 128)\n #define LOCAL_ALIGNMENT(TYPE,ALIGN) ((ALIGN) > 128 ? (ALIGN) : 128)\n \n #define EMPTY_FIELD_BOUNDARY 32\nIndex: gcc/config/spu/spu.c\n===================================================================\n--- gcc/config/spu/spu.c\t2017-09-21 22:36:18.178401236 +0100\n+++ gcc/config/spu/spu.c\t2017-09-22 17:37:26.785614385 +0100\n@@ -4159,7 +4159,7 @@ spu_encode_section_info (tree decl, rtx\n    which is both 16-byte aligned and padded to a 16-byte boundary.  This\n    would make it safe to store with a single instruction. \n    We guarantee the alignment and padding for static objects by aligning\n-   all of them to 16-bytes. (DATA_ALIGNMENT and CONSTANT_ALIGNMENT.)\n+   all of them to 16-bytes. (DATA_ALIGNMENT and TARGET_CONSTANT_ALIGNMENT.)\n    FIXME: We currently cannot guarantee this for objects on the stack\n    because assign_parm_setup_stack calls assign_stack_local with the\n    alignment of the parameter mode and in that case the alignment never\n@@ -7193,6 +7193,18 @@ spu_truly_noop_truncation (unsigned int\n {\n   return inprec <= 32 && outprec <= inprec;\n }\n+\n+/* Implement TARGET_CONSTANT_ALIGNMENT.\n+\n+   Make all static objects 16-byte aligned.  This allows us to assume\n+   they are also padded to 16 bytes, which means we can use a single\n+   load or store instruction to access them.  */\n+\n+static HOST_WIDE_INT\n+spu_constant_alignment (const_tree, HOST_WIDE_INT align)\n+{\n+  return MAX (align, 128);\n+}\n \f\n /*  Table of machine attributes.  */\n static const struct attribute_spec spu_attribute_table[] =\n@@ -7433,6 +7445,9 @@ #define TARGET_CAN_CHANGE_MODE_CLASS spu\n #undef TARGET_TRULY_NOOP_TRUNCATION\n #define TARGET_TRULY_NOOP_TRUNCATION spu_truly_noop_truncation\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT spu_constant_alignment\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \n #include \"gt-spu.h\"\nIndex: gcc/config/stormy16/stormy16.h\n===================================================================\n--- gcc/config/stormy16/stormy16.h\t2017-09-15 14:47:33.179332125 +0100\n+++ gcc/config/stormy16/stormy16.h\t2017-09-22 17:37:26.785614385 +0100\n@@ -87,10 +87,6 @@ #define DATA_ALIGNMENT(TYPE, ALIGN)\t\t\\\n    && TYPE_MODE (TREE_TYPE (TYPE)) == QImode\t\\\n    && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n \n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n-  (TREE_CODE (EXP) == STRING_CST\t\\\n-   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n-\n #define STRICT_ALIGNMENT 1\n \n #define PCC_BITFIELD_TYPE_MATTERS 1\nIndex: gcc/config/stormy16/stormy16.c\n===================================================================\n--- gcc/config/stormy16/stormy16.c\t2017-09-04 11:50:08.540041564 +0100\n+++ gcc/config/stormy16/stormy16.c\t2017-09-22 17:37:26.785614385 +0100\n@@ -2715,6 +2715,9 @@ #define TARGET_HARD_REGNO_MODE_OK xstorm\n #undef TARGET_MODES_TIEABLE_P\n #define TARGET_MODES_TIEABLE_P xstormy16_modes_tieable_p\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \n #include \"gt-stormy16.h\"\nIndex: gcc/config/tilegx/tilegx.h\n===================================================================\n--- gcc/config/tilegx/tilegx.h\t2017-09-15 14:47:33.180332018 +0100\n+++ gcc/config/tilegx/tilegx.h\t2017-09-22 17:37:26.786614385 +0100\n@@ -94,13 +94,6 @@ #define FASTEST_ALIGNMENT 64\n #define BIGGEST_FIELD_ALIGNMENT 128\n #define WIDEST_HARDWARE_FP_SIZE 64\n \n-/* Make strings word-aligned so strcpy from constants will be\n-   faster.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n-  ((TREE_CODE (EXP) == STRING_CST\t\\\n-    && (ALIGN) < FASTEST_ALIGNMENT)\t\\\n-   ? FASTEST_ALIGNMENT : (ALIGN))\n-\n /* Make arrays of chars word-aligned for the same reasons.  */\n #define DATA_ALIGNMENT(TYPE, ALIGN)\t\t\\\n   (TREE_CODE (TYPE) == ARRAY_TYPE\t\t\\\nIndex: gcc/config/tilegx/tilegx.c\n===================================================================\n--- gcc/config/tilegx/tilegx.c\t2017-09-15 14:47:33.180332018 +0100\n+++ gcc/config/tilegx/tilegx.c\t2017-09-22 17:37:26.786614385 +0100\n@@ -5734,6 +5734,9 @@ #define TARGET_CAN_USE_DOLOOP_P can_use_\n #undef  TARGET_TRULY_NOOP_TRUNCATION\n #define TARGET_TRULY_NOOP_TRUNCATION tilegx_truly_noop_truncation\n \n+#undef  TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \n #include \"gt-tilegx.h\"\nIndex: gcc/config/tilepro/tilepro.h\n===================================================================\n--- gcc/config/tilepro/tilepro.h\t2017-09-15 14:47:33.180332018 +0100\n+++ gcc/config/tilepro/tilepro.h\t2017-09-22 17:37:26.787614385 +0100\n@@ -58,13 +58,6 @@ #define PCC_BITFIELD_TYPE_MATTERS 1\n #define FASTEST_ALIGNMENT 32\n #define BIGGEST_FIELD_ALIGNMENT 64\n \n-/* Make strings word-aligned so strcpy from constants will be\n-   faster.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n-  ((TREE_CODE (EXP) == STRING_CST\t\\\n-    && (ALIGN) < FASTEST_ALIGNMENT)\t\\\n-   ? FASTEST_ALIGNMENT : (ALIGN))\n-\n /* Make arrays of chars word-aligned for the same reasons.  */\n #define DATA_ALIGNMENT(TYPE, ALIGN)\t\t\\\n   (TREE_CODE (TYPE) == ARRAY_TYPE\t\t\\\nIndex: gcc/config/tilepro/tilepro.c\n===================================================================\n--- gcc/config/tilepro/tilepro.c\t2017-09-04 08:30:09.354408112 +0100\n+++ gcc/config/tilepro/tilepro.c\t2017-09-22 17:37:26.786614385 +0100\n@@ -5091,6 +5091,9 @@ #define TARGET_ASM_FILE_END tilepro_file\n #undef  TARGET_CAN_USE_DOLOOP_P\n #define TARGET_CAN_USE_DOLOOP_P can_use_doloop_if_innermost\n \n+#undef  TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \n #include \"gt-tilepro.h\"\nIndex: gcc/config/visium/visium.h\n===================================================================\n--- gcc/config/visium/visium.h\t2017-09-15 14:47:33.181331910 +0100\n+++ gcc/config/visium/visium.h\t2017-09-22 17:37:26.787614385 +0100\n@@ -236,16 +236,6 @@ #define BIGGEST_ALIGNMENT 32\n    this macro is used instead of that alignment to align the object. */\n #define DATA_ALIGNMENT(TYPE,ALIGN) visium_data_alignment (TYPE, ALIGN)\n \n-/* `CONSTANT_ALIGNMENT (CONSTANT, BASIC-ALIGN)`\n-\n-   If defined, a C expression to compute the alignment given to a\n-   constant that is being placed in memory.  CONSTANT is the constant\n-   and BASIC-ALIGN is the alignment that the object would ordinarily\n-   have.  The value of this macro is used instead of that alignment to\n-   align the object. */\n-#define CONSTANT_ALIGNMENT(EXP,ALIGN) \\\n-  visium_data_alignment (TREE_TYPE (EXP), ALIGN)\n-\n /* `LOCAL_ALIGNMENT (TYPE, BASIC-ALIGN)`\n \n    If defined, a C expression to compute the alignment for a variable\nIndex: gcc/config/visium/visium.c\n===================================================================\n--- gcc/config/visium/visium.c\t2017-09-15 13:56:20.293149098 +0100\n+++ gcc/config/visium/visium.c\t2017-09-22 17:37:26.787614385 +0100\n@@ -237,6 +237,8 @@ static bool visium_modes_tieable_p (mach\n static bool visium_can_change_mode_class (machine_mode, machine_mode,\n \t\t\t\t\t  reg_class_t);\n \n+static HOST_WIDE_INT visium_constant_alignment (const_tree, HOST_WIDE_INT);\n+\n /* Setup the global target hooks structure.  */\n \n #undef  TARGET_MAX_ANCHOR_OFFSET\n@@ -360,6 +362,9 @@ #define TARGET_MODES_TIEABLE_P visium_mo\n #undef TARGET_CAN_CHANGE_MODE_CLASS\n #define TARGET_CAN_CHANGE_MODE_CLASS visium_can_change_mode_class\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT visium_constant_alignment\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \n namespace {\n@@ -834,6 +839,14 @@ visium_data_alignment (tree type, unsign\n   return align;\n }\n \n+/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n+\n+static HOST_WIDE_INT\n+visium_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n+{\n+  return visium_data_alignment (TREE_TYPE (exp), align);\n+}\n+\n /* Helper function for HARD_REGNO_RENAME_OK (FROM, TO).  Return non-zero if\n    it is OK to rename a hard register FROM to another hard register TO.  */\n \nIndex: gcc/config/xtensa/xtensa.h\n===================================================================\n--- gcc/config/xtensa/xtensa.h\t2017-09-15 14:47:33.181331910 +0100\n+++ gcc/config/xtensa/xtensa.h\t2017-09-22 17:37:26.788614385 +0100\n@@ -169,17 +169,6 @@ #define PROMOTE_MODE(MODE, UNSIGNEDP, TY\n    bitfields and the structures that contain them.  */\n #define PCC_BITFIELD_TYPE_MATTERS 1\n \n-/* Align string constants and constructors to at least a word boundary.\n-   The typical use of this macro is to increase alignment for string\n-   constants to be word aligned so that 'strcpy' calls that copy\n-   constants can be done inline.  */\n-#define CONSTANT_ALIGNMENT(EXP, ALIGN)\t\t\t\t\t\\\n-  (!optimize_size &&\t\t\t\t\t\t\t\\\n-   (TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR)\t\\\n-   && (ALIGN) < BITS_PER_WORD\t\t\t\t\t\t\\\n-\t? BITS_PER_WORD\t\t\t\t\t\t\t\\\n-\t: (ALIGN))\n-\n /* Align arrays, unions and records to at least a word boundary.\n    One use of this macro is to increase alignment of medium-size\n    data to make it all fit in fewer cache lines.  Another is to\nIndex: gcc/config/xtensa/xtensa.c\n===================================================================\n--- gcc/config/xtensa/xtensa.c\t2017-09-12 14:29:25.261529490 +0100\n+++ gcc/config/xtensa/xtensa.c\t2017-09-22 17:37:26.788614385 +0100\n@@ -181,6 +181,7 @@ static void xtensa_conditional_register_\n static unsigned int xtensa_hard_regno_nregs (unsigned int, machine_mode);\n static bool xtensa_hard_regno_mode_ok (unsigned int, machine_mode);\n static bool xtensa_modes_tieable_p (machine_mode, machine_mode);\n+static HOST_WIDE_INT xtensa_constant_alignment (const_tree, HOST_WIDE_INT);\n \n \f\n \n@@ -317,6 +318,9 @@ #define TARGET_HARD_REGNO_MODE_OK xtensa\n #undef TARGET_MODES_TIEABLE_P\n #define TARGET_MODES_TIEABLE_P xtensa_modes_tieable_p\n \n+#undef TARGET_CONSTANT_ALIGNMENT\n+#define TARGET_CONSTANT_ALIGNMENT xtensa_constant_alignment\n+\n struct gcc_target targetm = TARGET_INITIALIZER;\n \n \f\n@@ -4380,4 +4384,19 @@ enum reg_class xtensa_regno_to_class (in\n     return regno_to_class[regno];\n }\n \n+/* Implement TARGET_CONSTANT_ALIGNMENT.  Align string constants and\n+   constructors to at least a word boundary.  The typical use of this\n+   macro is to increase alignment for string constants to be word\n+   aligned so that 'strcpy' calls that copy constants can be done\n+   inline.  */\n+\n+static HOST_WIDE_INT\n+xtensa_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n+{\n+  if ((TREE_CODE (exp) == STRING_CST || TREE_CODE (exp) == CONSTRUCTOR)\n+      && !optimize_size)\n+    return MAX (align, BITS_PER_WORD);\n+  return align;\n+}\n+\n #include \"gt-xtensa.h\"\nIndex: gcc/system.h\n===================================================================\n--- gcc/system.h\t2017-09-15 15:37:22.136931501 +0100\n+++ gcc/system.h\t2017-09-22 17:37:26.790614385 +0100\n@@ -915,7 +915,7 @@ #define realloc xrealloc\n \tMODES_TIEABLE_P FUNCTION_ARG_PADDING SLOW_UNALIGNED_ACCESS\t\\\n \tHARD_REGNO_NREGS SECONDARY_MEMORY_NEEDED_MODE\t\t\t\\\n \tSECONDARY_MEMORY_NEEDED CANNOT_CHANGE_MODE_CLASS\t\t\\\n-\tTRULY_NOOP_TRUNCATION FUNCTION_ARG_OFFSET\n+\tTRULY_NOOP_TRUNCATION FUNCTION_ARG_OFFSET CONSTANT_ALIGNMENT\n \n /* Target macros only used for code built for the target, that have\n    moved to libgcc-tm.h or have never been present elsewhere.  */","headers":{"Return-Path":"<gcc-patches-return-462794-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-462794-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=\"lJDAmELn\"; 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 3xzK6s4BZJz9s5L\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 23 Sep 2017 02:43:32 +1000 (AEST)","(qmail 62145 invoked by alias); 22 Sep 2017 16:43:13 -0000","(qmail 61465 invoked by uid 89); 22 Sep 2017 16:43:12 -0000","from mail-wm0-f42.google.com (HELO mail-wm0-f42.google.com)\n\t(74.125.82.42) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 22 Sep 2017 16:43:02 +0000","by mail-wm0-f42.google.com with SMTP id q124so5508377wmb.0 for\n\t<gcc-patches@gcc.gnu.org>; Fri, 22 Sep 2017 09:43:01 -0700 (PDT)","from localhost (94.197.121.89.threembb.co.uk. [94.197.121.89]) by\n\tsmtp.gmail.com with ESMTPSA id\n\tf10sm158053wrg.20.2017.09.22.09.42.55 (version=TLS1_2\n\tcipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tFri, 22 Sep 2017 09:42: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:cc:subject:references:date:in-reply-to:message-id\n\t:mime-version:content-type; q=dns; s=default; b=CT6tmxMYQ3fpWmxL\n\tCm6ijvFuqYV2E3O7MrWEB2fR0AH8mE466rEXAoNltEFkkP9+NRo6JnP9y14TAkn6\n\tKnNUZ+blfFdQX3a89IumRKidzXfePaxtiHNB2v0e+vJblGO8nsspj5+XUSmcZ0mx\n\tHGUp69tj7pVvDfhF/ucmOMK9pEQ=","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:cc:subject:references:date:in-reply-to:message-id\n\t:mime-version:content-type; s=default; bh=RaI4GsVy/5MlYCxedq9zoq\n\t4KU4M=; b=lJDAmELnr6OLhpre4206pFg0Exn6A06VQA98PIjY3lle01Hit8AdPd\n\tcSjDfBjq+9Ka0NvcgPl6E3GNJ3ZBT1pLpQNsRw8rgtci6CIyTIf2sWhbU0YZpbVq\n\tts3qhtSa5we3it8C3N3ACjZXlGN9z4TRFGhOlBimNY84KyhHwCksk=","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.8 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_STOCKGEN,\n\tRCVD_IN_DNSWL_NONE,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=9506","X-HELO":"mail-wm0-f42.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:cc:subject:references\n\t:date:in-reply-to:message-id:user-agent:mime-version;\n\tbh=Dorg8XbvkYVLdipWxLb+oPjjuR70/b3t2GV3BLlequw=;\n\tb=iHVr115vuoevl+MlX6Kwbt6rR8NonuaH8WRPQ4fTWtlcH67lqCMqPmZwTqFbyLAb/J\n\tq5yOQ8zdlHGvuw+IhNs4v6LOBx4jp1R8E4MUf8Z/CG9H3BwQpvtN8dI5yxjrVNZURPTj\n\tsTumqzArtx0Kzd9ggABX7RJ0/NlpgOjXVLP2JLrsixP3fqlhuqHryAA2d6j9VJtyEUhP\n\tRsvf6pJ2EYaoLZqjpZXuUYqgn1gVbsChKaH9YolYmlzzWQdsqvmGnfOl7sJzuHXaPlJ1\n\tKdhoLfXik3tSnM959QLKv9lrKivaWe61TDoMnC6LLmO8ULq6d3ppGJ4CSFjo1er0xeMd\n\tj7bA==","X-Gm-Message-State":"AHPjjUgn8jdE/VyJ9DQ0pUFGxBkQpBgEqn5C/mzDFOOnjnidUe86ejYV\tcV17d4jT+3M74WXdT1Su+7X0jxK+M8k=","X-Google-Smtp-Source":"AOwi7QDmK7FufDins3+FlByF7wyq51FPeNR744yfbiC8lfZl2FWKPde/Ehcj3Bp98f6T2iTRiL/Lrg==","X-Received":"by 10.28.74.144 with SMTP id n16mr4711852wmi.151.1506098576769;\n\tFri, 22 Sep 2017 09:42:56 -0700 (PDT)","From":"Richard Sandiford <richard.sandiford@linaro.org>","To":"Richard Biener <richard.guenther@gmail.com>","Mail-Followup-To":"Richard Biener <richard.guenther@gmail.com>,\n\tGCC Patches <gcc-patches@gcc.gnu.org>,\n\trichard.sandiford@linaro.org","Cc":"GCC Patches <gcc-patches@gcc.gnu.org>","Subject":"Re: Don't query the frontend for unsupported types","References":"<87shfhzgwc.fsf@linaro.org>\t<FDB20764-7B41-4630-B4C6-3DEAFCE53C58@gmail.com>\t<874lrw5hxk.fsf@linaro.org>\t<CAFiYyc35uOLn4E1qVR+4PERDL3vumapyZt3OiLGxn8MXGWANrQ@mail.gmail.com>","Date":"Fri, 22 Sep 2017 17:42:53 +0100","In-Reply-To":"<CAFiYyc35uOLn4E1qVR+4PERDL3vumapyZt3OiLGxn8MXGWANrQ@mail.gmail.com>\t(Richard\n\tBiener's message of \"Thu, 21 Sep 2017 17:03:21 +0200\")","Message-ID":"<87zi9mptv6.fsf@linaro.org>","User-Agent":"Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)","MIME-Version":"1.0","Content-Type":"text/plain"}},{"id":1774711,"web_url":"http://patchwork.ozlabs.org/comment/1774711/","msgid":"<CAFiYyc1+Bx0SFLqM=0HWxLkMpDZXWq1fs5Jkie=DDpk1j-ZS3A@mail.gmail.com>","list_archive_url":null,"date":"2017-09-25T12:53:46","subject":"Re: Don't query the frontend for unsupported types","submitter":{"id":1765,"url":"http://patchwork.ozlabs.org/api/people/1765/","name":"Richard Biener","email":"richard.guenther@gmail.com"},"content":"On Fri, Sep 22, 2017 at 6:42 PM, Richard Sandiford\n<richard.sandiford@linaro.org> wrote:\n> Richard Biener <richard.guenther@gmail.com> writes:\n>> On Thu, Sep 21, 2017 at 2:56 PM, Richard Sandiford\n>> <richard.sandiford@linaro.org> wrote:\n>>> Richard Biener <richard.guenther@gmail.com> writes:\n>>>> On September 20, 2017 2:36:03 PM GMT+02:00, Richard Sandiford\n>>>> <richard.sandiford@linaro.org> wrote:\n>>>>>When forcing a constant of mode MODE into memory, force_const_mem\n>>>>>asks the frontend to provide the type associated with that mode.\n>>>>>In principle type_for_mode is allowed to return null, and although\n>>>>>one use site correctly handled that, the other didn't.\n>>>>>\n>>>>>I think there's agreement that it's bogus to use type_for_mode for\n>>>>>this kind of thing, since it forces frontends to handle types that\n>>>>>don't exist in that language.  See e.g. http://gcc.gnu.org/PR46805\n>>>>>where the Go frontend was forced to handle vector types even though\n>>>>>Go doesn't have vector types.\n>>>>>\n>>>>>Also, the frontends use code like:\n>>>>>\n>>>>>  else if (VECTOR_MODE_P (mode))\n>>>>>    {\n>>>>>      machine_mode inner_mode = GET_MODE_INNER (mode);\n>>>>>      tree inner_type = c_common_type_for_mode (inner_mode, unsignedp);\n>>>>>      if (inner_type != NULL_TREE)\n>>>>>        return build_vector_type_for_mode (inner_type, mode);\n>>>>>    }\n>>>>>\n>>>>>and there's no guarantee that every vector mode M used by backend\n>>>>>rtl has an associated vector type whose TYPE_MODE is M.  I think\n>>>>>really the type_for_mode hook should only return trees that _do_ have\n>>>>>the requested TYPE_MODE, but PR46805 linked above shows that this is\n>>>>>likely to have too many knock-on consequences.  It doesn't make sense\n>>>>>for force_const_mem to ask about vector modes that aren't valid for\n>>>>>vector types, so this patch handles the condition there instead.\n>>>>>\n>>>>>This is needed for SVE multi-register modes, which are modelled as\n>>>>>vector modes but are not usable as vector types.\n>>>>>\n>>>>>Tested on aarch64-linux-gnu, x86_64-linux-gnu and\n>>>>>powerpc64le-linus-gnu.\n>>>>>OK to install?\n>>>>\n>>>> I think we should get rid of the use entirely.\n>>>\n>>> I first read this as not using type_for_mode at all in force_const_mem,\n>>> which sounded like a good thing :-)\n>>\n>> That's what I meant ;)  A mode doesn't really have a type...\n>>\n>>   I tried it overnight on the usual\n>>> at-least-one-target-per-CPU set and diffing the before and after\n>>> assembly for the testsuite.  And it looks like i686 relies on this\n>>> to get an alignment of 16 rather than 4 for XFmode constants:\n>>> GET_MODE_ALIGNMENT (XFmode) == 32 (as requested by i386-modes.def),\n>>> but i386's CONSTANT_ALIGNMENT increases it to 128 for static constants.\n>>\n>> Then the issue is that CONSTANT_ALIGNMENT takes a tree and not a mode...\n>> even worse than type_for_mode is a use of make_tree!  Incidentially\n>> ix86_constant_alignment _does_ look at the mode in the end...\n>\n> OK, I guess this means another target hook conversion.  The patch\n> below converts CONSTANT_ALIGNMENT with its current interface.\n> The definition:\n>\n>   #define CONSTANT_ALIGNMENT(EXP, ALIGN) \\\n>     (TREE_CODE (EXP) == STRING_CST \\\n>      && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n>\n> was very common, so the patch adds a canned definition for that,\n> called constant_alignment_word_strings.  Some ports had a variation\n> that used a port-local FASTEST_ALIGNMENT instead of BITS_PER_WORD;\n> the patch uses constant_alignment_word_strings if FASTEST_ALIGNMENT\n> was always BITS_PER_WORD and a port-local hook function otherwise.\n>\n> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.\n> Also tested by comparing the testsuite assembly output on at least one\n> target per CPU directory.  I don't think this comes under Jeff's\n> preapproval due to the constant_alignment_word_strings thing, so:\n> OK to install?\n\nOk.\n\nThanks,\nRichard.\n\n> If so, then I'll follow up with a separate hook for rtl modes, which\n> varasm, default_constant_alignment and constant_alignment_word_strings\n> can all use.\n>\n> Thanks,\n> Richard\n>\n>\n> 2017-09-22  Richard Sandiford  <richard.sandiford@linaro.org>\n>\n> gcc/\n>         * target.def (constant_alignment): New hook.\n>         * defaults.h (CONSTANT_ALIGNMENT): Delete.\n>         * doc/tm.texi.in (CONSTANT_ALIGNMENT): Replace with...\n>         (TARGET_CONSTANT_ALIGNMENT): ...this new hook.\n>         * doc/tm.texi: Regenerate.\n>         * targhooks.h (default_constant_alignment): Declare.\n>         (constant_alignment_word_strings): Likewise.\n>         * targhooks.c (default_constant_alignment): New function.\n>         (constant_alignment_word_strings): Likewise.\n>         * builtins.c (get_object_alignment_2): Use targetm.constant_alignment\n>         instead of CONSTANT_ALIGNMENT.\n>         * varasm.c (align_variable, get_variable_align, build_constant_desc)\n>         (force_const_mem): Likewise.\n>         * config/aarch64/aarch64.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/aarch64/aarch64.c (aarch64_constant_alignment): New function.\n>         (aarch64_classify_address): Call it instead of CONSTANT_ALIGNMENT.\n>         (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         * config/alpha/alpha.h (CONSTANT_ALIGNMENT): Delete commented-out\n>         definition.\n>         * config/arc/arc.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/arc/arc.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/arm/arm.h (CONSTANT_ALIGNMENT_FACTOR): Delete.\n>         (CONSTANT_ALIGNMENT): Likewise.\n>         * config/arm/arm.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         (arm_constant_alignment): New function.\n>         * config/bfin/bfin.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/bfin/bfin.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/cr16/cr16.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/cr16/cr16.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/cris/cris.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/cris/cris.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         (cris_constant_alignment): New function.\n>         * config/epiphany/epiphany.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/epiphany/epiphany.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         (epiphany_constant_alignment): New function.\n>         * config/fr30/fr30.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/fr30/fr30.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/frv/frv.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/frv/frv.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/ft32/ft32.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/ft32/ft32.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/i386/i386.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/i386/i386-protos.h (ix86_constant_alignment): Delete.\n>         * config/i386/i386.c (ix86_constant_alignment): Make static.\n>         Use the same interface as the target hook.\n>         (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         * config/ia64/ia64.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/ia64/ia64.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/iq2000/iq2000.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/iq2000/iq2000.c (iq2000_constant_alignment): New function.\n>         (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         * config/lm32/lm32.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/lm32/lm32.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/m32r/m32r.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/m32r/m32r.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/mcore/mcore.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/mcore/mcore.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/microblaze/microblaze.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/microblaze/microblaze.c (microblaze_constant_alignment):\n>         New function.\n>         (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         * config/mips/mips.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/mips/mips.c (mips_constant_alignment): New function.\n>         (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         * config/mmix/mmix.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/mmix/mmix-protos.h (mmix_constant_alignment): Delete.\n>         * config/mmix/mmix.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         (mmix_constant_alignment): Make static.  Use the same interface\n>         as the target hook.\n>         * config/moxie/moxie.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/moxie/moxie.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/nios2/nios2.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/nios2/nios2.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/pa/pa.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/pa/pa.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/powerpcspe/powerpcspe.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/powerpcspe/powerpcspe.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         (rs6000_constant_alignment): New function.\n>         * config/riscv/riscv.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/riscv/riscv.c (riscv_constant_alignment): New function.\n>         (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         * config/rs6000/rs6000.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/rs6000/rs6000.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         (rs6000_constant_alignment): New function.\n>         * config/s390/s390.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/s390/s390.c (s390_constant_alignment): New function.\n>         (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         * config/sh/sh.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/sh/sh.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/sparc/sparc.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/sparc/sparc.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         (sparc_constant_alignment): New function.\n>         * config/spu/spu.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/spu/spu.c (spu_constant_alignment): New function.\n>         (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         * config/stormy16/stormy16.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/stormy16/stormy16.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/tilegx/tilegx.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/tilegx/tilegx.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/tilepro/tilepro.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/tilepro/tilepro.c (TARGET_CONSTANT_ALIGNMENT): Redefine to\n>         constant_alignment_word_strings.\n>         * config/visium/visium.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/visium/visium.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         (visium_constant_alignment): New function.\n>         * config/xtensa/xtensa.h (CONSTANT_ALIGNMENT): Delete.\n>         * config/xtensa/xtensa.c (TARGET_CONSTANT_ALIGNMENT): Redefine.\n>         (xtensa_constant_alignment): New function.\n>         * system.h (CONSTANT_ALIGNMENT): Poison.\n>\n> Index: gcc/target.def\n> ===================================================================\n> --- gcc/target.def      2017-09-22 17:31:56.428954480 +0100\n> +++ gcc/target.def      2017-09-22 17:37:26.791614385 +0100\n> @@ -3335,6 +3335,21 @@ HOOK_VECTOR_END (addr_space)\n>  #undef HOOK_PREFIX\n>  #define HOOK_PREFIX \"TARGET_\"\n>\n> +DEFHOOK\n> +(constant_alignment,\n> + \"This hook returns the alignment in bits of a constant that is being\\n\\\n> +placed in memory.  @var{constant} is the constant and @var{basic_align}\\n\\\n> +is the alignment that the object would ordinarily have.\\n\\\n> +\\n\\\n> +The default definition just returns @var{basic_align}.\\n\\\n> +\\n\\\n> +The typical use of this hook is to increase alignment for string\\n\\\n> +constants to be word aligned so that @code{strcpy} calls that copy\\n\\\n> +constants can be done inline.  The function\\n\\\n> +@code{constant_alignment_word_strings} provides such a definition.\",\n> + HOST_WIDE_INT, (const_tree constant, HOST_WIDE_INT basic_align),\n> + default_constant_alignment)\n> +\n>  /* True if MODE is valid for the target.  By \"valid\", we mean able to\n>     be manipulated in non-trivial ways.  In particular, this means all\n>     the arithmetic is supported.  */\n> Index: gcc/defaults.h\n> ===================================================================\n> --- gcc/defaults.h      2017-09-12 14:27:14.524325620 +0100\n> +++ gcc/defaults.h      2017-09-22 17:37:26.788614385 +0100\n> @@ -1265,10 +1265,6 @@ #define WORD_REGISTER_OPERATIONS 0\n>  #define LOAD_EXTEND_OP(M) UNKNOWN\n>  #endif\n>\n> -#ifndef CONSTANT_ALIGNMENT\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN) ALIGN\n> -#endif\n> -\n>  #ifndef INITIAL_FRAME_ADDRESS_RTX\n>  #define INITIAL_FRAME_ADDRESS_RTX NULL\n>  #endif\n> Index: gcc/doc/tm.texi.in\n> ===================================================================\n> --- gcc/doc/tm.texi.in  2017-09-22 17:31:36.934389276 +0100\n> +++ gcc/doc/tm.texi.in  2017-09-22 17:37:26.790614385 +0100\n> @@ -1050,19 +1050,7 @@ must be aligned to 16 byte boundaries.\n>  If this macro is not defined, then @var{basic-align} is used.\n>  @end defmac\n>\n> -@defmac CONSTANT_ALIGNMENT (@var{constant}, @var{basic-align})\n> -If defined, a C expression to compute the alignment given to a constant\n> -that is being placed in memory.  @var{constant} is the constant and\n> -@var{basic-align} is the alignment that the object would ordinarily\n> -have.  The value of this macro is used instead of that alignment to\n> -align the object.\n> -\n> -The default definition just returns @var{basic-align}.\n> -\n> -The typical use of this macro is to increase alignment for string\n> -constants to be word aligned so that @code{strcpy} calls that copy\n> -constants can be done inline.\n> -@end defmac\n> +@hook TARGET_CONSTANT_ALIGNMENT\n>\n>  @defmac LOCAL_ALIGNMENT (@var{type}, @var{basic-align})\n>  If defined, a C expression to compute the alignment for a variable in\n> Index: gcc/doc/tm.texi\n> ===================================================================\n> --- gcc/doc/tm.texi     2017-09-22 17:31:56.428006577 +0100\n> +++ gcc/doc/tm.texi     2017-09-22 17:37:26.789614385 +0100\n> @@ -1102,19 +1102,18 @@ must be aligned to 16 byte boundaries.\n>  If this macro is not defined, then @var{basic-align} is used.\n>  @end defmac\n>\n> -@defmac CONSTANT_ALIGNMENT (@var{constant}, @var{basic-align})\n> -If defined, a C expression to compute the alignment given to a constant\n> -that is being placed in memory.  @var{constant} is the constant and\n> -@var{basic-align} is the alignment that the object would ordinarily\n> -have.  The value of this macro is used instead of that alignment to\n> -align the object.\n> +@deftypefn {Target Hook} HOST_WIDE_INT TARGET_CONSTANT_ALIGNMENT (const_tree @var{constant}, HOST_WIDE_INT @var{basic_align})\n> +This hook returns the alignment in bits of a constant that is being\n> +placed in memory.  @var{constant} is the constant and @var{basic_align}\n> +is the alignment that the object would ordinarily have.\n>\n> -The default definition just returns @var{basic-align}.\n> +The default definition just returns @var{basic_align}.\n>\n> -The typical use of this macro is to increase alignment for string\n> +The typical use of this hook is to increase alignment for string\n>  constants to be word aligned so that @code{strcpy} calls that copy\n> -constants can be done inline.\n> -@end defmac\n> +constants can be done inline.  The function\n> +@code{constant_alignment_word_strings} provides such a definition.\n> +@end deftypefn\n>\n>  @defmac LOCAL_ALIGNMENT (@var{type}, @var{basic-align})\n>  If defined, a C expression to compute the alignment for a variable in\n> Index: gcc/targhooks.h\n> ===================================================================\n> --- gcc/targhooks.h     2017-09-22 17:31:36.935337179 +0100\n> +++ gcc/targhooks.h     2017-09-22 17:37:26.791614385 +0100\n> @@ -93,6 +93,9 @@ extern int default_builtin_vectorization\n>\n>  extern tree default_builtin_reciprocal (tree);\n>\n> +extern HOST_WIDE_INT default_constant_alignment (const_tree, HOST_WIDE_INT);\n> +extern HOST_WIDE_INT constant_alignment_word_strings (const_tree,\n> +                                                     HOST_WIDE_INT);\n>  extern HOST_WIDE_INT default_vector_alignment (const_tree);\n>\n>  extern HOST_WIDE_INT default_preferred_vector_alignment (const_tree);\n> Index: gcc/targhooks.c\n> ===================================================================\n> --- gcc/targhooks.c     2017-09-22 17:31:36.935337179 +0100\n> +++ gcc/targhooks.c     2017-09-22 17:37:26.791614385 +0100\n> @@ -1165,6 +1165,25 @@ tree default_mangle_decl_assembler_name\n>     return id;\n>  }\n>\n> +/* The default implementation of TARGET_CONSTANT_ALIGNMENT.  */\n> +\n> +HOST_WIDE_INT\n> +default_constant_alignment (const_tree, HOST_WIDE_INT align)\n> +{\n> +  return align;\n> +}\n> +\n> +/* An implementation of TARGET_CONSTANT_ALIGNMENT that aligns strings\n> +   to at least BITS_PER_WORD but otherwise makes no changes.  */\n> +\n> +HOST_WIDE_INT\n> +constant_alignment_word_strings (const_tree exp, HOST_WIDE_INT align)\n> +{\n> +  if (TREE_CODE (exp) == STRING_CST)\n> +    return MAX (align, BITS_PER_WORD);\n> +  return align;\n> +}\n> +\n>  /* Default to natural alignment for vector types.  */\n>  HOST_WIDE_INT\n>  default_vector_alignment (const_tree type)\n> Index: gcc/builtins.c\n> ===================================================================\n> --- gcc/builtins.c      2017-09-05 20:56:49.744887619 +0100\n> +++ gcc/builtins.c      2017-09-22 17:37:26.746614388 +0100\n> @@ -283,7 +283,7 @@ get_object_alignment_2 (tree exp, unsign\n>        exp = DECL_INITIAL (exp);\n>        align = TYPE_ALIGN (TREE_TYPE (exp));\n>        if (CONSTANT_CLASS_P (exp))\n> -       align = (unsigned) CONSTANT_ALIGNMENT (exp, align);\n> +       align = targetm.constant_alignment (exp, align);\n>\n>        known_alignment = true;\n>      }\n> @@ -359,7 +359,7 @@ get_object_alignment_2 (tree exp, unsign\n>           wrapped inside a CONST_DECL.  */\n>        align = TYPE_ALIGN (TREE_TYPE (exp));\n>        if (CONSTANT_CLASS_P (exp))\n> -       align = (unsigned) CONSTANT_ALIGNMENT (exp, align);\n> +       align = targetm.constant_alignment (exp, align);\n>\n>        known_alignment = true;\n>      }\n> Index: gcc/varasm.c\n> ===================================================================\n> --- gcc/varasm.c        2017-09-21 22:34:52.782138953 +0100\n> +++ gcc/varasm.c        2017-09-22 17:37:26.792614385 +0100\n> @@ -1055,7 +1055,7 @@ align_variable (tree decl, bool dont_out\n>               && (in_lto_p || DECL_INITIAL (decl) != error_mark_node))\n>             {\n>               unsigned int const_align\n> -               = CONSTANT_ALIGNMENT (DECL_INITIAL (decl), align);\n> +               = targetm.constant_alignment (DECL_INITIAL (decl), align);\n>               /* Don't increase alignment too much for TLS variables - TLS\n>                  space is too precious.  */\n>               if (! DECL_THREAD_LOCAL_P (decl) || const_align <= BITS_PER_WORD)\n> @@ -1106,8 +1106,8 @@ get_variable_align (tree decl)\n>              to mark offlined constructors.  */\n>           && (in_lto_p || DECL_INITIAL (decl) != error_mark_node))\n>         {\n> -         unsigned int const_align = CONSTANT_ALIGNMENT (DECL_INITIAL (decl),\n> -                                                        align);\n> +         unsigned int const_align\n> +           = targetm.constant_alignment (DECL_INITIAL (decl), align);\n>           /* Don't increase alignment too much for TLS variables - TLS space\n>              is too precious.  */\n>           if (! DECL_THREAD_LOCAL_P (decl) || const_align <= BITS_PER_WORD)\n> @@ -3326,12 +3326,10 @@ build_constant_desc (tree exp)\n>       Instead we set the flag that will be recognized in make_decl_rtl.  */\n>    DECL_IN_CONSTANT_POOL (decl) = 1;\n>    DECL_INITIAL (decl) = desc->value;\n> -  /* ??? CONSTANT_ALIGNMENT hasn't been updated for vector types on most\n> -     architectures so use DATA_ALIGNMENT as well, except for strings.  */\n> +  /* ??? targetm.constant_alignment hasn't been updated for vector types on\n> +     most architectures so use DATA_ALIGNMENT as well, except for strings.  */\n>    if (TREE_CODE (exp) == STRING_CST)\n> -    {\n> -      SET_DECL_ALIGN (decl, CONSTANT_ALIGNMENT (exp, DECL_ALIGN (decl)));\n> -    }\n> +    SET_DECL_ALIGN (decl, targetm.constant_alignment (exp, DECL_ALIGN (decl)));\n>    else\n>      align_variable (decl, 0);\n>\n> @@ -3790,7 +3788,7 @@ force_const_mem (machine_mode mode, rtx\n>\n>    tree type = lang_hooks.types.type_for_mode (mode, 0);\n>    if (type != NULL_TREE)\n> -    align = CONSTANT_ALIGNMENT (make_tree (type, x), align);\n> +    align = targetm.constant_alignment (make_tree (type, x), align);\n>\n>    pool->offset += (align / BITS_PER_UNIT) - 1;\n>    pool->offset &= ~ ((align / BITS_PER_UNIT) - 1);\n> Index: gcc/config/aarch64/aarch64.h\n> ===================================================================\n> --- gcc/config/aarch64/aarch64.h        2017-09-21 22:35:16.977238356 +0100\n> +++ gcc/config/aarch64/aarch64.h        2017-09-22 17:37:26.747614388 +0100\n> @@ -90,14 +90,6 @@ #define LONG_DOUBLE_TYPE_SIZE        128\n>     port.  */\n>  #define TARGET_PTRMEMFUNC_VBIT_LOCATION ptrmemfunc_vbit_in_delta\n>\n> -/* Make strings word-aligned so that strcpy from constants will be\n> -   faster.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)         \\\n> -  ((TREE_CODE (EXP) == STRING_CST              \\\n> -    && !optimize_size                          \\\n> -    && (ALIGN) < BITS_PER_WORD)                        \\\n> -   ? BITS_PER_WORD : ALIGN)\n> -\n>  /* Align definitions of arrays, unions and structures so that\n>     initializations and copies can be made more efficient.  This is not\n>     ABI-changing, so it only affects places where we can see the\n> Index: gcc/config/aarch64/aarch64.c\n> ===================================================================\n> --- gcc/config/aarch64/aarch64.c        2017-09-22 17:35:22.483794044 +0100\n> +++ gcc/config/aarch64/aarch64.c        2017-09-22 17:37:26.747614388 +0100\n> @@ -1142,6 +1142,17 @@ aarch64_hard_regno_caller_save_mode (uns\n>      return choose_hard_reg_mode (regno, nregs, false);\n>  }\n>\n> +/* Implement TARGET_CONSTANT_ALIGNMENT.  Make strings word-aligned so\n> +   that strcpy from constants will be faster.  */\n> +\n> +static HOST_WIDE_INT\n> +aarch64_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n> +{\n> +  if (TREE_CODE (exp) == STRING_CST && !optimize_size)\n> +    return MAX (align, BITS_PER_WORD);\n> +  return align;\n> +}\n> +\n>  /* Return true if calls to DECL should be treated as\n>     long-calls (ie called via a register).  */\n>  static bool\n> @@ -4622,7 +4633,7 @@ aarch64_classify_address (struct aarch64\n>                 {\n>                   tree exp = SYMBOL_REF_DECL (sym);\n>                   align = TYPE_ALIGN (TREE_TYPE (exp));\n> -                 align = CONSTANT_ALIGNMENT (exp, align);\n> +                 align = aarch64_constant_alignment (exp, align);\n>                 }\n>               else if (SYMBOL_REF_DECL (sym))\n>                 align = DECL_ALIGN (SYMBOL_REF_DECL (sym));\n> @@ -15687,6 +15698,9 @@ #define TARGET_MODES_TIEABLE_P aarch64_m\n>  #define TARGET_HARD_REGNO_CALL_PART_CLOBBERED \\\n>    aarch64_hard_regno_call_part_clobbered\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT aarch64_constant_alignment\n> +\n>  #if CHECKING_P\n>  #undef TARGET_RUN_TARGET_SELFTESTS\n>  #define TARGET_RUN_TARGET_SELFTESTS selftest::aarch64_run_selftests\n> Index: gcc/config/alpha/alpha.h\n> ===================================================================\n> --- gcc/config/alpha/alpha.h    2017-09-15 14:47:33.167333414 +0100\n> +++ gcc/config/alpha/alpha.h    2017-09-22 17:37:26.748614388 +0100\n> @@ -289,7 +289,6 @@ #define MINIMUM_ATOMIC_ALIGNMENT ((unsig\n>  /* ??? Only if block-move stuff knows about different source/destination\n>     alignment.  */\n>  #if 0\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN) MAX ((ALIGN), BITS_PER_WORD)\n>  #define DATA_ALIGNMENT(EXP, ALIGN) MAX ((ALIGN), BITS_PER_WORD)\n>  #endif\n>\n> Index: gcc/config/arc/arc.h\n> ===================================================================\n> --- gcc/config/arc/arc.h        2017-09-15 14:47:33.167333414 +0100\n> +++ gcc/config/arc/arc.h        2017-09-22 17:37:26.749614388 +0100\n> @@ -271,13 +271,6 @@ #define BIGGEST_ALIGNMENT 32\n>  /* The best alignment to use in cases where we have a choice.  */\n>  #define FASTEST_ALIGNMENT 32\n>\n> -/* Make strings word-aligned so strcpy from constants will be faster.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n> -  ((TREE_CODE (EXP) == STRING_CST      \\\n> -    && (ALIGN) < FASTEST_ALIGNMENT)    \\\n> -   ? FASTEST_ALIGNMENT : (ALIGN))\n> -\n> -\n>  /* Make arrays of chars word-aligned for the same reasons.  */\n>  #define LOCAL_ALIGNMENT(TYPE, ALIGN)             \\\n>    (TREE_CODE (TYPE) == ARRAY_TYPE               \\\n> Index: gcc/config/arc/arc.c\n> ===================================================================\n> --- gcc/config/arc/arc.c        2017-09-12 14:29:25.225531070 +0100\n> +++ gcc/config/arc/arc.c        2017-09-22 17:37:26.749614388 +0100\n> @@ -10657,6 +10657,9 @@ arc_use_anchors_for_symbol_p (const_rtx\n>  #undef TARGET_USE_ANCHORS_FOR_SYMBOL_P\n>  #define TARGET_USE_ANCHORS_FOR_SYMBOL_P arc_use_anchors_for_symbol_p\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  #include \"gt-arc.h\"\n> Index: gcc/config/arm/arm.h\n> ===================================================================\n> --- gcc/config/arm/arm.h        2017-09-22 17:22:08.191305805 +0100\n> +++ gcc/config/arm/arm.h        2017-09-22 17:37:26.752614387 +0100\n> @@ -592,15 +592,6 @@ #define MALLOC_ABI_ALIGNMENT  BIGGEST_AL\n>  #define BIGGEST_FIELD_ALIGNMENT 64\n>  #endif\n>\n> -/* Make strings word-aligned so strcpy from constants will be faster.  */\n> -#define CONSTANT_ALIGNMENT_FACTOR (TARGET_THUMB || ! arm_tune_xscale ? 1 : 2)\n> -\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)                         \\\n> -   ((TREE_CODE (EXP) == STRING_CST                             \\\n> -     && !optimize_size                                         \\\n> -     && (ALIGN) < BITS_PER_WORD * CONSTANT_ALIGNMENT_FACTOR)   \\\n> -    ? BITS_PER_WORD * CONSTANT_ALIGNMENT_FACTOR : (ALIGN))\n> -\n>  /* Align definitions of arrays, unions and structures so that\n>     initializations and copies can be made more efficient.  This is not\n>     ABI-changing, so it only affects places where we can see the\n> Index: gcc/config/arm/arm.c\n> ===================================================================\n> --- gcc/config/arm/arm.c        2017-09-22 17:35:22.486794044 +0100\n> +++ gcc/config/arm/arm.c        2017-09-22 17:37:26.751614388 +0100\n> @@ -316,6 +316,7 @@ static opt_scalar_float_mode arm_floatn_\n>  static unsigned int arm_hard_regno_nregs (unsigned int, machine_mode);\n>  static bool arm_hard_regno_mode_ok (unsigned int, machine_mode);\n>  static bool arm_modes_tieable_p (machine_mode, machine_mode);\n> +static HOST_WIDE_INT arm_constant_alignment (const_tree, HOST_WIDE_INT);\n>\n>  /* Table of machine attributes.  */\n>  static const struct attribute_spec arm_attribute_table[] =\n> @@ -795,6 +796,9 @@ #define TARGET_MODES_TIEABLE_P arm_modes\n>\n>  #undef TARGET_CAN_CHANGE_MODE_CLASS\n>  #define TARGET_CAN_CHANGE_MODE_CLASS arm_can_change_mode_class\n> +\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT arm_constant_alignment\n>\n>  /* Obstack for minipool constant handling.  */\n>  static struct obstack minipool_obstack;\n> @@ -31276,6 +31280,18 @@ arm_can_change_mode_class (machine_mode\n>    return true;\n>  }\n>\n> +/* Implement TARGET_CONSTANT_ALIGNMENT.  Make strings word-aligned so\n> +   strcpy from constants will be faster.  */\n> +\n> +static HOST_WIDE_INT\n> +arm_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n> +{\n> +  unsigned int factor = (TARGET_THUMB || ! arm_tune_xscale ? 1 : 2);\n> +  if (TREE_CODE (exp) == STRING_CST && !optimize_size)\n> +    return MAX (align, BITS_PER_WORD * factor);\n> +  return align;\n> +}\n> +\n>  #if CHECKING_P\n>  namespace selftest {\n>\n> Index: gcc/config/bfin/bfin.h\n> ===================================================================\n> --- gcc/config/bfin/bfin.h      2017-09-15 14:47:33.168333307 +0100\n> +++ gcc/config/bfin/bfin.h      2017-09-22 17:37:26.753614387 +0100\n> @@ -321,11 +321,6 @@ #define ACCUMULATE_OUTGOING_ARGS 1\n>\n>  #define LOCAL_ALIGNMENT(TYPE, ALIGN) bfin_local_alignment ((TYPE), (ALIGN))\n>\n> -/* Make strings word-aligned so strcpy from constants will be faster.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n> -  (TREE_CODE (EXP) == STRING_CST        \\\n> -   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n> -\n>  #define TRAMPOLINE_SIZE (TARGET_FDPIC ? 30 : 18)\n>\n>  /* Definitions for register eliminations.\n> Index: gcc/config/bfin/bfin.c\n> ===================================================================\n> --- gcc/config/bfin/bfin.c      2017-09-12 14:29:25.228530938 +0100\n> +++ gcc/config/bfin/bfin.c      2017-09-22 17:37:26.752614387 +0100\n> @@ -5882,4 +5882,7 @@ #define TARGET_HARD_REGNO_MODE_OK bfin_h\n>  #undef TARGET_MODES_TIEABLE_P\n>  #define TARGET_MODES_TIEABLE_P bfin_modes_tieable_p\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n> Index: gcc/config/cr16/cr16.h\n> ===================================================================\n> --- gcc/config/cr16/cr16.h      2017-09-15 14:47:33.168333307 +0100\n> +++ gcc/config/cr16/cr16.h      2017-09-22 17:37:26.753614387 +0100\n> @@ -114,11 +114,6 @@ #define DATA_ALIGNMENT(TYPE, ALIGN)\n>       && ((ALIGN) < BITS_PER_WORD))               \\\n>       ? (BITS_PER_WORD) : (ALIGN))\n>\n> -/* In CR16 strings are word-aligned; strcpy from constants will be faster.  */\n> -#define CONSTANT_ALIGNMENT(CONSTANT, ALIGN)                            \\\n> -  (((TREE_CODE (CONSTANT) == STRING_CST) && ((ALIGN) < BITS_PER_WORD)) \\\n> -     ? (BITS_PER_WORD) : (ALIGN))\n> -\n>  #define STRICT_ALIGNMENT 0\n>\n>  #define PCC_BITFIELD_TYPE_MATTERS 1\n> Index: gcc/config/cr16/cr16.c\n> ===================================================================\n> --- gcc/config/cr16/cr16.c      2017-09-12 14:29:25.229530894 +0100\n> +++ gcc/config/cr16/cr16.c      2017-09-22 17:37:26.753614387 +0100\n> @@ -200,6 +200,9 @@ #define TARGET_REGISTER_MOVE_COST   cr16_\n>  #undef TARGET_MEMORY_MOVE_COST\n>  #define TARGET_MEMORY_MOVE_COST        cr16_memory_move_cost\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT      constant_alignment_word_strings\n> +\n>  /* Table of machine attributes.  */\n>  static const struct attribute_spec cr16_attribute_table[] = {\n>    /* ISRs have special prologue and epilogue requirements.  */\n> Index: gcc/config/cris/cris.h\n> ===================================================================\n> --- gcc/config/cris/cris.h      2017-09-15 14:47:33.169333199 +0100\n> +++ gcc/config/cris/cris.h      2017-09-22 17:37:26.754614387 +0100\n> @@ -368,17 +368,6 @@ #define DATA_ALIGNMENT(TYPE, BASIC_ALIGN\n>       ? (BASIC_ALIGN < 32 ? 32 : BASIC_ALIGN)                   \\\n>       : (BASIC_ALIGN < 16 ? 16 : BASIC_ALIGN)) : BASIC_ALIGN)\n>\n> -/* Note that CONSTANT_ALIGNMENT has the effect of making gcc believe that\n> -   ALL references to constant stuff (in code segment, like strings) has\n> -   this alignment.  That is a rather rushed assumption.  Luckily we do not\n> -   care about the \"alignment\" operand to builtin memcpy (only place where\n> -   it counts), so it doesn't affect any bad spots.  */\n> -#define CONSTANT_ALIGNMENT(CONSTANT, BASIC_ALIGN)              \\\n> - (TARGET_CONST_ALIGN                                           \\\n> -  ? (TARGET_ALIGN_BY_32                                                \\\n> -     ? (BASIC_ALIGN < 32 ? 32 : BASIC_ALIGN)                   \\\n> -     : (BASIC_ALIGN < 16 ? 16 : BASIC_ALIGN)) : BASIC_ALIGN)\n> -\n>  /* FIXME: Define LOCAL_ALIGNMENT for word and dword or arrays and\n>     structures (if -mstack-align=), and check that it is good.  */\n>\n> Index: gcc/config/cris/cris.c\n> ===================================================================\n> --- gcc/config/cris/cris.c      2017-09-12 14:29:25.229530894 +0100\n> +++ gcc/config/cris/cris.c      2017-09-22 17:37:26.754614387 +0100\n> @@ -165,6 +165,7 @@ static bool cris_function_value_regno_p\n>  static void cris_file_end (void);\n>  static unsigned int cris_hard_regno_nregs (unsigned int, machine_mode);\n>  static bool cris_hard_regno_mode_ok (unsigned int, machine_mode);\n> +static HOST_WIDE_INT cris_constant_alignment (const_tree, HOST_WIDE_INT);\n>\n>  /* This is the parsed result of the \"-max-stack-stackframe=\" option.  If\n>     it (still) is zero, then there was no such option given.  */\n> @@ -287,6 +288,9 @@ #define TARGET_HARD_REGNO_NREGS cris_har\n>  #undef TARGET_HARD_REGNO_MODE_OK\n>  #define TARGET_HARD_REGNO_MODE_OK cris_hard_regno_mode_ok\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT cris_constant_alignment\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  /* Helper for cris_load_multiple_op and cris_ret_movem_op.  */\n> @@ -4325,6 +4329,23 @@ cris_hard_regno_mode_ok (unsigned int re\n>               || (regno != CRIS_MOF_REGNUM && regno != CRIS_ACR_REGNUM)));\n>  }\n>\n> +/* Implement TARGET_CONSTANT_ALIGNMENT.  Note that this hook has the\n> +   effect of making gcc believe that ALL references to constant stuff\n> +   (in code segment, like strings) have this alignment.  That is a rather\n> +   rushed assumption.  Luckily we do not care about the \"alignment\"\n> +   operand to builtin memcpy (only place where it counts), so it doesn't\n> +   affect any bad spots.  */\n> +\n> +static HOST_WIDE_INT\n> +cris_constant_alignment (const_tree, HOST_WIDE_INT basic_align)\n> +{\n> +  if (!TARGET_CONST_ALIGN)\n> +    return basic_align;\n> +  if (TARGET_ALIGN_BY_32)\n> +    return MAX (basic_align, 32);\n> +  return MAX (basic_align, 16);\n> +}\n> +\n>  #if 0\n>  /* Various small functions to replace macros.  Only called from a\n>     debugger.  They might collide with gcc functions or system functions,\n> Index: gcc/config/epiphany/epiphany.h\n> ===================================================================\n> --- gcc/config/epiphany/epiphany.h      2017-09-15 14:47:33.169333199 +0100\n> +++ gcc/config/epiphany/epiphany.h      2017-09-22 17:37:26.754614387 +0100\n> @@ -147,12 +147,6 @@ #define FASTEST_ALIGNMENT 64\n>\n>  #define MALLOC_ABI_ALIGNMENT BIGGEST_ALIGNMENT\n>\n> -/* Make strings dword-aligned so strcpy from constants will be faster.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n> -  ((TREE_CODE (EXP) == STRING_CST      \\\n> -    && (ALIGN) < FASTEST_ALIGNMENT)    \\\n> -   ? FASTEST_ALIGNMENT : (ALIGN))\n> -\n>  /* Make arrays of chars dword-aligned for the same reasons.\n>     Also, align arrays of SImode items.  */\n>  #define DATA_ALIGNMENT(TYPE, ALIGN)            \\\n> Index: gcc/config/epiphany/epiphany.c\n> ===================================================================\n> --- gcc/config/epiphany/epiphany.c      2017-09-04 11:49:42.897500726 +0100\n> +++ gcc/config/epiphany/epiphany.c      2017-09-22 17:37:26.754614387 +0100\n> @@ -173,6 +173,9 @@ #define TARGET_ASM_ALIGNED_SI_OP \"\\t.wor\n>\n>  #undef TARGET_HARD_REGNO_MODE_OK\n>  #define TARGET_HARD_REGNO_MODE_OK epiphany_hard_regno_mode_ok\n> +\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT epiphany_constant_alignment\n>\n>  bool\n>  epiphany_is_interrupt_p (tree decl)\n> @@ -3014,4 +3017,15 @@ epiphany_start_function (FILE *file, con\n>    ASM_OUTPUT_FUNCTION_LABEL (file, name, decl);\n>  }\n>\n> +\n> +/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n> +\n> +static HOST_WIDE_INT\n> +epiphany_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n> +{\n> +  if (TREE_CODE (exp) == STRING_CST)\n> +    return MAX (align, FASTEST_ALIGNMENT);\n> +  return align;\n> +}\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n> Index: gcc/config/fr30/fr30.h\n> ===================================================================\n> --- gcc/config/fr30/fr30.h      2017-09-15 14:47:33.169333199 +0100\n> +++ gcc/config/fr30/fr30.h      2017-09-22 17:37:26.755614387 +0100\n> @@ -88,10 +88,6 @@ #define DATA_ALIGNMENT(TYPE, ALIGN)          \\\n>     && TYPE_MODE (TREE_TYPE (TYPE)) == QImode   \\\n>     && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n>\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n> -  (TREE_CODE (EXP) == STRING_CST       \\\n> -   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n> -\n>  #define STRICT_ALIGNMENT 1\n>\n>  #define PCC_BITFIELD_TYPE_MATTERS 1\n> Index: gcc/config/fr30/fr30.c\n> ===================================================================\n> --- gcc/config/fr30/fr30.c      2017-08-10 14:36:08.721447283 +0100\n> +++ gcc/config/fr30/fr30.c      2017-09-22 17:37:26.754614387 +0100\n> @@ -190,6 +190,9 @@ #define TARGET_ASM_TRAMPOLINE_TEMPLATE f\n>  #undef TARGET_TRAMPOLINE_INIT\n>  #define TARGET_TRAMPOLINE_INIT fr30_trampoline_init\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>\n> Index: gcc/config/frv/frv.h\n> ===================================================================\n> --- gcc/config/frv/frv.h        2017-09-15 14:47:33.169333199 +0100\n> +++ gcc/config/frv/frv.h        2017-09-22 17:37:26.756614387 +0100\n> @@ -351,20 +351,6 @@ #define DATA_ALIGNMENT(TYPE, ALIGN)                \\\n>     && TYPE_MODE (TREE_TYPE (TYPE)) == QImode   \\\n>     && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n>\n> -/* If defined, a C expression to compute the alignment given to a constant that\n> -   is being placed in memory.  CONSTANT is the constant and ALIGN is the\n> -   alignment that the object would ordinarily have.  The value of this macro is\n> -   used instead of that alignment to align the object.\n> -\n> -   If this macro is not defined, then ALIGN is used.\n> -\n> -   The typical use of this macro is to increase alignment for string constants\n> -   to be word aligned so that `strcpy' calls that copy constants can be done\n> -   inline.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n> -  (TREE_CODE (EXP) == STRING_CST       \\\n> -   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n> -\n>  /* Define this macro to be the value 1 if instructions will fail to work if\n>     given data not on the nominal alignment.  If instructions will merely go\n>     slower in that case, define this macro as 0.  */\n> Index: gcc/config/frv/frv.c\n> ===================================================================\n> --- gcc/config/frv/frv.c        2017-09-12 14:29:25.231530806 +0100\n> +++ gcc/config/frv/frv.c        2017-09-22 17:37:26.756614387 +0100\n> @@ -523,6 +523,8 @@ #define TARGET_HARD_REGNO_NREGS frv_hard\n>  #define TARGET_HARD_REGNO_MODE_OK frv_hard_regno_mode_ok\n>  #undef TARGET_MODES_TIEABLE_P\n>  #define TARGET_MODES_TIEABLE_P frv_modes_tieable_p\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n>\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n> Index: gcc/config/ft32/ft32.h\n> ===================================================================\n> --- gcc/config/ft32/ft32.h      2017-09-15 14:47:33.169333199 +0100\n> +++ gcc/config/ft32/ft32.h      2017-09-22 17:37:26.756614387 +0100\n> @@ -354,12 +354,6 @@ #define PCC_BITFIELD_TYPE_MATTERS\n>     is GET_MODE_SIZE(DImode).  */\n>  #define MAX_FIXED_MODE_SIZE 32\n>\n> -/* Make strings word-aligned so strcpy from constants will be faster.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n> -  ((TREE_CODE (EXP) == STRING_CST       \\\n> -    && (ALIGN) < FASTEST_ALIGNMENT)     \\\n> -   ? FASTEST_ALIGNMENT : (ALIGN))\n> -\n>  /* Set this nonzero if move instructions will actually fail to work\n>     when given unaligned data.  */\n>  #define STRICT_ALIGNMENT 1\n> Index: gcc/config/ft32/ft32.c\n> ===================================================================\n> --- gcc/config/ft32/ft32.c      2017-08-30 12:18:46.608141057 +0100\n> +++ gcc/config/ft32/ft32.c      2017-09-22 17:37:26.756614387 +0100\n> @@ -940,6 +940,9 @@ ft32_elf_encode_section_info (tree decl,\n>      }\n>  }\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  #include \"gt-ft32.h\"\n> Index: gcc/config/i386/i386.h\n> ===================================================================\n> --- gcc/config/i386/i386.h      2017-09-21 11:53:16.598005975 +0100\n> +++ gcc/config/i386/i386.h      2017-09-22 17:37:26.761614387 +0100\n> @@ -848,20 +848,6 @@ #define ADJUST_FIELD_ALIGN(FIELD, TYPE,\n>    x86_field_alignment ((TYPE), (COMPUTED))\n>  #endif\n>\n> -/* If defined, a C expression to compute the alignment given to a\n> -   constant that is being placed in memory.  EXP is the constant\n> -   and ALIGN is the alignment that the object would ordinarily have.\n> -   The value of this macro is used instead of that alignment to align\n> -   the object.\n> -\n> -   If this macro is not defined, then ALIGN is used.\n> -\n> -   The typical use of this macro is to increase alignment for string\n> -   constants to be word aligned so that `strcpy' calls that copy\n> -   constants can be done inline.  */\n> -\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN) ix86_constant_alignment ((EXP), (ALIGN))\n> -\n>  /* If defined, a C expression to compute the alignment for a static\n>     variable.  TYPE is the data type, and ALIGN is the alignment that\n>     the object would ordinarily have.  The value of this macro is used\n> Index: gcc/config/i386/i386-protos.h\n> ===================================================================\n> --- gcc/config/i386/i386-protos.h       2017-09-15 13:56:20.266148661 +0100\n> +++ gcc/config/i386/i386-protos.h       2017-09-22 17:37:26.756614387 +0100\n> @@ -209,7 +209,6 @@ extern unsigned int ix86_local_alignment\n>                                           unsigned int);\n>  extern unsigned int ix86_minimum_alignment (tree, machine_mode,\n>                                             unsigned int);\n> -extern int ix86_constant_alignment (tree, int);\n>  extern tree ix86_handle_shared_attribute (tree *, tree, tree, int, bool *);\n>  extern tree ix86_handle_selectany_attribute (tree *, tree, tree, int, bool *);\n>  extern int x86_field_alignment (tree, int);\n> Index: gcc/config/i386/i386.c\n> ===================================================================\n> --- gcc/config/i386/i386.c      2017-09-22 17:31:56.418527551 +0100\n> +++ gcc/config/i386/i386.c      2017-09-22 17:37:26.760614387 +0100\n> @@ -31555,14 +31555,10 @@ ix86_sched_init_global (FILE *, int, int\n>  }\n>\n>\n> -/* Compute the alignment given to a constant that is being placed in memory.\n> -   EXP is the constant and ALIGN is the alignment that the object would\n> -   ordinarily have.\n> -   The value of this function is used instead of that alignment to align\n> -   the object.  */\n> +/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n>\n> -int\n> -ix86_constant_alignment (tree exp, int align)\n> +static HOST_WIDE_INT\n> +ix86_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n>  {\n>    if (TREE_CODE (exp) == REAL_CST || TREE_CODE (exp) == VECTOR_CST\n>        || TREE_CODE (exp) == INTEGER_CST)\n> @@ -53601,6 +53597,9 @@ #define TARGET_HARD_REGNO_CALL_PART_CLOB\n>  #undef TARGET_CAN_CHANGE_MODE_CLASS\n>  #define TARGET_CAN_CHANGE_MODE_CLASS ix86_can_change_mode_class\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT ix86_constant_alignment\n> +\n>  #if CHECKING_P\n>  #undef TARGET_RUN_TARGET_SELFTESTS\n>  #define TARGET_RUN_TARGET_SELFTESTS selftest::ix86_run_selftests\n> Index: gcc/config/ia64/ia64.h\n> ===================================================================\n> --- gcc/config/ia64/ia64.h      2017-09-15 14:47:33.170333092 +0100\n> +++ gcc/config/ia64/ia64.h      2017-09-22 17:37:26.762614387 +0100\n> @@ -185,15 +185,6 @@ #define DATA_ALIGNMENT(TYPE, ALIGN)                \\\n>     && TYPE_MODE (TREE_TYPE (TYPE)) == QImode   \\\n>     && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n>\n> -/* If defined, a C expression to compute the alignment given to a constant that\n> -   is being placed in memory.  CONSTANT is the constant and ALIGN is the\n> -   alignment that the object would ordinarily have.  The value of this macro is\n> -   used instead of that alignment to align the object.  */\n> -\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n> -  (TREE_CODE (EXP) == STRING_CST       \\\n> -   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n> -\n>  #define STRICT_ALIGNMENT 1\n>\n>  /* Define this if you wish to imitate the way many other C compilers handle\n> Index: gcc/config/ia64/ia64.c\n> ===================================================================\n> --- gcc/config/ia64/ia64.c      2017-09-22 17:31:56.419475454 +0100\n> +++ gcc/config/ia64/ia64.c      2017-09-22 17:37:26.762614387 +0100\n> @@ -672,6 +672,9 @@ #define TARGET_MODES_TIEABLE_P ia64_mode\n>  #undef TARGET_CAN_CHANGE_MODE_CLASS\n>  #define TARGET_CAN_CHANGE_MODE_CLASS ia64_can_change_mode_class\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  /* Returns TRUE iff the target attribute indicated by ATTR_ID takes a plain\n> Index: gcc/config/iq2000/iq2000.h\n> ===================================================================\n> --- gcc/config/iq2000/iq2000.h  2017-09-15 14:47:33.170333092 +0100\n> +++ gcc/config/iq2000/iq2000.h  2017-09-22 17:37:26.763614387 +0100\n> @@ -96,10 +96,6 @@ #define DATA_ALIGNMENT(TYPE, ALIGN)\n>         || TREE_CODE (TYPE) == UNION_TYPE                               \\\n>         || TREE_CODE (TYPE) == RECORD_TYPE)) ? BITS_PER_WORD : (ALIGN))\n>\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)                                 \\\n> -  ((TREE_CODE (EXP) == STRING_CST  || TREE_CODE (EXP) == CONSTRUCTOR)  \\\n> -   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n> -\n>  #define EMPTY_FIELD_BOUNDARY 32\n>\n>  #define STRUCTURE_SIZE_BOUNDARY 8\n> Index: gcc/config/iq2000/iq2000.c\n> ===================================================================\n> --- gcc/config/iq2000/iq2000.c  2017-09-04 11:50:24.548966298 +0100\n> +++ gcc/config/iq2000/iq2000.c  2017-09-22 17:37:26.762614387 +0100\n> @@ -180,6 +180,7 @@ static void iq2000_print_operand_address\n>  static bool iq2000_print_operand_punct_valid_p (unsigned char code);\n>  static bool iq2000_hard_regno_mode_ok (unsigned int, machine_mode);\n>  static bool iq2000_modes_tieable_p (machine_mode, machine_mode);\n> +static HOST_WIDE_INT iq2000_constant_alignment (const_tree, HOST_WIDE_INT);\n>\n>  #undef  TARGET_INIT_BUILTINS\n>  #define TARGET_INIT_BUILTINS           iq2000_init_builtins\n> @@ -264,6 +265,9 @@ #define TARGET_HARD_REGNO_MODE_OK   iq2000\n>  #undef  TARGET_MODES_TIEABLE_P\n>  #define TARGET_MODES_TIEABLE_P         iq2000_modes_tieable_p\n>\n> +#undef  TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT      iq2000_constant_alignment\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  /* Return nonzero if we split the address into high and low parts.  */\n> @@ -3532,4 +3536,14 @@ iq2000_modes_tieable_p (machine_mode mod\n>               || GET_MODE_CLASS (mode2) == MODE_COMPLEX_FLOAT));\n>  }\n>\n> +/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n> +\n> +static HOST_WIDE_INT\n> +iq2000_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n> +{\n> +  if (TREE_CODE (exp) == STRING_CST || TREE_CODE (exp) == CONSTRUCTOR)\n> +    return MAX (align, BITS_PER_WORD);\n> +  return align;\n> +}\n> +\n>  #include \"gt-iq2000.h\"\n> Index: gcc/config/lm32/lm32.h\n> ===================================================================\n> --- gcc/config/lm32/lm32.h      2017-09-15 14:47:33.171332984 +0100\n> +++ gcc/config/lm32/lm32.h      2017-09-22 17:37:26.763614387 +0100\n> @@ -99,11 +99,6 @@ #define STRICT_ALIGNMENT 1\n>\n>  #define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT\n>\n> -/* Make strings word-aligned so strcpy from constants will be faster.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n> -  (TREE_CODE (EXP) == STRING_CST       \\\n> -   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n> -\n>  /* Make arrays and structures word-aligned to allow faster copying etc.  */\n>  #define DATA_ALIGNMENT(TYPE, ALIGN)                                    \\\n>    ((((ALIGN) < BITS_PER_WORD)                                          \\\n> Index: gcc/config/lm32/lm32.c\n> ===================================================================\n> --- gcc/config/lm32/lm32.c      2017-09-05 20:56:49.753937121 +0100\n> +++ gcc/config/lm32/lm32.c      2017-09-22 17:37:26.763614387 +0100\n> @@ -113,6 +113,9 @@ #define TARGET_HARD_REGNO_MODE_OK lm32_h\n>  #undef TARGET_MODES_TIEABLE_P\n>  #define TARGET_MODES_TIEABLE_P lm32_modes_tieable_p\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  /* Current frame information calculated by lm32_compute_frame_size.  */\n> Index: gcc/config/m32r/m32r.h\n> ===================================================================\n> --- gcc/config/m32r/m32r.h      2017-09-15 14:47:33.171332984 +0100\n> +++ gcc/config/m32r/m32r.h      2017-09-22 17:37:26.766614387 +0100\n> @@ -260,12 +260,6 @@ #define BIGGEST_ALIGNMENT 32\n>  /* The best alignment to use in cases where we have a choice.  */\n>  #define FASTEST_ALIGNMENT 32\n>\n> -/* Make strings word-aligned so strcpy from constants will be faster.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN) \\\n> -  ((TREE_CODE (EXP) == STRING_CST      \\\n> -    && (ALIGN) < FASTEST_ALIGNMENT)    \\\n> -   ? FASTEST_ALIGNMENT : (ALIGN))\n> -\n>  /* Make arrays of chars word-aligned for the same reasons.  */\n>  #define DATA_ALIGNMENT(TYPE, ALIGN)                                    \\\n>    (TREE_CODE (TYPE) == ARRAY_TYPE                                      \\\n> Index: gcc/config/m32r/m32r.c\n> ===================================================================\n> --- gcc/config/m32r/m32r.c      2017-09-04 11:50:08.518432217 +0100\n> +++ gcc/config/m32r/m32r.c      2017-09-22 17:37:26.765614387 +0100\n> @@ -217,6 +217,9 @@ #define TARGET_HARD_REGNO_MODE_OK m32r_h\n>  #undef TARGET_MODES_TIEABLE_P\n>  #define TARGET_MODES_TIEABLE_P m32r_modes_tieable_p\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  /* Called by m32r_option_override to initialize various things.  */\n> Index: gcc/config/mcore/mcore.h\n> ===================================================================\n> --- gcc/config/mcore/mcore.h    2017-09-15 14:47:33.171332984 +0100\n> +++ gcc/config/mcore/mcore.h    2017-09-22 17:37:26.766614387 +0100\n> @@ -148,12 +148,6 @@ #define    PCC_BITFIELD_TYPE_MATTERS       1\n>     is GET_MODE_SIZE(DImode).  */\n>  #define MAX_FIXED_MODE_SIZE 32\n>\n> -/* Make strings word-aligned so strcpy from constants will be faster.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n> -  ((TREE_CODE (EXP) == STRING_CST      \\\n> -    && (ALIGN) < FASTEST_ALIGNMENT)    \\\n> -   ? FASTEST_ALIGNMENT : (ALIGN))\n> -\n>  /* Make arrays of chars word-aligned for the same reasons.  */\n>  #define DATA_ALIGNMENT(TYPE, ALIGN)            \\\n>    (TREE_CODE (TYPE) == ARRAY_TYPE              \\\n> Index: gcc/config/mcore/mcore.c\n> ===================================================================\n> --- gcc/config/mcore/mcore.c    2017-09-04 11:50:08.519332606 +0100\n> +++ gcc/config/mcore/mcore.c    2017-09-22 17:37:26.766614387 +0100\n> @@ -248,6 +248,9 @@ #define TARGET_HARD_REGNO_MODE_OK mcore_\n>  #undef TARGET_MODES_TIEABLE_P\n>  #define TARGET_MODES_TIEABLE_P mcore_modes_tieable_p\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  /* Adjust the stack and return the number of bytes taken to do it.  */\n> Index: gcc/config/microblaze/microblaze.h\n> ===================================================================\n> --- gcc/config/microblaze/microblaze.h  2017-09-15 14:47:33.172332877 +0100\n> +++ gcc/config/microblaze/microblaze.h  2017-09-22 17:37:26.767614387 +0100\n> @@ -234,12 +234,6 @@ #define SIZE_TYPE \"unsigned int\"\n>  #undef PTRDIFF_TYPE\n>  #define PTRDIFF_TYPE \"int\"\n>\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)                                 \\\n> -  ((TREE_CODE (EXP) == STRING_CST  || TREE_CODE (EXP) == CONSTRUCTOR)  \\\n> -   && (ALIGN) < BITS_PER_WORD                                          \\\n> -       ? BITS_PER_WORD                                                 \\\n> -       : (ALIGN))\n> -\n>  #define DATA_ALIGNMENT(TYPE, ALIGN)                                    \\\n>    ((((ALIGN) < BITS_PER_WORD)                                          \\\n>      && (TREE_CODE (TYPE) == ARRAY_TYPE                                 \\\n> Index: gcc/config/microblaze/microblaze.c\n> ===================================================================\n> --- gcc/config/microblaze/microblaze.c  2017-09-05 20:56:49.754842071 +0100\n> +++ gcc/config/microblaze/microblaze.c  2017-09-22 17:37:26.767614387 +0100\n> @@ -3800,6 +3800,16 @@ microblaze_machine_dependent_reorg (void\n>        return;\n>      }\n>  }\n> +\n> +/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n> +\n> +static HOST_WIDE_INT\n> +microblaze_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n> +{\n> +  if (TREE_CODE (exp) == STRING_CST || TREE_CODE (exp) == CONSTRUCTOR)\n> +    return MAX (align, BITS_PER_WORD);\n> +  return align;\n> +}\n>\n>  #undef TARGET_ENCODE_SECTION_INFO\n>  #define TARGET_ENCODE_SECTION_INFO      microblaze_encode_section_info\n> @@ -3904,6 +3914,9 @@ #define TARGET_HARD_REGNO_MODE_OK microb\n>  #undef TARGET_MODES_TIEABLE_P\n>  #define TARGET_MODES_TIEABLE_P microblaze_modes_tieable_p\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT microblaze_constant_alignment\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  #include \"gt-microblaze.h\"\n> Index: gcc/config/mips/mips.h\n> ===================================================================\n> --- gcc/config/mips/mips.h      2017-09-15 14:47:33.174332662 +0100\n> +++ gcc/config/mips/mips.h      2017-09-22 17:37:26.769614386 +0100\n> @@ -1636,22 +1636,6 @@ #define STRICT_ALIGNMENT 1\n>\n>  #define PCC_BITFIELD_TYPE_MATTERS 1\n>\n> -/* If defined, a C expression to compute the alignment given to a\n> -   constant that is being placed in memory.  CONSTANT is the constant\n> -   and ALIGN is the alignment that the object would ordinarily have.\n> -   The value of this macro is used instead of that alignment to align\n> -   the object.\n> -\n> -   If this macro is not defined, then ALIGN is used.\n> -\n> -   The typical use of this macro is to increase alignment for string\n> -   constants to be word aligned so that `strcpy' calls that copy\n> -   constants can be done inline.  */\n> -\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)                                 \\\n> -  ((TREE_CODE (EXP) == STRING_CST  || TREE_CODE (EXP) == CONSTRUCTOR)  \\\n> -   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n> -\n>  /* If defined, a C expression to compute the alignment for a static\n>     variable.  TYPE is the data type, and ALIGN is the alignment that\n>     the object would ordinarily have.  The value of this macro is used\n> Index: gcc/config/mips/mips.c\n> ===================================================================\n> --- gcc/config/mips/mips.c      2017-09-22 17:31:56.421371259 +0100\n> +++ gcc/config/mips/mips.c      2017-09-22 17:37:26.769614386 +0100\n> @@ -22336,6 +22336,16 @@ mips_truly_noop_truncation (unsigned int\n>  {\n>    return !TARGET_64BIT || inprec <= 32 || outprec > 32;\n>  }\n> +\n> +/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n> +\n> +static HOST_WIDE_INT\n> +mips_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n> +{\n> +  if (TREE_CODE (exp) == STRING_CST || TREE_CODE (exp) == CONSTRUCTOR)\n> +    return MAX (align, BITS_PER_WORD);\n> +  return align;\n> +}\n>\n>  /* Initialize the GCC target structure.  */\n>  #undef TARGET_ASM_ALIGNED_HI_OP\n> @@ -22634,6 +22644,9 @@ #define TARGET_CAN_CHANGE_MODE_CLASS mip\n>  #undef TARGET_TRULY_NOOP_TRUNCATION\n>  #define TARGET_TRULY_NOOP_TRUNCATION mips_truly_noop_truncation\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT mips_constant_alignment\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  #include \"gt-mips.h\"\n> Index: gcc/config/mmix/mmix.h\n> ===================================================================\n> --- gcc/config/mmix/mmix.h      2017-09-15 14:47:33.174332662 +0100\n> +++ gcc/config/mmix/mmix.h      2017-09-22 17:37:26.770614386 +0100\n> @@ -167,9 +167,6 @@ #define MAX_OFILE_ALIGNMENT (32768 * 8)\n>  #define DATA_ABI_ALIGNMENT(TYPE, BASIC_ALIGN) \\\n>   mmix_data_alignment (TYPE, BASIC_ALIGN)\n>\n> -#define CONSTANT_ALIGNMENT(CONSTANT, BASIC_ALIGN) \\\n> - mmix_constant_alignment (CONSTANT, BASIC_ALIGN)\n> -\n>  #define LOCAL_ALIGNMENT(TYPE, BASIC_ALIGN) \\\n>   mmix_local_alignment (TYPE, BASIC_ALIGN)\n>\n> Index: gcc/config/mmix/mmix-protos.h\n> ===================================================================\n> --- gcc/config/mmix/mmix-protos.h       2017-02-23 19:54:26.000000000 +0000\n> +++ gcc/config/mmix/mmix-protos.h       2017-09-22 17:37:26.769614386 +0100\n> @@ -47,7 +47,6 @@ extern unsigned mmix_dbx_register_number\n>  extern int mmix_use_simple_return (void);\n>  extern void mmix_make_decl_one_only (tree);\n>  extern int mmix_data_alignment (tree, int);\n> -extern int mmix_constant_alignment (tree, int);\n>  extern unsigned mmix_local_alignment (tree, unsigned);\n>  extern void mmix_asm_output_pool_prologue (FILE *, const char *, tree, int);\n>  extern void mmix_asm_output_aligned_common (FILE *, const char *, int, int);\n> Index: gcc/config/mmix/mmix.c\n> ===================================================================\n> --- gcc/config/mmix/mmix.c      2017-08-30 12:08:01.655417455 +0100\n> +++ gcc/config/mmix/mmix.c      2017-09-22 17:37:26.770614386 +0100\n> @@ -168,6 +168,7 @@ static void mmix_print_operand (FILE *,\n>  static void mmix_print_operand_address (FILE *, machine_mode, rtx);\n>  static bool mmix_print_operand_punct_valid_p (unsigned char);\n>  static void mmix_conditional_register_usage (void);\n> +static HOST_WIDE_INT mmix_constant_alignment (const_tree, HOST_WIDE_INT);\n>\n>  /* Target structure macros.  Listed by node.  See `Using and Porting GCC'\n>     for a general description.  */\n> @@ -282,6 +283,9 @@ #define TARGET_TRAMPOLINE_INIT mmix_tram\n>  #undef TARGET_OPTION_OVERRIDE\n>  #define TARGET_OPTION_OVERRIDE mmix_option_override\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT mmix_constant_alignment\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  /* Functions that are expansions for target macros.\n> @@ -334,10 +338,10 @@ mmix_data_alignment (tree type ATTRIBUTE\n>    return basic_align;\n>  }\n>\n> -/* CONSTANT_ALIGNMENT.  */\n> +/* Implement tARGET_CONSTANT_ALIGNMENT.  */\n>\n> -int\n> -mmix_constant_alignment (tree constant ATTRIBUTE_UNUSED, int basic_align)\n> +static HOST_WIDE_INT\n> +mmix_constant_alignment (const_tree, HOST_WIDE_INT basic_align)\n>  {\n>    if (basic_align < 32)\n>      return 32;\n> Index: gcc/config/moxie/moxie.h\n> ===================================================================\n> --- gcc/config/moxie/moxie.h    2017-09-15 14:47:33.175332555 +0100\n> +++ gcc/config/moxie/moxie.h    2017-09-22 17:37:26.770614386 +0100\n> @@ -317,12 +317,6 @@ #define    PCC_BITFIELD_TYPE_MATTERS       1\n>     is GET_MODE_SIZE(DImode).  */\n>  #define MAX_FIXED_MODE_SIZE 32\n>\n> -/* Make strings word-aligned so strcpy from constants will be faster.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n> -  ((TREE_CODE (EXP) == STRING_CST      \\\n> -    && (ALIGN) < FASTEST_ALIGNMENT)    \\\n> -   ? FASTEST_ALIGNMENT : (ALIGN))\n> -\n>  /* Make arrays of chars word-aligned for the same reasons.  */\n>  #define DATA_ALIGNMENT(TYPE, ALIGN)            \\\n>    (TREE_CODE (TYPE) == ARRAY_TYPE              \\\n> Index: gcc/config/moxie/moxie.c\n> ===================================================================\n> --- gcc/config/moxie/moxie.c    2017-08-10 14:36:08.735446777 +0100\n> +++ gcc/config/moxie/moxie.c    2017-09-22 17:37:26.770614386 +0100\n> @@ -667,6 +667,9 @@ #define TARGET_PRINT_OPERAND moxie_print\n>  #undef  TARGET_PRINT_OPERAND_ADDRESS\n>  #define TARGET_PRINT_OPERAND_ADDRESS moxie_print_operand_address\n>\n> +#undef  TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  #include \"gt-moxie.h\"\n> Index: gcc/config/nios2/nios2.h\n> ===================================================================\n> --- gcc/config/nios2/nios2.h    2017-09-15 14:47:33.175332555 +0100\n> +++ gcc/config/nios2/nios2.h    2017-09-22 17:37:26.771614386 +0100\n> @@ -92,10 +92,6 @@ #define STACK_BOUNDARY 32\n>  #define PREFERRED_STACK_BOUNDARY 32\n>  #define MAX_FIXED_MODE_SIZE 64\n>\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)                          \\\n> -  ((TREE_CODE (EXP) == STRING_CST)                              \\\n> -   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n> -\n>  #define LABEL_ALIGN(LABEL) nios2_label_align (LABEL)\n>\n>  /* Layout of source language data types.  */\n> Index: gcc/config/nios2/nios2.c\n> ===================================================================\n> --- gcc/config/nios2/nios2.c    2017-09-04 11:50:24.551667467 +0100\n> +++ gcc/config/nios2/nios2.c    2017-09-22 17:37:26.771614386 +0100\n> @@ -5116,6 +5116,9 @@ #define TARGET_ASM_OUTPUT_MI_THUNK nios2\n>  #undef TARGET_MACHINE_DEPENDENT_REORG\n>  #define TARGET_MACHINE_DEPENDENT_REORG nios2_reorg\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  #include \"gt-nios2.h\"\n> Index: gcc/config/pa/pa.h\n> ===================================================================\n> --- gcc/config/pa/pa.h  2017-09-15 14:47:33.176332447 +0100\n> +++ gcc/config/pa/pa.h  2017-09-22 17:37:26.772614386 +0100\n> @@ -309,11 +309,6 @@ #define BIGGEST_ALIGNMENT (2 * BITS_PER_\n>     atomic operations.  */\n>  #define MALLOC_ABI_ALIGNMENT (TARGET_SOM ? 64 : 128)\n>\n> -/* Get around hp-ux assembler bug, and make strcpy of constants fast.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)         \\\n> -  (TREE_CODE (EXP) == STRING_CST               \\\n> -   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n> -\n>  /* Make arrays of chars word-aligned for the same reasons.  */\n>  #define DATA_ALIGNMENT(TYPE, ALIGN)            \\\n>    (TREE_CODE (TYPE) == ARRAY_TYPE              \\\n> Index: gcc/config/pa/pa.c\n> ===================================================================\n> --- gcc/config/pa/pa.c  2017-09-15 13:56:20.276148823 +0100\n> +++ gcc/config/pa/pa.c  2017-09-22 17:37:26.772614386 +0100\n> @@ -425,6 +425,9 @@ #define TARGET_MODES_TIEABLE_P pa_modes_\n>  #undef TARGET_CAN_CHANGE_MODE_CLASS\n>  #define TARGET_CAN_CHANGE_MODE_CLASS pa_can_change_mode_class\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  /* Parse the -mfixed-range= option string.  */\n> Index: gcc/config/powerpcspe/powerpcspe.h\n> ===================================================================\n> --- gcc/config/powerpcspe/powerpcspe.h  2017-09-15 14:47:33.176332447 +0100\n> +++ gcc/config/powerpcspe/powerpcspe.h  2017-09-22 17:37:26.775614386 +0100\n> @@ -978,14 +978,6 @@ enum data_align { align_abi, align_opt,\n>  #define LOCAL_ALIGNMENT(TYPE, ALIGN)                           \\\n>    rs6000_data_alignment (TYPE, ALIGN, align_both)\n>\n> -/* Make strings word-aligned so strcpy from constants will be faster.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)                           \\\n> -  (TREE_CODE (EXP) == STRING_CST                                \\\n> -   && (STRICT_ALIGNMENT || !optimize_size)                       \\\n> -   && (ALIGN) < BITS_PER_WORD                                    \\\n> -   ? BITS_PER_WORD                                               \\\n> -   : (ALIGN))\n> -\n>  /* Make arrays of chars word-aligned for the same reasons.  */\n>  #define DATA_ALIGNMENT(TYPE, ALIGN) \\\n>    rs6000_data_alignment (TYPE, ALIGN, align_opt)\n> Index: gcc/config/powerpcspe/powerpcspe.c\n> ===================================================================\n> --- gcc/config/powerpcspe/powerpcspe.c  2017-09-22 17:31:56.424214967 +0100\n> +++ gcc/config/powerpcspe/powerpcspe.c  2017-09-22 17:37:26.775614386 +0100\n> @@ -1984,6 +1984,9 @@ #define TARGET_SLOW_UNALIGNED_ACCESS rs6\n>\n>  #undef TARGET_CAN_CHANGE_MODE_CLASS\n>  #define TARGET_CAN_CHANGE_MODE_CLASS rs6000_can_change_mode_class\n> +\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT rs6000_constant_alignment\n>\n>\n>  /* Processor table.  */\n> @@ -43752,6 +43755,17 @@ rs6000_optab_supported_p (int op, machin\n>        return true;\n>      }\n>  }\n> +\n> +/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n> +\n> +static HOST_WIDE_INT\n> +rs6000_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n> +{\n> +  if (TREE_CODE (exp) == STRING_CST\n> +      && (STRICT_ALIGNMENT || !optimize_size))\n> +    return MAX (align, BITS_PER_WORD);\n> +  return align;\n> +}\n>\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n> Index: gcc/config/riscv/riscv.h\n> ===================================================================\n> --- gcc/config/riscv/riscv.h    2017-09-15 14:47:33.176332447 +0100\n> +++ gcc/config/riscv/riscv.h    2017-09-22 17:37:26.776614386 +0100\n> @@ -152,22 +152,6 @@ #define STRICT_ALIGNMENT TARGET_STRICT_A\n>\n>  #define PCC_BITFIELD_TYPE_MATTERS 1\n>\n> -/* If defined, a C expression to compute the alignment given to a\n> -   constant that is being placed in memory.  CONSTANT is the constant\n> -   and ALIGN is the alignment that the object would ordinarily have.\n> -   The value of this macro is used instead of that alignment to align\n> -   the object.\n> -\n> -   If this macro is not defined, then ALIGN is used.\n> -\n> -   The typical use of this macro is to increase alignment for string\n> -   constants to be word aligned so that `strcpy' calls that copy\n> -   constants can be done inline.  */\n> -\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)                                 \\\n> -  ((TREE_CODE (EXP) == STRING_CST  || TREE_CODE (EXP) == CONSTRUCTOR)  \\\n> -   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n> -\n>  /* If defined, a C expression to compute the alignment for a static\n>     variable.  TYPE is the data type, and ALIGN is the alignment that\n>     the object would ordinarily have.  The value of this macro is used\n> Index: gcc/config/riscv/riscv.c\n> ===================================================================\n> --- gcc/config/riscv/riscv.c    2017-09-15 13:56:20.282148920 +0100\n> +++ gcc/config/riscv/riscv.c    2017-09-22 17:37:26.776614386 +0100\n> @@ -3995,6 +3995,17 @@ riscv_can_change_mode_class (machine_mod\n>    return !reg_classes_intersect_p (FP_REGS, rclass);\n>  }\n>\n> +\n> +/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n> +\n> +static HOST_WIDE_INT\n> +riscv_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n> +{\n> +  if (TREE_CODE (exp) == STRING_CST || TREE_CODE (exp) == CONSTRUCTOR)\n> +    return MAX (align, BITS_PER_WORD);\n> +  return align;\n> +}\n> +\n>  /* Initialize the GCC target structure.  */\n>  #undef TARGET_ASM_ALIGNED_HI_OP\n>  #define TARGET_ASM_ALIGNED_HI_OP \"\\t.half\\t\"\n> @@ -4142,6 +4153,9 @@ #define TARGET_SECONDARY_MEMORY_NEEDED r\n>  #undef TARGET_CAN_CHANGE_MODE_CLASS\n>  #define TARGET_CAN_CHANGE_MODE_CLASS riscv_can_change_mode_class\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT riscv_constant_alignment\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  #include \"gt-riscv.h\"\n> Index: gcc/config/rs6000/rs6000.h\n> ===================================================================\n> --- gcc/config/rs6000/rs6000.h  2017-09-15 14:47:33.177332340 +0100\n> +++ gcc/config/rs6000/rs6000.h  2017-09-22 17:37:26.779614386 +0100\n> @@ -950,14 +950,6 @@ enum data_align { align_abi, align_opt,\n>  #define LOCAL_ALIGNMENT(TYPE, ALIGN)                           \\\n>    rs6000_data_alignment (TYPE, ALIGN, align_both)\n>\n> -/* Make strings word-aligned so strcpy from constants will be faster.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)                           \\\n> -  (TREE_CODE (EXP) == STRING_CST                                \\\n> -   && (STRICT_ALIGNMENT || !optimize_size)                       \\\n> -   && (ALIGN) < BITS_PER_WORD                                    \\\n> -   ? BITS_PER_WORD                                               \\\n> -   : (ALIGN))\n> -\n>  /* Make arrays of chars word-aligned for the same reasons.  */\n>  #define DATA_ALIGNMENT(TYPE, ALIGN) \\\n>    rs6000_data_alignment (TYPE, ALIGN, align_opt)\n> Index: gcc/config/rs6000/rs6000.c\n> ===================================================================\n> --- gcc/config/rs6000/rs6000.c  2017-09-22 17:31:56.427058675 +0100\n> +++ gcc/config/rs6000/rs6000.c  2017-09-22 17:37:26.779614386 +0100\n> @@ -1974,6 +1974,9 @@ #define TARGET_SLOW_UNALIGNED_ACCESS rs6\n>\n>  #undef TARGET_CAN_CHANGE_MODE_CLASS\n>  #define TARGET_CAN_CHANGE_MODE_CLASS rs6000_can_change_mode_class\n> +\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT rs6000_constant_alignment\n>\n>\n>  /* Processor table.  */\n> @@ -39128,6 +39131,17 @@ rs6000_optab_supported_p (int op, machin\n>        return true;\n>      }\n>  }\n> +\n> +/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n> +\n> +static HOST_WIDE_INT\n> +rs6000_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n> +{\n> +  if (TREE_CODE (exp) == STRING_CST\n> +      && (STRICT_ALIGNMENT || !optimize_size))\n> +    return MAX (align, BITS_PER_WORD);\n> +  return align;\n> +}\n>\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n> Index: gcc/config/s390/s390.h\n> ===================================================================\n> --- gcc/config/s390/s390.h      2017-09-15 14:47:33.178332233 +0100\n> +++ gcc/config/s390/s390.h      2017-09-22 17:37:26.781614386 +0100\n> @@ -315,7 +315,6 @@ #define BIGGEST_ALIGNMENT 64\n>  #define EMPTY_FIELD_BOUNDARY 32\n>\n>  /* Alignment on even addresses for LARL instruction.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN)\n>  #define DATA_ABI_ALIGNMENT(TYPE, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN)\n>\n>  /* Alignment is not required by the hardware.  */\n> Index: gcc/config/s390/s390.c\n> ===================================================================\n> --- gcc/config/s390/s390.c      2017-09-21 11:53:16.508848803 +0100\n> +++ gcc/config/s390/s390.c      2017-09-22 17:37:26.781614386 +0100\n> @@ -15906,6 +15906,15 @@ s390_vector_alignment (const_tree type)\n>    return MIN (64, tree_to_shwi (TYPE_SIZE (type)));\n>  }\n>\n> +/* Implement TARGET_CONSTANT_ALIGNMENT.  Alignment on even addresses for\n> +   LARL instruction.  */\n> +\n> +static HOST_WIDE_INT\n> +s390_constant_alignment (const_tree, HOST_WIDE_INT align)\n> +{\n> +  return MAX (align, 16);\n> +}\n> +\n>  #ifdef HAVE_AS_MACHINE_MACHINEMODE\n>  /* Implement TARGET_ASM_FILE_START.  */\n>  static void\n> @@ -16325,6 +16334,9 @@ #define TARGET_OPTION_RESTORE s390_funct\n>  #undef TARGET_CAN_CHANGE_MODE_CLASS\n>  #define TARGET_CAN_CHANGE_MODE_CLASS s390_can_change_mode_class\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT s390_constant_alignment\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  #include \"gt-s390.h\"\n> Index: gcc/config/sh/sh.h\n> ===================================================================\n> --- gcc/config/sh/sh.h  2017-09-15 14:47:33.178332233 +0100\n> +++ gcc/config/sh/sh.h  2017-09-22 17:37:26.782614386 +0100\n> @@ -462,12 +462,6 @@ #define BIGGEST_ALIGNMENT  (TARGET_ALIGN\n>  /* The best alignment to use in cases where we have a choice.  */\n>  #define FASTEST_ALIGNMENT (32)\n>\n> -/* Make strings word-aligned so strcpy from constants will be faster.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN) \\\n> -  ((TREE_CODE (EXP) == STRING_CST      \\\n> -    && (ALIGN) < FASTEST_ALIGNMENT)    \\\n> -    ? FASTEST_ALIGNMENT : (ALIGN))\n> -\n>  /* get_mode_alignment assumes complex values are always held in multiple\n>     registers, but that is not the case on the SH; CQImode and CHImode are\n>     held in a single integer register.  */\n> Index: gcc/config/sh/sh.c\n> ===================================================================\n> --- gcc/config/sh/sh.c  2017-09-15 13:56:20.288149017 +0100\n> +++ gcc/config/sh/sh.c  2017-09-22 17:37:26.782614386 +0100\n> @@ -657,6 +657,9 @@ #define TARGET_MODES_TIEABLE_P sh_modes_\n>  #undef TARGET_CAN_CHANGE_MODE_CLASS\n>  #define TARGET_CAN_CHANGE_MODE_CLASS sh_can_change_mode_class\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>\n> Index: gcc/config/sparc/sparc.h\n> ===================================================================\n> --- gcc/config/sparc/sparc.h    2017-09-15 14:47:33.178332233 +0100\n> +++ gcc/config/sparc/sparc.h    2017-09-22 17:37:26.784614385 +0100\n> @@ -579,12 +579,6 @@ #define MAX_FIXED_MODE_SIZE GET_MODE_BIT\n>  #define STACK_SAVEAREA_MODE(LEVEL) \\\n>    ((LEVEL) == SAVE_NONLOCAL ? (TARGET_ARCH64 ? TImode : DImode) : Pmode)\n>\n> -/* Make strings word-aligned so strcpy from constants will be faster.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n> -  ((TREE_CODE (EXP) == STRING_CST      \\\n> -    && (ALIGN) < FASTEST_ALIGNMENT)    \\\n> -   ? FASTEST_ALIGNMENT : (ALIGN))\n> -\n>  /* Make arrays of chars word-aligned for the same reasons.  */\n>  #define DATA_ALIGNMENT(TYPE, ALIGN)            \\\n>    (TREE_CODE (TYPE) == ARRAY_TYPE              \\\n> Index: gcc/config/sparc/sparc.c\n> ===================================================================\n> --- gcc/config/sparc/sparc.c    2017-09-21 11:53:16.532263818 +0100\n> +++ gcc/config/sparc/sparc.c    2017-09-22 17:37:26.784614385 +0100\n> @@ -684,6 +684,7 @@ static bool sparc_hard_regno_mode_ok (un\n>  static bool sparc_modes_tieable_p (machine_mode, machine_mode);\n>  static bool sparc_can_change_mode_class (machine_mode, machine_mode,\n>                                          reg_class_t);\n> +static HOST_WIDE_INT sparc_constant_alignment (const_tree, HOST_WIDE_INT);\n>\n>  #ifdef SUBTARGET_ATTRIBUTE_TABLE\n>  /* Table of valid machine attributes.  */\n> @@ -925,6 +926,9 @@ #define TARGET_MODES_TIEABLE_P sparc_mod\n>  #undef TARGET_CAN_CHANGE_MODE_CLASS\n>  #define TARGET_CAN_CHANGE_MODE_CLASS sparc_can_change_mode_class\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT sparc_constant_alignment\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  /* Return the memory reference contained in X if any, zero otherwise.  */\n> @@ -13429,4 +13433,14 @@ sparc_can_change_mode_class (machine_mod\n>    return true;\n>  }\n>\n> +/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n> +\n> +static HOST_WIDE_INT\n> +sparc_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n> +{\n> +  if (TREE_CODE (exp) == STRING_CST)\n> +    return MAX (align, FASTEST_ALIGNMENT);\n> +  return align;\n> +}\n> +\n>  #include \"gt-sparc.h\"\n> Index: gcc/config/spu/spu.h\n> ===================================================================\n> --- gcc/config/spu/spu.h        2017-09-15 15:37:22.133931616 +0100\n> +++ gcc/config/spu/spu.h        2017-09-22 17:37:26.785614385 +0100\n> @@ -96,7 +96,6 @@ #define MINIMUM_ATOMIC_ALIGNMENT 128\n>     on the stack.  (Except a bug (?) allows some stack objects to be\n>     unaligned.)  */\n>  #define DATA_ALIGNMENT(TYPE,ALIGN) ((ALIGN) > 128 ? (ALIGN) : 128)\n> -#define CONSTANT_ALIGNMENT(TYPE,ALIGN) ((ALIGN) > 128 ? (ALIGN) : 128)\n>  #define LOCAL_ALIGNMENT(TYPE,ALIGN) ((ALIGN) > 128 ? (ALIGN) : 128)\n>\n>  #define EMPTY_FIELD_BOUNDARY 32\n> Index: gcc/config/spu/spu.c\n> ===================================================================\n> --- gcc/config/spu/spu.c        2017-09-21 22:36:18.178401236 +0100\n> +++ gcc/config/spu/spu.c        2017-09-22 17:37:26.785614385 +0100\n> @@ -4159,7 +4159,7 @@ spu_encode_section_info (tree decl, rtx\n>     which is both 16-byte aligned and padded to a 16-byte boundary.  This\n>     would make it safe to store with a single instruction.\n>     We guarantee the alignment and padding for static objects by aligning\n> -   all of them to 16-bytes. (DATA_ALIGNMENT and CONSTANT_ALIGNMENT.)\n> +   all of them to 16-bytes. (DATA_ALIGNMENT and TARGET_CONSTANT_ALIGNMENT.)\n>     FIXME: We currently cannot guarantee this for objects on the stack\n>     because assign_parm_setup_stack calls assign_stack_local with the\n>     alignment of the parameter mode and in that case the alignment never\n> @@ -7193,6 +7193,18 @@ spu_truly_noop_truncation (unsigned int\n>  {\n>    return inprec <= 32 && outprec <= inprec;\n>  }\n> +\n> +/* Implement TARGET_CONSTANT_ALIGNMENT.\n> +\n> +   Make all static objects 16-byte aligned.  This allows us to assume\n> +   they are also padded to 16 bytes, which means we can use a single\n> +   load or store instruction to access them.  */\n> +\n> +static HOST_WIDE_INT\n> +spu_constant_alignment (const_tree, HOST_WIDE_INT align)\n> +{\n> +  return MAX (align, 128);\n> +}\n>\n>  /*  Table of machine attributes.  */\n>  static const struct attribute_spec spu_attribute_table[] =\n> @@ -7433,6 +7445,9 @@ #define TARGET_CAN_CHANGE_MODE_CLASS spu\n>  #undef TARGET_TRULY_NOOP_TRUNCATION\n>  #define TARGET_TRULY_NOOP_TRUNCATION spu_truly_noop_truncation\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT spu_constant_alignment\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  #include \"gt-spu.h\"\n> Index: gcc/config/stormy16/stormy16.h\n> ===================================================================\n> --- gcc/config/stormy16/stormy16.h      2017-09-15 14:47:33.179332125 +0100\n> +++ gcc/config/stormy16/stormy16.h      2017-09-22 17:37:26.785614385 +0100\n> @@ -87,10 +87,6 @@ #define DATA_ALIGNMENT(TYPE, ALIGN)          \\\n>     && TYPE_MODE (TREE_TYPE (TYPE)) == QImode   \\\n>     && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n>\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n> -  (TREE_CODE (EXP) == STRING_CST       \\\n> -   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n> -\n>  #define STRICT_ALIGNMENT 1\n>\n>  #define PCC_BITFIELD_TYPE_MATTERS 1\n> Index: gcc/config/stormy16/stormy16.c\n> ===================================================================\n> --- gcc/config/stormy16/stormy16.c      2017-09-04 11:50:08.540041564 +0100\n> +++ gcc/config/stormy16/stormy16.c      2017-09-22 17:37:26.785614385 +0100\n> @@ -2715,6 +2715,9 @@ #define TARGET_HARD_REGNO_MODE_OK xstorm\n>  #undef TARGET_MODES_TIEABLE_P\n>  #define TARGET_MODES_TIEABLE_P xstormy16_modes_tieable_p\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  #include \"gt-stormy16.h\"\n> Index: gcc/config/tilegx/tilegx.h\n> ===================================================================\n> --- gcc/config/tilegx/tilegx.h  2017-09-15 14:47:33.180332018 +0100\n> +++ gcc/config/tilegx/tilegx.h  2017-09-22 17:37:26.786614385 +0100\n> @@ -94,13 +94,6 @@ #define FASTEST_ALIGNMENT 64\n>  #define BIGGEST_FIELD_ALIGNMENT 128\n>  #define WIDEST_HARDWARE_FP_SIZE 64\n>\n> -/* Make strings word-aligned so strcpy from constants will be\n> -   faster.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n> -  ((TREE_CODE (EXP) == STRING_CST      \\\n> -    && (ALIGN) < FASTEST_ALIGNMENT)    \\\n> -   ? FASTEST_ALIGNMENT : (ALIGN))\n> -\n>  /* Make arrays of chars word-aligned for the same reasons.  */\n>  #define DATA_ALIGNMENT(TYPE, ALIGN)            \\\n>    (TREE_CODE (TYPE) == ARRAY_TYPE              \\\n> Index: gcc/config/tilegx/tilegx.c\n> ===================================================================\n> --- gcc/config/tilegx/tilegx.c  2017-09-15 14:47:33.180332018 +0100\n> +++ gcc/config/tilegx/tilegx.c  2017-09-22 17:37:26.786614385 +0100\n> @@ -5734,6 +5734,9 @@ #define TARGET_CAN_USE_DOLOOP_P can_use_\n>  #undef  TARGET_TRULY_NOOP_TRUNCATION\n>  #define TARGET_TRULY_NOOP_TRUNCATION tilegx_truly_noop_truncation\n>\n> +#undef  TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  #include \"gt-tilegx.h\"\n> Index: gcc/config/tilepro/tilepro.h\n> ===================================================================\n> --- gcc/config/tilepro/tilepro.h        2017-09-15 14:47:33.180332018 +0100\n> +++ gcc/config/tilepro/tilepro.h        2017-09-22 17:37:26.787614385 +0100\n> @@ -58,13 +58,6 @@ #define PCC_BITFIELD_TYPE_MATTERS 1\n>  #define FASTEST_ALIGNMENT 32\n>  #define BIGGEST_FIELD_ALIGNMENT 64\n>\n> -/* Make strings word-aligned so strcpy from constants will be\n> -   faster.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \\\n> -  ((TREE_CODE (EXP) == STRING_CST      \\\n> -    && (ALIGN) < FASTEST_ALIGNMENT)    \\\n> -   ? FASTEST_ALIGNMENT : (ALIGN))\n> -\n>  /* Make arrays of chars word-aligned for the same reasons.  */\n>  #define DATA_ALIGNMENT(TYPE, ALIGN)            \\\n>    (TREE_CODE (TYPE) == ARRAY_TYPE              \\\n> Index: gcc/config/tilepro/tilepro.c\n> ===================================================================\n> --- gcc/config/tilepro/tilepro.c        2017-09-04 08:30:09.354408112 +0100\n> +++ gcc/config/tilepro/tilepro.c        2017-09-22 17:37:26.786614385 +0100\n> @@ -5091,6 +5091,9 @@ #define TARGET_ASM_FILE_END tilepro_file\n>  #undef  TARGET_CAN_USE_DOLOOP_P\n>  #define TARGET_CAN_USE_DOLOOP_P can_use_doloop_if_innermost\n>\n> +#undef  TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  #include \"gt-tilepro.h\"\n> Index: gcc/config/visium/visium.h\n> ===================================================================\n> --- gcc/config/visium/visium.h  2017-09-15 14:47:33.181331910 +0100\n> +++ gcc/config/visium/visium.h  2017-09-22 17:37:26.787614385 +0100\n> @@ -236,16 +236,6 @@ #define BIGGEST_ALIGNMENT 32\n>     this macro is used instead of that alignment to align the object. */\n>  #define DATA_ALIGNMENT(TYPE,ALIGN) visium_data_alignment (TYPE, ALIGN)\n>\n> -/* `CONSTANT_ALIGNMENT (CONSTANT, BASIC-ALIGN)`\n> -\n> -   If defined, a C expression to compute the alignment given to a\n> -   constant that is being placed in memory.  CONSTANT is the constant\n> -   and BASIC-ALIGN is the alignment that the object would ordinarily\n> -   have.  The value of this macro is used instead of that alignment to\n> -   align the object. */\n> -#define CONSTANT_ALIGNMENT(EXP,ALIGN) \\\n> -  visium_data_alignment (TREE_TYPE (EXP), ALIGN)\n> -\n>  /* `LOCAL_ALIGNMENT (TYPE, BASIC-ALIGN)`\n>\n>     If defined, a C expression to compute the alignment for a variable\n> Index: gcc/config/visium/visium.c\n> ===================================================================\n> --- gcc/config/visium/visium.c  2017-09-15 13:56:20.293149098 +0100\n> +++ gcc/config/visium/visium.c  2017-09-22 17:37:26.787614385 +0100\n> @@ -237,6 +237,8 @@ static bool visium_modes_tieable_p (mach\n>  static bool visium_can_change_mode_class (machine_mode, machine_mode,\n>                                           reg_class_t);\n>\n> +static HOST_WIDE_INT visium_constant_alignment (const_tree, HOST_WIDE_INT);\n> +\n>  /* Setup the global target hooks structure.  */\n>\n>  #undef  TARGET_MAX_ANCHOR_OFFSET\n> @@ -360,6 +362,9 @@ #define TARGET_MODES_TIEABLE_P visium_mo\n>  #undef TARGET_CAN_CHANGE_MODE_CLASS\n>  #define TARGET_CAN_CHANGE_MODE_CLASS visium_can_change_mode_class\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT visium_constant_alignment\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>  namespace {\n> @@ -834,6 +839,14 @@ visium_data_alignment (tree type, unsign\n>    return align;\n>  }\n>\n> +/* Implement TARGET_CONSTANT_ALIGNMENT.  */\n> +\n> +static HOST_WIDE_INT\n> +visium_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n> +{\n> +  return visium_data_alignment (TREE_TYPE (exp), align);\n> +}\n> +\n>  /* Helper function for HARD_REGNO_RENAME_OK (FROM, TO).  Return non-zero if\n>     it is OK to rename a hard register FROM to another hard register TO.  */\n>\n> Index: gcc/config/xtensa/xtensa.h\n> ===================================================================\n> --- gcc/config/xtensa/xtensa.h  2017-09-15 14:47:33.181331910 +0100\n> +++ gcc/config/xtensa/xtensa.h  2017-09-22 17:37:26.788614385 +0100\n> @@ -169,17 +169,6 @@ #define PROMOTE_MODE(MODE, UNSIGNEDP, TY\n>     bitfields and the structures that contain them.  */\n>  #define PCC_BITFIELD_TYPE_MATTERS 1\n>\n> -/* Align string constants and constructors to at least a word boundary.\n> -   The typical use of this macro is to increase alignment for string\n> -   constants to be word aligned so that 'strcpy' calls that copy\n> -   constants can be done inline.  */\n> -#define CONSTANT_ALIGNMENT(EXP, ALIGN)                                 \\\n> -  (!optimize_size &&                                                   \\\n> -   (TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR)   \\\n> -   && (ALIGN) < BITS_PER_WORD                                          \\\n> -       ? BITS_PER_WORD                                                 \\\n> -       : (ALIGN))\n> -\n>  /* Align arrays, unions and records to at least a word boundary.\n>     One use of this macro is to increase alignment of medium-size\n>     data to make it all fit in fewer cache lines.  Another is to\n> Index: gcc/config/xtensa/xtensa.c\n> ===================================================================\n> --- gcc/config/xtensa/xtensa.c  2017-09-12 14:29:25.261529490 +0100\n> +++ gcc/config/xtensa/xtensa.c  2017-09-22 17:37:26.788614385 +0100\n> @@ -181,6 +181,7 @@ static void xtensa_conditional_register_\n>  static unsigned int xtensa_hard_regno_nregs (unsigned int, machine_mode);\n>  static bool xtensa_hard_regno_mode_ok (unsigned int, machine_mode);\n>  static bool xtensa_modes_tieable_p (machine_mode, machine_mode);\n> +static HOST_WIDE_INT xtensa_constant_alignment (const_tree, HOST_WIDE_INT);\n>\n>\n>\n> @@ -317,6 +318,9 @@ #define TARGET_HARD_REGNO_MODE_OK xtensa\n>  #undef TARGET_MODES_TIEABLE_P\n>  #define TARGET_MODES_TIEABLE_P xtensa_modes_tieable_p\n>\n> +#undef TARGET_CONSTANT_ALIGNMENT\n> +#define TARGET_CONSTANT_ALIGNMENT xtensa_constant_alignment\n> +\n>  struct gcc_target targetm = TARGET_INITIALIZER;\n>\n>\n> @@ -4380,4 +4384,19 @@ enum reg_class xtensa_regno_to_class (in\n>      return regno_to_class[regno];\n>  }\n>\n> +/* Implement TARGET_CONSTANT_ALIGNMENT.  Align string constants and\n> +   constructors to at least a word boundary.  The typical use of this\n> +   macro is to increase alignment for string constants to be word\n> +   aligned so that 'strcpy' calls that copy constants can be done\n> +   inline.  */\n> +\n> +static HOST_WIDE_INT\n> +xtensa_constant_alignment (const_tree exp, HOST_WIDE_INT align)\n> +{\n> +  if ((TREE_CODE (exp) == STRING_CST || TREE_CODE (exp) == CONSTRUCTOR)\n> +      && !optimize_size)\n> +    return MAX (align, BITS_PER_WORD);\n> +  return align;\n> +}\n> +\n>  #include \"gt-xtensa.h\"\n> Index: gcc/system.h\n> ===================================================================\n> --- gcc/system.h        2017-09-15 15:37:22.136931501 +0100\n> +++ gcc/system.h        2017-09-22 17:37:26.790614385 +0100\n> @@ -915,7 +915,7 @@ #define realloc xrealloc\n>         MODES_TIEABLE_P FUNCTION_ARG_PADDING SLOW_UNALIGNED_ACCESS      \\\n>         HARD_REGNO_NREGS SECONDARY_MEMORY_NEEDED_MODE                   \\\n>         SECONDARY_MEMORY_NEEDED CANNOT_CHANGE_MODE_CLASS                \\\n> -       TRULY_NOOP_TRUNCATION FUNCTION_ARG_OFFSET\n> +       TRULY_NOOP_TRUNCATION FUNCTION_ARG_OFFSET CONSTANT_ALIGNMENT\n>\n>  /* Target macros only used for code built for the target, that have\n>     moved to libgcc-tm.h or have never been present elsewhere.  */","headers":{"Return-Path":"<gcc-patches-return-462889-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-462889-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=\"dnPhXpJZ\"; 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 3y13ty1r1Hz9s7F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 25 Sep 2017 22:54:17 +1000 (AEST)","(qmail 107357 invoked by alias); 25 Sep 2017 12:54:08 -0000","(qmail 107335 invoked by uid 89); 25 Sep 2017 12:54:07 -0000","from mail-wm0-f51.google.com (HELO mail-wm0-f51.google.com)\n\t(74.125.82.51) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tMon, 25 Sep 2017 12:53:52 +0000","by mail-wm0-f51.google.com with SMTP id r136so19293583wmf.2 for\n\t<gcc-patches@gcc.gnu.org>; Mon, 25 Sep 2017 05:53:51 -0700 (PDT)","by 10.80.143.34 with HTTP; Mon, 25 Sep 2017 05:53:46 -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\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:content-type; q=dns; s=default; b=MNQn/EG4ta/tTuoe3A\n\t8PsTp9vfW8K8NoAZD+oFjzCZEd3S15HChfDtOC7oq+L4fZ1m8Hb+v4vCLsmQcSUC\n\tUYNhFTRPrru5vbD5wpf/BSXlckHB9brYzyS/X8OaAK0iNtgrMvAvwZHkCDSGgpm9\n\tug2RSI+xFgpkD9M8NCYwXWWDU=","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\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:content-type; s=default; bh=QAOeZZC1ILkndZDW5bxdyt8a\n\tsX8=; b=dnPhXpJZeZ6Gxi7eu3H1ZoKbhGAhPxMIlCnFpyQ9I0jy05J7shp7EQcz\n\t25iZuo50s9tMNVUvKJQBrDkWnDiNP5C3jWcBJybyHQZvhYP2gQjZK/Q7EgvT2T5l\n\tNko9mlle1XetjvMi23ujFay16nM+sin/s7oONryKnLBQBtufB0s=","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=-9.7 required=5.0 tests=AWL, BAYES_00,\n\tFREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS,\n\tKAM_STOCKGEN, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mail-wm0-f51.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:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to;\n\tbh=7JUfdwDZXHoFG4x8HIVCp7WvxINjWmbkaqW+6DY3Pfw=;\n\tb=PSdNQyMfw2j6tE0CXLEw4jTCwRGCArKN9ZNyH5kqyX/DFDY4dVbTzq+S0Oi8oIZBGF\n\tXEbPROdLOfy/CAuzWN5RGSz6AJxnB3PdejTF+9fVlqawltxuGo7r0+Iiqdi8eFMnO66S\n\tHEiTIh8D9/pjvvu6QabY0wDa2bUG2c0zIEUuKB5N7Nfnnl+JKiyJFa6vFLQK7pACGB5L\n\tMeR9Dxyi6FVNfWWEb6RFeZ+wSPoz5+xBNyLPADVKn71dl2ukkPayMjFsyfc5WKUXaRwU\n\tPu3l3geUO+vHiRMBnjSkQU1BOlz+yU2SIJuE16e95KDIViSKJ84oGJss+nNUuPUEyPqa\n\t1CyQ==","X-Gm-Message-State":"AHPjjUjUq90Uhvi8BSurl1qlwM/HqLfCoqyOnPNI7WAeZ0/Wxs39unKc\tAo1n32Lrs9rLeov0Wd6XHilGloTbehWyJk32SGo=","X-Google-Smtp-Source":"AOwi7QA5Bdm7i+WXZ0PMoODGrnZacc5cwcJiYqxxeEVO/MRt2+AblKMjh8crWRnrdea0oUxiZMFgDXZPyJZyBz6lFSc=","X-Received":"by 10.80.186.110 with SMTP id 43mr13584659eds.18.1506344027177;\n\tMon, 25 Sep 2017 05:53:47 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<87zi9mptv6.fsf@linaro.org>","References":"<87shfhzgwc.fsf@linaro.org>\n\t<FDB20764-7B41-4630-B4C6-3DEAFCE53C58@gmail.com>\n\t<874lrw5hxk.fsf@linaro.org>\n\t<CAFiYyc35uOLn4E1qVR+4PERDL3vumapyZt3OiLGxn8MXGWANrQ@mail.gmail.com>\n\t<87zi9mptv6.fsf@linaro.org>","From":"Richard Biener <richard.guenther@gmail.com>","Date":"Mon, 25 Sep 2017 14:53:46 +0200","Message-ID":"<CAFiYyc1+Bx0SFLqM=0HWxLkMpDZXWq1fs5Jkie=DDpk1j-ZS3A@mail.gmail.com>","Subject":"Re: Don't query the frontend for unsupported types","To":"Richard Biener <richard.guenther@gmail.com>,\n\tGCC Patches <gcc-patches@gcc.gnu.org>,\n\tRichard Sandiford <richard.sandiford@linaro.org>","Content-Type":"text/plain; charset=\"UTF-8\"","X-IsSubscribed":"yes"}},{"id":1778028,"web_url":"http://patchwork.ozlabs.org/comment/1778028/","msgid":"<87k20ex2ps.fsf@linaro.org>","list_archive_url":null,"date":"2017-10-01T16:17:03","subject":"Re: Don't query the frontend for unsupported types","submitter":{"id":5450,"url":"http://patchwork.ozlabs.org/api/people/5450/","name":"Richard Sandiford","email":"richard.sandiford@linaro.org"},"content":"Richard Biener <richard.guenther@gmail.com> writes:\n> On Fri, Sep 22, 2017 at 6:42 PM, Richard Sandiford\n> <richard.sandiford@linaro.org> wrote:\n>> Richard Biener <richard.guenther@gmail.com> writes:\n>>> On Thu, Sep 21, 2017 at 2:56 PM, Richard Sandiford\n>>> <richard.sandiford@linaro.org> wrote:\n>>>> Richard Biener <richard.guenther@gmail.com> writes:\n>>>>> On September 20, 2017 2:36:03 PM GMT+02:00, Richard Sandiford\n>>>>> <richard.sandiford@linaro.org> wrote:\n>>>>>>When forcing a constant of mode MODE into memory, force_const_mem\n>>>>>>asks the frontend to provide the type associated with that mode.\n>>>>>>In principle type_for_mode is allowed to return null, and although\n>>>>>>one use site correctly handled that, the other didn't.\n>>>>>>\n>>>>>>I think there's agreement that it's bogus to use type_for_mode for\n>>>>>>this kind of thing, since it forces frontends to handle types that\n>>>>>>don't exist in that language.  See e.g. http://gcc.gnu.org/PR46805\n>>>>>>where the Go frontend was forced to handle vector types even though\n>>>>>>Go doesn't have vector types.\n>>>>>>\n>>>>>>Also, the frontends use code like:\n>>>>>>\n>>>>>>  else if (VECTOR_MODE_P (mode))\n>>>>>>    {\n>>>>>>      machine_mode inner_mode = GET_MODE_INNER (mode);\n>>>>>>      tree inner_type = c_common_type_for_mode (inner_mode, unsignedp);\n>>>>>>      if (inner_type != NULL_TREE)\n>>>>>>        return build_vector_type_for_mode (inner_type, mode);\n>>>>>>    }\n>>>>>>\n>>>>>>and there's no guarantee that every vector mode M used by backend\n>>>>>>rtl has an associated vector type whose TYPE_MODE is M.  I think\n>>>>>>really the type_for_mode hook should only return trees that _do_ have\n>>>>>>the requested TYPE_MODE, but PR46805 linked above shows that this is\n>>>>>>likely to have too many knock-on consequences.  It doesn't make sense\n>>>>>>for force_const_mem to ask about vector modes that aren't valid for\n>>>>>>vector types, so this patch handles the condition there instead.\n>>>>>>\n>>>>>>This is needed for SVE multi-register modes, which are modelled as\n>>>>>>vector modes but are not usable as vector types.\n>>>>>>\n>>>>>>Tested on aarch64-linux-gnu, x86_64-linux-gnu and\n>>>>>>powerpc64le-linus-gnu.\n>>>>>>OK to install?\n>>>>>\n>>>>> I think we should get rid of the use entirely.\n>>>>\n>>>> I first read this as not using type_for_mode at all in force_const_mem,\n>>>> which sounded like a good thing :-)\n>>>\n>>> That's what I meant ;)  A mode doesn't really have a type...\n>>>\n>>>   I tried it overnight on the usual\n>>>> at-least-one-target-per-CPU set and diffing the before and after\n>>>> assembly for the testsuite.  And it looks like i686 relies on this\n>>>> to get an alignment of 16 rather than 4 for XFmode constants:\n>>>> GET_MODE_ALIGNMENT (XFmode) == 32 (as requested by i386-modes.def),\n>>>> but i386's CONSTANT_ALIGNMENT increases it to 128 for static constants.\n>>>\n>>> Then the issue is that CONSTANT_ALIGNMENT takes a tree and not a mode...\n>>> even worse than type_for_mode is a use of make_tree!  Incidentially\n>>> ix86_constant_alignment _does_ look at the mode in the end...\n>>\n>> OK, I guess this means another target hook conversion.  The patch\n>> below converts CONSTANT_ALIGNMENT with its current interface.\n>> The definition:\n>>\n>>   #define CONSTANT_ALIGNMENT(EXP, ALIGN) \\\n>>     (TREE_CODE (EXP) == STRING_CST \\\n>>      && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n>>\n>> was very common, so the patch adds a canned definition for that,\n>> called constant_alignment_word_strings.  Some ports had a variation\n>> that used a port-local FASTEST_ALIGNMENT instead of BITS_PER_WORD;\n>> the patch uses constant_alignment_word_strings if FASTEST_ALIGNMENT\n>> was always BITS_PER_WORD and a port-local hook function otherwise.\n>>\n>> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.\n>> Also tested by comparing the testsuite assembly output on at least one\n>> target per CPU directory.  I don't think this comes under Jeff's\n>> preapproval due to the constant_alignment_word_strings thing, so:\n>> OK to install?\n>\n> Ok.\n\nThanks.  A bit later than intended, but here's the follow-on to add\nthe new rtx hook.\n\nTested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.\nAlso tested by comparing the testsuite assembly output on at least one\ntarget per CPU directory.  OK to install?\n\nRichard\n\n\n2017-10-01  Richard Sandiford  <richard.sandiford@linaro.org>\n\ngcc/\n\t* target.def (static_rtx_alignment): New hook.\n\t* targhooks.h (default_static_rtx_alignment): Declare.\n\t* targhooks.c (default_static_rtx_alignment): New function.\n\t* doc/tm.texi.in (TARGET_STATIC_RTX_ALIGNMENT): New hook.\n\t* doc/tm.texi: Regenerate.\n\t* varasm.c (force_const_mem): Use targetm.static_rtx_alignment\n\tinstead of targetm.constant_alignment.  Remove call to\n\tset_mem_attributes.\n\t* config/cris/cris.c (TARGET_STATIC_RTX_ALIGNMENT): Redefine.\n\t(cris_preferred_mininum_alignment): New function, split out from...\n\t(cris_constant_alignment): ...here.\n\t(cris_static_rtx_alignment): New function.\n\t* config/i386/i386.c (ix86_static_rtx_alignment): New function,\n\tsplit out from...\n\t(ix86_constant_alignment): ...here.\n\t(TARGET_STATIC_RTX_ALIGNMENT): Redefine.\n\t* config/mmix/mmix.c (TARGET_STATIC_RTX_ALIGNMENT): Redefine.\n\t(mmix_static_rtx_alignment): New function.\n\t* config/spu/spu.c (spu_static_rtx_alignment): New function.\n\t(TARGET_STATIC_RTX_ALIGNMENT): Redefine.\n\nIndex: gcc/target.def\n===================================================================\n--- gcc/target.def\t2017-09-25 17:04:16.792359030 +0100\n+++ gcc/target.def\t2017-10-01 17:14:18.480815538 +0100\n@@ -3336,6 +3336,15 @@ HOOK_VECTOR_END (addr_space)\n #define HOOK_PREFIX \"TARGET_\"\n \n DEFHOOK\n+(static_rtx_alignment,\n+ \"This hook returns the preferred alignment in bits for a\\n\\\n+statically-allocated rtx, such as a constant pool entry.  @var{mode}\\n\\\n+is the mode of the rtx.  The default implementation returns\\n\\\n+@samp{GET_MODE_ALIGNMENT (@var{mode})}.\",\n+ HOST_WIDE_INT, (machine_mode mode),\n+ default_static_rtx_alignment)\n+\n+DEFHOOK\n (constant_alignment,\n  \"This hook returns the alignment in bits of a constant that is being\\n\\\n placed in memory.  @var{constant} is the constant and @var{basic_align}\\n\\\nIndex: gcc/targhooks.h\n===================================================================\n--- gcc/targhooks.h\t2017-09-25 17:04:16.793358890 +0100\n+++ gcc/targhooks.h\t2017-10-01 17:14:18.481821912 +0100\n@@ -93,6 +93,7 @@ extern int default_builtin_vectorization\n \n extern tree default_builtin_reciprocal (tree);\n \n+extern HOST_WIDE_INT default_static_rtx_alignment (machine_mode);\n extern HOST_WIDE_INT default_constant_alignment (const_tree, HOST_WIDE_INT);\n extern HOST_WIDE_INT constant_alignment_word_strings (const_tree,\n \t\t\t\t\t\t      HOST_WIDE_INT);\nIndex: gcc/targhooks.c\n===================================================================\n--- gcc/targhooks.c\t2017-09-25 17:04:16.793358890 +0100\n+++ gcc/targhooks.c\t2017-10-01 17:14:18.481821912 +0100\n@@ -1165,6 +1165,14 @@ tree default_mangle_decl_assembler_name\n    return id;\n }\n \n+/* The default implementation of TARGET_STATIC_RTX_ALIGNMENT.  */\n+\n+HOST_WIDE_INT\n+default_static_rtx_alignment (machine_mode mode)\n+{\n+  return GET_MODE_ALIGNMENT (mode);\n+}\n+\n /* The default implementation of TARGET_CONSTANT_ALIGNMENT.  */\n \n HOST_WIDE_INT\nIndex: gcc/doc/tm.texi.in\n===================================================================\n--- gcc/doc/tm.texi.in\t2017-09-25 17:04:16.792359030 +0100\n+++ gcc/doc/tm.texi.in\t2017-10-01 17:14:18.480815538 +0100\n@@ -1026,6 +1026,8 @@ On 32-bit ELF the largest supported sect\n @samp{(0x80000000 * 8)}, but this is not representable on 32-bit hosts.\n @end defmac\n \n+@hook TARGET_STATIC_RTX_ALIGNMENT\n+\n @defmac DATA_ALIGNMENT (@var{type}, @var{basic-align})\n If defined, a C expression to compute the alignment for a variable in\n the static store.  @var{type} is the data type, and @var{basic-align} is\nIndex: gcc/doc/tm.texi\n===================================================================\n--- gcc/doc/tm.texi\t2017-09-25 17:04:16.791359170 +0100\n+++ gcc/doc/tm.texi\t2017-10-01 17:14:18.479809163 +0100\n@@ -1078,6 +1078,13 @@ On 32-bit ELF the largest supported sect\n @samp{(0x80000000 * 8)}, but this is not representable on 32-bit hosts.\n @end defmac\n \n+@deftypefn {Target Hook} HOST_WIDE_INT TARGET_STATIC_RTX_ALIGNMENT (machine_mode @var{mode})\n+This hook returns the preferred alignment in bits for a\n+statically-allocated rtx, such as a constant pool entry.  @var{mode}\n+is the mode of the rtx.  The default implementation returns\n+@samp{GET_MODE_ALIGNMENT (@var{mode})}.\n+@end deftypefn\n+\n @defmac DATA_ALIGNMENT (@var{type}, @var{basic-align})\n If defined, a C expression to compute the alignment for a variable in\n the static store.  @var{type} is the data type, and @var{basic-align} is\nIndex: gcc/varasm.c\n===================================================================\n--- gcc/varasm.c\t2017-09-25 17:04:16.793358890 +0100\n+++ gcc/varasm.c\t2017-10-01 17:14:18.481821912 +0100\n@@ -3784,11 +3784,8 @@ force_const_mem (machine_mode mode, rtx\n   *slot = desc;\n \n   /* Align the location counter as required by EXP's data type.  */\n-  align = GET_MODE_ALIGNMENT (mode == VOIDmode ? word_mode : mode);\n-\n-  tree type = lang_hooks.types.type_for_mode (mode, 0);\n-  if (type != NULL_TREE)\n-    align = targetm.constant_alignment (make_tree (type, x), align);\n+  machine_mode align_mode = (mode == VOIDmode ? word_mode : mode);\n+  align = targetm.static_rtx_alignment (align_mode);\n \n   pool->offset += (align / BITS_PER_UNIT) - 1;\n   pool->offset &= ~ ((align / BITS_PER_UNIT) - 1);\n@@ -3830,7 +3827,6 @@ force_const_mem (machine_mode mode, rtx\n \n   /* Construct the MEM.  */\n   desc->mem = def = gen_const_mem (mode, symbol);\n-  set_mem_attributes (def, lang_hooks.types.type_for_mode (mode, 0), 1);\n   set_mem_align (def, align);\n \n   /* If we're dropping a label to the constant pool, make sure we\nIndex: gcc/config/cris/cris.c\n===================================================================\n--- gcc/config/cris/cris.c\t2017-09-25 17:04:16.762363228 +0100\n+++ gcc/config/cris/cris.c\t2017-10-01 17:14:18.472764540 +0100\n@@ -165,6 +165,7 @@ static bool cris_function_value_regno_p\n static void cris_file_end (void);\n static unsigned int cris_hard_regno_nregs (unsigned int, machine_mode);\n static bool cris_hard_regno_mode_ok (unsigned int, machine_mode);\n+static HOST_WIDE_INT cris_static_rtx_alignment (machine_mode);\n static HOST_WIDE_INT cris_constant_alignment (const_tree, HOST_WIDE_INT);\n \n /* This is the parsed result of the \"-max-stack-stackframe=\" option.  If\n@@ -288,6 +289,8 @@ #define TARGET_HARD_REGNO_NREGS cris_har\n #undef TARGET_HARD_REGNO_MODE_OK\n #define TARGET_HARD_REGNO_MODE_OK cris_hard_regno_mode_ok\n \n+#undef TARGET_STATIC_RTX_ALIGNMENT\n+#define TARGET_STATIC_RTX_ALIGNMENT cris_static_rtx_alignment\n #undef TARGET_CONSTANT_ALIGNMENT\n #define TARGET_CONSTANT_ALIGNMENT cris_constant_alignment\n \n@@ -4329,6 +4332,26 @@ cris_hard_regno_mode_ok (unsigned int re\n \t      || (regno != CRIS_MOF_REGNUM && regno != CRIS_ACR_REGNUM)));\n }\n \n+/* Return the preferred minimum alignment for a static object.  */\n+\n+static HOST_WIDE_INT\n+cris_preferred_mininum_alignment (void)\n+{\n+  if (!TARGET_CONST_ALIGN)\n+    return 8;\n+  if (TARGET_ALIGN_BY_32)\n+    return 32;\n+  return 16;\n+}\n+\n+/* Implement TARGET_STATIC_RTX_ALIGNMENT.  */\n+\n+static HOST_WIDE_INT\n+cris_static_rtx_alignment (machine_mode mode)\n+{\n+  return MAX (cris_preferred_mininum_alignment (), GET_MODE_ALIGNMENT (mode));\n+}\n+\n /* Implement TARGET_CONSTANT_ALIGNMENT.  Note that this hook has the\n    effect of making gcc believe that ALL references to constant stuff\n    (in code segment, like strings) have this alignment.  That is a rather\n@@ -4339,11 +4362,7 @@ cris_hard_regno_mode_ok (unsigned int re\n static HOST_WIDE_INT\n cris_constant_alignment (const_tree, HOST_WIDE_INT basic_align)\n {\n-  if (!TARGET_CONST_ALIGN)\n-    return basic_align;\n-  if (TARGET_ALIGN_BY_32)\n-    return MAX (basic_align, 32);\n-  return MAX (basic_align, 16);\n+  return MAX (cris_preferred_mininum_alignment (), basic_align);\n }\n \n #if 0\nIndex: gcc/config/i386/i386.c\n===================================================================\n--- gcc/config/i386/i386.c\t2017-09-25 17:04:16.768362388 +0100\n+++ gcc/config/i386/i386.c\t2017-10-01 17:14:18.477796414 +0100\n@@ -31563,6 +31563,18 @@ ix86_sched_init_global (FILE *, int, int\n }\n \n \f\n+/* Implement TARGET_STATIC_RTX_ALIGNMENT.  */\n+\n+static HOST_WIDE_INT\n+ix86_static_rtx_alignment (machine_mode mode)\n+{\n+  if (mode == DFmode)\n+    return 64;\n+  if (ALIGN_MODE_128 (mode))\n+    return MAX (128, GET_MODE_ALIGNMENT (mode));\n+  return GET_MODE_ALIGNMENT (mode);\n+}\n+\n /* Implement TARGET_CONSTANT_ALIGNMENT.  */\n \n static HOST_WIDE_INT\n@@ -31571,10 +31583,9 @@ ix86_constant_alignment (const_tree exp,\n   if (TREE_CODE (exp) == REAL_CST || TREE_CODE (exp) == VECTOR_CST\n       || TREE_CODE (exp) == INTEGER_CST)\n     {\n-      if (TYPE_MODE (TREE_TYPE (exp)) == DFmode && align < 64)\n-\treturn 64;\n-      else if (ALIGN_MODE_128 (TYPE_MODE (TREE_TYPE (exp))) && align < 128)\n-\treturn 128;\n+      machine_mode mode = TYPE_MODE (TREE_TYPE (exp));\n+      HOST_WIDE_INT mode_align = ix86_static_rtx_alignment (mode);\n+      return MAX (mode_align, align);\n     }\n   else if (!optimize_size && TREE_CODE (exp) == STRING_CST\n \t   && TREE_STRING_LENGTH (exp) >= 31 && align < BITS_PER_WORD)\n@@ -53605,6 +53616,8 @@ #define TARGET_HARD_REGNO_CALL_PART_CLOB\n #undef TARGET_CAN_CHANGE_MODE_CLASS\n #define TARGET_CAN_CHANGE_MODE_CLASS ix86_can_change_mode_class\n \n+#undef TARGET_STATIC_RTX_ALIGNMENT\n+#define TARGET_STATIC_RTX_ALIGNMENT ix86_static_rtx_alignment\n #undef TARGET_CONSTANT_ALIGNMENT\n #define TARGET_CONSTANT_ALIGNMENT ix86_constant_alignment\n \nIndex: gcc/config/mmix/mmix.c\n===================================================================\n--- gcc/config/mmix/mmix.c\t2017-09-25 17:04:16.774361549 +0100\n+++ gcc/config/mmix/mmix.c\t2017-10-01 17:14:18.477796414 +0100\n@@ -168,6 +168,7 @@ static void mmix_print_operand (FILE *,\n static void mmix_print_operand_address (FILE *, machine_mode, rtx);\n static bool mmix_print_operand_punct_valid_p (unsigned char);\n static void mmix_conditional_register_usage (void);\n+static HOST_WIDE_INT mmix_static_rtx_alignment (machine_mode);\n static HOST_WIDE_INT mmix_constant_alignment (const_tree, HOST_WIDE_INT);\n \n /* Target structure macros.  Listed by node.  See `Using and Porting GCC'\n@@ -283,6 +284,8 @@ #define TARGET_TRAMPOLINE_INIT mmix_tram\n #undef TARGET_OPTION_OVERRIDE\n #define TARGET_OPTION_OVERRIDE mmix_option_override\n \n+#undef TARGET_STATIC_RTX_ALIGNMENT\n+#define TARGET_STATIC_RTX_ALIGNMENT mmix_static_rtx_alignment\n #undef TARGET_CONSTANT_ALIGNMENT\n #define TARGET_CONSTANT_ALIGNMENT mmix_constant_alignment\n \n@@ -338,6 +341,14 @@ mmix_data_alignment (tree type ATTRIBUTE\n   return basic_align;\n }\n \n+/* Implement TARGET_STATIC_RTX_ALIGNMENT.  */\n+\n+static HOST_WIDE_INT\n+mmix_static_rtx_alignment (machine_mode mode)\n+{\n+  return MAX (GET_MODE_ALIGNMENT (mode), 32);\n+}\n+\n /* Implement tARGET_CONSTANT_ALIGNMENT.  */\n \n static HOST_WIDE_INT\nIndex: gcc/config/spu/spu.c\n===================================================================\n--- gcc/config/spu/spu.c\t2017-09-25 17:04:16.787359730 +0100\n+++ gcc/config/spu/spu.c\t2017-10-01 17:14:18.478802788 +0100\n@@ -7194,6 +7194,18 @@ spu_truly_noop_truncation (unsigned int\n   return inprec <= 32 && outprec <= inprec;\n }\n \n+/* Implement TARGET_STATIC_RTX_ALIGNMENT.\n+\n+   Make all static objects 16-byte aligned.  This allows us to assume\n+   they are also padded to 16 bytes, which means we can use a single\n+   load or store instruction to access them.  */\n+\n+static HOST_WIDE_INT\n+spu_static_rtx_alignment (machine_mode mode)\n+{\n+  return MAX (GET_MODE_ALIGNMENT (mode), 128);\n+}\n+\n /* Implement TARGET_CONSTANT_ALIGNMENT.\n \n    Make all static objects 16-byte aligned.  This allows us to assume\n@@ -7445,6 +7457,8 @@ #define TARGET_CAN_CHANGE_MODE_CLASS spu\n #undef TARGET_TRULY_NOOP_TRUNCATION\n #define TARGET_TRULY_NOOP_TRUNCATION spu_truly_noop_truncation\n \n+#undef TARGET_STATIC_RTX_ALIGNMENT\n+#define TARGET_STATIC_RTX_ALIGNMENT spu_static_rtx_alignment\n #undef TARGET_CONSTANT_ALIGNMENT\n #define TARGET_CONSTANT_ALIGNMENT spu_constant_alignment","headers":{"Return-Path":"<gcc-patches-return-463293-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-463293-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=\"eIWftE6Z\"; 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 3y4r6V3yYxz9t61\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon,  2 Oct 2017 03:17:22 +1100 (AEDT)","(qmail 115583 invoked by alias); 1 Oct 2017 16:17:11 -0000","(qmail 115573 invoked by uid 89); 1 Oct 2017 16:17:11 -0000","from mail-wr0-f180.google.com (HELO mail-wr0-f180.google.com)\n\t(209.85.128.180) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tSun, 01 Oct 2017 16:17:08 +0000","by mail-wr0-f180.google.com with SMTP id a43so2410911wrc.0 for\n\t<gcc-patches@gcc.gnu.org>; Sun, 01 Oct 2017 09:17:07 -0700 (PDT)","from localhost ([2.26.27.252]) by smtp.gmail.com with ESMTPSA id\n\tf89sm9752651wmh.18.2017.10.01.09.17.03 (version=TLS1_2\n\tcipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tSun, 01 Oct 2017 09:17:04 -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:cc:subject:references:date:in-reply-to:message-id\n\t:mime-version:content-type; q=dns; s=default; b=gBRZEMYZrBgrRzJA\n\tZtAA8W++JSl65NvYIeJ9TKwXjrpTKgYdhZgB5R2h7fsK8jbyb4ck2QzSndaiVusr\n\tweLM3Lzcibbdmwu9haKb5WLETjoHMNz5TDsw7WibEDCPPnb/smgW06KxB2ui7MCR\n\torJCUutZrNmkcI9gqU1aofIDLxA=","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:cc:subject:references:date:in-reply-to:message-id\n\t:mime-version:content-type; s=default; bh=xz4AIOz3D7mYT4DPeXyHET\n\tBU54Q=; b=eIWftE6ZuwyMv4R/fnXDKUe/OVLbT5wyw5o53brbOT9xecShBHxT35\n\t7u9onulgMl/h8D7xvHBlZZ0YfgnASPaHkiXAEbX3sIoucILbQHoqJSJZlmB0Fb7h\n\t4FQxR9V6Hzc8Vg8LNWcrM+Noag5w4H+cbdL+3NOZvusJRVAHoXymw=","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.8 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=canned","X-HELO":"mail-wr0-f180.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:cc:subject:references\n\t:date:in-reply-to:message-id:user-agent:mime-version;\n\tbh=0g1cGvDj3VhmCUw2vINLNWCE6ETM389JhpFmavGudco=;\n\tb=jjVgj5ANWV8uqjNgTyn8lrfkEyjyrl+Oxe9a1+pwwQ3EAAv5t5w61UUkLywnB+UnKp\n\t3dlj7bHHERGlRJbj3WVVD8AxWMGjmVERfZYdHMs+4Gf6ELRz9cMkRHf4Ny/aMvV+7XEo\n\tjlKCMXSYwsVfie17xG5l99CKWE0oiYkclr0ds/Cdk9JcGzuyXca9/XoLnLmL+JiCrI/I\n\tFIVunCdbj5eo/mBfJ0hCShGOeaGTsLFvuw25Pc6brXcVBR3nF9uQerlB9QmaLmOys93V\n\t2t5ec/F7X/enTYkuPdnoQHvWebwyuYzT/VlgjqssaCl/MvJWR8h8XMQS8kHFUI8CIktC\n\tJISw==","X-Gm-Message-State":"AHPjjUieCI3R6/DCI1mP5ZSHK15KePTOa735LhqtzcnWAGYK1VQPxPTZ\tEw6RpxjYLsUIBNQeAb4KRGpfPgAOQOA=","X-Google-Smtp-Source":"AOwi7QBNdbFBjwfcGPBwhM3fvPcKTl2NEfGMK2G5aGWHO4EvKpnXmJA2hPJq0ezJYJiz8mkIFiJTtQ==","X-Received":"by 10.223.182.71 with SMTP id i7mr11543417wre.43.1506874625919;\n\tSun, 01 Oct 2017 09:17:05 -0700 (PDT)","From":"Richard Sandiford <richard.sandiford@linaro.org>","To":"Richard Biener <richard.guenther@gmail.com>","Mail-Followup-To":"Richard Biener <richard.guenther@gmail.com>,\n\tGCC Patches <gcc-patches@gcc.gnu.org>,\n\trichard.sandiford@linaro.org","Cc":"GCC Patches <gcc-patches@gcc.gnu.org>","Subject":"Re: Don't query the frontend for unsupported types","References":"<87shfhzgwc.fsf@linaro.org>\t<FDB20764-7B41-4630-B4C6-3DEAFCE53C58@gmail.com>\t<874lrw5hxk.fsf@linaro.org>\t<CAFiYyc35uOLn4E1qVR+4PERDL3vumapyZt3OiLGxn8MXGWANrQ@mail.gmail.com>\t<87zi9mptv6.fsf@linaro.org>\t<CAFiYyc1+Bx0SFLqM=0HWxLkMpDZXWq1fs5Jkie=DDpk1j-ZS3A@mail.gmail.com>","Date":"Sun, 01 Oct 2017 17:17:03 +0100","In-Reply-To":"<CAFiYyc1+Bx0SFLqM=0HWxLkMpDZXWq1fs5Jkie=DDpk1j-ZS3A@mail.gmail.com>\t(Richard\n\tBiener's message of \"Mon, 25 Sep 2017 14:53:46 +0200\")","Message-ID":"<87k20ex2ps.fsf@linaro.org>","User-Agent":"Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)","MIME-Version":"1.0","Content-Type":"text/plain"}},{"id":1792722,"web_url":"http://patchwork.ozlabs.org/comment/1792722/","msgid":"<87po9dbv4v.fsf@linaro.org>","list_archive_url":null,"date":"2017-10-23T18:02:08","subject":"Re: Don't query the frontend for unsupported types","submitter":{"id":5450,"url":"http://patchwork.ozlabs.org/api/people/5450/","name":"Richard Sandiford","email":"richard.sandiford@linaro.org"},"content":"Ping.\n\nRichard Sandiford <richard.sandiford@linaro.org> writes:\n> Richard Biener <richard.guenther@gmail.com> writes:\n>> On Fri, Sep 22, 2017 at 6:42 PM, Richard Sandiford\n>> <richard.sandiford@linaro.org> wrote:\n>>> Richard Biener <richard.guenther@gmail.com> writes:\n>>>> On Thu, Sep 21, 2017 at 2:56 PM, Richard Sandiford\n>>>> <richard.sandiford@linaro.org> wrote:\n>>>>> Richard Biener <richard.guenther@gmail.com> writes:\n>>>>>> On September 20, 2017 2:36:03 PM GMT+02:00, Richard Sandiford\n>>>>>> <richard.sandiford@linaro.org> wrote:\n>>>>>>>When forcing a constant of mode MODE into memory, force_const_mem\n>>>>>>>asks the frontend to provide the type associated with that mode.\n>>>>>>>In principle type_for_mode is allowed to return null, and although\n>>>>>>>one use site correctly handled that, the other didn't.\n>>>>>>>\n>>>>>>>I think there's agreement that it's bogus to use type_for_mode for\n>>>>>>>this kind of thing, since it forces frontends to handle types that\n>>>>>>>don't exist in that language.  See e.g. http://gcc.gnu.org/PR46805\n>>>>>>>where the Go frontend was forced to handle vector types even though\n>>>>>>>Go doesn't have vector types.\n>>>>>>>\n>>>>>>>Also, the frontends use code like:\n>>>>>>>\n>>>>>>>  else if (VECTOR_MODE_P (mode))\n>>>>>>>    {\n>>>>>>>      machine_mode inner_mode = GET_MODE_INNER (mode);\n>>>>>>>      tree inner_type = c_common_type_for_mode (inner_mode, unsignedp);\n>>>>>>>      if (inner_type != NULL_TREE)\n>>>>>>>        return build_vector_type_for_mode (inner_type, mode);\n>>>>>>>    }\n>>>>>>>\n>>>>>>>and there's no guarantee that every vector mode M used by backend\n>>>>>>>rtl has an associated vector type whose TYPE_MODE is M.  I think\n>>>>>>>really the type_for_mode hook should only return trees that _do_ have\n>>>>>>>the requested TYPE_MODE, but PR46805 linked above shows that this is\n>>>>>>>likely to have too many knock-on consequences.  It doesn't make sense\n>>>>>>>for force_const_mem to ask about vector modes that aren't valid for\n>>>>>>>vector types, so this patch handles the condition there instead.\n>>>>>>>\n>>>>>>>This is needed for SVE multi-register modes, which are modelled as\n>>>>>>>vector modes but are not usable as vector types.\n>>>>>>>\n>>>>>>>Tested on aarch64-linux-gnu, x86_64-linux-gnu and\n>>>>>>>powerpc64le-linus-gnu.\n>>>>>>>OK to install?\n>>>>>>\n>>>>>> I think we should get rid of the use entirely.\n>>>>>\n>>>>> I first read this as not using type_for_mode at all in force_const_mem,\n>>>>> which sounded like a good thing :-)\n>>>>\n>>>> That's what I meant ;)  A mode doesn't really have a type...\n>>>>\n>>>>   I tried it overnight on the usual\n>>>>> at-least-one-target-per-CPU set and diffing the before and after\n>>>>> assembly for the testsuite.  And it looks like i686 relies on this\n>>>>> to get an alignment of 16 rather than 4 for XFmode constants:\n>>>>> GET_MODE_ALIGNMENT (XFmode) == 32 (as requested by i386-modes.def),\n>>>>> but i386's CONSTANT_ALIGNMENT increases it to 128 for static constants.\n>>>>\n>>>> Then the issue is that CONSTANT_ALIGNMENT takes a tree and not a mode...\n>>>> even worse than type_for_mode is a use of make_tree!  Incidentially\n>>>> ix86_constant_alignment _does_ look at the mode in the end...\n>>>\n>>> OK, I guess this means another target hook conversion.  The patch\n>>> below converts CONSTANT_ALIGNMENT with its current interface.\n>>> The definition:\n>>>\n>>>   #define CONSTANT_ALIGNMENT(EXP, ALIGN) \\\n>>>     (TREE_CODE (EXP) == STRING_CST \\\n>>>      && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n>>>\n>>> was very common, so the patch adds a canned definition for that,\n>>> called constant_alignment_word_strings.  Some ports had a variation\n>>> that used a port-local FASTEST_ALIGNMENT instead of BITS_PER_WORD;\n>>> the patch uses constant_alignment_word_strings if FASTEST_ALIGNMENT\n>>> was always BITS_PER_WORD and a port-local hook function otherwise.\n>>>\n>>> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.\n>>> Also tested by comparing the testsuite assembly output on at least one\n>>> target per CPU directory.  I don't think this comes under Jeff's\n>>> preapproval due to the constant_alignment_word_strings thing, so:\n>>> OK to install?\n>>\n>> Ok.\n>\n> Thanks.  A bit later than intended, but here's the follow-on to add\n> the new rtx hook.\n>\n> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.\n> Also tested by comparing the testsuite assembly output on at least one\n> target per CPU directory.  OK to install?\n>\n> Richard\n>\n>\n> 2017-10-01  Richard Sandiford  <richard.sandiford@linaro.org>\n>\n> gcc/\n> \t* target.def (static_rtx_alignment): New hook.\n> \t* targhooks.h (default_static_rtx_alignment): Declare.\n> \t* targhooks.c (default_static_rtx_alignment): New function.\n> \t* doc/tm.texi.in (TARGET_STATIC_RTX_ALIGNMENT): New hook.\n> \t* doc/tm.texi: Regenerate.\n> \t* varasm.c (force_const_mem): Use targetm.static_rtx_alignment\n> \tinstead of targetm.constant_alignment.  Remove call to\n> \tset_mem_attributes.\n> \t* config/cris/cris.c (TARGET_STATIC_RTX_ALIGNMENT): Redefine.\n> \t(cris_preferred_mininum_alignment): New function, split out from...\n> \t(cris_constant_alignment): ...here.\n> \t(cris_static_rtx_alignment): New function.\n> \t* config/i386/i386.c (ix86_static_rtx_alignment): New function,\n> \tsplit out from...\n> \t(ix86_constant_alignment): ...here.\n> \t(TARGET_STATIC_RTX_ALIGNMENT): Redefine.\n> \t* config/mmix/mmix.c (TARGET_STATIC_RTX_ALIGNMENT): Redefine.\n> \t(mmix_static_rtx_alignment): New function.\n> \t* config/spu/spu.c (spu_static_rtx_alignment): New function.\n> \t(TARGET_STATIC_RTX_ALIGNMENT): Redefine.\n>\n> Index: gcc/target.def\n> ===================================================================\n> --- gcc/target.def\t2017-09-25 17:04:16.792359030 +0100\n> +++ gcc/target.def\t2017-10-01 17:14:18.480815538 +0100\n> @@ -3336,6 +3336,15 @@ HOOK_VECTOR_END (addr_space)\n>  #define HOOK_PREFIX \"TARGET_\"\n>  \n>  DEFHOOK\n> +(static_rtx_alignment,\n> + \"This hook returns the preferred alignment in bits for a\\n\\\n> +statically-allocated rtx, such as a constant pool entry.  @var{mode}\\n\\\n> +is the mode of the rtx.  The default implementation returns\\n\\\n> +@samp{GET_MODE_ALIGNMENT (@var{mode})}.\",\n> + HOST_WIDE_INT, (machine_mode mode),\n> + default_static_rtx_alignment)\n> +\n> +DEFHOOK\n>  (constant_alignment,\n>   \"This hook returns the alignment in bits of a constant that is being\\n\\\n>  placed in memory.  @var{constant} is the constant and @var{basic_align}\\n\\\n> Index: gcc/targhooks.h\n> ===================================================================\n> --- gcc/targhooks.h\t2017-09-25 17:04:16.793358890 +0100\n> +++ gcc/targhooks.h\t2017-10-01 17:14:18.481821912 +0100\n> @@ -93,6 +93,7 @@ extern int default_builtin_vectorization\n>  \n>  extern tree default_builtin_reciprocal (tree);\n>  \n> +extern HOST_WIDE_INT default_static_rtx_alignment (machine_mode);\n>  extern HOST_WIDE_INT default_constant_alignment (const_tree, HOST_WIDE_INT);\n>  extern HOST_WIDE_INT constant_alignment_word_strings (const_tree,\n>  \t\t\t\t\t\t      HOST_WIDE_INT);\n> Index: gcc/targhooks.c\n> ===================================================================\n> --- gcc/targhooks.c\t2017-09-25 17:04:16.793358890 +0100\n> +++ gcc/targhooks.c\t2017-10-01 17:14:18.481821912 +0100\n> @@ -1165,6 +1165,14 @@ tree default_mangle_decl_assembler_name\n>     return id;\n>  }\n>  \n> +/* The default implementation of TARGET_STATIC_RTX_ALIGNMENT.  */\n> +\n> +HOST_WIDE_INT\n> +default_static_rtx_alignment (machine_mode mode)\n> +{\n> +  return GET_MODE_ALIGNMENT (mode);\n> +}\n> +\n>  /* The default implementation of TARGET_CONSTANT_ALIGNMENT.  */\n>  \n>  HOST_WIDE_INT\n> Index: gcc/doc/tm.texi.in\n> ===================================================================\n> --- gcc/doc/tm.texi.in\t2017-09-25 17:04:16.792359030 +0100\n> +++ gcc/doc/tm.texi.in\t2017-10-01 17:14:18.480815538 +0100\n> @@ -1026,6 +1026,8 @@ On 32-bit ELF the largest supported sect\n>  @samp{(0x80000000 * 8)}, but this is not representable on 32-bit hosts.\n>  @end defmac\n>  \n> +@hook TARGET_STATIC_RTX_ALIGNMENT\n> +\n>  @defmac DATA_ALIGNMENT (@var{type}, @var{basic-align})\n>  If defined, a C expression to compute the alignment for a variable in\n>  the static store.  @var{type} is the data type, and @var{basic-align} is\n> Index: gcc/doc/tm.texi\n> ===================================================================\n> --- gcc/doc/tm.texi\t2017-09-25 17:04:16.791359170 +0100\n> +++ gcc/doc/tm.texi\t2017-10-01 17:14:18.479809163 +0100\n> @@ -1078,6 +1078,13 @@ On 32-bit ELF the largest supported sect\n>  @samp{(0x80000000 * 8)}, but this is not representable on 32-bit hosts.\n>  @end defmac\n>  \n> +@deftypefn {Target Hook} HOST_WIDE_INT TARGET_STATIC_RTX_ALIGNMENT (machine_mode @var{mode})\n> +This hook returns the preferred alignment in bits for a\n> +statically-allocated rtx, such as a constant pool entry.  @var{mode}\n> +is the mode of the rtx.  The default implementation returns\n> +@samp{GET_MODE_ALIGNMENT (@var{mode})}.\n> +@end deftypefn\n> +\n>  @defmac DATA_ALIGNMENT (@var{type}, @var{basic-align})\n>  If defined, a C expression to compute the alignment for a variable in\n>  the static store.  @var{type} is the data type, and @var{basic-align} is\n> Index: gcc/varasm.c\n> ===================================================================\n> --- gcc/varasm.c\t2017-09-25 17:04:16.793358890 +0100\n> +++ gcc/varasm.c\t2017-10-01 17:14:18.481821912 +0100\n> @@ -3784,11 +3784,8 @@ force_const_mem (machine_mode mode, rtx\n>    *slot = desc;\n>  \n>    /* Align the location counter as required by EXP's data type.  */\n> -  align = GET_MODE_ALIGNMENT (mode == VOIDmode ? word_mode : mode);\n> -\n> -  tree type = lang_hooks.types.type_for_mode (mode, 0);\n> -  if (type != NULL_TREE)\n> -    align = targetm.constant_alignment (make_tree (type, x), align);\n> +  machine_mode align_mode = (mode == VOIDmode ? word_mode : mode);\n> +  align = targetm.static_rtx_alignment (align_mode);\n>  \n>    pool->offset += (align / BITS_PER_UNIT) - 1;\n>    pool->offset &= ~ ((align / BITS_PER_UNIT) - 1);\n> @@ -3830,7 +3827,6 @@ force_const_mem (machine_mode mode, rtx\n>  \n>    /* Construct the MEM.  */\n>    desc->mem = def = gen_const_mem (mode, symbol);\n> -  set_mem_attributes (def, lang_hooks.types.type_for_mode (mode, 0), 1);\n>    set_mem_align (def, align);\n>  \n>    /* If we're dropping a label to the constant pool, make sure we\n> Index: gcc/config/cris/cris.c\n> ===================================================================\n> --- gcc/config/cris/cris.c\t2017-09-25 17:04:16.762363228 +0100\n> +++ gcc/config/cris/cris.c\t2017-10-01 17:14:18.472764540 +0100\n> @@ -165,6 +165,7 @@ static bool cris_function_value_regno_p\n>  static void cris_file_end (void);\n>  static unsigned int cris_hard_regno_nregs (unsigned int, machine_mode);\n>  static bool cris_hard_regno_mode_ok (unsigned int, machine_mode);\n> +static HOST_WIDE_INT cris_static_rtx_alignment (machine_mode);\n>  static HOST_WIDE_INT cris_constant_alignment (const_tree, HOST_WIDE_INT);\n>  \n>  /* This is the parsed result of the \"-max-stack-stackframe=\" option.  If\n> @@ -288,6 +289,8 @@ #define TARGET_HARD_REGNO_NREGS cris_har\n>  #undef TARGET_HARD_REGNO_MODE_OK\n>  #define TARGET_HARD_REGNO_MODE_OK cris_hard_regno_mode_ok\n>  \n> +#undef TARGET_STATIC_RTX_ALIGNMENT\n> +#define TARGET_STATIC_RTX_ALIGNMENT cris_static_rtx_alignment\n>  #undef TARGET_CONSTANT_ALIGNMENT\n>  #define TARGET_CONSTANT_ALIGNMENT cris_constant_alignment\n>  \n> @@ -4329,6 +4332,26 @@ cris_hard_regno_mode_ok (unsigned int re\n>  \t      || (regno != CRIS_MOF_REGNUM && regno != CRIS_ACR_REGNUM)));\n>  }\n>  \n> +/* Return the preferred minimum alignment for a static object.  */\n> +\n> +static HOST_WIDE_INT\n> +cris_preferred_mininum_alignment (void)\n> +{\n> +  if (!TARGET_CONST_ALIGN)\n> +    return 8;\n> +  if (TARGET_ALIGN_BY_32)\n> +    return 32;\n> +  return 16;\n> +}\n> +\n> +/* Implement TARGET_STATIC_RTX_ALIGNMENT.  */\n> +\n> +static HOST_WIDE_INT\n> +cris_static_rtx_alignment (machine_mode mode)\n> +{\n> +  return MAX (cris_preferred_mininum_alignment (), GET_MODE_ALIGNMENT (mode));\n> +}\n> +\n>  /* Implement TARGET_CONSTANT_ALIGNMENT.  Note that this hook has the\n>     effect of making gcc believe that ALL references to constant stuff\n>     (in code segment, like strings) have this alignment.  That is a rather\n> @@ -4339,11 +4362,7 @@ cris_hard_regno_mode_ok (unsigned int re\n>  static HOST_WIDE_INT\n>  cris_constant_alignment (const_tree, HOST_WIDE_INT basic_align)\n>  {\n> -  if (!TARGET_CONST_ALIGN)\n> -    return basic_align;\n> -  if (TARGET_ALIGN_BY_32)\n> -    return MAX (basic_align, 32);\n> -  return MAX (basic_align, 16);\n> +  return MAX (cris_preferred_mininum_alignment (), basic_align);\n>  }\n>  \n>  #if 0\n> Index: gcc/config/i386/i386.c\n> ===================================================================\n> --- gcc/config/i386/i386.c\t2017-09-25 17:04:16.768362388 +0100\n> +++ gcc/config/i386/i386.c\t2017-10-01 17:14:18.477796414 +0100\n> @@ -31563,6 +31563,18 @@ ix86_sched_init_global (FILE *, int, int\n>  }\n>  \n>  \f\n> +/* Implement TARGET_STATIC_RTX_ALIGNMENT.  */\n> +\n> +static HOST_WIDE_INT\n> +ix86_static_rtx_alignment (machine_mode mode)\n> +{\n> +  if (mode == DFmode)\n> +    return 64;\n> +  if (ALIGN_MODE_128 (mode))\n> +    return MAX (128, GET_MODE_ALIGNMENT (mode));\n> +  return GET_MODE_ALIGNMENT (mode);\n> +}\n> +\n>  /* Implement TARGET_CONSTANT_ALIGNMENT.  */\n>  \n>  static HOST_WIDE_INT\n> @@ -31571,10 +31583,9 @@ ix86_constant_alignment (const_tree exp,\n>    if (TREE_CODE (exp) == REAL_CST || TREE_CODE (exp) == VECTOR_CST\n>        || TREE_CODE (exp) == INTEGER_CST)\n>      {\n> -      if (TYPE_MODE (TREE_TYPE (exp)) == DFmode && align < 64)\n> -\treturn 64;\n> -      else if (ALIGN_MODE_128 (TYPE_MODE (TREE_TYPE (exp))) && align < 128)\n> -\treturn 128;\n> +      machine_mode mode = TYPE_MODE (TREE_TYPE (exp));\n> +      HOST_WIDE_INT mode_align = ix86_static_rtx_alignment (mode);\n> +      return MAX (mode_align, align);\n>      }\n>    else if (!optimize_size && TREE_CODE (exp) == STRING_CST\n>  \t   && TREE_STRING_LENGTH (exp) >= 31 && align < BITS_PER_WORD)\n> @@ -53605,6 +53616,8 @@ #define TARGET_HARD_REGNO_CALL_PART_CLOB\n>  #undef TARGET_CAN_CHANGE_MODE_CLASS\n>  #define TARGET_CAN_CHANGE_MODE_CLASS ix86_can_change_mode_class\n>  \n> +#undef TARGET_STATIC_RTX_ALIGNMENT\n> +#define TARGET_STATIC_RTX_ALIGNMENT ix86_static_rtx_alignment\n>  #undef TARGET_CONSTANT_ALIGNMENT\n>  #define TARGET_CONSTANT_ALIGNMENT ix86_constant_alignment\n>  \n> Index: gcc/config/mmix/mmix.c\n> ===================================================================\n> --- gcc/config/mmix/mmix.c\t2017-09-25 17:04:16.774361549 +0100\n> +++ gcc/config/mmix/mmix.c\t2017-10-01 17:14:18.477796414 +0100\n> @@ -168,6 +168,7 @@ static void mmix_print_operand (FILE *,\n>  static void mmix_print_operand_address (FILE *, machine_mode, rtx);\n>  static bool mmix_print_operand_punct_valid_p (unsigned char);\n>  static void mmix_conditional_register_usage (void);\n> +static HOST_WIDE_INT mmix_static_rtx_alignment (machine_mode);\n>  static HOST_WIDE_INT mmix_constant_alignment (const_tree, HOST_WIDE_INT);\n>  \n>  /* Target structure macros.  Listed by node.  See `Using and Porting GCC'\n> @@ -283,6 +284,8 @@ #define TARGET_TRAMPOLINE_INIT mmix_tram\n>  #undef TARGET_OPTION_OVERRIDE\n>  #define TARGET_OPTION_OVERRIDE mmix_option_override\n>  \n> +#undef TARGET_STATIC_RTX_ALIGNMENT\n> +#define TARGET_STATIC_RTX_ALIGNMENT mmix_static_rtx_alignment\n>  #undef TARGET_CONSTANT_ALIGNMENT\n>  #define TARGET_CONSTANT_ALIGNMENT mmix_constant_alignment\n>  \n> @@ -338,6 +341,14 @@ mmix_data_alignment (tree type ATTRIBUTE\n>    return basic_align;\n>  }\n>  \n> +/* Implement TARGET_STATIC_RTX_ALIGNMENT.  */\n> +\n> +static HOST_WIDE_INT\n> +mmix_static_rtx_alignment (machine_mode mode)\n> +{\n> +  return MAX (GET_MODE_ALIGNMENT (mode), 32);\n> +}\n> +\n>  /* Implement tARGET_CONSTANT_ALIGNMENT.  */\n>  \n>  static HOST_WIDE_INT\n> Index: gcc/config/spu/spu.c\n> ===================================================================\n> --- gcc/config/spu/spu.c\t2017-09-25 17:04:16.787359730 +0100\n> +++ gcc/config/spu/spu.c\t2017-10-01 17:14:18.478802788 +0100\n> @@ -7194,6 +7194,18 @@ spu_truly_noop_truncation (unsigned int\n>    return inprec <= 32 && outprec <= inprec;\n>  }\n>  \n> +/* Implement TARGET_STATIC_RTX_ALIGNMENT.\n> +\n> +   Make all static objects 16-byte aligned.  This allows us to assume\n> +   they are also padded to 16 bytes, which means we can use a single\n> +   load or store instruction to access them.  */\n> +\n> +static HOST_WIDE_INT\n> +spu_static_rtx_alignment (machine_mode mode)\n> +{\n> +  return MAX (GET_MODE_ALIGNMENT (mode), 128);\n> +}\n> +\n>  /* Implement TARGET_CONSTANT_ALIGNMENT.\n>  \n>     Make all static objects 16-byte aligned.  This allows us to assume\n> @@ -7445,6 +7457,8 @@ #define TARGET_CAN_CHANGE_MODE_CLASS spu\n>  #undef TARGET_TRULY_NOOP_TRUNCATION\n>  #define TARGET_TRULY_NOOP_TRUNCATION spu_truly_noop_truncation\n>  \n> +#undef TARGET_STATIC_RTX_ALIGNMENT\n> +#define TARGET_STATIC_RTX_ALIGNMENT spu_static_rtx_alignment\n>  #undef TARGET_CONSTANT_ALIGNMENT\n>  #define TARGET_CONSTANT_ALIGNMENT spu_constant_alignment\n>","headers":{"Return-Path":"<gcc-patches-return-464889-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-464889-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=\"preXWxZG\"; 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 3yLPPX4Cbrz9t2t\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 24 Oct 2017 05:02:24 +1100 (AEDT)","(qmail 93364 invoked by alias); 23 Oct 2017 18:02:16 -0000","(qmail 93355 invoked by uid 89); 23 Oct 2017 18:02:16 -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\tMon, 23 Oct 2017 18:02:13 +0000","by mail-wm0-f45.google.com with SMTP id 78so8633109wmb.1 for\n\t<gcc-patches@gcc.gnu.org>; Mon, 23 Oct 2017 11:02:12 -0700 (PDT)","from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id\n\tz35sm18974912wrc.9.2017.10.23.11.02.08 (version=TLS1_2\n\tcipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tMon, 23 Oct 2017 11:02:09 -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:cc:subject:references:date:in-reply-to:message-id\n\t:mime-version:content-type; q=dns; s=default; b=v4OQN5lJp22c4jWT\n\t1VHJM3vhlZfGBnb0aAITMAkHpXwJ58hM/eoHalk114QD9vmQKIHEdSWz0/eKLAN6\n\tTz25ug1fvVEczIoQrG1sr5M+oYDdRIQlBwde/lmfjJJv3RoqSl1gct+248phN29Y\n\t4P7wpDDPwhwkIZhMHjDOSyr3/Rw=","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:cc:subject:references:date:in-reply-to:message-id\n\t:mime-version:content-type; s=default; bh=QYrtVkkTzrmZwGydPC7WDP\n\t/NXqE=; b=preXWxZGQNlX6e1S3AQ6Xp6rYkoUB1IBvaNXM51sb6Ghgsrk8BKTYU\n\tynchSQ2Drn68SDTa2KH7DaMWjxZ5UTl7bPnk5iDFA2qRLk6VsQhOJgq8cRC9b+nE\n\tedyecThLtsqEZaJAlmPjAFJ2yHnjiG1AdDzFePCFGfVWB6ygoh4bU=","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=-9.7 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS,\n\tRCVD_IN_DNSWL_NONE, SPF_PASS,\n\tURIBL_BLACK autolearn=ham version=3.3.2 spammy=overnight,\n\tconsequences, canned","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:cc:subject:references\n\t:date:in-reply-to:message-id:user-agent:mime-version;\n\tbh=sWnu5s8sBYKq896Ub42N16zRJobpvTpbspQ8MH+e01I=;\n\tb=HzFextgd91n4wQGMSjZ1LHSlQZ/yWZr59taJOBdHonLy2XKmxZtoWcDDZyjo6h5VQ1\n\tO+JZ6dcEizLnW98bruFv1XRBAdfdRXS0lSiy42ZCZu13ZNYh1oXVLqDewWSR5MySm9Yi\n\tRFZHqErDZih4p2jStbdmImKjHGnyrjWKinBm5lVWNCc6PV+FI9zKn/zQOV4rh7se8mO+\n\tn267WjyHCczMeVY84Pi3sHeReSRvB/QFoI8AFG+Y3IwMy7zaIaVQeA23ZelS3NSiv856\n\t/Zsnz25tcuxwSEb26QZKemq5Ko4HbD9UN3ZnGYgJSk1wA9XSzG0Vn2Wwv6qzELGqYaUw\n\tQXbQ==","X-Gm-Message-State":"AMCzsaWgpkXfrg26AHqotWbpbQBn2IibFOzEK+NsIQqnd0KUuu8exlCk\tByHzBGAwqRWMsl01lEfVRSE/fs+SUJY=","X-Google-Smtp-Source":"ABhQp+Q8eBXpE0tm3Y9zQiJay8lwq7aK0kt8jqlSc45fxQZfO6iXx6VEB/hIS0CaxHW6b3CmYtfhNg==","X-Received":"by 10.28.155.145 with SMTP id d139mr5836801wme.119.1508781730342;\n\tMon, 23 Oct 2017 11:02:10 -0700 (PDT)","From":"Richard Sandiford <richard.sandiford@linaro.org>","To":"Richard Biener <richard.guenther@gmail.com>","Mail-Followup-To":"Richard Biener <richard.guenther@gmail.com>,\n\tGCC Patches <gcc-patches@gcc.gnu.org>,\n\trichard.sandiford@linaro.org","Cc":"GCC Patches <gcc-patches@gcc.gnu.org>","Subject":"Re: Don't query the frontend for unsupported types","References":"<87shfhzgwc.fsf@linaro.org>\t<FDB20764-7B41-4630-B4C6-3DEAFCE53C58@gmail.com>\t<874lrw5hxk.fsf@linaro.org>\t<CAFiYyc35uOLn4E1qVR+4PERDL3vumapyZt3OiLGxn8MXGWANrQ@mail.gmail.com>\t<87zi9mptv6.fsf@linaro.org>\t<CAFiYyc1+Bx0SFLqM=0HWxLkMpDZXWq1fs5Jkie=DDpk1j-ZS3A@mail.gmail.com>\t<87k20ex2ps.fsf@linaro.org>","Date":"Mon, 23 Oct 2017 19:02:08 +0100","In-Reply-To":"<87k20ex2ps.fsf@linaro.org> (Richard Sandiford's message of\n\t\"Sun, 01 Oct 2017 17:17:03 +0100\")","Message-ID":"<87po9dbv4v.fsf@linaro.org>","User-Agent":"Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)","MIME-Version":"1.0","Content-Type":"text/plain"}},{"id":1793730,"web_url":"http://patchwork.ozlabs.org/comment/1793730/","msgid":"<CAFiYyc296LrybX33iPcBXe01HcVv_oTy7=Q4bvVLdYj5+e1ZOg@mail.gmail.com>","list_archive_url":null,"date":"2017-10-25T13:09:52","subject":"Re: Don't query the frontend for unsupported types","submitter":{"id":1765,"url":"http://patchwork.ozlabs.org/api/people/1765/","name":"Richard Biener","email":"richard.guenther@gmail.com"},"content":"On Sun, Oct 1, 2017 at 6:17 PM, Richard Sandiford\n<richard.sandiford@linaro.org> wrote:\n> Richard Biener <richard.guenther@gmail.com> writes:\n>> On Fri, Sep 22, 2017 at 6:42 PM, Richard Sandiford\n>> <richard.sandiford@linaro.org> wrote:\n>>> Richard Biener <richard.guenther@gmail.com> writes:\n>>>> On Thu, Sep 21, 2017 at 2:56 PM, Richard Sandiford\n>>>> <richard.sandiford@linaro.org> wrote:\n>>>>> Richard Biener <richard.guenther@gmail.com> writes:\n>>>>>> On September 20, 2017 2:36:03 PM GMT+02:00, Richard Sandiford\n>>>>>> <richard.sandiford@linaro.org> wrote:\n>>>>>>>When forcing a constant of mode MODE into memory, force_const_mem\n>>>>>>>asks the frontend to provide the type associated with that mode.\n>>>>>>>In principle type_for_mode is allowed to return null, and although\n>>>>>>>one use site correctly handled that, the other didn't.\n>>>>>>>\n>>>>>>>I think there's agreement that it's bogus to use type_for_mode for\n>>>>>>>this kind of thing, since it forces frontends to handle types that\n>>>>>>>don't exist in that language.  See e.g. http://gcc.gnu.org/PR46805\n>>>>>>>where the Go frontend was forced to handle vector types even though\n>>>>>>>Go doesn't have vector types.\n>>>>>>>\n>>>>>>>Also, the frontends use code like:\n>>>>>>>\n>>>>>>>  else if (VECTOR_MODE_P (mode))\n>>>>>>>    {\n>>>>>>>      machine_mode inner_mode = GET_MODE_INNER (mode);\n>>>>>>>      tree inner_type = c_common_type_for_mode (inner_mode, unsignedp);\n>>>>>>>      if (inner_type != NULL_TREE)\n>>>>>>>        return build_vector_type_for_mode (inner_type, mode);\n>>>>>>>    }\n>>>>>>>\n>>>>>>>and there's no guarantee that every vector mode M used by backend\n>>>>>>>rtl has an associated vector type whose TYPE_MODE is M.  I think\n>>>>>>>really the type_for_mode hook should only return trees that _do_ have\n>>>>>>>the requested TYPE_MODE, but PR46805 linked above shows that this is\n>>>>>>>likely to have too many knock-on consequences.  It doesn't make sense\n>>>>>>>for force_const_mem to ask about vector modes that aren't valid for\n>>>>>>>vector types, so this patch handles the condition there instead.\n>>>>>>>\n>>>>>>>This is needed for SVE multi-register modes, which are modelled as\n>>>>>>>vector modes but are not usable as vector types.\n>>>>>>>\n>>>>>>>Tested on aarch64-linux-gnu, x86_64-linux-gnu and\n>>>>>>>powerpc64le-linus-gnu.\n>>>>>>>OK to install?\n>>>>>>\n>>>>>> I think we should get rid of the use entirely.\n>>>>>\n>>>>> I first read this as not using type_for_mode at all in force_const_mem,\n>>>>> which sounded like a good thing :-)\n>>>>\n>>>> That's what I meant ;)  A mode doesn't really have a type...\n>>>>\n>>>>   I tried it overnight on the usual\n>>>>> at-least-one-target-per-CPU set and diffing the before and after\n>>>>> assembly for the testsuite.  And it looks like i686 relies on this\n>>>>> to get an alignment of 16 rather than 4 for XFmode constants:\n>>>>> GET_MODE_ALIGNMENT (XFmode) == 32 (as requested by i386-modes.def),\n>>>>> but i386's CONSTANT_ALIGNMENT increases it to 128 for static constants.\n>>>>\n>>>> Then the issue is that CONSTANT_ALIGNMENT takes a tree and not a mode...\n>>>> even worse than type_for_mode is a use of make_tree!  Incidentially\n>>>> ix86_constant_alignment _does_ look at the mode in the end...\n>>>\n>>> OK, I guess this means another target hook conversion.  The patch\n>>> below converts CONSTANT_ALIGNMENT with its current interface.\n>>> The definition:\n>>>\n>>>   #define CONSTANT_ALIGNMENT(EXP, ALIGN) \\\n>>>     (TREE_CODE (EXP) == STRING_CST \\\n>>>      && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))\n>>>\n>>> was very common, so the patch adds a canned definition for that,\n>>> called constant_alignment_word_strings.  Some ports had a variation\n>>> that used a port-local FASTEST_ALIGNMENT instead of BITS_PER_WORD;\n>>> the patch uses constant_alignment_word_strings if FASTEST_ALIGNMENT\n>>> was always BITS_PER_WORD and a port-local hook function otherwise.\n>>>\n>>> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.\n>>> Also tested by comparing the testsuite assembly output on at least one\n>>> target per CPU directory.  I don't think this comes under Jeff's\n>>> preapproval due to the constant_alignment_word_strings thing, so:\n>>> OK to install?\n>>\n>> Ok.\n>\n> Thanks.  A bit later than intended, but here's the follow-on to add\n> the new rtx hook.\n>\n> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.\n> Also tested by comparing the testsuite assembly output on at least one\n> target per CPU directory.  OK to install?\n\nOk, sorry for the delay.\n\nRichard.\n\n> Richard\n>\n>\n> 2017-10-01  Richard Sandiford  <richard.sandiford@linaro.org>\n>\n> gcc/\n>         * target.def (static_rtx_alignment): New hook.\n>         * targhooks.h (default_static_rtx_alignment): Declare.\n>         * targhooks.c (default_static_rtx_alignment): New function.\n>         * doc/tm.texi.in (TARGET_STATIC_RTX_ALIGNMENT): New hook.\n>         * doc/tm.texi: Regenerate.\n>         * varasm.c (force_const_mem): Use targetm.static_rtx_alignment\n>         instead of targetm.constant_alignment.  Remove call to\n>         set_mem_attributes.\n>         * config/cris/cris.c (TARGET_STATIC_RTX_ALIGNMENT): Redefine.\n>         (cris_preferred_mininum_alignment): New function, split out from...\n>         (cris_constant_alignment): ...here.\n>         (cris_static_rtx_alignment): New function.\n>         * config/i386/i386.c (ix86_static_rtx_alignment): New function,\n>         split out from...\n>         (ix86_constant_alignment): ...here.\n>         (TARGET_STATIC_RTX_ALIGNMENT): Redefine.\n>         * config/mmix/mmix.c (TARGET_STATIC_RTX_ALIGNMENT): Redefine.\n>         (mmix_static_rtx_alignment): New function.\n>         * config/spu/spu.c (spu_static_rtx_alignment): New function.\n>         (TARGET_STATIC_RTX_ALIGNMENT): Redefine.\n>\n> Index: gcc/target.def\n> ===================================================================\n> --- gcc/target.def      2017-09-25 17:04:16.792359030 +0100\n> +++ gcc/target.def      2017-10-01 17:14:18.480815538 +0100\n> @@ -3336,6 +3336,15 @@ HOOK_VECTOR_END (addr_space)\n>  #define HOOK_PREFIX \"TARGET_\"\n>\n>  DEFHOOK\n> +(static_rtx_alignment,\n> + \"This hook returns the preferred alignment in bits for a\\n\\\n> +statically-allocated rtx, such as a constant pool entry.  @var{mode}\\n\\\n> +is the mode of the rtx.  The default implementation returns\\n\\\n> +@samp{GET_MODE_ALIGNMENT (@var{mode})}.\",\n> + HOST_WIDE_INT, (machine_mode mode),\n> + default_static_rtx_alignment)\n> +\n> +DEFHOOK\n>  (constant_alignment,\n>   \"This hook returns the alignment in bits of a constant that is being\\n\\\n>  placed in memory.  @var{constant} is the constant and @var{basic_align}\\n\\\n> Index: gcc/targhooks.h\n> ===================================================================\n> --- gcc/targhooks.h     2017-09-25 17:04:16.793358890 +0100\n> +++ gcc/targhooks.h     2017-10-01 17:14:18.481821912 +0100\n> @@ -93,6 +93,7 @@ extern int default_builtin_vectorization\n>\n>  extern tree default_builtin_reciprocal (tree);\n>\n> +extern HOST_WIDE_INT default_static_rtx_alignment (machine_mode);\n>  extern HOST_WIDE_INT default_constant_alignment (const_tree, HOST_WIDE_INT);\n>  extern HOST_WIDE_INT constant_alignment_word_strings (const_tree,\n>                                                       HOST_WIDE_INT);\n> Index: gcc/targhooks.c\n> ===================================================================\n> --- gcc/targhooks.c     2017-09-25 17:04:16.793358890 +0100\n> +++ gcc/targhooks.c     2017-10-01 17:14:18.481821912 +0100\n> @@ -1165,6 +1165,14 @@ tree default_mangle_decl_assembler_name\n>     return id;\n>  }\n>\n> +/* The default implementation of TARGET_STATIC_RTX_ALIGNMENT.  */\n> +\n> +HOST_WIDE_INT\n> +default_static_rtx_alignment (machine_mode mode)\n> +{\n> +  return GET_MODE_ALIGNMENT (mode);\n> +}\n> +\n>  /* The default implementation of TARGET_CONSTANT_ALIGNMENT.  */\n>\n>  HOST_WIDE_INT\n> Index: gcc/doc/tm.texi.in\n> ===================================================================\n> --- gcc/doc/tm.texi.in  2017-09-25 17:04:16.792359030 +0100\n> +++ gcc/doc/tm.texi.in  2017-10-01 17:14:18.480815538 +0100\n> @@ -1026,6 +1026,8 @@ On 32-bit ELF the largest supported sect\n>  @samp{(0x80000000 * 8)}, but this is not representable on 32-bit hosts.\n>  @end defmac\n>\n> +@hook TARGET_STATIC_RTX_ALIGNMENT\n> +\n>  @defmac DATA_ALIGNMENT (@var{type}, @var{basic-align})\n>  If defined, a C expression to compute the alignment for a variable in\n>  the static store.  @var{type} is the data type, and @var{basic-align} is\n> Index: gcc/doc/tm.texi\n> ===================================================================\n> --- gcc/doc/tm.texi     2017-09-25 17:04:16.791359170 +0100\n> +++ gcc/doc/tm.texi     2017-10-01 17:14:18.479809163 +0100\n> @@ -1078,6 +1078,13 @@ On 32-bit ELF the largest supported sect\n>  @samp{(0x80000000 * 8)}, but this is not representable on 32-bit hosts.\n>  @end defmac\n>\n> +@deftypefn {Target Hook} HOST_WIDE_INT TARGET_STATIC_RTX_ALIGNMENT (machine_mode @var{mode})\n> +This hook returns the preferred alignment in bits for a\n> +statically-allocated rtx, such as a constant pool entry.  @var{mode}\n> +is the mode of the rtx.  The default implementation returns\n> +@samp{GET_MODE_ALIGNMENT (@var{mode})}.\n> +@end deftypefn\n> +\n>  @defmac DATA_ALIGNMENT (@var{type}, @var{basic-align})\n>  If defined, a C expression to compute the alignment for a variable in\n>  the static store.  @var{type} is the data type, and @var{basic-align} is\n> Index: gcc/varasm.c\n> ===================================================================\n> --- gcc/varasm.c        2017-09-25 17:04:16.793358890 +0100\n> +++ gcc/varasm.c        2017-10-01 17:14:18.481821912 +0100\n> @@ -3784,11 +3784,8 @@ force_const_mem (machine_mode mode, rtx\n>    *slot = desc;\n>\n>    /* Align the location counter as required by EXP's data type.  */\n> -  align = GET_MODE_ALIGNMENT (mode == VOIDmode ? word_mode : mode);\n> -\n> -  tree type = lang_hooks.types.type_for_mode (mode, 0);\n> -  if (type != NULL_TREE)\n> -    align = targetm.constant_alignment (make_tree (type, x), align);\n> +  machine_mode align_mode = (mode == VOIDmode ? word_mode : mode);\n> +  align = targetm.static_rtx_alignment (align_mode);\n>\n>    pool->offset += (align / BITS_PER_UNIT) - 1;\n>    pool->offset &= ~ ((align / BITS_PER_UNIT) - 1);\n> @@ -3830,7 +3827,6 @@ force_const_mem (machine_mode mode, rtx\n>\n>    /* Construct the MEM.  */\n>    desc->mem = def = gen_const_mem (mode, symbol);\n> -  set_mem_attributes (def, lang_hooks.types.type_for_mode (mode, 0), 1);\n>    set_mem_align (def, align);\n>\n>    /* If we're dropping a label to the constant pool, make sure we\n> Index: gcc/config/cris/cris.c\n> ===================================================================\n> --- gcc/config/cris/cris.c      2017-09-25 17:04:16.762363228 +0100\n> +++ gcc/config/cris/cris.c      2017-10-01 17:14:18.472764540 +0100\n> @@ -165,6 +165,7 @@ static bool cris_function_value_regno_p\n>  static void cris_file_end (void);\n>  static unsigned int cris_hard_regno_nregs (unsigned int, machine_mode);\n>  static bool cris_hard_regno_mode_ok (unsigned int, machine_mode);\n> +static HOST_WIDE_INT cris_static_rtx_alignment (machine_mode);\n>  static HOST_WIDE_INT cris_constant_alignment (const_tree, HOST_WIDE_INT);\n>\n>  /* This is the parsed result of the \"-max-stack-stackframe=\" option.  If\n> @@ -288,6 +289,8 @@ #define TARGET_HARD_REGNO_NREGS cris_har\n>  #undef TARGET_HARD_REGNO_MODE_OK\n>  #define TARGET_HARD_REGNO_MODE_OK cris_hard_regno_mode_ok\n>\n> +#undef TARGET_STATIC_RTX_ALIGNMENT\n> +#define TARGET_STATIC_RTX_ALIGNMENT cris_static_rtx_alignment\n>  #undef TARGET_CONSTANT_ALIGNMENT\n>  #define TARGET_CONSTANT_ALIGNMENT cris_constant_alignment\n>\n> @@ -4329,6 +4332,26 @@ cris_hard_regno_mode_ok (unsigned int re\n>               || (regno != CRIS_MOF_REGNUM && regno != CRIS_ACR_REGNUM)));\n>  }\n>\n> +/* Return the preferred minimum alignment for a static object.  */\n> +\n> +static HOST_WIDE_INT\n> +cris_preferred_mininum_alignment (void)\n> +{\n> +  if (!TARGET_CONST_ALIGN)\n> +    return 8;\n> +  if (TARGET_ALIGN_BY_32)\n> +    return 32;\n> +  return 16;\n> +}\n> +\n> +/* Implement TARGET_STATIC_RTX_ALIGNMENT.  */\n> +\n> +static HOST_WIDE_INT\n> +cris_static_rtx_alignment (machine_mode mode)\n> +{\n> +  return MAX (cris_preferred_mininum_alignment (), GET_MODE_ALIGNMENT (mode));\n> +}\n> +\n>  /* Implement TARGET_CONSTANT_ALIGNMENT.  Note that this hook has the\n>     effect of making gcc believe that ALL references to constant stuff\n>     (in code segment, like strings) have this alignment.  That is a rather\n> @@ -4339,11 +4362,7 @@ cris_hard_regno_mode_ok (unsigned int re\n>  static HOST_WIDE_INT\n>  cris_constant_alignment (const_tree, HOST_WIDE_INT basic_align)\n>  {\n> -  if (!TARGET_CONST_ALIGN)\n> -    return basic_align;\n> -  if (TARGET_ALIGN_BY_32)\n> -    return MAX (basic_align, 32);\n> -  return MAX (basic_align, 16);\n> +  return MAX (cris_preferred_mininum_alignment (), basic_align);\n>  }\n>\n>  #if 0\n> Index: gcc/config/i386/i386.c\n> ===================================================================\n> --- gcc/config/i386/i386.c      2017-09-25 17:04:16.768362388 +0100\n> +++ gcc/config/i386/i386.c      2017-10-01 17:14:18.477796414 +0100\n> @@ -31563,6 +31563,18 @@ ix86_sched_init_global (FILE *, int, int\n>  }\n>\n>\n> +/* Implement TARGET_STATIC_RTX_ALIGNMENT.  */\n> +\n> +static HOST_WIDE_INT\n> +ix86_static_rtx_alignment (machine_mode mode)\n> +{\n> +  if (mode == DFmode)\n> +    return 64;\n> +  if (ALIGN_MODE_128 (mode))\n> +    return MAX (128, GET_MODE_ALIGNMENT (mode));\n> +  return GET_MODE_ALIGNMENT (mode);\n> +}\n> +\n>  /* Implement TARGET_CONSTANT_ALIGNMENT.  */\n>\n>  static HOST_WIDE_INT\n> @@ -31571,10 +31583,9 @@ ix86_constant_alignment (const_tree exp,\n>    if (TREE_CODE (exp) == REAL_CST || TREE_CODE (exp) == VECTOR_CST\n>        || TREE_CODE (exp) == INTEGER_CST)\n>      {\n> -      if (TYPE_MODE (TREE_TYPE (exp)) == DFmode && align < 64)\n> -       return 64;\n> -      else if (ALIGN_MODE_128 (TYPE_MODE (TREE_TYPE (exp))) && align < 128)\n> -       return 128;\n> +      machine_mode mode = TYPE_MODE (TREE_TYPE (exp));\n> +      HOST_WIDE_INT mode_align = ix86_static_rtx_alignment (mode);\n> +      return MAX (mode_align, align);\n>      }\n>    else if (!optimize_size && TREE_CODE (exp) == STRING_CST\n>            && TREE_STRING_LENGTH (exp) >= 31 && align < BITS_PER_WORD)\n> @@ -53605,6 +53616,8 @@ #define TARGET_HARD_REGNO_CALL_PART_CLOB\n>  #undef TARGET_CAN_CHANGE_MODE_CLASS\n>  #define TARGET_CAN_CHANGE_MODE_CLASS ix86_can_change_mode_class\n>\n> +#undef TARGET_STATIC_RTX_ALIGNMENT\n> +#define TARGET_STATIC_RTX_ALIGNMENT ix86_static_rtx_alignment\n>  #undef TARGET_CONSTANT_ALIGNMENT\n>  #define TARGET_CONSTANT_ALIGNMENT ix86_constant_alignment\n>\n> Index: gcc/config/mmix/mmix.c\n> ===================================================================\n> --- gcc/config/mmix/mmix.c      2017-09-25 17:04:16.774361549 +0100\n> +++ gcc/config/mmix/mmix.c      2017-10-01 17:14:18.477796414 +0100\n> @@ -168,6 +168,7 @@ static void mmix_print_operand (FILE *,\n>  static void mmix_print_operand_address (FILE *, machine_mode, rtx);\n>  static bool mmix_print_operand_punct_valid_p (unsigned char);\n>  static void mmix_conditional_register_usage (void);\n> +static HOST_WIDE_INT mmix_static_rtx_alignment (machine_mode);\n>  static HOST_WIDE_INT mmix_constant_alignment (const_tree, HOST_WIDE_INT);\n>\n>  /* Target structure macros.  Listed by node.  See `Using and Porting GCC'\n> @@ -283,6 +284,8 @@ #define TARGET_TRAMPOLINE_INIT mmix_tram\n>  #undef TARGET_OPTION_OVERRIDE\n>  #define TARGET_OPTION_OVERRIDE mmix_option_override\n>\n> +#undef TARGET_STATIC_RTX_ALIGNMENT\n> +#define TARGET_STATIC_RTX_ALIGNMENT mmix_static_rtx_alignment\n>  #undef TARGET_CONSTANT_ALIGNMENT\n>  #define TARGET_CONSTANT_ALIGNMENT mmix_constant_alignment\n>\n> @@ -338,6 +341,14 @@ mmix_data_alignment (tree type ATTRIBUTE\n>    return basic_align;\n>  }\n>\n> +/* Implement TARGET_STATIC_RTX_ALIGNMENT.  */\n> +\n> +static HOST_WIDE_INT\n> +mmix_static_rtx_alignment (machine_mode mode)\n> +{\n> +  return MAX (GET_MODE_ALIGNMENT (mode), 32);\n> +}\n> +\n>  /* Implement tARGET_CONSTANT_ALIGNMENT.  */\n>\n>  static HOST_WIDE_INT\n> Index: gcc/config/spu/spu.c\n> ===================================================================\n> --- gcc/config/spu/spu.c        2017-09-25 17:04:16.787359730 +0100\n> +++ gcc/config/spu/spu.c        2017-10-01 17:14:18.478802788 +0100\n> @@ -7194,6 +7194,18 @@ spu_truly_noop_truncation (unsigned int\n>    return inprec <= 32 && outprec <= inprec;\n>  }\n>\n> +/* Implement TARGET_STATIC_RTX_ALIGNMENT.\n> +\n> +   Make all static objects 16-byte aligned.  This allows us to assume\n> +   they are also padded to 16 bytes, which means we can use a single\n> +   load or store instruction to access them.  */\n> +\n> +static HOST_WIDE_INT\n> +spu_static_rtx_alignment (machine_mode mode)\n> +{\n> +  return MAX (GET_MODE_ALIGNMENT (mode), 128);\n> +}\n> +\n>  /* Implement TARGET_CONSTANT_ALIGNMENT.\n>\n>     Make all static objects 16-byte aligned.  This allows us to assume\n> @@ -7445,6 +7457,8 @@ #define TARGET_CAN_CHANGE_MODE_CLASS spu\n>  #undef TARGET_TRULY_NOOP_TRUNCATION\n>  #define TARGET_TRULY_NOOP_TRUNCATION spu_truly_noop_truncation\n>\n> +#undef TARGET_STATIC_RTX_ALIGNMENT\n> +#define TARGET_STATIC_RTX_ALIGNMENT spu_static_rtx_alignment\n>  #undef TARGET_CONSTANT_ALIGNMENT\n>  #define TARGET_CONSTANT_ALIGNMENT spu_constant_alignment\n>","headers":{"Return-Path":"<gcc-patches-return-465082-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-465082-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=\"aC3kfsUY\"; 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 3yMVqP525Kz9t2h\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 26 Oct 2017 00:10:09 +1100 (AEDT)","(qmail 111308 invoked by alias); 25 Oct 2017 13:09:59 -0000","(qmail 111298 invoked by uid 89); 25 Oct 2017 13:09:58 -0000","from mail-wm0-f41.google.com (HELO mail-wm0-f41.google.com)\n\t(74.125.82.41) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 25 Oct 2017 13:09:55 +0000","by mail-wm0-f41.google.com with SMTP id 196so15794959wma.1 for\n\t<gcc-patches@gcc.gnu.org>; Wed, 25 Oct 2017 06:09:54 -0700 (PDT)","by 10.80.143.34 with HTTP; Wed, 25 Oct 2017 06:09:52 -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\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:content-type; q=dns; s=default; b=uxzGY1+nWABfB6k9/P\n\t9ivddEOUiGQaDuThhv+ELOTBvRGmC75xU3J27XAKxA86kDYmxD98UD78107IYswZ\n\td3m4oXzuNThhKgRxVM8kFqv80mCuQyFjsmHsUCLnieoSFGAQQ1f/h1EO4nTE3PjJ\n\tqjLvjk/H9UwhjlC7O9ICox/l0=","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\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:content-type; s=default; bh=NK8D3/VOOWXj5Cv1K+juX47P\n\tVnQ=; b=aC3kfsUYEEv/VjGkcavehxO7pyKXFzmfpVpV7pneuGys5qvKaIVE7ukd\n\ttLHoe2axA3hHH/VouZVosJPDNxzfYaT0ZfK8o72fNM3FtG26Sy5oSe7eT5OBOCvY\n\taZS9Yoj1X+Xvm+YBEsFkCsN9tpUPv+t8H7ONbCr016vgkHLfiQM=","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=-9.0 required=5.0 tests=AWL, BAYES_00,\n\tFREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS,\n\tRCVD_IN_DNSWL_NONE, SPF_PASS,\n\tURIBL_BLACK autolearn=ham version=3.3.2 spammy=","X-HELO":"mail-wm0-f41.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:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to;\n\tbh=Na/Cr6wyfvDAH98EvVLbAEm86Hw/23R1Ofc8lSCz61I=;\n\tb=aMSwpHo4Cp34JdFM0N/2EtinBoq9Dn+hD9zx1OAOrMcJTBzxfiH2m/td19TCkWUUbo\n\tCiyWh8pjk9uOSf2PjvLom5feFIV7THfSGnEq3X/WXNT0cb/eAudPnI9ucpEg5DPDHz04\n\tgjeBOS/vb1S3tuO81F4zKJ7FSsdEO9vs+FnPpHbczxWiUlRhlL+d3tVsIl0GLc41LOs0\n\tzdGzB34+nahLYzL8ROFq3K10iQ9SAiMrcjdLI0yD3TBZvanixlKq/rcjn0+poFDjSqti\n\ttPMvdTt9zorsinZbsIo8h5obqG/kAr3AfbM4dmgZY24rD/e9WXpK4hP2T1K2FYLdz3Hg\n\tB4fA==","X-Gm-Message-State":"AMCzsaUdfZj56f1GNdE2aaNlmsR77wEM5JAOtn4AkrIPEiTXZKF1bOrU\tC37gTFv7crdVOD+K2YAcWs3OLNtvuc3yPh+xuss=","X-Google-Smtp-Source":"ABhQp+TnLu2Tdz4053YC7hHXgpw+9shsrwgXJhM7BHLIXYnnIRhUlpU07oWz7K6h9IufNJ3Gmp/VVoFlHeGA3TCr1s4=","X-Received":"by 10.80.175.165 with SMTP id h34mr24492889edd.292.1508936992825;\n\tWed, 25 Oct 2017 06:09:52 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<87k20ex2ps.fsf@linaro.org>","References":"<87shfhzgwc.fsf@linaro.org>\n\t<FDB20764-7B41-4630-B4C6-3DEAFCE53C58@gmail.com>\n\t<874lrw5hxk.fsf@linaro.org>\n\t<CAFiYyc35uOLn4E1qVR+4PERDL3vumapyZt3OiLGxn8MXGWANrQ@mail.gmail.com>\n\t<87zi9mptv6.fsf@linaro.org>\n\t<CAFiYyc1+Bx0SFLqM=0HWxLkMpDZXWq1fs5Jkie=DDpk1j-ZS3A@mail.gmail.com>\n\t<87k20ex2ps.fsf@linaro.org>","From":"Richard Biener <richard.guenther@gmail.com>","Date":"Wed, 25 Oct 2017 15:09:52 +0200","Message-ID":"<CAFiYyc296LrybX33iPcBXe01HcVv_oTy7=Q4bvVLdYj5+e1ZOg@mail.gmail.com>","Subject":"Re: Don't query the frontend for unsupported types","To":"Richard Biener <richard.guenther@gmail.com>,\n\tGCC Patches <gcc-patches@gcc.gnu.org>,\n\tRichard Sandiford <richard.sandiford@linaro.org>","Content-Type":"text/plain; charset=\"UTF-8\"","X-IsSubscribed":"yes"}}]