From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 9E08C3858000 for ; Wed, 22 Feb 2023 18:33:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9E08C3858000 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677090825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Vcj6O6QLPnIG31d7fFS3SGpys0RO7pqt1rxE0NukFyw=; b=jMGLifN5jXbGGDwHQK8Db/IStFfWcU1diTDJkk0bPQFr4w5ArvqvTI+dJxWNRuQLRTW+Ik mmMltnDGPkycMWsEj6YRzOkSKEMFfs6zofKoQwj6wKB7g/EpKXwReREDgrUAdBzBmT/11s QV2dso5VPqvEiSg++esISVc7DCx/Sk4= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-674-8i4ypvTKN_2HZ8t3Se2H2A-1; Wed, 22 Feb 2023 13:33:42 -0500 X-MC-Unique: 8i4ypvTKN_2HZ8t3Se2H2A-1 Received: by mail-qv1-f71.google.com with SMTP id px25-20020a056214051900b0056f0794632bso4910767qvb.18 for ; Wed, 22 Feb 2023 10:33:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Vcj6O6QLPnIG31d7fFS3SGpys0RO7pqt1rxE0NukFyw=; b=F5C/hE7D0qgPot7RhzXOUF/i6K1oKSGCP+OLFjgkhCC8gPzt7ISFiKssbQGaHsb5qZ N+vdD+QofqXKy2DTFjm3CEraG8EXPrtQNbT/J9tCTpuCGK61CW/ks3H1O4VJRzbmO/Ks ahjCp+/7HZufACWqfQAdaq9dmnDz4diQWlN1JlRW7lQCwrR7Qh6cgPqVxEuyTWv9QUY6 nVBzTiCmophYAu6MT46stMAOPkAFtVe22KmWNFp2OtMSaXAN/VGPqeR1ep2alnvxK7na L7TY7wJvdh1Ya0doNZBlq0VRkSnstKaJ550B5DSBFERMiVST/pGuv7n0eF+rqC31Op9w 8xSg== X-Gm-Message-State: AO0yUKXoLKzP6kCh2WrM5WyAtxo+gr5asypke6DTgIHppfUOt4mRcd+V 7YrbdCfDchPYBlkggmLrntGuqi3WXTUV9fJU0Yx5gED95qe+qqWjS7UUIzpw4PiqVACrLFud54G 8haefoPLEkzFYdfYd5w== X-Received: by 2002:a05:622a:1791:b0:3b9:c019:b134 with SMTP id s17-20020a05622a179100b003b9c019b134mr15689496qtk.4.1677090821686; Wed, 22 Feb 2023 10:33:41 -0800 (PST) X-Google-Smtp-Source: AK7set+8oVFKWDlVO4wKPU9Qql6s2+WMI8gjx/8yuXJrikRM6mifeceG3VYr10u7l8Cdp+SFcBMmRQ== X-Received: by 2002:a05:622a:1791:b0:3b9:c019:b134 with SMTP id s17-20020a05622a179100b003b9c019b134mr15689468qtk.4.1677090821423; Wed, 22 Feb 2023 10:33:41 -0800 (PST) Received: from ?IPV6:2607:fea8:a263:f600::de2a? ([2607:fea8:a263:f600::de2a]) by smtp.gmail.com with ESMTPSA id d13-20020ac8534d000000b003b9b48cdbe8sm4752749qto.58.2023.02.22.10.33.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Feb 2023 10:33:40 -0800 (PST) Message-ID: <9378f3fb-0538-45fd-5066-1920de50e6c9@redhat.com> Date: Wed, 22 Feb 2023 13:33:39 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583] To: Tamar Christina , Richard Biener , Richard Sandiford Cc: Tamar Christina via Gcc-patches , nd , "jlaw@ventanamicro.com" References: <77142b9b-7af8-eb04-e596-6dd2f97aff9a@redhat.com> From: Andrew MacLeod In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,BODY_8BITS,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 List-Id: On 2/22/23 13:03, Tamar Christina wrote: >> -----Original Message----- >> From: Andrew MacLeod >> Sent: Wednesday, February 22, 2023 4:42 PM >> To: Tamar Christina ; Richard Biener >> ; Richard Sandiford >> Cc: Tamar Christina via Gcc-patches ; nd >> ; jlaw@ventanamicro.com >> Subject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask >> by using new optabs [PR108583] >> >> >> On 2/15/23 13:42, Andrew MacLeod wrote: >>> On 2/15/23 12:50, Andrew MacLeod wrote: >>>> On 2/15/23 12:13, Tamar Christina wrote: >>>>>> On 2/15/23 07:51, Tamar Christina wrote: >>>> void >>>> operator_plus::wi_fold (irange &r, tree type, >>>>                         const wide_int &lh_lb, const wide_int &lh_ub, >>>>                         const wide_int &rh_lb, const wide_int &rh_ub) >>>> const { >>>>   wi::overflow_type ov_lb, ov_ub; >>>>   signop s = TYPE_SIGN (type); >>>> >>>>   // Do whatever wideint magic is required to do this adds in higher >>>> precision >>>>   wide_int new_lb = wi::add (lh_lb, rh_lb, s, &ov_lb); >>>>   wide_int new_ub = wi::add (lh_ub, rh_ub, s, &ov_ub); >>>> >>>>   r = int_range<2> (type, new_lb, new_ub); } >>>> >>>> >>>> The operator needs to be registered, I've attached the skeleton for >>>> it.  you should just have to finish implementing wi_fold(). >>>> >>>> in theory :-) >>>> >>> You also mentioned earlier that some were tree codes, some were >>> internal function calls?  We have some initial support for built in >>> functions, but I am not familiar with all the various forms they can >>> take.  We currently support CFN_ functions in >>> >>>   gimple-range-op.cc, gimple_range_op_handler::maybe_builtin_call () >>> >>> Basically this is part of a "gimple_range_op_handler"  wrapper for >>> range-ops which can provide a range-ops class for stmts that don't map >>> to a binary or unary form.. such as built in functions. >>> >>> If you get to the point where you need this for a builtin function, I >>> can help you through that too.  Although someone may have to also help >>> me through what differentiates the different kinds of internal >>> function :-)    I presume they are all similar in some way. >>> >>> Andrew >>> >> Oh yeah, and in case you haven't figured it out on your own, you'll have >> to remove WIDEN_MULT_EXPR from the range-ops init table.   This >> non-standard mechanism only gets checked if there is no standard >> range-op table entry for the tree code :-P >> > Hmm it looks like it'll work, but it keeps segfaulting in: > > bool > range_op_handler::fold_range (vrange &r, tree type, > const vrange &lh, > const vrange &rh, > relation_trio rel) const > { > gcc_checking_assert (m_valid); > if (m_int) > return m_int->fold_range (as_a (r), type, > as_a (lh), > as_a (rh), rel); > > while trying to call fold_range. > > But m_int is set to the right instance. Probably something I'm missing, > I'll double check it all. > Hmm.  whats your class operator_widen_mult* look like? what are you inheriting from?   Send me your patch and I'll have a look if you want.  this is somewhat  new territory :-) I cant imagine it being a linkage thing between the 2 files since the operator is defined in another file and the address taken in this one? that should work, but strange that cant make the call... Andrew