From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by sourceware.org (Postfix) with ESMTPS id 34FD03858D33 for ; Mon, 21 Nov 2022 01:07:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 34FD03858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yb1-xb32.google.com with SMTP id e68so11944967ybh.2 for ; Sun, 20 Nov 2022 17:07:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=924xFX+mq1lc6exAU24fqIZmFx6Vdm3H75w1hkVq3H4=; b=OSHSthOImofToCWpGQnE1yIjPAJiAwpvF/b1inq+fvF+pRUS87IdP9KmVqxi8j8S/W m2kGnoB8k0i7nuiWPPM1ppRrmZNgWhL1qZArnPhAJOLSgrTb489dTAWh7KhMsIPk/rZE yzZnYsc3ioSBXNRGWqBlKIP1ey7nr38Ei32G2f2dGFmWA+/Idx1eSQwL0MuDA7ijkFHZ jhCW18j7M3kQFvj0zT9MC90QlXInVoyj9VXBJEcclhRXlBjiO5KsDOB8J1LoWgVA6C9n 1uAbgxe7alleEUwhK4en3WXC++Lz80DanzxxvqwQXzDjBIuaf0MSnSpFTsaDEApW2Oyh Oirw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=924xFX+mq1lc6exAU24fqIZmFx6Vdm3H75w1hkVq3H4=; b=jHOGpgKTT1262711mD/r+P6JjVayAnsfpmSMKUj0VY9HGdSfLhhZhYLn4lVk8g39Pz /MVhXZqhy/wpCZLsWR9SzBLp98bArtb00ZNXjhWN3/iEbWbTClV4bf850oG280+29Df0 X+Y1TtkkGZ7lZ0a1bUFl3DjcBO38UNq5b93is6+hdfSf1Q3NP/tMnkhjBoQUvfsnHQSf Sqeu9anMIQuIEpGNK0C5xC1fxHhepCcD99sFWZG1tSOFrd4NjrPD2nkX9KVVpcZJUE5w qOhAp4UsE0Oxbjoe8U5uPplb3zjpMaDVbg1dTjYkvfU5mzgvX+v/6na4fdh2E4I+F6wI Iu/Q== X-Gm-Message-State: ANoB5plWaGS4VBjMWGoDfux/HGbgT4yzSQv7NTXKB7j94QytvBujFoba E3SG6oR3D6kzyIUIjX8XxNZ8sRq1Wp+ohSJYdgTqBI+ba4s= X-Google-Smtp-Source: AA0mqf40wPcE5ZU/Lnm4LAKx4ZYgTjUQYTKYkaYh5sbyzlbFPYY7xVh4nP2cCrs9Jg20KYVZFm5e04wIdJ8mDHQXEiI= X-Received: by 2002:a25:490:0:b0:6dd:b9a3:7ad4 with SMTP id 138-20020a250490000000b006ddb9a37ad4mr15545659ybe.611.1668992821500; Sun, 20 Nov 2022 17:07:01 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Hongtao Liu Date: Mon, 21 Nov 2022 09:10:10 +0800 Message-ID: Subject: Re: [PATCH] i386: Uglify some local identifiers in *intrin.h [PR107748] To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 Sat, Nov 19, 2022 at 4:38 PM Jakub Jelinek wrote: > > 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? Ok, thanks. > > 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. > > --- 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 > > > Jakub > -- BR, Hongtao