Hi rsmith,

These changes help us fix some issues related to C++ modules, and will help us 
diverge less from trunk in our SDK headers.

Create new file _denormals.h to contain duplicate definitions from pmmintrin.h 
(and xmmintrin.h, actually our version only, which also needed the denormal 
definitions).
Change pmmintrin.h and xmmintrin.h to include _denormals.h and delete duplicate 
definitions.
Change mm_malloc.h to not include stdlib.h and size_t, as this creates a 
circular module reference. Locally declare malloc and free with a size_t 
equivalent type, and replace other size_t references.
Create new file _gnu_va_list.h to define __builtin_va_list.  We had duplicate 
definitions of this locally, so we broke it out into a common header.
Change stdarg.h to include _gnu_va_list.h and delete the definition of 
__builtin_va_list there.

http://reviews.llvm.org/D9229

Files:
  lib/Headers/_denormals.h
  lib/Headers/_gnuc_va_list.h
  lib/Headers/mm_malloc.h
  lib/Headers/module.modulemap
  lib/Headers/pmmintrin.h
  lib/Headers/stdarg.h
  lib/Headers/xmmintrin.h

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lib/Headers/_gnuc_va_list.h
===================================================================
--- lib/Headers/_gnuc_va_list.h
+++ lib/Headers/_gnuc_va_list.h
@@ -0,0 +1,29 @@
+/*===---- _gnuc_va_list.h-------------------------------------------------===
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*
+*===-----------------------------------------------------------------------===
+*/
+
+#pragma once
+
+#ifndef _VA_LIST_DECLARED
+#define _VA_LIST_DECLARED
+typedef __builtin_va_list __gnuc_va_list;
+#endif
Index: lib/Headers/pmmintrin.h
===================================================================
--- lib/Headers/pmmintrin.h
+++ lib/Headers/pmmintrin.h
@@ -29,6 +29,7 @@
 #else
 
 #include <emmintrin.h>
+#include <_denormals.h>
 
 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
 _mm_lddqu_si128(__m128i const *__p)
@@ -92,14 +93,6 @@
   return __builtin_shufflevector(__a, __a, 0, 0);
 }
 
-#define _MM_DENORMALS_ZERO_ON   (0x0040)
-#define _MM_DENORMALS_ZERO_OFF  (0x0000)
-
-#define _MM_DENORMALS_ZERO_MASK (0x0040)
-
-#define _MM_GET_DENORMALS_ZERO_MODE() (_mm_getcsr() & _MM_DENORMALS_ZERO_MASK)
-#define _MM_SET_DENORMALS_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_DENORMALS_ZERO_MASK) | (x)))
-
 static __inline__ void __attribute__((__always_inline__, __nodebug__))
 _mm_monitor(void const *__p, unsigned __extensions, unsigned __hints)
 {
Index: lib/Headers/module.modulemap
===================================================================
--- lib/Headers/module.modulemap
+++ lib/Headers/module.modulemap
@@ -26,9 +26,14 @@
     header "immintrin.h"
     header "x86intrin.h"
 
+    explicit module _denormals {
+      header "_denormals.h"
+      export *
+    }
+
     explicit module mm_malloc {
       header "mm_malloc.h"
-      export * // note: for <stdlib.h> dependency
+      export *
     }
 
     explicit module cpuid {
Index: lib/Headers/xmmintrin.h
===================================================================
--- lib/Headers/xmmintrin.h
+++ lib/Headers/xmmintrin.h
@@ -29,6 +29,7 @@
 #else
 
 #include <mmintrin.h>
+#include <_denormals.h>
 
 typedef int __v4si __attribute__((__vector_size__(16)));
 typedef float __v4sf __attribute__((__vector_size__(16)));
Index: lib/Headers/_denormals.h
===================================================================
--- lib/Headers/_denormals.h
+++ lib/Headers/_denormals.h
@@ -0,0 +1,40 @@
+/*===---- _denormals.h - SSE intrinsics -----------------------------------===
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*
+*===-----------------------------------------------------------------------===
+*/
+
+#ifndef __DENORMALS_H
+#define __DENORMALS_H
+
+
+/* SCE_ARCH: bz16632.
+* Convenience macros for DAZ to complement FLUSH_ZERO.
+* These are equivalent to those defined by the Intel compiler.
+*/
+#define _MM_DENORMALS_ZERO_MASK (0x0040)
+#define _MM_DENORMALS_ZERO_ON   (0x0040)
+#define _MM_DENORMALS_ZERO_OFF  (0x0000)
+
+#define _MM_GET_DENORMALS_ZERO_MODE() (_mm_getcsr() & _MM_DENORMALS_ZERO_MASK)
+#define _MM_SET_DENORMALS_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_DENORMALS_ZERO_MASK) | (x)))
+/* end SCE_ARCH */
+
+#endif // __DENORMALS_H
Index: lib/Headers/mm_malloc.h
===================================================================
--- lib/Headers/mm_malloc.h
+++ lib/Headers/mm_malloc.h
@@ -24,26 +24,32 @@
 #ifndef __MM_MALLOC_H
 #define __MM_MALLOC_H
 
-#include <stdlib.h>
+#ifdef __cplusplus
+extern "C" void free(void *);
+extern "C" void *malloc(__SIZE_TYPE__);
+#else
+void free(void *);
+void *malloc(__SIZE_TYPE__);
+#endif
 
 #ifdef _WIN32
 #include <malloc.h>
 #else
 #ifndef __cplusplus
-extern int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
+extern int posix_memalign(void **__memptr, __SIZE_TYPE__ __alignment, __SIZE_TYPE__ __size);
 #else
 // Some systems (e.g. those with GNU libc) declare posix_memalign with an
 // exception specifier. Via an "egregious workaround" in
 // Sema::CheckEquivalentExceptionSpec, Clang accepts the following as a valid
 // redeclaration of glibc's declaration.
-extern "C" int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
+extern "C" int posix_memalign(void **__memptr, __SIZE_TYPE__ __alignment, __SIZE_TYPE__ __size);
 #endif
 #endif
 
 #if !(defined(_WIN32) && defined(_mm_malloc))
 static __inline__ void *__attribute__((__always_inline__, __nodebug__,
                                        __malloc__))
-_mm_malloc(size_t __size, size_t __align)
+_mm_malloc(__SIZE_TYPE__ __size, __SIZE_TYPE__ __align)
 {
   if (__align == 1) {
     return malloc(__size);
Index: lib/Headers/stdarg.h
===================================================================
--- lib/Headers/stdarg.h
+++ lib/Headers/stdarg.h
@@ -26,6 +26,8 @@
 #ifndef __STDARG_H
 #define __STDARG_H
 
+#include <_gnuc_va_list.h>
+
 #ifndef _VA_LIST
 typedef __builtin_va_list va_list;
 #define _VA_LIST
@@ -43,10 +45,4 @@
 #define va_copy(dest, src)  __builtin_va_copy(dest, src)
 #endif
 
-/* Hack required to make standard headers work, at least on Ubuntu */
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST 1
-#endif
-typedef __builtin_va_list __gnuc_va_list;
-
 #endif /* __STDARG_H */
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to