{"id":809607,"url":"http://patchwork.ozlabs.org/api/1.0/patches/809607/?format=json","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.0/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<87pob6iu26.fsf@linaro.org>","date":"2017-09-04T11:26:09","name":"[1/9] Make more use of int_mode_for_mode","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"0b45f61f920031dafa5db89fb3f2631cd0555bfd","submitter":{"id":5450,"url":"http://patchwork.ozlabs.org/api/1.0/people/5450/?format=json","name":"Richard Sandiford","email":"richard.sandiford@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/87pob6iu26.fsf@linaro.org/mbox/","series":[{"id":1357,"url":"http://patchwork.ozlabs.org/api/1.0/series/1357/?format=json","date":"2017-09-04T11:24:26","name":"Make more use of opt_mode","version":1,"mbox":"http://patchwork.ozlabs.org/series/1357/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809607/checks/","tags":{},"headers":{"Return-Path":"<gcc-patches-return-461403-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-461403-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=\"YTSDEV+w\"; 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 3xm6xM1kvMz9s4s\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon,  4 Sep 2017 21:26:31 +1000 (AEST)","(qmail 26040 invoked by alias); 4 Sep 2017 11:26:23 -0000","(qmail 26023 invoked by uid 89); 4 Sep 2017 11:26:23 -0000","from mail-wr0-f178.google.com (HELO mail-wr0-f178.google.com)\n\t(209.85.128.178) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tMon, 04 Sep 2017 11:26:18 +0000","by mail-wr0-f178.google.com with SMTP id j3so699836wrb.3 for\n\t<gcc-patches@gcc.gnu.org>; Mon, 04 Sep 2017 04:26:17 -0700 (PDT)","from localhost (94.197.120.41.threembb.co.uk. [94.197.120.41]) by\n\tsmtp.gmail.com with ESMTPSA id\n\tl4sm8972017wrb.70.2017.09.04.04.26.14 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:26:15 -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=ci9hr0Wf2FTbEsKsaz+2ftoyIG+qO\n\tU8+0J4/OLjKpVB1/2snTJFtipiydFulsDeQzLGDFDOP8mWcgD+cAyr1HExB6rli2\n\to0laESoK42QGmHodzj0HJ8vAJ17i/hGDC2mvTUkrdBspyeDUmqVPeGqvWdBklRfS\n\tY8jwRLtSIRNNmo=","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=LOISBu5WQTlWjXrCgBDLzsW1tng=; b=YTS\n\tDEV+wfcF5+YpxTWFNV+/uooNh5eucr9zy04YOUFpsRb1Ix++/88AKIUoz5J1a9EU\n\tTkvtRXrj1aPK/c97bLY/CnU0Aw5a1IwV8f+vMROmsngIVjTG6huDmXt3aJ6OZ74S\n\txZX2AtPszDNoN1sZfeKKq6LNhS6WgQ9piLth9QtU=","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=45037","X-HELO":"mail-wr0-f178.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=nUz5+85GK+K4aloh2gHtEKKcgEezsiNyuikiqpJclrM=;\n\tb=e3AlLxAc29NUk7oPIKyBzVOdQTYPzqQb7PraoxVQOy8bwJsgm3ZoJVEdDeGQ1eJ69S\n\tn69OI2JFKe/tJrZqh4JLV2fhNio+VUxHw33O8s5MZqTdsztCzXK/HqQMxGXEqS9DLLCc\n\tlKzwP5rXFX7dE02ipL/+SsuTuBNGOC7ZiPqxvgLDVnRLme3I2xvUZifvsV39+orM2s/v\n\t2bywhYTkUAKGZJwvYq81UDzjXBQnkre7FXj6UhAkG4yw2AZAgKRGA2ela1xJ9NcLdgKS\n\tt7lSAO7S5ehBTdusI3/PmknfhImFIBEXa1mfvZ6l7vZWAe+ID/q9ENtNmXyZJIqwczrA\n\tmYoA==","X-Gm-Message-State":"AHPjjUhzjVrYjp9SZXj+Dcs8MWVHAh4fsLrDU1LGGW2naMnZzSZvE4X7\t0t0lkkvrvy3VesMeU+fsLQ==","X-Google-Smtp-Source":"ADKCNb7HR2Ui4Z0HGGltsOIEYcWpTs3ccOhXwzm8uAOVnV0bEZ8fnCmS0ffvVk7bUOAJbnJUwbtlzw==","X-Received":"by 10.223.151.198 with SMTP id t6mr91808wrb.89.1504524375879;\n\tMon, 04 Sep 2017 04:26:15 -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":"[1/9] Make more use of int_mode_for_mode","References":"<87tw0iiu51.fsf@linaro.org>","Date":"Mon, 04 Sep 2017 12:26:09 +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":"<87pob6iu26.fsf@linaro.org>","User-Agent":"Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)","MIME-Version":"1.0","Content-Type":"text/plain"},"content":"This patch converts more places that could use int_mode_for_mode\ninstead of mode_for_size.  This is in preparation for an upcoming\npatch that makes mode_for_size itself return an opt_mode.\n\nThe reason for using required () in exp2_immediate_p is that\nwe go on to do:\n\n    trunc_int_for_mode (..., int_mode)\n\nwhich would be invalid for (and have failed for) BLKmode.\n\nThe reason for using required () in spu_convert_move and\nresolve_simple_move is that we go on to use registers of\nthe returned mode in non-call rtl instructions, which would\nbe invalid for BLKmode.\n\n2017-09-04  Richard Sandiford  <richard.sandiford@linaro.org>\n\ngcc/\n\t* config/spu/spu.c (exp2_immediate_p): Use int_mode_for_mode.\n\t(spu_convert_move): Likewise.\n\t* lower-subreg.c (resolve_simple_move): Likewise.","diff":"Index: gcc/config/spu/spu.c\n===================================================================\n--- gcc/config/spu/spu.c\t2017-09-04 11:50:24.563372530 +0100\n+++ gcc/config/spu/spu.c\t2017-09-04 12:18:41.572976650 +0100\n@@ -3372,7 +3372,7 @@ arith_immediate_p (rtx op, machine_mode\n   constant_to_array (mode, op, arr);\n \n   bytes = GET_MODE_UNIT_SIZE (mode);\n-  mode = mode_for_size (GET_MODE_UNIT_BITSIZE (mode), MODE_INT, 0);\n+  mode = int_mode_for_mode (GET_MODE_INNER (mode)).require ();\n \n   /* Check that bytes are repeated. */\n   for (i = bytes; i < 16; i += bytes)\n@@ -3415,7 +3415,7 @@ exp2_immediate_p (rtx op, machine_mode m\n   mode = GET_MODE_INNER (mode);\n \n   bytes = GET_MODE_SIZE (mode);\n-  int_mode = mode_for_size (GET_MODE_BITSIZE (mode), MODE_INT, 0);\n+  int_mode = int_mode_for_mode (mode).require ();\n \n   /* Check that bytes are repeated. */\n   for (i = bytes; i < 16; i += bytes)\n@@ -4503,7 +4503,7 @@ spu_expand_mov (rtx * ops, machine_mode\n spu_convert_move (rtx dst, rtx src)\n {\n   machine_mode mode = GET_MODE (dst);\n-  machine_mode int_mode = mode_for_size (GET_MODE_BITSIZE (mode), MODE_INT, 0);\n+  machine_mode int_mode = int_mode_for_mode (mode).require ();\n   rtx reg;\n   gcc_assert (GET_MODE (src) == TImode);\n   reg = int_mode != mode ? gen_reg_rtx (int_mode) : dst;\nIndex: gcc/lower-subreg.c\n===================================================================\n--- gcc/lower-subreg.c\t2017-09-04 11:50:08.544543511 +0100\n+++ gcc/lower-subreg.c\t2017-09-04 12:18:41.572976650 +0100\n@@ -956,11 +956,7 @@ resolve_simple_move (rtx set, rtx_insn *\n       if (real_dest == NULL_RTX)\n \treal_dest = dest;\n       if (!SCALAR_INT_MODE_P (dest_mode))\n-\t{\n-\t  dest_mode = mode_for_size (GET_MODE_SIZE (dest_mode) * BITS_PER_UNIT,\n-\t\t\t\t     MODE_INT, 0);\n-\t  gcc_assert (dest_mode != BLKmode);\n-\t}\n+\tdest_mode = int_mode_for_mode (dest_mode).require ();\n       dest = gen_reg_rtx (dest_mode);\n       if (REG_P (real_dest))\n \tREG_ATTRS (dest) = REG_ATTRS (real_dest);\n","prefixes":["1/9"]}