xbolva00 updated this revision to Diff 404395. xbolva00 added a comment. Added newline
CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117091/new/ https://reviews.llvm.org/D117091 Files: clang/lib/Headers/mm_malloc.h clang/test/Headers/Inputs/include/malloc.h clang/test/Headers/mm_malloc.c Index: clang/test/Headers/mm_malloc.c =================================================================== --- /dev/null +++ clang/test/Headers/mm_malloc.c @@ -0,0 +1,12 @@ + +// RUN: %clang_cc1 -internal-isystem %S/Inputs/include %s -emit-llvm -O1 -triple x86_64-linux-gnu -o - | FileCheck %s +#include <mm_malloc.h> + +_Bool align_test(void) { +// CHECK-LABEL: @align_test( +// CHECK: ret i1 true + void *p = _mm_malloc(1024, 16); + _Bool ret = ((__UINTPTR_TYPE__)p % 16) == 0; + _mm_free(p); + return ret; +} Index: clang/test/Headers/Inputs/include/malloc.h =================================================================== --- /dev/null +++ clang/test/Headers/Inputs/include/malloc.h @@ -0,0 +1,5 @@ +#if defined(__MINGW32__) +void *__mingw_aligned_malloc(size_t, size_t) +#elif defined(_WIN32) +void *_aligned_malloc(size_t, size_t); +#endif \ No newline at end of file Index: clang/lib/Headers/mm_malloc.h =================================================================== --- clang/lib/Headers/mm_malloc.h +++ clang/lib/Headers/mm_malloc.h @@ -28,9 +28,9 @@ #if !(defined(_WIN32) && defined(_mm_malloc)) static __inline__ void *__attribute__((__always_inline__, __nodebug__, - __malloc__)) -_mm_malloc(size_t __size, size_t __align) -{ + __malloc__, alloc_size(1), + alloc_align(2))) +_mm_malloc(size_t __size, size_t __align) { if (__align == 1) { return malloc(__size); }
Index: clang/test/Headers/mm_malloc.c =================================================================== --- /dev/null +++ clang/test/Headers/mm_malloc.c @@ -0,0 +1,12 @@ + +// RUN: %clang_cc1 -internal-isystem %S/Inputs/include %s -emit-llvm -O1 -triple x86_64-linux-gnu -o - | FileCheck %s +#include <mm_malloc.h> + +_Bool align_test(void) { +// CHECK-LABEL: @align_test( +// CHECK: ret i1 true + void *p = _mm_malloc(1024, 16); + _Bool ret = ((__UINTPTR_TYPE__)p % 16) == 0; + _mm_free(p); + return ret; +} Index: clang/test/Headers/Inputs/include/malloc.h =================================================================== --- /dev/null +++ clang/test/Headers/Inputs/include/malloc.h @@ -0,0 +1,5 @@ +#if defined(__MINGW32__) +void *__mingw_aligned_malloc(size_t, size_t) +#elif defined(_WIN32) +void *_aligned_malloc(size_t, size_t); +#endif \ No newline at end of file Index: clang/lib/Headers/mm_malloc.h =================================================================== --- clang/lib/Headers/mm_malloc.h +++ clang/lib/Headers/mm_malloc.h @@ -28,9 +28,9 @@ #if !(defined(_WIN32) && defined(_mm_malloc)) static __inline__ void *__attribute__((__always_inline__, __nodebug__, - __malloc__)) -_mm_malloc(size_t __size, size_t __align) -{ + __malloc__, alloc_size(1), + alloc_align(2))) +_mm_malloc(size_t __size, size_t __align) { if (__align == 1) { return malloc(__size); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits