Bug 522440 QCMS: Make sse/sse2 code built with Sun Studio 12 on Solaris r=jmuizelaar, ted.mielczarek
authorGinn Chen <ginn.chen@sun.com>
Fri, 20 Nov 2009 14:15:39 +0800
changeset 35161 7e5d6d6bef822e640b94cba6af3e220c4620809f
parent 35160 512adcdf2f7f00a1bac4ed3d715d641e1a12f5c7
child 35162 9ecbae6faef137b58363b2d5c7e629ef8b95b650
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmuizelaar, ted
bugs522440
milestone1.9.3a1pre
Bug 522440 QCMS: Make sse/sse2 code built with Sun Studio 12 on Solaris r=jmuizelaar, ted.mielczarek
config/rules.mk
config/solaris_ia32.map
gfx/qcms/Makefile.in
gfx/qcms/transform.c
js/src/config/rules.mk
js/src/config/solaris_ia32.map
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -357,16 +357,19 @@ else
 CXXFLAGS		+= -EHsc
 endif # _MSC_VER
 endif # GNU_CC
 endif # ENABLE_CXX_EXCEPTIONS
 endif # WINNT
 
 ifeq ($(SOLARIS_SUNPRO_CXX),1)
 CXXFLAGS += -features=extensions -D__FUNCTION__=__func__
+ifeq (86,$(findstring 86,$(OS_TEST)))
+OS_LDFLAGS += -M $(topsrcdir)/config/solaris_ia32.map
+endif # x86
 endif # Solaris Sun Studio C++
 
 ifeq (,$(filter-out WINNT WINCE,$(HOST_OS_ARCH)))
 HOST_PDBFILE=$(basename $(@F)).pdb
 endif
 
 ifndef TARGETS
 TARGETS			= $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
new file mode 100644
--- /dev/null
+++ b/config/solaris_ia32.map
@@ -0,0 +1,1 @@
+hwcap_1 = OVERRIDE;
--- a/gfx/qcms/Makefile.in
+++ b/gfx/qcms/Makefile.in
@@ -16,20 +16,25 @@ EXPORTS      = qcms.h qcmstypes.h
 CSRCS = iccread.c transform.c
 
 ifeq (86,$(findstring 86,$(OS_TEST)))
 	CSRCS += transform-sse2.c transform-sse1.c
 ifdef GNU_CC
 	SSE1_FLAGS=-msse
 	SSE2_FLAGS=-msse2
 else
+ifeq ($(SOLARIS_SUNPRO_CC),1)
+	SSE1_FLAGS=-xarch=sse
+	SSE2_FLAGS=-xarch=sse2
+else
 	SSE1_FLAGS=
 	SSE2_FLAGS=
 endif
 endif
+endif
 
 FORCE_STATIC_LIB = 1
 # This library is used by other shared libs
 FORCE_USE_PIC = 1
 
 include $(topsrcdir)/config/rules.mk
 
 CFLAGS          += -DMOZ_QCMS
--- a/gfx/qcms/transform.c
+++ b/gfx/qcms/transform.c
@@ -20,20 +20,20 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include <stdlib.h>
 #include <math.h>
 #include <assert.h>
 #include "qcmsint.h"
 
-/* for MSVC, GCC, and Intel compilers */
-#if defined(_M_IX86) || defined(__i386__) || defined(_M_AMD64) || defined(__x86_64__)
+/* for MSVC, GCC, Intel, and Sun compilers */
+#if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_M_AMD64) || defined(__x86_64__) || defined(__x86_64)
 #define X86
-#endif /* _M_IX86 || __i386__ || _M_AMD64 || __x86_64__ */
+#endif /* _M_IX86 || __i386__ || __i386 || _M_AMD64 || __x86_64__ || __x86_64 */
 
 //XXX: could use a bettername
 typedef uint16_t uint16_fract_t;
 
 /* value must be a value between 0 and 1 */
 //XXX: is the above a good restriction to have?
 float lut_interp_linear(double value, uint16_t *table, int length)
 {
@@ -1057,17 +1057,17 @@ static void cpuid(uint32_t fxn, uint32_t
               mov    d_, edx
               xchg   ebx, esi
        }
        *a = a_;
        *b = b_;
        *c = c_;
        *d = d_;
 }
-#elif defined(__GNUC__) && defined(__i386__)
+#elif (defined(__GNUC__) || defined(__SUNPRO_C)) && (defined(__i386__) || defined(__i386))
 #define HAS_CPUID
 /* Get us a CPUID function. We can't use ebx because it's the PIC register on
    some platforms, so we use ESI instead and save ebx to avoid clobbering it. */
 static void cpuid(uint32_t fxn, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d) {
 
 	uint32_t a_, b_, c_, d_;
        __asm__ __volatile__ ("xchgl %%ebx, %%esi; cpuid; xchgl %%ebx, %%esi;" 
                              : "=a" (a_), "=S" (b_), "=c" (c_), "=d" (d_) : "a" (fxn));
@@ -1083,17 +1083,17 @@ static void cpuid(uint32_t fxn, uint32_t
 /* MMX is always supported per
  *  Gecko v1.9.1 minimum CPU requirements */
 #define SSE1_EDX_MASK (1UL << 25)
 #define SSE2_EDX_MASK (1UL << 26)
 #define SSE3_ECX_MASK (1UL <<  0)
 
 static int sse_version_available(void)
 {
-#if defined(__x86_64__) || defined(_M_AMD64)
+#if defined(__x86_64__) || defined(__x86_64) || defined(_M_AMD64)
 	/* we know at build time that 64-bit CPUs always have SSE2
 	 * this tells the compiler that non-SSE2 branches will never be
 	 * taken (i.e. OK to optimze away the SSE1 and non-SIMD code */
 	return 2;
 #elif defined(HAS_CPUID)
 	static int sse_version = -1;
 	uint32_t a, b, c, d;
 	uint32_t function = 0x00000001;
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -357,16 +357,19 @@ else
 CXXFLAGS		+= -EHsc
 endif # _MSC_VER
 endif # GNU_CC
 endif # ENABLE_CXX_EXCEPTIONS
 endif # WINNT
 
 ifeq ($(SOLARIS_SUNPRO_CXX),1)
 CXXFLAGS += -features=extensions -D__FUNCTION__=__func__
+ifeq (86,$(findstring 86,$(OS_TEST)))
+OS_LDFLAGS += -M $(topsrcdir)/config/solaris_ia32.map
+endif # x86
 endif # Solaris Sun Studio C++
 
 ifeq (,$(filter-out WINNT WINCE,$(HOST_OS_ARCH)))
 HOST_PDBFILE=$(basename $(@F)).pdb
 endif
 
 ifndef TARGETS
 TARGETS			= $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
new file mode 100644
--- /dev/null
+++ b/js/src/config/solaris_ia32.map
@@ -0,0 +1,1 @@
+hwcap_1 = OVERRIDE;