1 // RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse2 -emit-llvm -ffp-exception-behavior=strict -o - -Wall -Werror | FileCheck %s
2 // RUN: %clang_cc1 -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse2 -emit-llvm -ffp-exception-behavior=strict -o - -Wall -Werror | FileCheck %s
7 __m128d
test_mm_cmpeq_pd(__m128d A
, __m128d B
) {
8 // CHECK-LABEL: test_mm_cmpeq_pd
9 // CHECK: [[CMP:%.*]] = call <2 x i1> @llvm.experimental.constrained.fcmp.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, metadata !"oeq", metadata !"fpexcept.strict")
10 // CHECK-NEXT: [[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
11 // CHECK-NEXT: [[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
12 return _mm_cmpeq_pd(A
, B
);
15 __m128d
test_mm_cmpge_pd(__m128d A
, __m128d B
) {
16 // CHECK-LABEL: test_mm_cmpge_pd
17 // CHECK: [[CMP:%.*]] = call <2 x i1> @llvm.experimental.constrained.fcmps.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, metadata !"ole", metadata !"fpexcept.strict")
18 // CHECK-NEXT: [[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
19 // CHECK-NEXT: [[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
20 return _mm_cmpge_pd(A
, B
);
23 __m128d
test_mm_cmpgt_pd(__m128d A
, __m128d B
) {
24 // CHECK-LABEL: test_mm_cmpgt_pd
25 // CHECK: [[CMP:%.*]] = call <2 x i1> @llvm.experimental.constrained.fcmps.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, metadata !"olt", metadata !"fpexcept.strict")
26 // CHECK-NEXT: [[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
27 // CHECK-NEXT: [[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
28 return _mm_cmpgt_pd(A
, B
);
31 __m128d
test_mm_cmple_pd(__m128d A
, __m128d B
) {
32 // CHECK-LABEL: test_mm_cmple_pd
33 // CHECK: [[CMP:%.*]] = call <2 x i1> @llvm.experimental.constrained.fcmps.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, metadata !"ole", metadata !"fpexcept.strict")
34 // CHECK-NEXT: [[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
35 // CHECK-NEXT: [[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
36 return _mm_cmple_pd(A
, B
);
39 __m128d
test_mm_cmplt_pd(__m128d A
, __m128d B
) {
40 // CHECK-LABEL: test_mm_cmplt_pd
41 // CHECK: [[CMP:%.*]] = call <2 x i1> @llvm.experimental.constrained.fcmps.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, metadata !"olt", metadata !"fpexcept.strict")
42 // CHECK-NEXT: [[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
43 // CHECK-NEXT: [[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
44 return _mm_cmplt_pd(A
, B
);
47 __m128d
test_mm_cmpneq_pd(__m128d A
, __m128d B
) {
48 // CHECK-LABEL: test_mm_cmpneq_pd
49 // CHECK: [[CMP:%.*]] = call <2 x i1> @llvm.experimental.constrained.fcmp.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, metadata !"une", metadata !"fpexcept.strict")
50 // CHECK-NEXT: [[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
51 // CHECK-NEXT: [[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
52 return _mm_cmpneq_pd(A
, B
);
55 __m128d
test_mm_cmpnge_pd(__m128d A
, __m128d B
) {
56 // CHECK-LABEL: test_mm_cmpnge_pd
57 // CHECK: [[CMP:%.*]] = call <2 x i1> @llvm.experimental.constrained.fcmps.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, metadata !"ugt", metadata !"fpexcept.strict")
58 // CHECK-NEXT: [[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
59 // CHECK-NEXT: [[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
60 return _mm_cmpnge_pd(A
, B
);
63 __m128d
test_mm_cmpngt_pd(__m128d A
, __m128d B
) {
64 // CHECK-LABEL: test_mm_cmpngt_pd
65 // CHECK: [[CMP:%.*]] = call <2 x i1> @llvm.experimental.constrained.fcmps.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, metadata !"uge", metadata !"fpexcept.strict")
66 // CHECK-NEXT: [[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
67 // CHECK-NEXT: [[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
68 return _mm_cmpngt_pd(A
, B
);
71 __m128d
test_mm_cmpnle_pd(__m128d A
, __m128d B
) {
72 // CHECK-LABEL: test_mm_cmpnle_pd
73 // CHECK: [[CMP:%.*]] = call <2 x i1> @llvm.experimental.constrained.fcmps.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, metadata !"ugt", metadata !"fpexcept.strict")
74 // CHECK-NEXT: [[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
75 // CHECK-NEXT: [[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
76 return _mm_cmpnle_pd(A
, B
);
79 __m128d
test_mm_cmpnlt_pd(__m128d A
, __m128d B
) {
80 // CHECK-LABEL: test_mm_cmpnlt_pd
81 // CHECK: [[CMP:%.*]] = call <2 x i1> @llvm.experimental.constrained.fcmps.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, metadata !"uge", metadata !"fpexcept.strict")
82 // CHECK-NEXT: [[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
83 // CHECK-NEXT: [[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
84 return _mm_cmpnlt_pd(A
, B
);
87 __m128d
test_mm_cmpord_pd(__m128d A
, __m128d B
) {
88 // CHECK-LABEL: test_mm_cmpord_pd
89 // CHECK: [[CMP:%.*]] = call <2 x i1> @llvm.experimental.constrained.fcmp.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, metadata !"ord", metadata !"fpexcept.strict")
90 // CHECK-NEXT: [[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
91 // CHECK-NEXT: [[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
92 return _mm_cmpord_pd(A
, B
);
95 __m128d
test_mm_cmpunord_pd(__m128d A
, __m128d B
) {
96 // CHECK-LABEL: test_mm_cmpunord_pd
97 // CHECK: [[CMP:%.*]] = call <2 x i1> @llvm.experimental.constrained.fcmp.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, metadata !"uno", metadata !"fpexcept.strict")
98 // CHECK-NEXT: [[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
99 // CHECK-NEXT: [[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
100 return _mm_cmpunord_pd(A
, B
);