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: 55142 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2BC863857B8B for ; Thu, 22 Sep 2022 18:49:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BC863857B8B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663872599; 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=l3xiENFaw8siMOPgNhhxRVCoIIgly6OydRSD2TADVtdp/0C9gdh3mvEq4/A7kDfAZ 7akhpC2Et3NwmEhO5iaZhcHB9iuMxXnevDJiH//dCdPq3/zSqeWDxwPe33qFHzPAeV QZb7N8kwk4cZxfT/0zqVzWFuWPHMsneh9uuG2jyw= 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-Google-Smtp-Source: AMsMyM6yR2ubkJc8Ie1WjH1HEReb6ex1hHjESGtkWxmCbr+b5Aw+M8UvDuht3JbSwZGCniqihGn+0g== 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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