public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, i386, PR53877] New intrinsics for LZCNT
@ 2012-07-16 14:15 Kirill Yukhin
  2012-07-16 14:33 ` H.J. Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Kirill Yukhin @ 2012-07-16 14:15 UTC (permalink / raw)
  To: Uros Bizjak, H.J. Lu, gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

Hello guys,

Here is a tiny patch which adds two new intrinsics which were
introduced in recent spec [1].
They're aliased to the existing __lzcnt_*  and live under same CPUID.

ChangeLog entry is:
2012-07-16  Kirill Yukhin  <kirill.yukhin@intel.com>

        PR target/53877
        * config/i386/lzcntintrin.h (_lzcnt_u32): New.
        (_lzcnt_u64): Ditto.

Is it OK for trunk?

[1] --  http://software.intel.com/file/45088

Thanks, K

[-- Attachment #2: lzcnt-new-intrin-1.gcc.patch --]
[-- Type: application/octet-stream, Size: 855 bytes --]

diff --git a/gcc/config/i386/lzcntintrin.h b/gcc/config/i386/lzcntintrin.h
index 31db7dc..31a7163 100644
--- a/gcc/config/i386/lzcntintrin.h
+++ b/gcc/config/i386/lzcntintrin.h
@@ -44,12 +44,24 @@ __lzcnt32 (unsigned int __X)
   return __builtin_clz (__X);
 }
 
+extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_lzcnt_u32 (unsigned int __X)
+{
+  return __builtin_clz (__X);
+}
+
 #ifdef __x86_64__
 extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __lzcnt64 (unsigned long long __X)
 {
   return __builtin_clzll (__X);
 }
+
+extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_lzcnt_u64 (unsigned long long __X)
+{
+  return __builtin_clzll (__X);
+}
 #endif
 
 #endif /* _LZCNTINTRIN_H_INCLUDED */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, i386, PR53877] New intrinsics for LZCNT
  2012-07-16 14:15 [PATCH, i386, PR53877] New intrinsics for LZCNT Kirill Yukhin
@ 2012-07-16 14:33 ` H.J. Lu
  2012-07-16 14:53   ` Uros Bizjak
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2012-07-16 14:33 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Uros Bizjak, gcc-patches List

On Mon, Jul 16, 2012 at 7:14 AM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
> Hello guys,
>
> Here is a tiny patch which adds two new intrinsics which were
> introduced in recent spec [1].
> They're aliased to the existing __lzcnt_*  and live under same CPUID.
>
> ChangeLog entry is:
> 2012-07-16  Kirill Yukhin  <kirill.yukhin@intel.com>
>
>         PR target/53877
>         * config/i386/lzcntintrin.h (_lzcnt_u32): New.
>         (_lzcnt_u64): Ditto.
>
> Is it OK for trunk?
>

I think we should add a testcase for each.  Also it should
also be applied on 4.7.


-- 
H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, i386, PR53877] New intrinsics for LZCNT
  2012-07-16 14:33 ` H.J. Lu
@ 2012-07-16 14:53   ` Uros Bizjak
  0 siblings, 0 replies; 3+ messages in thread
From: Uros Bizjak @ 2012-07-16 14:53 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Kirill Yukhin, gcc-patches List

On Mon, Jul 16, 2012 at 4:32 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Jul 16, 2012 at 7:14 AM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
>> Hello guys,
>>
>> Here is a tiny patch which adds two new intrinsics which were
>> introduced in recent spec [1].
>> They're aliased to the existing __lzcnt_*  and live under same CPUID.
>>
>> ChangeLog entry is:
>> 2012-07-16  Kirill Yukhin  <kirill.yukhin@intel.com>
>>
>>         PR target/53877
>>         * config/i386/lzcntintrin.h (_lzcnt_u32): New.
>>         (_lzcnt_u64): Ditto.
>>
>> Is it OK for trunk?
>>
>
> I think we should add a testcase for each.  Also it should
> also be applied on 4.7.

This patch just calls __builtin_clz{,ll}, for which we already have
test coverage. Also, please note a couple of sse-*.c testcases that
check compilation of all intrinsics in one shot.

So, OK for mainline and 4.7.

Thanks,
Uros.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-07-16 14:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-16 14:15 [PATCH, i386, PR53877] New intrinsics for LZCNT Kirill Yukhin
2012-07-16 14:33 ` H.J. Lu
2012-07-16 14:53   ` Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).