From patchwork Wed Jun 7 16:51:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 104628 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp339127vqr; Wed, 7 Jun 2023 09:52:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7KOrJTNrP5/3W0JuoSBKVNCLFUpL2Lgc45nVS80jLrJR6tLDXpiuDNanawCh7gnppWBZ28 X-Received: by 2002:a17:907:3dab:b0:971:5a79:29ff with SMTP id he43-20020a1709073dab00b009715a7929ffmr5692024ejc.48.1686156726356; Wed, 07 Jun 2023 09:52:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686156726; cv=none; d=google.com; s=arc-20160816; b=yeJRZ/GhmMtkBvDWKiGT7JWON5SsD4XMqmhJcz36e0T3o8xDrQgls57hx6SicSd90r ATAqIuFJ/xuFxMlThfWR+n1iflyYAE+kuJNdLWhTluswuIxZ6ddVjhpshLgJXk6zBrNL YQzZLlJ9xBDO1I0sNuwP8eyC3Inp3bi6SeUROkK2+ys8rV6AgG/EF88qLF82hAlfVHsb RwrdHAUZoxmOTEALkshxDRhfDqDjGwNUun4rxpY/JHb5D3AoQuNYIk4phLg/5b0MIX5b R5bLL3gOpen9CQ7ArOYtrzLKWfNBHqFI8SKjqZuDPpFZmvcqijIWxgVTWORLBaRRKK/H WPbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:cc:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=v45GkYddTl4TWwlXe1/GE8GsQt1so5bY+rW8dJ4G4OI=; b=KwTdxAREWec82ZozqShC81rkY6nFwP2GetTP8FDtoYZIJjAN04rNiswD/0jk6sLvPv NIlnip/u3Ay5L1/dAmr6uNpVbhRt361MJ4cEjKiqiU1lj2YSd4krFqeTTZYxeIvX4Ovp P+JQq47lqdE1/Zm1Q7LVL7sezsmEVM4O+FWFh3ub8NCTLkw5iUo+YPMXANp0LFRvDGGv 2tYxXwXlJfy8BYuZWnOhHxqGqXv7WwYUUQsSy6VmTWHgIcrSyWjjLJE5SyMWOlr39pH6 IBjYzPj2e51bsBfLWLEWaHqwF5REI6Ta44jbLwclyPOdck4aYMoZvMeoS/doOIH286RH 39/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=qv3OHFcc; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g13-20020a1709067c4d00b0096b4c03e010si8412709ejp.1032.2023.06.07.09.52.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 09:52:06 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=qv3OHFcc; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 39375385771F for ; Wed, 7 Jun 2023 16:52:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 39375385771F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686156725; bh=v45GkYddTl4TWwlXe1/GE8GsQt1so5bY+rW8dJ4G4OI=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=qv3OHFcc2GqOrWfz8OtZmMninf8AmewEQeE9DLbXJieg1Kn5m6UB/zpyojWXfHNpG ncrUMUWzNJwYOsgBWJaJ6Cs8xHb9tv1UPPy7OpYiN97A96/jx8KsnBNFk4koJUJ5uY jKrWISC6iBktCVJpLQK23jCl3PoVLE+sx6YtgNB4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id E32953858288 for ; Wed, 7 Jun 2023 16:51:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E32953858288 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-313-wreN9zy5OOGiHeltrkoJuQ-1; Wed, 07 Jun 2023 12:51:18 -0400 X-MC-Unique: wreN9zy5OOGiHeltrkoJuQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7CF08801182; Wed, 7 Jun 2023 16:51:18 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4046B492B00; Wed, 7 Jun 2023 16:51:18 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 357GpFrt3600225 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 7 Jun 2023 18:51:16 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 357GpEPx3600223; Wed, 7 Jun 2023 18:51:14 +0200 Date: Wed, 7 Jun 2023 18:51:14 +0200 To: Uros Bizjak , Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] i386: Fix endless recursion in ix86_expand_vector_init_general with MMX [PR110152] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768063475526256537?= X-GMAIL-MSGID: =?utf-8?q?1768063475526256537?= Hi! I'm getting +FAIL: gcc.target/i386/3dnow-1.c (internal compiler error: Segmentation fault signal terminated program cc1) +FAIL: gcc.target/i386/3dnow-1.c (test for excess errors) +FAIL: gcc.target/i386/3dnow-2.c (internal compiler error: Segmentation fault signal terminated program cc1) +FAIL: gcc.target/i386/3dnow-2.c (test for excess errors) +FAIL: gcc.target/i386/mmx-1.c (internal compiler error: Segmentation fault signal terminated program cc1) +FAIL: gcc.target/i386/mmx-1.c (test for excess errors) +FAIL: gcc.target/i386/mmx-2.c (internal compiler error: Segmentation fault signal terminated program cc1) +FAIL: gcc.target/i386/mmx-2.c (test for excess errors) regressions on i686-linux since r14-1166. The problem is when ix86_expand_vector_init_general is called with mmx_ok = true and mode = V4HImode, it newly recurses with mmx_ok = false and mode = V2SImode, but as mmx_ok is false and !TARGET_SSE, we recurse again with the same arguments (ok, fresh new tmp and vals) infinitely. The following patch fixes that by passing mmx_ok to that recursive call. For n_words == 4 it isn't needed, because we only care about mmx_ok for V2SImode or V2SFmode and no other modes. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2023-06-07 Jakub Jelinek PR target/110152 * config/i386/i386-expand.cc (ix86_expand_vector_init_general): For n_words == 2 recurse with mmx_ok as first argument rather than false. Jakub --- gcc/config/i386/i386-expand.cc.jj 2023-06-03 15:32:04.489410367 +0200 +++ gcc/config/i386/i386-expand.cc 2023-06-07 10:31:34.715981752 +0200 @@ -16371,7 +16371,7 @@ quarter: machine_mode concat_mode = tmp_mode == DImode ? V2DImode : V2SImode; rtx tmp = gen_reg_rtx (concat_mode); vals = gen_rtx_PARALLEL (concat_mode, gen_rtvec_v (2, words)); - ix86_expand_vector_init_general (false, concat_mode, tmp, vals); + ix86_expand_vector_init_general (mmx_ok, concat_mode, tmp, vals); emit_move_insn (target, gen_lowpart (mode, tmp)); } else if (n_words == 4)