From patchwork Sat Nov 19 08:37:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 23236 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp615028wrr; Sat, 19 Nov 2022 00:38:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf5YRl/JosEtzVkXCb7VfdKKELnr5MHhc8r264F6JvdJxqzw6qHXNpPDfVNiU6cvpBIkyJpN X-Received: by 2002:a05:6402:541a:b0:463:be84:5283 with SMTP id ev26-20020a056402541a00b00463be845283mr718789edb.7.1668847135439; Sat, 19 Nov 2022 00:38:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668847135; cv=none; d=google.com; s=arc-20160816; b=0fnDgDbhc7mB4/AGfnfRsD/kHZ7yT6QFqM4TR7cfqIu1mud853MKq9FwDFfMMOqS/Z rxt73HdMw1U0zuG520fZoZleu/h0CreUn7429WEECL73dT+S2e9FFNCDlemHGW28zhyv dGqrWzT0znQlA1glj6gaUXTTZCcXi8zmU+mf09J4570PEti9vasBAQJnQeRnsLndhFub DavMsy1f+KRJXEfLy219innuIvg8mnJXcYnjsJkmzRJypGwKq9FZ1Uq6KP3jzXTqpM7n ezl1EYF061C/Ne5B5PqTwk/afb6cN8Y0L0HS3UeM4Uwx38/g27VceoNTw3XVoiBcJf88 eCoA== 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-disposition:mime-version:message-id:subject:cc:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=7rqKU2hZdbtjL/+FP3IZj3E4flzGbjv0r1vw68liDgQ=; b=cCTvddYTABgGQigkp70pNPWiJFdoNKU1XigPObA5RJHK+ZXjV6XHyF+IBkL0wnyYk7 l45VbJqryrlIpfPHVxSwmuc93zlFZ0kg9gaCSWGrP0x2mRJh6sgPeTt+aC2OLLwKXho3 x3wC3TQB5J0FEqIRshM7giPlMsdMVoe4rfUG5E3+CXF73E4SDsx0WH+jsr9vBOAFEXqx h7CiZFVmyQgWmKzFT6A17FNLgdZyemc/YthW/mwF47SEz+vXCS3PSMfK6WGyjtrIf0TD yXm0FVDrM/UbMV/mzi+ex0JoY0AZOHsjWDIEbHjZYNRlyn1HBLlqUeM+AoC7UAknlC4Y EiXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=R6bJQGDz; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id z2-20020a1709063ac200b007b2912955desi3839573ejd.125.2022.11.19.00.38.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 00:38:55 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=R6bJQGDz; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 EB60C3858284 for ; Sat, 19 Nov 2022 08:38:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB60C3858284 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668847134; bh=7rqKU2hZdbtjL/+FP3IZj3E4flzGbjv0r1vw68liDgQ=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=R6bJQGDzo9QaVfriqj03ODiedf/h2XIiK4DbKJJuKn4N+Wq9V/d/ZGkuJNfxUX04E KioDiwPEAnqKkERutH930j3PvMfELFV58FQl5h38ZtVyG3JMLGG2/SFnrqox+h7ECS 4g/qLrng36tmrn4iOBqxC3TNPV1gB+Bcgj1HUjOM= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id EEEC93858D1E for ; Sat, 19 Nov 2022 08:38:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EEEC93858D1E Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-155-nVTiM0lRO3ON7RbzaDrdVQ-1; Sat, 19 Nov 2022 03:38:00 -0500 X-MC-Unique: nVTiM0lRO3ON7RbzaDrdVQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A405F801585; Sat, 19 Nov 2022 08:37:59 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 60D0440C6EC3; Sat, 19 Nov 2022 08:37:59 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2AJ8bsGs3761079 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sat, 19 Nov 2022 09:37:55 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2AJ8bruH3761078; Sat, 19 Nov 2022 09:37:53 +0100 Date: Sat, 19 Nov 2022 09:37:53 +0100 To: Hongtao Liu Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] i386: Uglify some local identifiers in *intrin.h [PR107748] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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 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: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek 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?1749913053728696376?= X-GMAIL-MSGID: =?utf-8?q?1749913053728696376?= Hi! While reporting PR107748 (where is a problem with non-uglified names, but I've left it out because it needs fixing anyway), I've noticed various spots where identifiers in *intrin.h headers weren't uglified. The following patch fixed those that are related to unions (I've grepped for [a-zA-Z]\.[a-zA-Z] spots). The reason we need those to be uglified is the same as why the arguments of the inlines are __ prefixed and most of automatic vars in the inlines - say a, v or u aren't part of implementation namespace and so users could #define u whatever->something #include and it should still work, as long as u is not e.g. one of the names of the functions/macros the header provides (_mm* etc.). Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2022-11-19 Jakub Jelinek PR target/107748 * config/i386/avx512fp16intrin.h (_mm512_castph512_ph128, _mm512_castph512_ph256, _mm512_castph128_ph512, _mm512_castph256_ph512, _mm512_set1_pch): Uglify names of local variables and union members. * config/i386/avx512fp16vlintrin.h (_mm256_castph256_ph128, _mm256_castph128_ph256, _mm256_set1_pch, _mm_set1_pch): Likewise. * config/i386/smmintrin.h (_mm_extract_ps): Likewise. Jakub --- gcc/config/i386/avx512fp16intrin.h.jj 2022-09-27 08:03:26.974984702 +0200 +++ gcc/config/i386/avx512fp16intrin.h 2022-11-18 12:51:10.668957336 +0100 @@ -272,10 +272,10 @@ _mm512_castph512_ph128 (__m512h __A) { union { - __m128h a[4]; - __m512h v; - } u = { .v = __A }; - return u.a[0]; + __m128h __a[4]; + __m512h __v; + } __u = { .__v = __A }; + return __u.__a[0]; } extern __inline __m256h @@ -284,10 +284,10 @@ _mm512_castph512_ph256 (__m512h __A) { union { - __m256h a[2]; - __m512h v; - } u = { .v = __A }; - return u.a[0]; + __m256h __a[2]; + __m512h __v; + } __u = { .__v = __A }; + return __u.__a[0]; } extern __inline __m512h @@ -296,11 +296,11 @@ _mm512_castph128_ph512 (__m128h __A) { union { - __m128h a[4]; - __m512h v; - } u; - u.a[0] = __A; - return u.v; + __m128h __a[4]; + __m512h __v; + } __u; + __u.__a[0] = __A; + return __u.__v; } extern __inline __m512h @@ -309,11 +309,11 @@ _mm512_castph256_ph512 (__m256h __A) { union { - __m256h a[2]; - __m512h v; - } u; - u.a[0] = __A; - return u.v; + __m256h __a[2]; + __m512h __v; + } __u; + __u.__a[0] = __A; + return __u.__v; } extern __inline __m512h @@ -7156,11 +7156,11 @@ _mm512_set1_pch (_Float16 _Complex __A) { union { - _Float16 _Complex a; - float b; - } u = { .a = __A}; + _Float16 _Complex __a; + float __b; + } __u = { .__a = __A}; - return (__m512h) _mm512_set1_ps (u.b); + return (__m512h) _mm512_set1_ps (__u.__b); } // intrinsics below are alias for f*mul_*ch --- gcc/config/i386/avx512fp16vlintrin.h.jj 2022-01-11 23:11:21.760299007 +0100 +++ gcc/config/i386/avx512fp16vlintrin.h 2022-11-18 12:52:23.242951737 +0100 @@ -124,10 +124,10 @@ _mm256_castph256_ph128 (__m256h __A) { union { - __m128h a[2]; - __m256h v; - } u = { .v = __A }; - return u.a[0]; + __m128h __a[2]; + __m256h __v; + } __u = { .__v = __A }; + return __u.__a[0]; } extern __inline __m256h @@ -136,11 +136,11 @@ _mm256_castph128_ph256 (__m128h __A) { union { - __m128h a[2]; - __m256h v; - } u; - u.a[0] = __A; - return u.v; + __m128h __a[2]; + __m256h __v; + } __u; + __u.__a[0] = __A; + return __u.__v; } extern __inline __m256h @@ -3317,11 +3317,11 @@ _mm256_set1_pch (_Float16 _Complex __A) { union { - _Float16 _Complex a; - float b; - } u = { .a = __A }; + _Float16 _Complex __a; + float __b; + } __u = { .__a = __A }; - return (__m256h) _mm256_set1_ps (u.b); + return (__m256h) _mm256_set1_ps (__u.__b); } extern __inline __m128h @@ -3330,11 +3330,11 @@ _mm_set1_pch (_Float16 _Complex __A) { union { - _Float16 _Complex a; - float b; - } u = { .a = __A }; + _Float16 _Complex __a; + float __b; + } __u = { .__a = __A }; - return (__m128h) _mm_set1_ps (u.b); + return (__m128h) _mm_set1_ps (__u.__b); } // intrinsics below are alias for f*mul_*ch --- gcc/config/i386/smmintrin.h.jj 2022-04-19 07:20:56.429171229 +0200 +++ gcc/config/i386/smmintrin.h 2022-11-18 12:53:26.226079037 +0100 @@ -365,17 +365,18 @@ _mm_insert_ps (__m128 __D, __m128 __S, c extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_extract_ps (__m128 __X, const int __N) { - union { int i; float f; } __tmp; - __tmp.f = __builtin_ia32_vec_ext_v4sf ((__v4sf)__X, __N); - return __tmp.i; + union { int __i; float __f; } __tmp; + __tmp.__f = __builtin_ia32_vec_ext_v4sf ((__v4sf)__X, __N); + return __tmp.__i; } #else #define _mm_extract_ps(X, N) \ (__extension__ \ ({ \ - union { int i; float f; } __tmp; \ - __tmp.f = __builtin_ia32_vec_ext_v4sf ((__v4sf)(__m128)(X), (int)(N)); \ - __tmp.i; \ + union { int __i; float __f; } __tmp; \ + __tmp.__f = __builtin_ia32_vec_ext_v4sf ((__v4sf)(__m128)(X), \ + (int)(N)); \ + __tmp.__i; \ })) #endif