Debian Codegraph @

clang/test/CodeGen/X86/sse41-builtins-constrained.c

raw
1 // RUN: %clang_cc1 -x c -frounding-math -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
2 // RUN: %clang_cc1 -x c -frounding-math -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
3 // RUN: %clang_cc1 -x c -frounding-math -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
4 // RUN: %clang_cc1 -x c -frounding-math -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
5 // RUN: %clang_cc1 -x c++ -frounding-math -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
6 // RUN: %clang_cc1 -x c++ -frounding-math -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
7 // RUN: %clang_cc1 -x c++ -frounding-math -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
8 // RUN: %clang_cc1 -x c++ -frounding-math -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
9
10 // RUN: %clang_cc1 -x c -frounding-math -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK
11 // RUN: %clang_cc1 -x c -frounding-math -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK
12 // RUN: %clang_cc1 -x c -frounding-math -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK
13 // RUN: %clang_cc1 -x c -frounding-math -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK
14 // RUN: %clang_cc1 -x c++ -frounding-math -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK
15 // RUN: %clang_cc1 -x c++ -frounding-math -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK
16 // RUN: %clang_cc1 -x c++ -frounding-math -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK
17 // RUN: %clang_cc1 -x c++ -frounding-math -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK
18
19
20 #include <immintrin.h>
21
22 __m128d test_mm_round_pd_roundeven(__m128d x) {
23 // CHECK-LABEL: test_mm_round_pd_roundeven
24 // CHECK: %{{.*}} = call <2 x double> @llvm.experimental.constrained.roundeven.v2f64(<2 x double> %{{.*}}, metadata !"fpexcept.ignore")
25 return _mm_round_pd(x, 0b1000);
26 }
27
28 __m128d test_mm_round_pd_mxcsr(__m128d x) {
29 // CHECK-LABEL: test_mm_round_pd_mxcsr
30 // CHECK: %{{.*}} = call <2 x double> @llvm.x86.sse41.round.pd(<2 x double> %{{.*}}, i32 12)
31 return _mm_round_pd(x, 0b1100);
32 }
33
34 __m128d test_mm_round_pd_fround_no_exc(__m128d x) {
35 // CHECK-LABEL: test_mm_round_pd_fround_no_exc
36 // CHECK: %{{.*}} = call <2 x double> @llvm.x86.sse41.round.pd(<2 x double> %{{.*}}, i32 0)
37 return _mm_round_pd(x, 0b0000);
38 }
39
40 __m128 test_mm_round_ps_floor(__m128 x) {
41 // CHECK-LABEL: test_mm_round_ps_floor
42 // CHECK: %{{.*}} = call <4 x float> @llvm.experimental.constrained.floor.v4f32(<4 x float> %{{.*}}, metadata !"fpexcept.ignore")
43 return _mm_round_ps(x, 0b1001);
44 }
45
46 __m128 test_mm_round_ps_mxcsr(__m128 x) {
47 // CHECK-LABEL: test_mm_round_ps_mxcsr
48 // CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> %{{.*}}, i32 12)
49 return _mm_round_ps(x, 0b1100);
50 }
51
52 __m128 test_mm_round_ps_fround_no_exc(__m128 x) {
53 // CHECK-LABEL: test_mm_round_ps_fround_no_exc
54 // CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> %{{.*}}, i32 0)
55 return _mm_round_ps(x, 0b0000);
56 }
57
58 __m128d test_mm_round_sd_ceil(__m128d x, __m128d y) {
59 // CHECK-LABEL: test_mm_round_sd_ceil
60 // CHECK: %[[A:.*]] = extractelement <2 x double> %{{.*}}, i32 0
61 // CHECK: %[[B:.*]] = call double @llvm.experimental.constrained.ceil.f64(double %[[A:.*]], metadata !"fpexcept.ignore")
62 // CHECK: %{{.*}} = insertelement <2 x double> %0, double %[[B:.*]], i32 0
63 return _mm_round_sd(x, y, 0b1010);
64 }
65
66 __m128d test_mm_round_sd_mxcsr(__m128d x, __m128d y) {
67 // CHECK-LABEL: test_mm_round_sd_mxcsr
68 // CHECK: %{{.*}} = call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 12)
69 return _mm_round_sd(x, y, 0b1100);
70 }
71
72 __m128d test_mm_round_sd_fround_no_exc(__m128d x, __m128d y) {
73 // CHECK-LABEL: test_mm_round_sd_fround_no_exc
74 // CHECK: %{{.*}} = call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 0)
75 return _mm_round_sd(x, y, 0b0000);
76 }
77
78 __m128 test_mm_round_ss_trunc(__m128 x, __m128 y) {
79 // CHECK-LABEL: test_mm_round_ss_trunc
80 // CHECK: %[[A:.*]] = extractelement <4 x float> %{{.*}}, i32 0
81 // CHECK: %[[B:.*]] = call float @llvm.experimental.constrained.trunc.f32(float %[[A:.*]], metadata !"fpexcept.ignore")
82 // CHECK: %{{.*}} = insertelement <4 x float> %0, float %[[B:.*]], i32 0
83 return _mm_round_ss(x, y, 0b1011);
84 }
85
86 __m128 test_mm_round_ss_mxcsr(__m128 x, __m128 y) {
87 // CHECK-LABEL: test_mm_round_ss_mxcsr
88 // CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %1, i32 12)
89 return _mm_round_ss(x, y, 0b1100);
90 }
91
92 __m128 test_mm_round_ss_fround_no_exc(__m128 x, __m128 y) {
93 // CHECK-LABEL: test_mm_round_ss_fround_no_exc
94 // CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %1, i32 0)
95 return _mm_round_ss(x, y, 0b0000);
96 }