get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 809612,
    "url": "http://patchwork.ozlabs.org/api/patches/809612/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/873782itg4.fsf@linaro.org/",
    "project": {
        "id": 17,
        "url": "http://patchwork.ozlabs.org/api/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": "<873782itg4.fsf@linaro.org>",
    "list_archive_url": null,
    "date": "2017-09-04T11:39:23",
    "name": "[6/9] Make mode_for_vector return an opt_mode",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "d60f6d1290da9889cc0b971564ea4e7c5add4cae",
    "submitter": {
        "id": 5450,
        "url": "http://patchwork.ozlabs.org/api/people/5450/?format=api",
        "name": "Richard Sandiford",
        "email": "richard.sandiford@linaro.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/873782itg4.fsf@linaro.org/mbox/",
    "series": [
        {
            "id": 1357,
            "url": "http://patchwork.ozlabs.org/api/series/1357/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=1357",
            "date": "2017-09-04T11:24:26",
            "name": "Make more use of opt_mode",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/1357/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/809612/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/809612/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<gcc-patches-return-461409-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-461409-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=\"lOFKCLAi\"; 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 3xm7Dg2Pl9z9s8J\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon,  4 Sep 2017 21:39:47 +1000 (AEST)",
            "(qmail 95422 invoked by alias); 4 Sep 2017 11:39:38 -0000",
            "(qmail 95144 invoked by uid 89); 4 Sep 2017 11:39:38 -0000",
            "from mail-wm0-f46.google.com (HELO mail-wm0-f46.google.com)\n\t(74.125.82.46) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tMon, 04 Sep 2017 11:39:32 +0000",
            "by mail-wm0-f46.google.com with SMTP id v2so3320017wmf.0 for\n\t<gcc-patches@gcc.gnu.org>; Mon, 04 Sep 2017 04:39:31 -0700 (PDT)",
            "from localhost (94.197.120.41.threembb.co.uk. [94.197.120.41]) by\n\tsmtp.gmail.com with ESMTPSA id\n\tb10sm3239811wrc.69.2017.09.04.04.39.27 for\n\t<gcc-patches@gcc.gnu.org> (version=TLS1_2\n\tcipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tMon, 04 Sep 2017 04:39:28 -0700 (PDT)"
        ],
        "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:from\n\t:to:subject:references:date:in-reply-to:message-id:mime-version\n\t:content-type; q=dns; s=default; b=tpuM+9TE3NokMrcgk5Or1gRhVwpDk\n\toofjhERyGOSFIlzhxU1lgK6C+3MLClLw0eEadwgQlDArhz0MYA2C0m0ysgoXn0UQ\n\tqmRsbj+VUvVS49QyQvQHa4Y5/fdlCL/ZU3QZgHwkBlaJP+IchkH+Fdq4m5KyLnDC\n\tYPsu2eJ0m9rW9s=",
        "DKIM-Signature": "v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:from\n\t:to:subject:references:date:in-reply-to:message-id:mime-version\n\t:content-type; s=default; bh=HvK+rnrGMiSBns41WJRUPdTceKs=; b=lOF\n\tKCLAiQPgh++uA9KydIq/x3hRKNwd7XISHhPL98ojSg3I/ZtJKrFap6/6pTOvulUr\n\tHwynTP4ZrftScXOe/NhnxWeyYcgUeXkFJpR4o1h0uq49eXwxI0pX5r87B/HMJt1C\n\tpcR573UgDFY43WIgO+3DouD+O+L/WS7yV+4SWhME=",
        "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.6 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=",
        "X-HELO": "mail-wm0-f46.google.com",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:from:to:mail-followup-to:subject:references:date\n\t:in-reply-to:message-id:user-agent:mime-version;\n\tbh=9Q4lZm9oQLSdoJghrdwkeYXTKu8uRndI+oeTuF296ko=;\n\tb=YtVfJWaIFmHvxLQh8mMJcn61mz9bxaKDL6usfPzHnJtYTsMVJq3uMP9JOKFtGX4XHR\n\tZyEQSfTBkH9wUP18DuhO1pNMaQgklvXv0BvJZISC6/QRCeZmmXYYhZ8Bd6fXonjmSvVX\n\talrv3DzdRNV0n9JAprUtjIY4HrqDkK4qaL8UzSKUXFjuu/2zi/KvhqNtOFpZya8Got5D\n\tV0j2D/+NQWMoqIN0TMxZpWBa9nLyn7GETcrWeq8lgROOy5Qq5FUvAbtORmurH4/LYZSJ\n\tRSWuqB8dTskZb7xilvX+7418kOx0P34uA5xAxcczXp0uu93Zl4hot6a69Hgogdtr6nMk\n\tgW/Q==",
        "X-Gm-Message-State": "AHPjjUjD9YXI3BAQxgwdBvxUHD+SqqQR9Ixje0dVhlDpETHLn0RGf63o\tHFupR2ymlF9D2FZK8ZQkrg==",
        "X-Google-Smtp-Source": "ADKCNb7J2QCWEpcf9LJwxH/nh9XmmxtZ88gMVO8dvkRFkoHVku3k5sd1oStx4eUi1Dc9VjzOfs2kBg==",
        "X-Received": "by 10.28.183.8 with SMTP id h8mr399905wmf.24.1504525168769;\n\tMon, 04 Sep 2017 04:39:28 -0700 (PDT)",
        "From": "Richard Sandiford <richard.sandiford@linaro.org>",
        "To": "gcc-patches@gcc.gnu.org",
        "Mail-Followup-To": "gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org",
        "Subject": "[6/9] Make mode_for_vector return an opt_mode",
        "References": "<87tw0iiu51.fsf@linaro.org>",
        "Date": "Mon, 04 Sep 2017 12:39:23 +0100",
        "In-Reply-To": "<87tw0iiu51.fsf@linaro.org> (Richard Sandiford's message of\n\t\"Mon, 04 Sep 2017 12:24:26 +0100\")",
        "Message-ID": "<873782itg4.fsf@linaro.org>",
        "User-Agent": "Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain"
    },
    "content": "...following on from the mode_for_size change.  The patch also removes\nmachmode.h versions of the stor-layout.c comments, since the comments\nin the .c file are more complete.\n\n2017-09-04  Richard Sandiford  <richard.sandiford@linaro.org>\n\ngcc/\n\t* machmode.h (mode_for_vector): Return an opt_mode.\n\t* stor-layout.c (mode_for_vector): Likewise.\n\t(mode_for_int_vector): Update accordingly.\n\t(layout_type): Likewise.\n\t* config/i386/i386.c (emit_memmov): Likewise.\n\t(ix86_expand_set_or_movmem): Likewise.\n\t(ix86_expand_vector_init): Likewise.\n\t(ix86_get_mask_mode): Likewise.\n\t* config/powerpcspe/powerpcspe.c (rs6000_expand_vec_perm_const_1):\n\tLikewise.\n\t* config/rs6000/rs6000.c (rs6000_expand_vec_perm_const_1): Likewise.\n\t* expmed.c (extract_bit_field_1): Likewise.\n\t* expr.c (expand_expr_real_2): Likewise.\n\t* optabs-query.c (can_vec_perm_p): Likewise.\n\t(can_vec_mask_load_store_p): Likewise.\n\t* optabs.c (expand_vec_perm): Likewise.\n\t* targhooks.c (default_get_mask_mode): Likewise.\n\t* tree-vect-stmts.c (vectorizable_store): Likewise.\n\t(vectorizable_load): Likewise.\n\t(get_vectype_for_scalar_type_and_size): Likewise.",
    "diff": "Index: gcc/machmode.h\n===================================================================\n--- gcc/machmode.h\t2017-09-04 12:18:53.153306182 +0100\n+++ gcc/machmode.h\t2017-09-04 12:18:55.821333642 +0100\n@@ -682,8 +682,6 @@ decimal_float_mode_for_size (unsigned in\n     (mode_for_size (size, MODE_DECIMAL_FLOAT, 0));\n }\n \n-/* Similar to mode_for_size, but find the smallest mode for a given width.  */\n-\n extern machine_mode smallest_mode_for_size (unsigned int, enum mode_class);\n \n /* Find the narrowest integer mode that contains at least SIZE bits.\n@@ -695,17 +693,9 @@ smallest_int_mode_for_size (unsigned int\n   return as_a <scalar_int_mode> (smallest_mode_for_size (size, MODE_INT));\n }\n \n-/* Return an integer mode of exactly the same size as the input mode.  */\n-\n extern opt_scalar_int_mode int_mode_for_mode (machine_mode);\n-\n extern machine_mode bitwise_mode_for_mode (machine_mode);\n-\n-/* Return a mode that is suitable for representing a vector,\n-   or BLKmode on failure.  */\n-\n-extern machine_mode mode_for_vector (scalar_mode, unsigned);\n-\n+extern opt_machine_mode mode_for_vector (scalar_mode, unsigned);\n extern opt_machine_mode mode_for_int_vector (unsigned int, unsigned int);\n \n /* Return the integer vector equivalent of MODE, if one exists.  In other\nIndex: gcc/stor-layout.c\n===================================================================\n--- gcc/stor-layout.c\t2017-09-04 12:18:53.153306182 +0100\n+++ gcc/stor-layout.c\t2017-09-04 12:18:55.824344959 +0100\n@@ -471,11 +471,11 @@ bitwise_type_for_mode (machine_mode mode\n   return inner_type;\n }\n \n-/* Find a mode that is suitable for representing a vector with\n-   NUNITS elements of mode INNERMODE.  Returns BLKmode if there\n-   is no suitable mode.  */\n+/* Find a mode that is suitable for representing a vector with NUNITS\n+   elements of mode INNERMODE, if one exists.  The returned mode can be\n+   either an integer mode or a vector mode.  */\n \n-machine_mode\n+opt_machine_mode\n mode_for_vector (scalar_mode innermode, unsigned nunits)\n {\n   machine_mode mode;\n@@ -499,22 +499,18 @@ mode_for_vector (scalar_mode innermode,\n   FOR_EACH_MODE_FROM (mode, mode)\n     if (GET_MODE_NUNITS (mode) == nunits\n \t&& GET_MODE_INNER (mode) == innermode)\n-      break;\n+      return mode;\n \n   /* For integers, try mapping it to a same-sized scalar mode.  */\n-  if (mode == VOIDmode\n-      && GET_MODE_CLASS (innermode) == MODE_INT)\n+  if (GET_MODE_CLASS (innermode) == MODE_INT)\n     {\n       unsigned int nbits = nunits * GET_MODE_BITSIZE (innermode);\n-      mode = int_mode_for_size (nbits, 0).else_blk ();\n+      if (int_mode_for_size (nbits, 0).exists (&mode)\n+\t  && have_regs_of_mode[mode])\n+\treturn mode;\n     }\n \n-  if (mode == VOIDmode\n-      || (GET_MODE_CLASS (mode) == MODE_INT\n-\t  && !have_regs_of_mode[mode]))\n-    return BLKmode;\n-\n-  return mode;\n+  return opt_machine_mode ();\n }\n \n /* Return the mode for a vector that has NUNITS integer elements of\n@@ -525,12 +521,10 @@ mode_for_vector (scalar_mode innermode,\n mode_for_int_vector (unsigned int int_bits, unsigned int nunits)\n {\n   scalar_int_mode int_mode;\n-  if (int_mode_for_size (int_bits, 0).exists (&int_mode))\n-    {\n-      machine_mode vec_mode = mode_for_vector (int_mode, nunits);\n-      if (vec_mode != BLKmode)\n-\treturn vec_mode;\n-    }\n+  machine_mode vec_mode;\n+  if (int_mode_for_size (int_bits, 0).exists (&int_mode)\n+      && mode_for_vector (int_mode, nunits).exists (&vec_mode))\n+    return vec_mode;\n   return opt_machine_mode ();\n }\n \n@@ -2264,7 +2258,7 @@ layout_type (tree type)\n \tif (TYPE_MODE (type) == VOIDmode)\n \t  SET_TYPE_MODE (type,\n \t\t\t mode_for_vector (SCALAR_TYPE_MODE (innertype),\n-\t\t\t\t\t  nunits));\n+\t\t\t\t\t  nunits).else_blk ());\n \n \tTYPE_SATURATING (type) = TYPE_SATURATING (TREE_TYPE (type));\n         TYPE_UNSIGNED (type) = TYPE_UNSIGNED (TREE_TYPE (type));\nIndex: gcc/config/i386/i386.c\n===================================================================\n--- gcc/config/i386/i386.c\t2017-09-04 12:18:44.903326171 +0100\n+++ gcc/config/i386/i386.c\t2017-09-04 12:18:55.808284598 +0100\n@@ -27420,9 +27420,8 @@ emit_memmov (rtx destmem, rtx *srcmem, r\n   if (GET_MODE_SIZE (move_mode) > GET_MODE_SIZE (word_mode))\n     {\n       int nunits = GET_MODE_SIZE (move_mode) / GET_MODE_SIZE (word_mode);\n-      move_mode = mode_for_vector (word_mode, nunits);\n-      code = optab_handler (mov_optab, move_mode);\n-      if (code == CODE_FOR_nothing)\n+      if (!mode_for_vector (word_mode, nunits).exists (&move_mode)\n+\t  || (code = optab_handler (mov_optab, move_mode)) == CODE_FOR_nothing)\n \t{\n \t  move_mode = word_mode;\n \t  piece_size = GET_MODE_SIZE (move_mode);\n@@ -28654,8 +28653,8 @@ ix86_expand_set_or_movmem (rtx dst, rtx\n       if (GET_MODE_SIZE (move_mode) > GET_MODE_SIZE (word_mode))\n \t{\n \t  int nunits = GET_MODE_SIZE (move_mode) / GET_MODE_SIZE (word_mode);\n-\t  move_mode = mode_for_vector (word_mode, nunits);\n-\t  if (optab_handler (mov_optab, move_mode) == CODE_FOR_nothing)\n+\t  if (!mode_for_vector (word_mode, nunits).exists (&move_mode)\n+\t      || optab_handler (mov_optab, move_mode) == CODE_FOR_nothing)\n \t    move_mode = word_mode;\n \t}\n       gcc_assert (optab_handler (mov_optab, move_mode) != CODE_FOR_nothing);\n@@ -44497,11 +44496,9 @@ ix86_expand_vector_init (bool mmx_ok, rt\n \t  rtx ops[2] = { XVECEXP (vals, 0, 0), XVECEXP (vals, 0, 1) };\n \t  if (inner_mode == QImode || inner_mode == HImode)\n \t    {\n-\t      mode = mode_for_vector (SImode,\n-\t\t\t\t      n_elts * GET_MODE_SIZE (inner_mode) / 4);\n-\t      inner_mode\n-\t\t= mode_for_vector (SImode,\n-\t\t\t\t   n_elts * GET_MODE_SIZE (inner_mode) / 8);\n+\t      unsigned int n_bits = n_elts * GET_MODE_SIZE (inner_mode);\n+\t      mode = mode_for_vector (SImode, n_bits / 4).require ();\n+\t      inner_mode = mode_for_vector (SImode, n_bits / 8).require ();\n \t      ops[0] = gen_lowpart (inner_mode, ops[0]);\n \t      ops[1] = gen_lowpart (inner_mode, ops[1]);\n \t      subtarget = gen_reg_rtx (mode);\n@@ -51619,7 +51616,7 @@ ix86_get_mask_mode (unsigned nunits, uns\n \n   gcc_assert (elem_size * nunits == vector_size);\n \n-  return mode_for_vector (elem_mode, nunits);\n+  return mode_for_vector (elem_mode, nunits).else_blk ();\n }\n \n \f\nIndex: gcc/config/powerpcspe/powerpcspe.c\n===================================================================\n--- gcc/config/powerpcspe/powerpcspe.c\t2017-09-04 12:18:53.148287319 +0100\n+++ gcc/config/powerpcspe/powerpcspe.c\t2017-09-04 12:18:55.812299689 +0100\n@@ -38679,7 +38679,7 @@ rs6000_expand_vec_perm_const_1 (rtx targ\n \n       vmode = GET_MODE (target);\n       gcc_assert (GET_MODE_NUNITS (vmode) == 2);\n-      dmode = mode_for_vector (GET_MODE_INNER (vmode), 4);\n+      dmode = mode_for_vector (GET_MODE_INNER (vmode), 4).require ();\n       x = gen_rtx_VEC_CONCAT (dmode, op0, op1);\n       v = gen_rtvec (2, GEN_INT (perm0), GEN_INT (perm1));\n       x = gen_rtx_VEC_SELECT (vmode, x, gen_rtx_PARALLEL (VOIDmode, v));\nIndex: gcc/config/rs6000/rs6000.c\n===================================================================\n--- gcc/config/rs6000/rs6000.c\t2017-09-04 12:18:53.151298637 +0100\n+++ gcc/config/rs6000/rs6000.c\t2017-09-04 12:18:55.815311006 +0100\n@@ -35525,7 +35525,7 @@ rs6000_expand_vec_perm_const_1 (rtx targ\n \n       vmode = GET_MODE (target);\n       gcc_assert (GET_MODE_NUNITS (vmode) == 2);\n-      dmode = mode_for_vector (GET_MODE_INNER (vmode), 4);\n+      dmode = mode_for_vector (GET_MODE_INNER (vmode), 4).require ();\n       x = gen_rtx_VEC_CONCAT (dmode, op0, op1);\n       v = gen_rtvec (2, GEN_INT (perm0), GEN_INT (perm1));\n       x = gen_rtx_VEC_SELECT (vmode, x, gen_rtx_PARALLEL (VOIDmode, v));\nIndex: gcc/expmed.c\n===================================================================\n--- gcc/expmed.c\t2017-09-04 12:18:50.673054653 +0100\n+++ gcc/expmed.c\t2017-09-04 12:18:55.817318551 +0100\n@@ -1578,10 +1578,11 @@ extract_bit_field_1 (rtx str_rtx, unsign\n       machine_mode new_mode = GET_MODE (op0);\n       if (GET_MODE_INNER (new_mode) != GET_MODE_INNER (tmode))\n \t{\n-\t  new_mode = mode_for_vector (GET_MODE_INNER (tmode),\n-\t\t\t\t      GET_MODE_BITSIZE (GET_MODE (op0))\n-\t\t\t\t      / GET_MODE_UNIT_BITSIZE (tmode));\n-\t  if (!VECTOR_MODE_P (new_mode)\n+\t  scalar_mode inner_mode = GET_MODE_INNER (tmode);\n+\t  unsigned int nunits = (GET_MODE_BITSIZE (GET_MODE (op0))\n+\t\t\t\t / GET_MODE_UNIT_BITSIZE (tmode));\n+\t  if (!mode_for_vector (inner_mode, nunits).exists (&new_mode)\n+\t      || !VECTOR_MODE_P (new_mode)\n \t      || GET_MODE_SIZE (new_mode) != GET_MODE_SIZE (GET_MODE (op0))\n \t      || GET_MODE_INNER (new_mode) != GET_MODE_INNER (tmode)\n \t      || !targetm.vector_mode_supported_p (new_mode))\nIndex: gcc/expr.c\n===================================================================\n--- gcc/expr.c\t2017-09-04 12:18:44.938520082 +0100\n+++ gcc/expr.c\t2017-09-04 12:18:55.820329869 +0100\n@@ -9445,7 +9445,7 @@ #define REDUCE_BIT_FIELD(expr)\t(reduce_b\n \t  tree sel_type = TREE_TYPE (treeop2);\n \t  machine_mode vmode\n \t    = mode_for_vector (SCALAR_TYPE_MODE (TREE_TYPE (sel_type)),\n-\t\t\t       TYPE_VECTOR_SUBPARTS (sel_type));\n+\t\t\t       TYPE_VECTOR_SUBPARTS (sel_type)).require ();\n \t  gcc_assert (GET_MODE_CLASS (vmode) == MODE_VECTOR_INT);\n \t  op2 = simplify_subreg (vmode, op2, TYPE_MODE (sel_type), 0);\n \t  gcc_assert (op2 && GET_CODE (op2) == CONST_VECTOR);\nIndex: gcc/optabs-query.c\n===================================================================\n--- gcc/optabs-query.c\t2017-08-30 12:20:31.700622400 +0100\n+++ gcc/optabs-query.c\t2017-09-04 12:18:55.821333642 +0100\n@@ -376,10 +376,9 @@ can_vec_perm_p (machine_mode mode, bool\n     return true;\n \n   /* We allow fallback to a QI vector mode, and adjust the mask.  */\n-  if (GET_MODE_INNER (mode) == QImode)\n-    return false;\n-  qimode = mode_for_vector (QImode, GET_MODE_SIZE (mode));\n-  if (!VECTOR_MODE_P (qimode))\n+  if (GET_MODE_INNER (mode) == QImode\n+      || !mode_for_vector (QImode, GET_MODE_SIZE (mode)).exists (&qimode)\n+      || !VECTOR_MODE_P (qimode))\n     return false;\n \n   /* ??? For completeness, we ought to check the QImode version of\n@@ -547,12 +546,14 @@ can_vec_mask_load_store_p (machine_mode\n       vector_sizes &= ~cur;\n       if (cur <= GET_MODE_SIZE (smode))\n \tcontinue;\n-      vmode = mode_for_vector (smode, cur / GET_MODE_SIZE (smode));\n-      mask_mode = targetm.vectorize.get_mask_mode (GET_MODE_NUNITS (vmode),\n-\t\t\t\t\t\t   cur);\n-      if (VECTOR_MODE_P (vmode)\n-\t  && convert_optab_handler (op, vmode, mask_mode) != CODE_FOR_nothing)\n-\treturn true;\n+      unsigned int nunits = cur / GET_MODE_SIZE (smode);\n+      if (mode_for_vector (smode, nunits).exists (&vmode)\n+\t  && VECTOR_MODE_P (vmode))\n+\t{\n+\t  mask_mode = targetm.vectorize.get_mask_mode (nunits, cur);\n+\t  if (convert_optab_handler (op, vmode, mask_mode) != CODE_FOR_nothing)\n+\t    return true;\n+\t}\n     }\n   return false;\n }\nIndex: gcc/optabs.c\n===================================================================\n--- gcc/optabs.c\t2017-09-04 11:48:08.609549644 +0100\n+++ gcc/optabs.c\t2017-09-04 12:18:55.823341187 +0100\n@@ -5434,13 +5434,10 @@ expand_vec_perm (machine_mode mode, rtx\n \n   /* Set QIMODE to a different vector mode with byte elements.\n      If no such mode, or if MODE already has byte elements, use VOIDmode.  */\n-  qimode = VOIDmode;\n-  if (GET_MODE_INNER (mode) != QImode)\n-    {\n-      qimode = mode_for_vector (QImode, w);\n-      if (!VECTOR_MODE_P (qimode))\n-\tqimode = VOIDmode;\n-    }\n+  if (GET_MODE_INNER (mode) == QImode\n+      || !mode_for_vector (QImode, w).exists (&qimode)\n+      || !VECTOR_MODE_P (qimode))\n+    qimode = VOIDmode;\n \n   /* If the input is a constant, expand it specially.  */\n   gcc_assert (GET_MODE_CLASS (GET_MODE (sel)) == MODE_VECTOR_INT);\nIndex: gcc/targhooks.c\n===================================================================\n--- gcc/targhooks.c\t2017-09-04 11:50:24.568774867 +0100\n+++ gcc/targhooks.c\t2017-09-04 12:18:55.825348732 +0100\n@@ -1210,8 +1210,8 @@ default_get_mask_mode (unsigned nunits,\n \n   gcc_assert (elem_size * nunits == vector_size);\n \n-  vector_mode = mode_for_vector (elem_mode, nunits);\n-  if (!VECTOR_MODE_P (vector_mode)\n+  if (!mode_for_vector (elem_mode, nunits).exists (&vector_mode)\n+      || !VECTOR_MODE_P (vector_mode)\n       || !targetm.vector_mode_supported_p (vector_mode))\n     vector_mode = BLKmode;\n \nIndex: gcc/tree-vect-stmts.c\n===================================================================\n--- gcc/tree-vect-stmts.c\t2017-08-31 07:32:43.676061469 +0100\n+++ gcc/tree-vect-stmts.c\t2017-09-04 12:18:55.828360049 +0100\n@@ -6032,8 +6032,9 @@ vectorizable_store (gimple *stmt, gimple\n \t      /* First check if vec_extract optab doesn't support extraction\n \t\t of vector elts directly.  */\n \t      scalar_mode elmode = SCALAR_TYPE_MODE (elem_type);\n-\t      machine_mode vmode = mode_for_vector (elmode, group_size);\n-\t      if (! VECTOR_MODE_P (vmode)\n+\t      machine_mode vmode;\n+\t      if (!mode_for_vector (elmode, group_size).exists (&vmode)\n+\t\t  || !VECTOR_MODE_P (vmode)\n \t\t  || (convert_optab_handler (vec_extract_optab,\n \t\t\t\t\t     TYPE_MODE (vectype), vmode)\n \t\t      == CODE_FOR_nothing))\n@@ -6046,11 +6047,12 @@ vectorizable_store (gimple *stmt, gimple\n \t\t  unsigned lsize\n \t\t    = group_size * GET_MODE_BITSIZE (elmode);\n \t\t  elmode = int_mode_for_size (lsize, 0).require ();\n-\t\t  vmode = mode_for_vector (elmode, nunits / group_size);\n \t\t  /* If we can't construct such a vector fall back to\n \t\t     element extracts from the original vector type and\n \t\t     element size stores.  */\n-\t\t  if (VECTOR_MODE_P (vmode)\n+\t\t  if (mode_for_vector (elmode,\n+\t\t\t\t       nunits / group_size).exists (&vmode)\n+\t\t      && VECTOR_MODE_P (vmode)\n \t\t      && (convert_optab_handler (vec_extract_optab,\n \t\t\t\t\t\t vmode, elmode)\n \t\t\t  != CODE_FOR_nothing))\n@@ -7070,8 +7072,9 @@ vectorizable_load (gimple *stmt, gimple_\n \t      /* First check if vec_init optab supports construction from\n \t\t vector elts directly.  */\n \t      scalar_mode elmode = SCALAR_TYPE_MODE (TREE_TYPE (vectype));\n-\t      machine_mode vmode = mode_for_vector (elmode, group_size);\n-\t      if (VECTOR_MODE_P (vmode)\n+\t      machine_mode vmode;\n+\t      if (mode_for_vector (elmode, group_size).exists (&vmode)\n+\t\t  && VECTOR_MODE_P (vmode)\n \t\t  && (convert_optab_handler (vec_init_optab,\n \t\t\t\t\t     TYPE_MODE (vectype), vmode)\n \t\t      != CODE_FOR_nothing))\n@@ -7092,10 +7095,11 @@ vectorizable_load (gimple *stmt, gimple_\n \t\t  unsigned lsize\n \t\t    = group_size * TYPE_PRECISION (TREE_TYPE (vectype));\n \t\t  elmode = int_mode_for_size (lsize, 0).require ();\n-\t\t  vmode = mode_for_vector (elmode, nunits / group_size);\n \t\t  /* If we can't construct such a vector fall back to\n \t\t     element loads of the original vector type.  */\n-\t\t  if (VECTOR_MODE_P (vmode)\n+\t\t  if (mode_for_vector (elmode,\n+\t\t\t\t       nunits / group_size).exists (&vmode)\n+\t\t      && VECTOR_MODE_P (vmode)\n \t\t      && (convert_optab_handler (vec_init_optab, vmode, elmode)\n \t\t\t  != CODE_FOR_nothing))\n \t\t    {\n@@ -9098,8 +9102,8 @@ get_vectype_for_scalar_type_and_size (tr\n      lookup a vector mode of the specified size.  */\n   if (size == 0)\n     simd_mode = targetm.vectorize.preferred_simd_mode (inner_mode);\n-  else\n-    simd_mode = mode_for_vector (inner_mode, size / nbytes);\n+  else if (!mode_for_vector (inner_mode, size / nbytes).exists (&simd_mode))\n+    return NULL_TREE;\n   nunits = GET_MODE_SIZE (simd_mode) / nbytes;\n   /* NOTE: nunits == 1 is allowed to support single element vector types.  */\n   if (nunits < 1)\n",
    "prefixes": [
        "6/9"
    ]
}