harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r531893 - in /harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared: mkernel.cpp mkernel.h
Date Tue, 24 Apr 2007 12:05:56 GMT
Author: varlax
Date: Tue Apr 24 05:05:54 2007
New Revision: 531893

URL: http://svn.apache.org/viewvc?view=rev&rev=531893
Log:
Documented CPUID::isSSE2Supported and fixed IPF compilation

Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/mkernel.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/mkernel.h

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/mkernel.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/mkernel.cpp?view=diff&rev=531893&r1=531892&r2=531893
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/mkernel.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/mkernel.cpp Tue Apr 24 05:05:54 2007
@@ -190,24 +190,28 @@
 #endif    
 }
 
-
+#if defined(_EM64T_)
 bool CPUID::isSSE2Supported() {
-//uncomment to test on SSE2 PC:
-//  if (true) return false;
-#if defined (_EM64T_) || defined(_IA64_)
     return true;
-#else
-
+}
+#elif defined(_IA32_) //older IA-32
+bool CPUID::isSSE2Supported() {
+    /*
+     * cpuid instruction: 
+     * - takes 0x1 on eax,
+     * - returns standard features flags in edx, bit 26 is SSE2 flag
+     * - clobbers ebx, ecx
+     */
     unsigned int fflags =0;
 #ifdef _WIN32
     __asm {
-        mov    eax, 0x1  //returns standard features flags in edx, bit 26 is SSE2 flag
+        mov    eax, 0x1
         cpuid
         mov    fflags, edx
     };
-#elif PLATFORM_POSIX
+#elif defined (__linux__)
     unsigned int stub;
-
+    //ebx must be restored for -fPIC
      __asm__ __volatile__ (
             "push %%ebx; cpuid; mov %%ebx, %%edi; pop %%ebx" :
                 "=a" (stub),
@@ -215,12 +219,11 @@
                 "=c" (stub),
                 "=d" (fflags) : "a" (0x1));
 #else
-#error 0  
+#error "Need assembly code to query CPUID on this platform"
 #endif
     bool res = ((fflags & (1<<26))!=0);
     return res;
-
-#endif
 }
+#endif //older IA-32
 
 }; // ~namespace Jitrino

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/mkernel.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/mkernel.h?view=diff&rev=531893&r1=531892&r2=531893
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/mkernel.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/mkernel.h Tue Apr 24 05:05:54 2007
@@ -574,7 +574,10 @@
 class CPUID {
     CPUID(){}
 public:
+#if defined(_IA32_) || defined(_EM64T_)
+    /** SSE2 is an extension of the IA-32 architecture, since 2000. */
     static bool isSSE2Supported();
+#endif
 };
 
 }; // ~namespace Jitrino



Mime
View raw message