Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / X86 / f16c-builtins.c
blob20b6013647ca513f64a45e4aeec3a7fd083ee36c
1 // RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +f16c -emit-llvm -o - -Wall -Werror | FileCheck %s
4 #include <immintrin.h>
6 float test_cvtsh_ss(unsigned short a) {
7 // CHECK-LABEL: test_cvtsh_ss
8 // CHECK: insertelement <8 x i16> undef, i16 %{{.*}}, i32 0
9 // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 1
10 // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 2
11 // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 3
12 // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 4
13 // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 5
14 // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 6
15 // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 7
16 // CHECK: shufflevector <8 x i16> %{{.*}}, <8 x i16> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
17 // CHECK: fpext <4 x half> %{{.*}} to <4 x float>
18 // CHECK: extractelement <4 x float> %{{.*}}, i32 0
19 return _cvtsh_ss(a);
22 unsigned short test_cvtss_sh(float a) {
23 // CHECK-LABEL: test_cvtss_sh
24 // CHECK: insertelement <4 x float> undef, float %{{.*}}, i32 0
25 // CHECK: insertelement <4 x float> %{{.*}}, float 0.000000e+00, i32 1
26 // CHECK: insertelement <4 x float> %{{.*}}, float 0.000000e+00, i32 2
27 // CHECK: insertelement <4 x float> %{{.*}}, float 0.000000e+00, i32 3
28 // CHECK: call <8 x i16> @llvm.x86.vcvtps2ph.128(<4 x float> %{{.*}}, i32 0)
29 // CHECK: extractelement <8 x i16> %{{.*}}, i32 0
30 return _cvtss_sh(a, 0);
33 __m128 test_mm_cvtph_ps(__m128i a) {
34 // CHECK-LABEL: test_mm_cvtph_ps
35 // CHECK: shufflevector <8 x i16> %{{.*}}, <8 x i16> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
36 // CHECK: fpext <4 x half> %{{.*}} to <4 x float>
37 return _mm_cvtph_ps(a);
40 __m256 test_mm256_cvtph_ps(__m128i a) {
41 // CHECK-LABEL: test_mm256_cvtph_ps
42 // CHECK: fpext <8 x half> %{{.*}} to <8 x float>
43 return _mm256_cvtph_ps(a);
46 __m128i test_mm_cvtps_ph(__m128 a) {
47 // CHECK-LABEL: test_mm_cvtps_ph
48 // CHECK: call <8 x i16> @llvm.x86.vcvtps2ph.128(<4 x float> %{{.*}}, i32 0)
49 return _mm_cvtps_ph(a, 0);
52 __m128i test_mm256_cvtps_ph(__m256 a) {
53 // CHECK-LABEL: test_mm256_cvtps_ph
54 // CHECK: call <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float> %{{.*}}, i32 0)
55 return _mm256_cvtps_ph(a, 0);