xbolva00 updated this revision to Diff 402207. 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/mm_malloc.c Index: clang/test/Headers/mm_malloc.c =================================================================== --- /dev/null +++ clang/test/Headers/mm_malloc.c @@ -0,0 +1,11 @@ +// RUN: %clang -emit-llvm -std=c11 -x c %s -O1 --target=x86_64-linux-gnu -S -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/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,11 @@ +// RUN: %clang -emit-llvm -std=c11 -x c %s -O1 --target=x86_64-linux-gnu -S -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/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