i386-sse-*.c fails on mainline

Bernd Schmidt bernds@redhat.com
Mon May 6 11:24:00 GMT 2002


On Sun, 5 May 2002, Andreas Jaeger wrote:
> Bernd,
> 
> with your recent changes to xmmintrin.h I get failures for the
> i386-sse-*.c tests, for example:
> 
> In file included from /cvs/gcc/gcc/testsuite/gcc.dg/i386-sse-2.c:12:
> /builds/gcc/gcc-3.2-devel/gcc/include/xmmintrin.h: In function `_mm_add_pd':
> /builds/gcc/gcc-3.2-devel/gcc/include/xmmintrin.h:1074: can't convert between vector values of different size

This happens because the SSE2 builtins aren't available with only -msse, so
the compiler thinks they are plain unprototyped functions and assumes a
return type of 'int'.

Fixed with the following patch.


Bernd

	* config/i386/i386.h (CPP_CPUCOMMON_SPEC): Define __SSE2_BUILTINS__ if
	-msse2.
	* config/i386/xmmintrin.h: Use it to conditionalize SSE2 support.

Index: config/i386/i386.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.h,v
retrieving revision 1.256
diff -c -p -r1.256 i386.h
*** config/i386/i386.h	29 Apr 2002 18:40:47 -0000	1.256
--- config/i386/i386.h	6 May 2002 17:29:45 -0000
*************** extern int ix86_arch;
*** 619,624 ****
--- 619,625 ----
  |march=athlon-mp: -D__3dNOW__ }\
  %{march=athlon|march=athlon-tbird|march=athlon-4|march=athlon-xp\
  |march=athlon-mp: -D__3dNOW_A__ }\
+ %{msse2: -D__SSE2_BUILTINS__ }\
  %{march=pentium4: -D__SSE2__ }\
  %{!march*:%{!mcpu*:%{!m386:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}}}"
  
Index: config/i386/xmmintrin.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/xmmintrin.h,v
retrieving revision 1.3
diff -c -p -r1.3 xmmintrin.h
*** config/i386/xmmintrin.h	4 May 2002 17:06:56 -0000	1.3
--- config/i386/xmmintrin.h	6 May 2002 17:29:47 -0000
*************** do {									\
*** 1058,1063 ****
--- 1058,1064 ----
    (row3) = __builtin_ia32_shufps (__t2, __t3, 0xDD);			\
  } while (0)
  
+ #ifdef __SSE2_BUILTINS__
  /* SSE2 */
  typedef int __v2df __attribute__ ((mode (V2DF)));
  typedef int __v2di __attribute__ ((mode (V2DI)));
*************** _mm_mfence (void)
*** 1978,1984 ****
    __builtin_ia32_mfence ();
  }
  
! /* End of SSE2.  */
! 
  
  #endif /* _XMMINTRIN_H_INCLUDED */
--- 1979,1984 ----
    __builtin_ia32_mfence ();
  }
  
! #endif /* __SSE2_BUILTINS__  */
  
  #endif /* _XMMINTRIN_H_INCLUDED */



More information about the Gcc-patches mailing list