From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by sourceware.org (Postfix) with ESMTPS id A26583858CDA for ; Mon, 18 Jul 2022 06:07:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A26583858CDA Received: by mail-qk1-x735.google.com with SMTP id l3so5889033qkl.3 for ; Sun, 17 Jul 2022 23:07:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GBIrT3rNz2CttEGlnfqrPJjpU4BJOL7BjNVxm0cYw3c=; b=529+Y7BX8qyVBdVR8W8DmeW75CZph/6P7se580ugbIeEHDtdNpoPWsIJ49onwltZju 0PA+88WHHmnGSYgwb2pyKoE+KYQ8OgN2rlwLSF8H7IpROX6J6RrNmwOTC94juRhorVlU Fcc4lvWS6xLeW+WEf6pswtbfMiuTidjvy05bp8yUXjSK0XNFNBLukVXPPaXXvlnEDXnQ 9BWx6UUeLKRH/jySF7Yi8xxhrzfSRcLNNtaMXBFKiXyOwsT6PM8JZh4b2ODC8G1fWT0K 3JFcSkls2FEPjVKSQ/Z5tBOr34G7xDT0x4iJF6nZp07BjsDsPBMyVHd/ZVSoXFfZft0/ gcFw== X-Gm-Message-State: AJIora+cPLOR6PmtJu0VzSheFciTK649ggYzlvZSZwU1dGv4o/U3ijrj KYGedvDyY3jIiLC49k1VjuBOvVXctRDH6rcjzM2PEAK0/9w= X-Google-Smtp-Source: AGRyM1umKMKPqFdFyYxHN0QfSpMIXBzcbfiArDZUIWV+tuybBFWb+ieIfNvJlwd1VHggY3YaMxiWXUVHri4BqwjMPyA= X-Received: by 2002:a05:620a:2587:b0:6a7:ee6f:bf2a with SMTP id x7-20020a05620a258700b006a7ee6fbf2amr16656064qko.542.1658124448852; Sun, 17 Jul 2022 23:07:28 -0700 (PDT) MIME-Version: 1.0 References: <008201d8990c$8ce7ac00$a6b70400$@nextmovesoftware.com> In-Reply-To: <008201d8990c$8ce7ac00$a6b70400$@nextmovesoftware.com> From: Uros Bizjak Date: Mon, 18 Jul 2022 08:07:18 +0200 Message-ID: Subject: Re: [x86 PATCH] Fix issue with x86_64_const_vector_operand predicate. To: Roger Sayle Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jul 2022 06:07:31 -0000 On Sat, Jul 16, 2022 at 2:06 PM Roger Sayle wrote: > > > This patch fixes (what I believe is) a latent bug in i386.md's > x86_64_const_vector_operand define_predicate. According to the > documentation, when a predicate is called with rtx operand OP and > machine_mode operand MODE, we can't shouldn't assume that the > MODE is (or has been checked to be) GET_MODE (OP). > > The failure mode is that recog can call x86_64_const_vector_operand > on an arbitrary CONST_VECTOR passing a MODE of V2QI_mode, but when > the CONST_VECTOR is in fact V1TImode, it's unsafe to directly call > ix86_convert_const_vector_to_integer, which assumes that the CONST_VECTOR > contains CONST_INTs when it actually contains CONST_WIDE_INTs. The > checks in this define_predicate need to be testing OP's mode, and > ideally confirming that this matches the passed in/specified MODE. > > This bug is currently latent, but adding an innocent/unrelated > define_insn, such as "(set (reg:CCC FLAGS_REG) (const_int 0))" to > i386.md can occasionally change the order in which genrecog generates > its tests, then ICEing during bootstrap due to V1TI CONST_VECTORs. > > > This patch has been tested on x86_64-pc-linux-gnu with make bootstrap > and make -k check, both with and without --target-board=unix{-m32}, > with no new failures. Ok for mainline? > > 2022-07-16 Roger Sayle > > gcc/ChangeLog > * config/i386/predicates.md (x86_64_const_vector_operand): > Check the operand's mode matches the specified mode argument. OK. Thanks, Uros. > > > Thanks in advance, > Roger > -- >