1// RUN: %clang_cc1 %s -ffreestanding -triple x86_64-apple-macosx10.9.0 -emit-llvm -o - | FileCheck %s
2//
3// RUN: rm -rf %t
4// RUN: %clang_cc1 %s -ffreestanding -triple x86_64-apple-macosx10.9.0 -emit-llvm -o - \
5// RUN:     -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -isystem %S/Inputs/include \
6// RUN:     | FileCheck %s
7// REQUIRES: x86-registered-target
8#include <xmmintrin.h>
9
10// CHECK: @c = common global i8 0, align 16
11_MM_ALIGN16 char c;
12
13// Make sure the last step of _mm_cvtps_pi16 converts <4 x i32> to <4 x i16> by
14// checking that clang emits PACKSSDW instead of PACKSSWB.
15
16// CHECK: define i64 @test_mm_cvtps_pi16
17// CHECK: call x86_mmx @llvm.x86.mmx.packssdw
18
19__m64 test_mm_cvtps_pi16(__m128 a) {
20  return _mm_cvtps_pi16(a);
21}
22
23// Make sure that including <xmmintrin.h> also makes <emmintrin.h>'s content available.
24// This is an ugly hack for GCC compatibility.
25__m128 test_xmmintrin_provides_emmintrin(__m128d __a, __m128d __b) {
26  return _mm_add_sd(__a, __b);
27}
28
29#if __STDC_HOSTED__
30// Make sure stdlib.h symbols are accessible.
31void *p = NULL;
32#endif
33