From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from server.nextmovesoftware.com (server.nextmovesoftware.com [162.254.253.69]) by sourceware.org (Postfix) with ESMTPS id EE0A73858D39 for ; Wed, 24 May 2023 17:54:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EE0A73858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nextmovesoftware.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nextmovesoftware.com; s=default; h=Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=cBQthX7xwOkLnb8GvWG9vcyG8hJQU1n45CGwWnnQ2BA=; b=QsqtbKtYa86I8brFzh6eiOeV1O 1L84cADxHcBKxhwPsGxkR/hAQyeDKSZg1q4ZRzuRCVncbmTFcuaRLiZBhzo/eQaTpp4uvaeoDey+Q LOfqC/nC+IweY6hefK7C8Xg4H1WGI3NfoqRKxNj7Hwi58uVfnMeikHoHcW7iBgtOtaw/llokiUiAK KlNGxrjuvyx5KJPZHLous7SMYcu0GV89pboJfylQbDu9hSU2Iph9LdRk/OVjJh6JiGXefBN8OZPAJ GEAwlRrDQeCFagCtgOXPX6GLWNFoJys29DoLYJMkDn0FG9jSJdJXRVem16/UsVRprVHMPsiXCQ/lU sU+DkSHw==; Received: from host86-169-41-81.range86-169.btcentralplus.com ([86.169.41.81]:65281 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1q1sga-0001mv-14; Wed, 24 May 2023 13:54:08 -0400 From: "Roger Sayle" To: Cc: "'Uros Bizjak'" Subject: [i386 PATCH] A minor code clean-up: Use NULL_RTX instead of nullptr Date: Wed, 24 May 2023 18:54:06 +0100 Message-ID: <07ac01d98e68$bced1fa0$36c75ee0$@nextmovesoftware.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_07AD_01D98E71.1EB3F8A0" X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdmOZ5IA5NnLEoxlTAWIlDP/bqJ+Aw== Content-Language: en-gb X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.nextmovesoftware.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - nextmovesoftware.com X-Get-Message-Sender-Via: server.nextmovesoftware.com: authenticated_id: roger@nextmovesoftware.com X-Authenticated-Sender: server.nextmovesoftware.com: roger@nextmovesoftware.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,URIBL_BLACK 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: This is a multipart message in MIME format. ------=_NextPart_000_07AD_01D98E71.1EB3F8A0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit My understanding is that GCC's preferred null value for rtx is NULL_RTX (and for tree is NULL_TREE), and by being typed allows strict type checking, and use with function polymorphism and template instantiation. C++'s nullptr is preferred over NULL and 0 for pointer types that don't have a defined null of the correct type. This minor clean-up uses NULL_RTX consistently in i386-expand.cc. This patch has been tested on x86_64-pc-linux-gnu with make bootstrap and make -k check, both with and without --target_board=unix{-m32} with no new failures. Ok for mainline? Is my understanding correct? 2023-05-24 Roger Sayle gcc/ChangeLog * config/i386/i386.cc (ix86_convert_wide_int_to_broadcast): Use NULL_RTX instead of nullptr. (ix86_convert_const_wide_int_to_broadcast): Likewise. (ix86_broadcast_from_constant): Likewise. (ix86_expand_vector_move): Likewise. (ix86_extract_perm_from_pool_constant): Likewise. Thanks, Roger -- ------=_NextPart_000_07AD_01D98E71.1EB3F8A0 Content-Type: text/plain; name="patchnl.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="patchnl.txt" diff --git a/gcc/config/i386/i386-expand.cc = b/gcc/config/i386/i386-expand.cc=0A= index 634fe61..a867288 100644=0A= --- a/gcc/config/i386/i386-expand.cc=0A= +++ b/gcc/config/i386/i386-expand.cc=0A= @@ -296,7 +296,7 @@ ix86_convert_const_wide_int_to_broadcast = (machine_mode mode, rtx op)=0A= /* Don't use integer vector broadcast if we can't move from GPR to SSE=0A= register directly. */=0A= if (!TARGET_INTER_UNIT_MOVES_TO_VEC)=0A= - return nullptr;=0A= + return NULL_RTX;=0A= =0A= /* Convert CONST_WIDE_INT to a non-standard SSE constant integer=0A= broadcast only if vector broadcast is available. */=0A= @@ -305,7 +305,7 @@ ix86_convert_const_wide_int_to_broadcast = (machine_mode mode, rtx op)=0A= || standard_sse_constant_p (op, mode)=0A= || (CONST_WIDE_INT_NUNITS (op) * HOST_BITS_PER_WIDE_INT=0A= !=3D GET_MODE_BITSIZE (mode)))=0A= - return nullptr;=0A= + return NULL_RTX;=0A= =0A= HOST_WIDE_INT val =3D CONST_WIDE_INT_ELT (op, 0);=0A= HOST_WIDE_INT val_broadcast;=0A= @@ -326,12 +326,12 @@ ix86_convert_const_wide_int_to_broadcast = (machine_mode mode, rtx op)=0A= val_broadcast))=0A= broadcast_mode =3D DImode;=0A= else=0A= - return nullptr;=0A= + return NULL_RTX;=0A= =0A= /* Check if OP can be broadcasted from VAL. */=0A= for (int i =3D 1; i < CONST_WIDE_INT_NUNITS (op); i++)=0A= if (val !=3D CONST_WIDE_INT_ELT (op, i))=0A= - return nullptr;=0A= + return NULL_RTX;=0A= =0A= unsigned int nunits =3D (GET_MODE_SIZE (mode)=0A= / GET_MODE_SIZE (broadcast_mode));=0A= @@ -525,7 +525,7 @@ ix86_expand_move (machine_mode mode, rtx operands[])=0A= {=0A= rtx tmp =3D ix86_convert_const_wide_int_to_broadcast=0A= (GET_MODE (op0), op1);=0A= - if (tmp !=3D nullptr)=0A= + if (tmp !=3D NULL_RTX)=0A= op1 =3D tmp;=0A= }=0A= }=0A= @@ -541,13 +541,13 @@ ix86_broadcast_from_constant (machine_mode mode, = rtx op)=0A= {=0A= int nunits =3D GET_MODE_NUNITS (mode);=0A= if (nunits < 2)=0A= - return nullptr;=0A= + return NULL_RTX;=0A= =0A= /* Don't use integer vector broadcast if we can't move from GPR to SSE=0A= register directly. */=0A= if (!TARGET_INTER_UNIT_MOVES_TO_VEC=0A= && INTEGRAL_MODE_P (mode))=0A= - return nullptr;=0A= + return NULL_RTX;=0A= =0A= /* Convert CONST_VECTOR to a non-standard SSE constant integer=0A= broadcast only if vector broadcast is available. */=0A= @@ -557,7 +557,7 @@ ix86_broadcast_from_constant (machine_mode mode, rtx = op)=0A= || GET_MODE_INNER (mode) =3D=3D DImode))=0A= || FLOAT_MODE_P (mode))=0A= || standard_sse_constant_p (op, mode))=0A= - return nullptr;=0A= + return NULL_RTX;=0A= =0A= /* Don't broadcast from a 64-bit integer constant in 32-bit mode.=0A= We can still put 64-bit integer constant in memory when=0A= @@ -565,14 +565,14 @@ ix86_broadcast_from_constant (machine_mode mode, = rtx op)=0A= if (GET_MODE_INNER (mode) =3D=3D DImode && !TARGET_64BIT=0A= && (!TARGET_AVX512F=0A= || (GET_MODE_SIZE (mode) < 64 && !TARGET_AVX512VL)))=0A= - return nullptr;=0A= + return NULL_RTX;=0A= =0A= if (GET_MODE_INNER (mode) =3D=3D TImode)=0A= - return nullptr;=0A= + return NULL_RTX;=0A= =0A= rtx constant =3D get_pool_constant (XEXP (op, 0));=0A= if (GET_CODE (constant) !=3D CONST_VECTOR)=0A= - return nullptr;=0A= + return NULL_RTX;=0A= =0A= /* There could be some rtx like=0A= (mem/u/c:V16QI (symbol_ref/u:DI ("*.LC1")))=0A= @@ -581,8 +581,8 @@ ix86_broadcast_from_constant (machine_mode mode, rtx = op)=0A= {=0A= constant =3D simplify_subreg (mode, constant, GET_MODE (constant),=0A= 0);=0A= - if (constant =3D=3D nullptr || GET_CODE (constant) !=3D = CONST_VECTOR)=0A= - return nullptr;=0A= + if (constant =3D=3D NULL_RTX || GET_CODE (constant) !=3D = CONST_VECTOR)=0A= + return NULL_RTX;=0A= }=0A= =0A= rtx first =3D XVECEXP (constant, 0, 0);=0A= @@ -592,7 +592,7 @@ ix86_broadcast_from_constant (machine_mode mode, rtx = op)=0A= rtx tmp =3D XVECEXP (constant, 0, i);=0A= /* Vector duplicate value. */=0A= if (!rtx_equal_p (tmp, first))=0A= - return nullptr;=0A= + return NULL_RTX;=0A= }=0A= =0A= return first;=0A= @@ -641,7 +641,7 @@ ix86_expand_vector_move (machine_mode mode, rtx = operands[])=0A= machine_mode mode =3D GET_MODE (op0);=0A= rtx tmp =3D ix86_convert_const_wide_int_to_broadcast=0A= (mode, op1);=0A= - if (tmp =3D=3D nullptr)=0A= + if (tmp =3D=3D NULL_RTX)=0A= op1 =3D validize_mem (force_const_mem (mode, op1));=0A= else=0A= op1 =3D tmp;=0A= @@ -656,7 +656,7 @@ ix86_expand_vector_move (machine_mode mode, rtx = operands[])=0A= && CONSTANT_POOL_ADDRESS_P (XEXP (op1, 0))))=0A= {=0A= rtx first =3D ix86_broadcast_from_constant (mode, op1);=0A= - if (first !=3D nullptr)=0A= + if (first !=3D NULL_RTX)=0A= {=0A= /* Broadcast to XMM/YMM/ZMM register from an integer=0A= constant or scalar mem. */=0A= @@ -5797,7 +5797,7 @@ ix86_extract_perm_from_pool_constant (int* perm, = rtx mem)=0A= {=0A= constant =3D simplify_subreg (mode, constant, GET_MODE = (constant), 0);=0A= =0A= - if (constant =3D=3D nullptr || GET_CODE (constant) !=3D = CONST_VECTOR)=0A= + if (constant =3D=3D NULL_RTX || GET_CODE (constant) !=3D = CONST_VECTOR)=0A= return false;=0A= }=0A= =0A= ------=_NextPart_000_07AD_01D98E71.1EB3F8A0--