Patchwork [i386] cpuid function for prefetchw

login
register
mail settings
Submitter Gopalasubramanian, Ganesh
Date Aug. 13, 2012, 10:39 a.m.
Message ID <EB4625145972F94C9680D8CADD6516152A07164E@sausexdag04.amd.com>
Download mbox | patch
Permalink /patch/176903/
State New
Headers show

Comments

Gopalasubramanian, Ganesh - Aug. 13, 2012, 10:39 a.m.
Yes! Thanks Jakub.

-----Original Message-----
From: Jakub Jelinek [mailto:jakub@redhat.com] 
Sent: Monday, August 13, 2012 3:16 PM
To: Gopalasubramanian, Ganesh
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH,i386] cpuid function for prefetchw

On Mon, Aug 13, 2012 at 09:29:45AM +0000, Gopalasubramanian, Ganesh wrote:
> To get the prefetchw cpuid flag, cpuid function 0x80000001 needs to be 
> called.
> Previous to patch, function 0x7 is called.
> 
> Bootstrapping and "make -k check" passes without failures.
> Ok for trunk?

IMHO you move it to a wrong spot, ecx bits of CPUID 0x80000001 are tested earlier.

So I think you want this instead (bootstrap/regtest in progress):

2012-08-13  Ganesh Gopalasubramanian  <Ganesh.Gopalasubramanian@amd.com>
	    Jakub Jelinek  <jakub@redhat.com>

	PR driver/54210
	* config/i386/driver-i386.c (host_detect_local_cpu): Test bit_PRFCHW
	bit of CPUID 0x80000001 %ecx instead of CPUID 7 %ecx.
	* config/i386/cpuid.h (bits_PRFCHW): Move definition to CPUID
	0x80000001 %ecx flags.



	Jakub

Patch

--- gcc/config/i386/driver-i386.c.jj	2012-08-10 15:49:25.000000000 +0200
+++ gcc/config/i386/driver-i386.c	2012-08-13 11:30:14.570494736 +0200
@@ -467,7 +467,6 @@  const char *host_detect_local_cpu (int a
       has_bmi2 = ebx & bit_BMI2;
       has_fsgsbase = ebx & bit_FSGSBASE;
       has_rdseed = ebx & bit_RDSEED;
-      has_prfchw = ecx & bit_PRFCHW;
       has_adx = ebx & bit_ADX;
     }
 
@@ -488,6 +487,7 @@  const char *host_detect_local_cpu (int a
       has_xop = ecx & bit_XOP;
       has_tbm = ecx & bit_TBM;
       has_lzcnt = ecx & bit_LZCNT;
+      has_prfchw = ecx & bit_PRFCHW;
 
       has_longmode = edx & bit_LM;
       has_3dnowp = edx & bit_3DNOWP;
--- gcc/config/i386/cpuid.h.jj	2012-08-10 15:49:25.000000000 +0200
+++ gcc/config/i386/cpuid.h	2012-08-13 11:31:30.346494092 +0200
@@ -52,6 +52,7 @@ 
 #define bit_LAHF_LM	(1 << 0)
 #define bit_ABM		(1 << 5)
 #define bit_SSE4a	(1 << 6)
+#define bit_PRFCHW	(1 << 8)
 #define bit_XOP         (1 << 11)
 #define bit_LWP 	(1 << 15)
 #define bit_FMA4        (1 << 16)
@@ -69,7 +70,6 @@ 
 #define bit_HLE	(1 << 4)
 #define bit_AVX2	(1 << 5)
 #define bit_BMI2	(1 << 8)
-#define bit_PRFCHW	(1 << 8)
 #define bit_RTM	(1 << 11)
 #define bit_RDSEED	(1 << 18)
 #define bit_ADX	(1 << 19)