From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc34.google.com (mail-oo1-xc34.google.com [IPv6:2607:f8b0:4864:20::c34]) by sourceware.org (Postfix) with ESMTPS id AE8FA3858CDB for ; Sat, 30 Dec 2023 03:13:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE8FA3858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AE8FA3858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::c34 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703906026; cv=none; b=GS9XKB/j0pqiqR1cVYqgL+x/eAY+tbhsiKwsphDZOkZ2o7zYj2puGCjdrF4Zch411WUilsVt6wJSumW5XK6kWKXlumTcjIqf5ux+5rKsYRxN1GHnkU/yykvGnrflM5fELXvd0oQdUUoIJ+GzuIos0ifoyy1aicTzqNlE1dCB3YM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703906026; c=relaxed/simple; bh=T7Te1+LEkod2uhvBKV0wOw8ZkxFSLa1AGYOAS3iw9js=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=A9SC3mNPbW85pa0CgDntMJF4xalALzmO7+syzctxBLb65+tYGLHnaD5Z7DEROCeQua0b+zFmPhl4D37YasYT/kLpcDPdqX+RL2sL9fK0N4X30nZHqv1KYOHhaZp4/HQrtxOMz7HTF6tmdtRQnj9QpCkkGNyb3O1p3opdKHvcsps= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-58a7d13b00bso4289893eaf.1 for ; Fri, 29 Dec 2023 19:13:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703906023; x=1704510823; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=7T3oRJDokppaiXfz3OqxmILAEXGa6HJ6wNu6ynGJVHE=; b=JJyXA+1Opfe5aqnsUTOb2hiwjsouiSMzeqnyckQk+J2YPh5GJmnrYW4/RE3jiE6jlv ygX8GK3RatvFOUnUC0wTTCWdgL28LehiXeZ1G0Oyst6Ow1LQ+6a2zjCUXQXkEARpvpQz oGl7dNsWImcz4On92EF1ptnQvetB7fv9ChU+CpGN10dUX2P9HiPBkYR8o3tSy33oeEBi HRo+xFvZ9FoZypQCT1ZpdZhgzA/lHr8FRHfk58wBzmHzHGxoKlU4bdZ9MTCWSa/+QMsq Q07GnLsVLh4tPK3bYLJdr+6PYUCUI670vP9ZmDZXw/sRDf2w2etHM8/eE4e9Al8tx9f2 VcUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703906023; x=1704510823; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7T3oRJDokppaiXfz3OqxmILAEXGa6HJ6wNu6ynGJVHE=; b=lNUTM7lAempxS8IM0bucx7qpLNy3/PpXsDrwSBmNUe9Wu4nir60hyhDMKNl5ZurKSU orNY7PoDH3ZR75cOAClF0fJ8DAbwsrJpiJlm9cEtixIoRdw6FPSFNKvHf45Xe4uCYTXT NauKHimYRXcqueAuqTcCHARvSvOysXYcBCW0TdVTc8X5hj0Gu2AnjwOozABVexYw7/yq yGQjj1MQCXM2Vei4gMWXYdvWQL7fLgyZhE2RzqW4oVllXdAWZID0xUQ/we+YvEJrCXoK xYFIkIBgr/1ypdvCJhgLYt1sqy2HMMDuD3bzxMJ3r1FeF4GPjcMw7eXt0UjAHliUxOm1 eJAg== X-Gm-Message-State: AOJu0YwaHAMtRVfSsy2D/FUCZU5zGQxbjZXq7v4dYQtFCJfT9irh72GS 2DVd8LR6inGLfjZfcIurV5g= X-Google-Smtp-Source: AGHT+IFPEAcnozYy7/97EAVYmFaj5mHrVGWjGfZt+eE8xiJSbqX0g7yO07dgPDs/dOwocflEyVH63A== X-Received: by 2002:a05:6359:1a46:b0:170:b476:d962 with SMTP id ru6-20020a0563591a4600b00170b476d962mr11052078rwb.20.1703906022727; Fri, 29 Dec 2023 19:13:42 -0800 (PST) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id mj20-20020a17090b369400b0028ca92ab09asm3119859pjb.56.2023.12.29.19.13.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Dec 2023 19:13:42 -0800 (PST) Message-ID: <3083f796-ea26-497d-8ae7-fbb18643ce1b@gmail.com> Date: Fri, 29 Dec 2023 20:13:37 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] RISC-V: XFAIL pr30957-1.c when loop vectorized with variable factor Content-Language: en-US To: "Li, Pan2" , "gcc-patches@gcc.gnu.org" Cc: "juzhe.zhong@rivai.ai" , "Wang, Yanzhang" , "kito.cheng@gmail.com" , "richard.guenther@gmail.com" References: <20231223110733.2565292-1-pan2.li@intel.com> <20231226093445.1860961-1-pan2.li@intel.com> <782f6b96-d60e-48ef-9f7f-931b9480dcb2@gmail.com> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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,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 List-Id: On 12/28/23 22:56, Li, Pan2 wrote: > Thanks Jeff. > > I think I locate where aarch64 performs the trick here. > > 1. In the .final we have rtl like > > (insn:TI 6 8 29 (set (reg:SF 32 v0) > (const_double:SF -0.0 [-0x0.0p+0])) "/home/box/panli/gnu-toolchain/gcc/gcc/testsuite/gcc.dg/pr30957-1.c":31:7 79 {*movsf_aarch64} > (nil)) > > 2. the movsf_aarch64 comes from the aarch64.md file similar to the below rtl. Aka, it will generate movi\t%0.2s, #0 if > the aarch64_reg_or_fp_zero is true. > > 1640 (define_insn "*mov_aarch64" > 1641 [(set (match_operand:SFD 0 "nonimmediate_operand") > 1642 match_operand:SFD 1 "general_operand"))] > 1643 "TARGET_FLOAT && (register_operand (operands[0], mode) > 1644 || aarch64_reg_or_fp_zero (operands[1], mode))" > 1645 {@ [ cons: =0 , 1 ; attrs: type , arch ] > 1646 [ w , Y ; neon_move , simd ] movi\t%0.2s, #0 > > 3. Then we will have aarch64_float_const_zero_rtx_p here, and the -0.0 input rtl will return true in line 10873 because of no-signed-zero is given. > > 10863 bool > 10864 aarch64_float_const_zero_rtx_p (rtx x > 10865 { > 10866 /* 0.0 in Decimal Floating Point cannot be represented by #0 or > 10867 zr as our callers expect, so no need to check the actual > 10868 value if X is of Decimal Floating Point type. */ > 10869 if (GET_MODE_CLASS (GET_MODE (x)) == MODE_DECIMAL_FLOAT) > 10870 return false; > 10871 > 10872 if (REAL_VALUE_MINUS_ZERO (*CONST_DOUBLE_REAL_VALUE (x))) > 10873 return !HONOR_SIGNED_ZEROS (GET_MODE (x)); > 10874 return real_equal (CONST_DOUBLE_REAL_VALUE (x), &dconst0); > 10875 } > > I think that explain why we have +0.0 in aarch64 here. Yup. Thanks a ton for diving into this. So I think that points us to the right fix, specifically we should be turning -0.0 into 0.0 when !HONOR_SIGNED_ZEROS rather than xfailing the test. I think we'd need to adjust reg_or_0_operand and riscv_output_move, probably the G constraint as well. We might also need to adjust move_operand and perhaps riscv_legitimize_move. jeff