From patchwork Thu Sep 22 18:49:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 28 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp338651wrt; Thu, 22 Sep 2022 11:50:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM659qbpnAv9s4xJZdTfp7k9Z0fOhw+QVwhWy+oRElBry/p7X5OKy+aHA6gg8dubCDsWHFP+ X-Received: by 2002:a17:907:2d09:b0:782:7120:7092 with SMTP id gs9-20020a1709072d0900b0078271207092mr2256693ejc.141.1663872618057; Thu, 22 Sep 2022 11:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663872618; cv=none; d=google.com; s=arc-20160816; b=rz/m6F2Oyl5G4ozNa1bUdVoelQzrDqTwz4HMWjB1OGbFkA3iRjcxmz700OzP8gmVcQ 1GTwGPD393PWsRqQUQaytQGSl79EDxR+Nr5Yt4lQfskCIU9lgisQuoR8uzhNt+F470w/ f63C1PmdEuiP3pHBQrNhD2H6xc7wcLAK4wSs8GCEzZmkL18sXUYektmYigLDTiGK5Kgo VtiWT5H80muRjg5dh+05+8LXoTdR5eqzg1fDB236LLRR1BTANPqrFu4WcT00dADILJnJ gDQLrKzLZRTTc+EyHgS/nsIVlkRHkYJlFdkk5hUnNb9EMZ5pgTqnHBjNvQEg8P3Jdy1T nTMw== 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-transfer-encoding:content-language:subject:to:user-agent :mime-version:date:message-id:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=oxnG3uxBUhD3nYz882imwpk+KZljq+G3Fg+FntZRgY4=; b=nOXMzbEKFI0tvlajgFF8kFgs7SzJYdyBY6+IwYVx/7wi5X1utvhgeOQhgSLXEu9BvA 38pqzTjq9i0dj3pNZ9SdGOwrr6IT75k8Yn45D/XqbNw3/dJYPg0/em4VkRqwZxJhEU1D YBv7mpPpqAlUNMOHwwTbJPskpkfBsXB9VpQLAZB/EkOOyIqTz/qGI4apwi30NQ2hBBY5 3bqxYGBKLcIXf28pr2e/kWpMYrN8prY6sVC7B9dT8zcbg1by9YDhV/0uFgnem0Bdy3KH QqnWjbqtsTLmzylU43G7IMZWQhCCC3muAjOF9Nw8fx9Wy3UiEqZQxdBA96s34negRPVb IN6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=IgjEy8Cc; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id l17-20020a170906795100b00780def41dc4si5307700ejo.527.2022.09.22.11.50.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 11:50:18 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=IgjEy8Cc; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 3F4A33857BBD for ; Thu, 22 Sep 2022 18:50:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F4A33857BBD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663872613; bh=oxnG3uxBUhD3nYz882imwpk+KZljq+G3Fg+FntZRgY4=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=IgjEy8Ccoesk5Ln1zXCVpRp0/x5znRdR/o7xCwsJmHn9oOEW240gWidIGRcC/6kpm hphC3FghQxUt+xqM0i+V1aklzuXaR3diQJ3SqmNqkjGLAurE5DdzhWfNecDONpo7qh OP2p5x99iJPH7M4D8NYPYMmoHwIBzANP6nlzn92M= 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.133.124]) by sourceware.org (Postfix) with ESMTPS id 8855538582B5 for ; Thu, 22 Sep 2022 18:49:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8855538582B5 Received: from mail-il1-f197.google.com (mail-il1-f197.google.com [209.85.166.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-360-EJoAt32YNtmG-593-15qMQ-1; Thu, 22 Sep 2022 14:49:28 -0400 X-MC-Unique: EJoAt32YNtmG-593-15qMQ-1 Received: by mail-il1-f197.google.com with SMTP id w10-20020a056e021a6a00b002f5f24e56aeso6175471ilv.19 for ; Thu, 22 Sep 2022 11:49:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date; bh=oxnG3uxBUhD3nYz882imwpk+KZljq+G3Fg+FntZRgY4=; b=1+XvK8RGNeqQavx9yWxC9rjQy80qJWw5aojXct2lPS8CJCDEkbMfzH7mYECDk26xff 8xcqzQH4szZMnfETJvcHD0q4FwBKAliYhZORoP7mqK/N0517aI/wEY9r9usrDavSWu7L BFNpR9rgvf5T21NP8FQS7/gUhGAC2lRbhX6Ei+nAmbzESuLcpE8+je4ysHPLUWgjFWZ8 2SbLrKy5udRR3VnbWC1+Q2tD2iyZDSPbLH81KbD+cIpGfzk7a2d4NkpV7ZJHHzfENzgt A1NNyYJUc4q3TdRGCHHqNWDI/Qvy8ii+zxTNs3Q8iHvoRPOKhDh2Nketz7WY1FITYUk2 n9Qw== X-Gm-Message-State: ACrzQf3k5edsibdRtOHH1k4CzMCv6WveQLE6IOjE3kOBSblCT2a4bdq/ gaVyswO6Z4IMhO3q1PwFTf53aFv5XPyl4J2P0KLYSIUuxfEavu8h3W8hBhGGEUwb0BZr1DJoXjE etXz/1uuaOq+sAYtggjV26eYliDPlOsrjna1YlzksZg1jt0uZnxzFUF8+kkOiBsomynkd8g== X-Received: by 2002:a05:6602:27c3:b0:68b:b670:2bbb with SMTP id l3-20020a05660227c300b0068bb6702bbbmr2193250ios.201.1663872567632; Thu, 22 Sep 2022 11:49:27 -0700 (PDT) X-Received: by 2002:a05:6602:27c3:b0:68b:b670:2bbb with SMTP id l3-20020a05660227c300b0068bb6702bbbmr2193244ios.201.1663872567386; Thu, 22 Sep 2022 11:49:27 -0700 (PDT) Received: from ?IPV6:2607:fea8:a263:f600::3dbe? ([2607:fea8:a263:f600::3dbe]) by smtp.gmail.com with ESMTPSA id e15-20020a026d4f000000b003435c50f000sm2550862jaf.14.2022.09.22.11.49.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Sep 2022 11:49:26 -0700 (PDT) Message-ID: <571782f9-72e6-5c30-da55-b8d62d3a153e@redhat.com> Date: Thu, 22 Sep 2022 14:49:25 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 To: gcc-patches Subject: [PATCH 00/17] Move builtin functions to range-ops. X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, 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 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: Andrew MacLeod via Gcc-patches From: Andrew MacLeod Reply-To: Andrew MacLeod 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?1744696894324831937?= X-GMAIL-MSGID: =?utf-8?q?1744696894324831937?= Builtin functions have been handled until now as special cases in gimple-range-fold.cc. This set of patches makes the changes required to create a range_operator for those functions.  This allows them to behave like a normal unary/binary operation through out the ranger ecosystem.  In particular, it will enable us to make GORI aware of them as we can now provide op1_range and op2_range routines, as well as registering an relations as needed.  None of these enhanced functions are provided yet, this is strictly a conversion.  This enables us to do this for any operation with 1 or 2 operands. There are 17 patches, some are bug fixes, some are infrastructure, a couple are just missing functionality, but most are them are conversions of the builtins.  I did each builtin as a separate patch so if a regression triggers, we can pinpoint it faster. Of note: Patch 2 : Modifies the range_op_handler class to store an integer handler and a float handler rather than the old tree-code and type.  By looking up the handler immediately and storing the pointer, this opens up the possibility of processing handlers which are not in a tree-code table. Patch 3 : Range-ops is suppose to be IL independent, designed to work in RTL land as well.  A little bit of gimple had crept in, and I needed a layer that is gimple aware.  This patch introduces a gimple_range_op_handler which inherits from range_op_handler, and acts as the connector between the gimple IL and range-ops. Some of that code was in range-ops, and a lot more was located in the GORI file.  All those bits and pieces have been moved into the new class. Patch 7 : This patch adjusts gimple_range_op_handler constructor to also check if a builtin function call might have a range_operator object available, and if so, return that.  This initial conversion also adds CFN_BUILT_IN_CONSTANT_P as the first builtin, removing it from the big switch in gimple-range-fold.cc. Patch 8-16 :  Moves SIGNBIT, TOUPPER/LOWER, POPCOUNT, CLZ, CTZ, CLRSB, UBSAN*, STRLEN, and GOACC to range-ops. patch 17: Finally, moves CFA_BUILT_IN_PARITY to range-ops, and removes the builtin-function code checks from range_of_call in gimple_range-fold.cc These patches all bootstrap on x86_64-pc-linux-gnu with no regressions.   Performance wise, it all ends up as approximately a wash. (VRP a hair slower, threading a hair faster) Pushed. Andrew