From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x92f.google.com (mail-ua1-x92f.google.com [IPv6:2607:f8b0:4864:20::92f]) by sourceware.org (Postfix) with ESMTPS id 5E81A3947426 for ; Thu, 14 Jan 2021 11:13:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5E81A3947426 Received: by mail-ua1-x92f.google.com with SMTP id 17so1654958uaq.4 for ; Thu, 14 Jan 2021 03:13:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kfkSW0OLtnuB586GLC74MybxypvXDSnUgC5CDCL0ktk=; b=WOYHWQCl4g3HEBuH8qOTc4mxlA7iCazk0+I61Wnx5rzYhDCQkUyNMisRRoiHt3TZbX BIrD+UGTfSnxD+6OBjyVI/g6+J63AyyVofH9rjO+wnScX2IcCjiNAVIxQiAy6O5czc1V 8dEU+xoDGFZepXo5zOgzjaCSUM0YGG5vfjabEI5fwPq+7VHR68cVpqArnc4f+czFefBa vmCLpZCse6P5vX9vbFXUySDKsj3fPyXsNO10XQlRQDWfXklizuDZk0IpO0H6EvubPWKe oP1A/YPrBpjN9Vpnwo5WSYCtbCdcUBRiD8JYQhaySDrBt9nunJOGWeFLzvzs1M6zBudy LJGA== X-Gm-Message-State: AOAM532pyyE52nXkR5Tgrkgc10ZDGyBZZ1BvxfgdWcDR7FNdtGuELdGA zsBRgD+9Xrltt0NSHcY8EjLJQlGGu5IogfaYa2k= X-Google-Smtp-Source: ABdhPJxEQiWoBEAt8egKEZFAoXJ36LfyBD8AtGCJFb5zTEJQ3qeKtooaHLZ+6/RdqPZjyXPF1u8EOfrJFBhGqB5qQ4s= X-Received: by 2002:ab0:127:: with SMTP id 36mr5244071uak.118.1610622835976; Thu, 14 Jan 2021 03:13:55 -0800 (PST) MIME-Version: 1.0 References: <20210106143931.GC725145@tucnak> In-Reply-To: From: Hongtao Liu Date: Thu, 14 Jan 2021 19:16:41 +0800 Message-ID: Subject: Re: [PATCH] [AVX512] Fix ICE: Convert integer mask to vector in ix86_expand_fp_vec_cmp/ix86_expand_int_vec_cmp [PR98537] To: Jakub Jelinek Cc: GCC Patches , Kirill Yukhin , "H. J. Lu" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-4.5 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Thu, 14 Jan 2021 11:13:57 -0000 ping. On Thu, Jan 7, 2021 at 1:22 PM Hongtao Liu wrote: > > On Wed, Jan 6, 2021 at 10:39 PM Jakub Jelinek wrote: > > > > On Wed, Jan 06, 2021 at 02:49:13PM +0800, Hongtao Liu wrote: > > > ix86_expand_fp_vec_cmp/ix86_expand_int_vec_cmp are used by vec_cmpmn > > > for vector comparison to vector mask, but ix86_expand_sse_cmp(which is > > > called in upper 2 functions.) may return integer mask whenever integer > > > mask is available, so convert integer mask back to vector mask if > > > needed. > > > > > > gcc/ChangeLog: > > > > > > PR target/98537 > > > * config/i386/i386-expand.c (ix86_expand_fp_vec_cmp): > > > When cmp is integer mask, convert it to vector. > > > (ix86_expand_int_vec_cmp): Ditto. > > > > > > gcc/testsuite/ChangeLog: > > > > > > PR target/98537 > > > * g++.target/i386/avx512bw-pr98537-1.C: New test. > > > * g++.target/i386/avx512vl-pr98537-1.C: New test. > > > * g++.target/i386/avx512vl-pr98537-2.C: New test. > > > > Do we optimize it then to an AVX/AVX2 comparison if possible? > > > When i'm looking at the code, i find there's other places which > require comparison dest to be vector(i.e. ix86_expand_sse_unpack, > ix86_expand_mul_widen_evenodd). It's a potential bug. > So I fix this bug in another way which won't generate an integer mask > when the comparison dest is required to a vector mask. > > Update patch: > ix86_expand_sse_cmp/ix86_expand_int_sse_cmp is used for vector > comparison, considering that avx512 introduces integer mask, but some > original callers require the dest of comparison to be a vector. > So add a new parameter vector_mask_p to control the result > of vector comparison to be vector or not. > regtested/bootstrapped on x86_64-linux-gnu{-m32,}. > > gcc/ChangeLog: > > PR target/98537 > * config/i386/i386-expand.c (ix86_expand_sse_cmp): Add a new > parameter vector_mask_p to control whether the comparison > result should be a vector or not. > (ix86_expand_int_sse_cmp): Ditto. > (ix86_expand_sse_movcc): cmpmode should be MODE_INT. > (ix86_expand_fp_movcc): Allow vector comparison dest as > integer mask. > (ix86_expand_fp_vcond): Ditto. > (ix86_expand_int_vcond): Ditto. > (ix86_expand_fp_vec_cmp): Require vector comparison dest as > vector. > (ix86_expand_int_vec_cmp): Ditto. > (ix86_expand_sse_unpack): Ditto. > (ix86_expand_mul_widen_evenodd): Ditto. > > gcc/testsuite/ChangeLog: > > PR target/98537 > * g++.target/i386/avx512bw-pr98537-1.C: New test. > * g++.target/i386/avx512vl-pr98537-1.C: New test. > * g++.target/i386/avx512vl-pr98537-2.C: New test. > > > > @@ -4024,8 +4025,18 @@ ix86_expand_fp_vec_cmp (rtx operands[]) > > cmp = ix86_expand_sse_cmp (operands[0], code, operands[2], operands[3], > > operands[1], operands[2]); > > > > - if (operands[0] != cmp) > > - emit_move_insn (operands[0], cmp); > > + if (operands[0] != cmp) > > + { > > > > The indentation of the if above looks wrong. > > Otherwise LGTM. > > > > Jakub > > > > > -- > BR, > Hongtao -- BR, Hongtao