Patchwork [1/2] AMD bdver2 processors - BMI

login
register
mail settings
Submitter Quentin Neill
Date Nov. 15, 2010, 9:29 p.m.
Message ID <AANLkTinHfzk-+p25sKYTsZbxTqG2iTkRPgy+DMQXg8YO@mail.gmail.com>
Download mbox | patch
Permalink /patch/71303/
State New
Headers show

Comments

Quentin Neill - Nov. 15, 2010, 9:29 p.m.
On Mon, Nov 15, 2010 at 3:28 PM, Quentin Neill
<quentin.neill.gnu@gmail.com> wrote:
> On Wed, Nov 10, 2010 at 8:06 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> Your checkin caused:
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46422
>
> Fixed with the attached, passes bootstrap and make -k check (this time
> I compared against the trunk build and did not see any new failures)
>
> Okay to commit?
> --
> Quentin

Resend to the patches list, not just H.J. -- Quentin
Richard Guenther - Nov. 15, 2010, 10:21 p.m.
On Mon, Nov 15, 2010 at 10:29 PM, Quentin Neill
<quentin.neill.gnu@gmail.com> wrote:
> On Mon, Nov 15, 2010 at 3:28 PM, Quentin Neill
> <quentin.neill.gnu@gmail.com> wrote:
>> On Wed, Nov 10, 2010 at 8:06 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>> Your checkin caused:
>>>
>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46422
>>
>> Fixed with the attached, passes bootstrap and make -k check (this time
>> I compared against the trunk build and did not see any new failures)
>>
>> Okay to commit?

Ok.

Thanks,

Richard.

>> --
>> Quentin
>
> Resend to the patches list, not just H.J. -- Quentin
>

Patch

From 05720941c00255ebb50f09b40df118c306b2b7da Mon Sep 17 00:00:00 2001
From: Quentin Neill <quentin.neill.gnu@gmail.com>
Date: Mon, 15 Nov 2010 15:21:05 -0600
Subject: [PATCH] Fix PR target/46422

2010-11-15  Quentin Neill  <quentin.neill.gnu@gmail.com>

       PR target/46422
       * config/i386/bmiintrin.h (__lzcnt_u16, __lzcnt_u32,
	   __lzcnt_u64): Call the clz builtin.
---
 gcc/ChangeLog               |    6 ++++++
 gcc/config/i386/bmiintrin.h |   12 ++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 03fae9f..dae5a30 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@ 
+2010-11-15  Quentin Neill  <quentin.neill.gnu@gmail.com>
+
+	PR target/46422
+	* config/i386/bmiintrin.h (__lzcnt_u16, __lzcnt_u32, __lzcnt_u64):
+	Call the clz builtin.
+
 2010-11-10  Joseph Myers  <joseph@codesourcery.com>
 
 	* cfgloop.c (verify_loop_structure): Use %' in diagnostics.  Start
diff --git a/gcc/config/i386/bmiintrin.h b/gcc/config/i386/bmiintrin.h
index d3b3bbd..225f2ec 100644
--- a/gcc/config/i386/bmiintrin.h
+++ b/gcc/config/i386/bmiintrin.h
@@ -35,13 +35,13 @@ 
 extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __lzcnt_u16 (unsigned short __X)
 {
-  return __builtin_ia32_lzcnt_u16 (__X);
+  return __builtin_clzs (__X);
 }
 
 extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __tzcnt_u16 (unsigned short __X)
 {
-  return __builtin_ctzs(__X);
+  return __builtin_ctzs (__X);
 }
 
 
@@ -82,14 +82,14 @@  __blsr_u32 (unsigned int __X)
 extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __lzcnt_u32 (unsigned int __X)
 {
-  return __builtin_ia32_lzcnt_u32 (__X);
+  return __builtin_clz (__X);
 }
 
 
 extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __tzcnt_u32 (unsigned int __X)
 {
-  return __builtin_ctz(__X);
+  return __builtin_ctz (__X);
 }
 
 
@@ -131,13 +131,13 @@  __blsr_u64 (unsigned long long __X)
 extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __lzcnt_u64 (unsigned long long __X)
 {
-  return __builtin_ia32_lzcnt_u64 (__X);
+  return __builtin_clzll (__X);
 }
 
 extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __tzcnt_u64 (unsigned long long __X)
 {
-  return __builtin_ctzll(__X);
+  return __builtin_ctzll (__X);
 }
 
 #endif /* __x86_64__  */
-- 
1.7.0.4