From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id C55F33858439 for ; Tue, 16 May 2023 03:59:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C55F33858439 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-643990c5319so9857696b3a.2 for ; Mon, 15 May 2023 20:59:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684209586; x=1686801586; 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=C4vz7QPQyV7T99id+GnvAyiSLwUxniL6Mau+qThXVrw=; b=n+jVN6fHNsiXDDVVCg4kygAlQBPHlRD2LoMMRXw1u0ltTyOvs8bca2LpRnMtV8cSW4 FLYcEo4urnCAXVCMcnQd5RXvoYIvmycSFQwmXlGDpwY3DUnPG2Dzp+0pZX4sxbvmnO6F V+RT3z6AK2LLHRgEMf0GAdcsDKyh/COLukwwDKjF9jvGLRnFuaYDw8/5Hhbi2xNqdFrT N3UGDRngTYvs8y+lFagIjRZ8Dys88FeeWAwpsVkXmMe4enhRVIrc+rHW76b7HljsMAAD Qe6rd7dcPac1KeRHV5TQ+zWlTAnBR+PoZQvHNS8vdkVsOUvswN1DDHjjrsVw1oL4kiIM AiHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684209586; x=1686801586; 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=C4vz7QPQyV7T99id+GnvAyiSLwUxniL6Mau+qThXVrw=; b=HiDd7+1+5CbvKK31I6nGc4yo3pfYx5xV4r8/UxJT0DRwGUqPitEvv5BthpvVTAzdYO fmF5ley0hP3arFeL7bs9Amx0Yy9TtklT/nbfSL/C1C6G6NMWVahBXwQKH8Zwv9BYm2T0 Me/Urp7VzGIGgB7SuzBxon8tTuetFRQSGIh06+KDsG0NcJqCSi0YWnVcir+SMPMRqnjT XqLbGPX4UZmeGcXQWgw6DIQQdHxxiVbPq48DdxxbTuOErtfi6YA6Mw6cvIvWWYOBJrwk z4T8kMouESa13k5l1/dJsUmSXJ87eHhFIaA6mdmyEMrNF5/2KLRUDfXlsUYijhWy3ZaV RoFQ== X-Gm-Message-State: AC+VfDx4buPTGvMoUjas8tXzNvidkQP5NTO86lyo8XWrg9Geyp5ozvwy rpuvV6z1h1TnOk2mkVPVuZI= X-Google-Smtp-Source: ACHHUZ44JNNB29gyp106oJMQGjK0KnHBMryN6834obX1/sgJqyE6uRepTwjEWEcAOMmmXae1EyKMzw== X-Received: by 2002:a05:6a00:2d09:b0:63b:5c82:e209 with SMTP id fa9-20020a056a002d0900b0063b5c82e209mr51075070pfb.10.1684209585657; Mon, 15 May 2023 20:59:45 -0700 (PDT) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id q12-20020a63cc4c000000b0051eff0a70d7sm12351985pgi.94.2023.05.15.20.59.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 May 2023 20:59:45 -0700 (PDT) Message-ID: <5df70b7d-06fb-f0ba-10f6-bf88a5c06b73@gmail.com> Date: Mon, 15 May 2023 21:59:43 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH v8] RISC-V: Add the 'zfa' extension, version 0.2. Content-Language: en-US To: jinma , gcc-patches Cc: "kito.cheng" , "kito.cheng" , palmer References: <20230419095751.815-1-jinma@linux.alibaba.com> <20230506075440.1078-1-jinma@linux.alibaba.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=-10.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,NICE_REPLY_A,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 5/6/23 06:53, jinma wrote: >>>> diff --git a/gcc/config/riscv/iterators.md b/gcc/config/riscv/iterators.md >>>> index 9b767038452..c81b08e3cc5 100644 >>>> --- a/gcc/config/riscv/iterators.md >>>> +++ b/gcc/config/riscv/iterators.md >>>> @@ -288,3 +288,8 @@ (define_int_iterator QUIET_COMPARISON [UNSPEC_FLT_QUIET UNSPEC_FLE_QUIET]) >>>> (define_int_attr quiet_pattern [(UNSPEC_FLT_QUIET "lt") (UNSPEC_FLE_QUIET "le")]) >>>> (define_int_attr QUIET_PATTERN [(UNSPEC_FLT_QUIET "LT") (UNSPEC_FLE_QUIET "LE")]) >>>> >>>> +(define_int_iterator ROUND [UNSPEC_ROUND UNSPEC_FLOOR UNSPEC_CEIL UNSPEC_BTRUNC UNSPEC_ROUNDEVEN UNSPEC_NEARBYINT]) >>>> +(define_int_attr round_pattern [(UNSPEC_ROUND "round") (UNSPEC_FLOOR "floor") (UNSPEC_CEIL "ceil") >>>> + (UNSPEC_BTRUNC "btrunc") (UNSPEC_ROUNDEVEN "roundeven") (UNSPEC_NEARBYINT "nearbyint")]) >>>> +(define_int_attr round_rm [(UNSPEC_ROUND "rmm") (UNSPEC_FLOOR "rdn") (UNSPEC_CEIL "rup") >>>> + (UNSPEC_BTRUNC "rtz") (UNSPEC_ROUNDEVEN "rne") (UNSPEC_NEARBYINT "dyn")]) >>> Do we really need to use unspecs for all these cases? I would expect >>> some correspond to the trunc, round, ceil, nearbyint, etc well known RTX >>> codes. >>> >>> In general, we should try to avoid unspecs when there is a clear >>> semantic match between the instruction and GCC's RTX opcodes. So please >>> review the existing RTX code semantics to see if any match the new >>> instructions. If there are matches, use those RTX codes rather than >>> UNSPECs. >> >> I'll try, thanks. > > > I encountered some confusion about this. I checked gcc's documents and > found no RTX codes that can correspond to round, ceil, nearbyint, etc. > Only "(fix:m x)" seems to correspond to trunc, which can be expressed > as rounding towards zero, while others have not yet been found. You're largely correct. My bad. There's named patterns for round to integer, nearbyint, etc, but no RTX codes. So they need to be handled as unspecs. Sorry fo the confusion. Jeff