get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/833335/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 833335,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/833335/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/1509625835-22344-7-git-send-email-claziss@synopsys.com/",
    "project": {
        "id": 17,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/17/?format=api",
        "name": "GNU Compiler Collection",
        "link_name": "gcc",
        "list_id": "gcc-patches.gcc.gnu.org",
        "list_email": "gcc-patches@gcc.gnu.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1509625835-22344-7-git-send-email-claziss@synopsys.com>",
    "list_archive_url": null,
    "date": "2017-11-02T12:30:35",
    "name": "[6/6,ARC] Add 'aux' variable attribute.",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "54c097ba9371939a4341df7aab1058a6458e0852",
    "submitter": {
        "id": 67086,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/67086/?format=api",
        "name": "Claudiu Zissulescu",
        "email": "Claudiu.Zissulescu@synopsys.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/1509625835-22344-7-git-send-email-claziss@synopsys.com/mbox/",
    "series": [
        {
            "id": 11495,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/11495/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=11495",
            "date": "2017-11-02T12:30:29",
            "name": "New baremetal features and fixes",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/11495/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/833335/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/833335/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<gcc-patches-return-465741-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-465741-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=\"gBtiaYmK\"; 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 3ySPl401jYz9sBW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  2 Nov 2017 23:38:23 +1100 (AEDT)",
            "(qmail 55729 invoked by alias); 2 Nov 2017 12:34:51 -0000",
            "(qmail 55713 invoked by uid 89); 2 Nov 2017 12:34:50 -0000",
            "from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tThu, 02 Nov 2017 12:34:47 +0000",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim\n\t4.71)\t(envelope-from <Claudiu.Zissulescu@synopsys.com>)\tid\n\t1eAEhm-0003tQ-6N\tfor gcc-patches@gcc.gnu.org;\n\tThu, 02 Nov 2017 08:34:45 -0400",
            "from us01smtprelay-2.synopsys.com ([198.182.47.9]:35831\n\thelo=smtprelay.synopsys.com)\tby eggs.gnu.org with esmtps\n\t(TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\t(Exim\n\t4.71)\t(envelope-from <Claudiu.Zissulescu@synopsys.com>)\tid\n\t1eAEhl-0003ss-Tj\tfor gcc-patches@gcc.gnu.org;\n\tThu, 02 Nov 2017 08:34:42 -0400",
            "from mailhost.synopsys.com (mailhost3.synopsys.com\n\t[10.12.238.238])\tby smtprelay.synopsys.com (Postfix) with\n\tESMTP id 7C1B024E203D; Thu,  2 Nov 2017 05:34:39 -0700 (PDT)",
            "from mailhost.synopsys.com (localhost [127.0.0.1])\tby\n\tmailhost.synopsys.com (Postfix) with ESMTP id 629ABB20;\n\tThu,  2 Nov 2017 05:34:39 -0700 (PDT)",
            "from US01WEHTC2.internal.synopsys.com\n\t(us01wehtc2-vip.internal.synopsys.com [10.12.239.238])\tby\n\tmailhost.synopsys.com (Postfix) with ESMTP id 51CE7B1E;\n\tThu,  2 Nov 2017 05:34:39 -0700 (PDT)",
            "from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by\n\tUS01WEHTC2.internal.synopsys.com (10.12.239.237) with\n\tMicrosoft SMTP Server (TLS) id 14.3.266.1;\n\tThu, 2 Nov 2017 05:34:33 -0700",
            "from IN01WEHTCA.internal.synopsys.com (10.144.199.103) by\n\tIN01WEHTCB.internal.synopsys.com (10.144.199.105) with\n\tMicrosoft SMTP Server (TLS) id 14.3.266.1;\n\tThu, 2 Nov 2017 18:04:32 +0530",
            "from nl20droid1.internal.synopsys.com (10.100.24.228) by\n\tIN01WEHTCA.internal.synopsys.com (10.144.199.243) with\n\tMicrosoft SMTP Server (TLS) id 14.3.266.1;\n\tThu, 2 Nov 2017 18:04:31 +0530"
        ],
        "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:date:message-id:in-reply-to:references\n\t:mime-version:content-type; q=dns; s=default; b=LKVkp071eDRTZxXM\n\tO2guwWF6bJHHEZqUoHmfRf74TphtEt0IpILrN/tG4hkDB5wiJbtixM+f4Aak9Ei+\n\twdQWZHLfZl7nDeX4KYHbs/feS+OqOhbHrJfwFSHf7Z5KfUuYawwOB068VAIrrdlr\n\tRk5ROJZZPpZbx+ShbQDn8oJEFs4=",
        "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:date:message-id:in-reply-to:references\n\t:mime-version:content-type; s=default; bh=7W4JshgJaZ0SPJlQy49JH/\n\tgQkho=; b=gBtiaYmKv/EHoVfNc/I3ln5K7dHPSb5NwukYgTeRgy6QDmClgayEli\n\tP8ykIlr05xf9o5vtJbxZzE4vehVJUGeLQTnYUpEL7IJMtQwNkbBscAO52YHtxKOE\n\troZoKd/o7k6vkK+J6wxFrPoGay3j2hNUMcj3Cdg5cmj5lBjw3SYzc=",
        "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=-23.9 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tKAM_LAZY_DOMAIN_SECURITY,\n\tKAM_STOCKGEN autolearn=ham version=3.3.2 spammy=",
        "X-HELO": "eggs.gnu.org",
        "From": "Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com>",
        "To": "<gcc-patches@gcc.gnu.org>",
        "CC": "<Claudiu.Zissulescu@synopsys.com>, <Francois.Bedard@synopsys.com>,\n\t<andrew.burgess@embecosm.com>",
        "Subject": "[PATCH 6/6] [ARC] Add 'aux' variable attribute.",
        "Date": "Thu, 2 Nov 2017 13:30:35 +0100",
        "Message-ID": "<1509625835-22344-7-git-send-email-claziss@synopsys.com>",
        "In-Reply-To": "<1509625835-22344-1-git-send-email-claziss@synopsys.com>",
        "References": "<1509625835-22344-1-git-send-email-claziss@synopsys.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 3.x [fuzzy]",
        "X-Received-From": "198.182.47.9"
    },
    "content": "From: claziss <claziss@synopsys.com>\n\nThe 'aux' variable attribute is used to directly access the auxiliary\nregister space from C.\n\ngcc/\n2017-07-25  Claudiu Zissulescu  <claziss@synopsys.com>\n\n\t* config/arc/arc.c (arc_handle_aux_attribute): New function.\n\t(arc_attribute_table): Add 'aux' attribute.\n\t(arc_in_small_data_p): Consider aux like variables.\n\t(arc_is_aux_reg_p): New function.\n\t(arc_asm_output_aligned_decl_local): Ignore 'aux' like variables.\n\t(arc_get_aux_arg): New function.\n\t(prepare_move_operands): Handle aux-register access.\n\t(arc_handle_aux_attribute): New function.\n\t* doc/extend.texi (ARC Variable attributes): Add subsection.\n\ntestsuite/\n2017-07-25  Claudiu Zissulescu  <claziss@synopsys.com>\n\n\t* gcc.target/arc/taux-1.c: New test.\n\t* gcc.target/arc/taux-2.c: Likewise.\n---\n gcc/config/arc/arc.c                  | 160 +++++++++++++++++++++++++++++++++-\n gcc/doc/extend.texi                   |  13 +++\n gcc/testsuite/gcc.target/arc/taux-1.c |  38 ++++++++\n gcc/testsuite/gcc.target/arc/taux-2.c |  15 ++++\n 4 files changed, 225 insertions(+), 1 deletion(-)\n create mode 100644 gcc/testsuite/gcc.target/arc/taux-1.c\n create mode 100644 gcc/testsuite/gcc.target/arc/taux-2.c",
    "diff": "diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c\nindex a397cbd..33f68ef 100644\n--- a/gcc/config/arc/arc.c\n+++ b/gcc/config/arc/arc.c\n@@ -223,6 +223,7 @@ static tree arc_handle_fndecl_attribute (tree *, tree, tree, int, bool *);\n static tree arc_handle_jli_attribute (tree *, tree, tree, int, bool *);\n static tree arc_handle_secure_attribute (tree *, tree, tree, int, bool *);\n static tree arc_handle_uncached_attribute (tree *, tree, tree, int, bool *);\n+static tree arc_handle_aux_attribute (tree *, tree, tree, int, bool *);\n \n /* Initialized arc_attribute_table to NULL since arc doesnot have any\n    machine specific supported attributes.  */\n@@ -257,6 +258,8 @@ const struct attribute_spec arc_attribute_table[] =\n   /* Bypass caches using .di flag.  */\n   { \"uncached\", 0, 0, false, true, false, arc_handle_uncached_attribute,\n     false },\n+  /* Declare a variable as aux.  */\n+  { \"aux\", 0, 1, true, false, false, arc_handle_aux_attribute, false },\n   { NULL, 0, 0, false, false, false, NULL, false }\n };\n static int arc_comp_type_attributes (const_tree, const_tree);\n@@ -8071,6 +8074,11 @@ arc_in_small_data_p (const_tree decl)\n   if (lookup_attribute (\"uncached\", attr))\n     return false;\n \n+  /* and for aux regs.  */\n+  attr = DECL_ATTRIBUTES (decl);\n+  if (lookup_attribute (\"aux\", attr))\n+    return false;\n+\n   if (DECL_SECTION_NAME (decl) != 0)\n     {\n       const char *name = DECL_SECTION_NAME (decl);\n@@ -8238,6 +8246,35 @@ compact_sda_memory_operand (rtx op, machine_mode mode, bool short_p)\n   return false;\n }\n \n+/* Return TRUE if PAT is accessing an aux-reg.  */\n+\n+static bool\n+arc_is_aux_reg_p (rtx pat)\n+{\n+  tree attrs = NULL_TREE;\n+  tree addr;\n+\n+  if (!MEM_P (pat))\n+    return false;\n+\n+  /* Get the memory attributes.  */\n+  addr = MEM_EXPR (pat);\n+  if (!addr)\n+    return false;\n+\n+  /* Get the attributes.  */\n+  if (TREE_CODE (addr) == VAR_DECL)\n+    attrs = DECL_ATTRIBUTES (addr);\n+  else if (TREE_CODE (addr) == MEM_REF)\n+    attrs = TYPE_ATTRIBUTES (TREE_TYPE (TREE_OPERAND (addr, 0)));\n+  else\n+    return false;\n+\n+  if (lookup_attribute (\"aux\", attrs))\n+    return true;\n+  return false;\n+}\n+\n /* Implement ASM_OUTPUT_ALIGNED_DECL_LOCAL.  */\n \n void\n@@ -8246,7 +8283,14 @@ arc_asm_output_aligned_decl_local (FILE * stream, tree decl, const char * name,\n \t\t\t\t   unsigned HOST_WIDE_INT align,\n \t\t\t\t   unsigned HOST_WIDE_INT globalize_p)\n {\n-  int in_small_data =   arc_in_small_data_p (decl);\n+  int in_small_data = arc_in_small_data_p (decl);\n+  rtx mem = decl == NULL_TREE ? NULL_RTX : DECL_RTL (decl);\n+\n+  /* Don't output aux-reg symbols.  */\n+  if (mem != NULL_RTX && MEM_P (mem)\n+      && SYMBOL_REF_P (XEXP (mem, 0))\n+      && arc_is_aux_reg_p (mem))\n+    return;\n \n   if (in_small_data)\n     switch_to_section (get_named_section (NULL, \".sbss\", 0));\n@@ -8586,12 +8630,80 @@ arc_expand_movmem (rtx *operands)\n   return true;\n }\n \n+static bool\n+arc_get_aux_arg (rtx pat, int *auxr)\n+{\n+  tree attr, addr = MEM_EXPR (pat);\n+  if (TREE_CODE (addr) != VAR_DECL)\n+    return false;\n+\n+  attr = DECL_ATTRIBUTES (addr);\n+  if (lookup_attribute (\"aux\", attr))\n+    {\n+      tree arg = TREE_VALUE (attr);\n+      if (arg)\n+\t{\n+\t  *auxr = TREE_INT_CST_LOW (TREE_VALUE (arg));\n+\t  return true;\n+\t}\n+    }\n+\n+  return false;\n+}\n+\n /* Prepare operands for move in MODE.  Return true iff the move has\n    been emitted.  */\n \n bool\n prepare_move_operands (rtx *operands, machine_mode mode)\n {\n+  /* First handle aux attribute.  */\n+  if (mode == SImode\n+      && (MEM_P (operands[0]) || MEM_P (operands[1])))\n+    {\n+      rtx tmp;\n+      int auxr = 0;\n+      if (MEM_P (operands[0]) && arc_is_aux_reg_p (operands[0]))\n+\t{\n+\t  /* Save operation.  */\n+\t  if (arc_get_aux_arg (operands[0], &auxr))\n+\t    {\n+\t      tmp = gen_reg_rtx (SImode);\n+\t      emit_move_insn (tmp, GEN_INT (auxr));\n+\t    }\n+\t  else\n+\t    {\n+\t      tmp = XEXP (operands[0], 0);\n+\t    }\n+\n+\t  operands[1] = force_reg (SImode, operands[1]);\n+\t  emit_insn (gen_rtx_UNSPEC_VOLATILE\n+\t\t     (VOIDmode, gen_rtvec (2, operands[1], tmp),\n+\t\t      VUNSPEC_ARC_SR));\n+\t  return true;\n+\t}\n+      if (MEM_P (operands[1]) && arc_is_aux_reg_p (operands[1]))\n+\t{\n+\t  if (arc_get_aux_arg (operands[1], &auxr))\n+\t    {\n+\t      tmp = gen_reg_rtx (SImode);\n+\t      emit_move_insn (tmp, GEN_INT (auxr));\n+\t    }\n+\t  else\n+\t    {\n+\t      tmp = XEXP (operands[1], 0);\n+\t      gcc_assert (GET_CODE (tmp) == SYMBOL_REF);\n+\t    }\n+\t  /* Load operation.  */\n+\t  gcc_assert (REG_P (operands[0]));\n+\t  emit_insn (gen_rtx_SET (operands[0],\n+\t\t\t\t  gen_rtx_UNSPEC_VOLATILE\n+\t\t\t\t  (SImode, gen_rtvec (1, tmp),\n+\t\t\t\t   VUNSPEC_ARC_LR)));\n+\t  return true;\n+\t}\n+    }\n+\n   /* We used to do this only for MODE_INT Modes, but addresses to floating\n      point variables may well be in the small data section.  */\n   if (!TARGET_NO_SDATA_SET && small_data_pattern (operands[0], Pmode))\n@@ -11127,6 +11239,52 @@ arc_is_uncached_mem_p (rtx pat)\n   return false;\n }\n \n+/* Handle aux attribute.  The auxiliary registers are addressed using\n+   special instructions lr and sr.  The attribute 'aux' indicates if a\n+   variable refers to the aux-regs and what is the register number\n+   desired.  */\n+\n+static tree\n+arc_handle_aux_attribute (tree *node,\n+\t\t\t  tree name, tree args, int,\n+\t\t\t  bool *no_add_attrs)\n+{\n+  /* Isn't it better to use address spaces for the aux-regs?  */\n+  if (DECL_P (*node))\n+    {\n+      if (TREE_CODE (*node) != VAR_DECL)\n+\t{\n+\t  error (\"%qE attribute only applies to variables\",  name);\n+\t  *no_add_attrs = true;\n+\t}\n+      else if (args)\n+\t{\n+\t  if (TREE_CODE (TREE_VALUE (args)) == NON_LVALUE_EXPR)\n+\t    TREE_VALUE (args) = TREE_OPERAND (TREE_VALUE (args), 0);\n+\t  tree arg = TREE_VALUE (args);\n+\t  if (TREE_CODE (arg) != INTEGER_CST)\n+\t    {\n+\t      warning (0, \"%qE attribute allows only an integer \"\n+\t\t       \"constant argument\", name);\n+\t      *no_add_attrs = true;\n+\t    }\n+\t  /* FIXME! add range check.  TREE_INT_CST_LOW (arg) */\n+\t}\n+\n+      if (TREE_CODE (*node) == VAR_DECL)\n+\t{\n+\t  tree fntype = TREE_TYPE (*node);\n+\t  if (fntype && TREE_CODE (fntype) == POINTER_TYPE)\n+\t    {\n+\t      tree attrs = tree_cons (get_identifier (\"aux\"), NULL_TREE,\n+\t\t\t\t      TYPE_ATTRIBUTES (fntype));\n+\t      TYPE_ATTRIBUTES (fntype) = attrs;\n+\t    }\n+\t}\n+    }\n+  return NULL_TREE;\n+}\n+\n /* Implement TARGET_USE_ANCHORS_FOR_SYMBOL_P.  We don't want to use\n    anchors for small data: the GP register acts as an anchor in that\n    case.  We also don't want to use them for PC-relative accesses,\ndiff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi\nindex 0f8ba05..1f6ef4e 100644\n--- a/gcc/doc/extend.texi\n+++ b/gcc/doc/extend.texi\n@@ -5803,6 +5803,7 @@ attributes.\n \n @menu\n * Common Variable Attributes::\n+* ARC Variable Attributes::\n * AVR Variable Attributes::\n * Blackfin Variable Attributes::\n * H8/300 Variable Attributes::\n@@ -6165,6 +6166,18 @@ The @code{weak} attribute is described in\n \n @end table\n \n+@node ARC Variable Attributes\n+@subsection ARC Variable Attributes\n+\n+@table @code\n+@item aux\n+@cindex @code{aux} variable attribute, ARC\n+The @code{aux} attribute is used to directly access the ARC's\n+auxiliary register space from C.  The auxilirary register number is\n+given via attribute argument.\n+\n+@end table\n+\n @node AVR Variable Attributes\n @subsection AVR Variable Attributes\n \ndiff --git a/gcc/testsuite/gcc.target/arc/taux-1.c b/gcc/testsuite/gcc.target/arc/taux-1.c\nnew file mode 100644\nindex 0000000..a2b7778\n--- /dev/null\n+++ b/gcc/testsuite/gcc.target/arc/taux-1.c\n@@ -0,0 +1,38 @@\n+/* { dg-do compile } */\n+/* { dg-options \"-O1 */\n+\n+\n+#define __aux() __attribute__((aux))\n+\n+__aux() int *a_ptr;\n+extern __aux() int a_var;\n+\n+/* Generates:\n+   mov r0, @a_var\n+   sr  10,[r0]\n+*/\n+void foo (void)\n+{\n+  a_var = 10;\n+}\n+\n+/* Generates:\n+   mov r0, @a_ptr\n+   sr  a_var,[r0]\n+*/\n+void foo1 (void)\n+{\n+  a_ptr = &a_var;\n+}\n+\n+/* Generates:\n+   lr  %r1,[a_ptr]\n+   sr  10,[%r1]\n+*/\n+void foo2 (void)\n+{\n+  *a_ptr = 10;\n+}\n+\n+/* { dg-final { scan-assembler-times \"sr\" 3 } } */\n+/* { dg-final { scan-assembler-times \"lr\" 1 } } */\ndiff --git a/gcc/testsuite/gcc.target/arc/taux-2.c b/gcc/testsuite/gcc.target/arc/taux-2.c\nnew file mode 100644\nindex 0000000..5644bcd\n--- /dev/null\n+++ b/gcc/testsuite/gcc.target/arc/taux-2.c\n@@ -0,0 +1,15 @@\n+/* { dg-do compile } */\n+/* { dg-options \"-O1 */\n+\n+#define __aux(r) __attribute__((aux(r)))\n+static volatile __aux(0x1000) int var;\n+\n+int foo (void)\n+{\n+  var++;\n+}\n+\n+/* { dg-final { scan-assembler-times \"sr\" 1 } } */\n+/* { dg-final { scan-assembler-times \"lr\" 1 } } */\n+/* { dg-final { scan-assembler \"4096\" } } */\n+/* { dg-final { scan-assembler-not \"\\\\.type\\tvar, @object\" } } */\n",
    "prefixes": [
        "6/6",
        "ARC"
    ]
}