1
1
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O2 -fclangir -emit-cir %s -o - | FileCheck %s --check-prefix=CIR
2
2
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O2 -fclangir -emit-llvm %s -o - | FileCheck %s -check-prefix=LLVM
3
- // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O2 -emit-llvm %s -o - | FileCheck %s -check-prefix=OG
3
+ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O2 -emit-llvm %s -o - | FileCheck %s -check-prefix=OGCG
4
4
5
5
typedef float __m128 __attribute__((__vector_size__ (16 ), __aligned__ (16 )));
6
6
typedef double __m128d __attribute__((__vector_size__ (16 ), __aligned__ (16 )));
7
7
8
8
__m128 test_cmpnleps (__m128 A , __m128 B ) {
9
-
10
9
// CIR-LABEL: @test_cmpnleps
11
10
// CIR: [[CMP:%.*]] = cir.vec.cmp(le, [[A:%.*]], [[B:%.*]]) : !cir.vector<!cir.float x 4>, !cir.vector<!s32i x 4>
12
11
// CIR: [[NOTCMP:%.*]] = cir.unary(not, [[CMP]]) : !cir.vector<!s32i x 4>, !cir.vector<!s32i x 4>
@@ -21,17 +20,16 @@ __m128 test_cmpnleps(__m128 A, __m128 B) {
21
20
// LLVM-NEXT: [[CAST:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float>
22
21
// LLVM-NEXT: ret <4 x float> [[CAST]]
23
22
24
- // OG -LABEL: test_cmpnleps
25
- // OG : [[CMP:%.*]] = fcmp ugt <4 x float> {{.*}}, {{.*}}
26
- // OG -NEXT: [[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i32>
27
- // OG -NEXT: [[CAST:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float>
28
- // OG -NEXT: ret <4 x float> [[CAST]]
23
+ // OGCG -LABEL: test_cmpnleps
24
+ // OGCG : [[CMP:%.*]] = fcmp ugt <4 x float> {{.*}}, {{.*}}
25
+ // OGCG -NEXT: [[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i32>
26
+ // OGCG -NEXT: [[CAST:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float>
27
+ // OGCG -NEXT: ret <4 x float> [[CAST]]
29
28
return __builtin_ia32_cmpnleps (A , B );
30
29
}
31
30
32
31
33
32
__m128d test_cmpnlepd (__m128d A , __m128d B ) {
34
-
35
33
// CIR-LABEL: @test_cmpnlepd
36
34
// CIR: [[CMP:%.*]] = cir.vec.cmp(le, [[A:%.*]], [[B:%.*]]) : !cir.vector<!cir.double x 2>, !cir.vector<!s64i x 2>
37
35
// CIR-NEXT: [[NOTCMP:%.*]] = cir.unary(not, [[CMP]]) : !cir.vector<!s64i x 2>, !cir.vector<!s64i x 2>
@@ -46,10 +44,59 @@ __m128d test_cmpnlepd(__m128d A, __m128d B) {
46
44
// LLVM-NEXT: [[CAST:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
47
45
// LLVM-NEXT: ret <2 x double> [[CAST]]
48
46
49
- // OG -LABEL: test_cmpnlepd
50
- // OG : [[CMP:%.*]] = fcmp ugt <2 x double> {{.*}}, {{.*}}
51
- // OG -NEXT: [[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
52
- // OG -NEXT: [[CAST:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
53
- // OG -NEXT: ret <2 x double> [[CAST]]
47
+ // OGCG -LABEL: test_cmpnlepd
48
+ // OGCG : [[CMP:%.*]] = fcmp ugt <2 x double> {{.*}}, {{.*}}
49
+ // OGCG -NEXT: [[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
50
+ // OGCG -NEXT: [[CAST:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
51
+ // OGCG -NEXT: ret <2 x double> [[CAST]]
54
52
return __builtin_ia32_cmpnlepd (A , B );
55
53
}
54
+
55
+
56
+ __m128 test_cmpnltps (__m128 A , __m128 B ) {
57
+ // CIR-LABEL: @test_cmpnltps
58
+ // CIR: [[CMP:%.*]] = cir.vec.cmp(lt, [[A:%.*]], [[B:%.*]]) : !cir.vector<!cir.float x 4>, !cir.vector<!s32i x 4>
59
+ // CIR: [[NOTCMP:%.*]] = cir.unary(not, [[CMP]]) : !cir.vector<!s32i x 4>, !cir.vector<!s32i x 4>
60
+ // CIR-NEXT: [[CAST:%.*]] = cir.cast(bitcast, [[NOTCMP:%.*]] : !cir.vector<!s32i x 4>), !cir.vector<!cir.float x 4>
61
+ // CIR-NEXT: cir.store [[CAST]], [[ALLOCA:%.*]] : !cir.vector<!cir.float x 4>, !cir.ptr<!cir.vector<!cir.float x 4>>
62
+ // CIR-NEXT: [[LD:%.*]] = cir.load [[ALLOCA]] :
63
+ // CIR-NEXT: cir.return [[LD]] : !cir.vector<!cir.float x 4>
64
+
65
+ // LLVM-LABEL: test_cmpnltps
66
+ // LLVM: [[CMP:%.*]] = fcmp uge <4 x float> {{.*}}, {{.*}}
67
+ // LLVM-NEXT: [[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i32>
68
+ // LLVM-NEXT: [[CAST:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float>
69
+ // LLVM-NEXT: ret <4 x float> [[CAST]]
70
+
71
+ // OGCG-LABEL: test_cmpnltps
72
+ // OGCG: [[CMP:%.*]] = fcmp uge <4 x float> {{.*}}, {{.*}}
73
+ // OGCG-NEXT: [[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i32>
74
+ // OGCG-NEXT: [[CAST:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float>
75
+ // OGCG-NEXT: ret <4 x float> [[CAST]]
76
+ return __builtin_ia32_cmpnltps (A , B );
77
+ }
78
+
79
+
80
+ __m128d test_cmpnltpd (__m128d A , __m128d B ) {
81
+ // CIR-LABEL: @test_cmpnltpd
82
+ // CIR: [[CMP:%.*]] = cir.vec.cmp(lt, [[A:%.*]], [[B:%.*]]) : !cir.vector<!cir.double x 2>, !cir.vector<!s64i x 2>
83
+ // CIR-NEXT: [[NOTCMP:%.*]] = cir.unary(not, [[CMP]]) : !cir.vector<!s64i x 2>, !cir.vector<!s64i x 2>
84
+ // CIR-NEXT: [[CAST:%.*]] = cir.cast(bitcast, [[NOTCMP]] : !cir.vector<!s64i x 2>), !cir.vector<!cir.double x 2>
85
+ // CIR-NEXT: cir.store [[CAST]], [[ALLOCA:%.*]] : !cir.vector<!cir.double x 2>, !cir.ptr<!cir.vector<!cir.double x 2>>
86
+ // CIR-NEXT: [[LD:%.*]] = cir.load [[ALLOCA]] :
87
+ // CIR-NEXT: cir.return [[LD]] : !cir.vector<!cir.double x 2>
88
+
89
+ // LLVM-LABEL: test_cmpnltpd
90
+ // LLVM: [[CMP:%.*]] = fcmp uge <2 x double> {{.*}}, {{.*}}
91
+ // LLVM-NEXT: [[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
92
+ // LLVM-NEXT: [[CAST:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
93
+ // LLVM-NEXT: ret <2 x double> [[CAST]]
94
+
95
+ // OGCG-LABEL: test_cmpnltpd
96
+ // OGCG: [[CMP:%.*]] = fcmp uge <2 x double> {{.*}}, {{.*}}
97
+ // OGCG-NEXT: [[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
98
+ // OGCG-NEXT: [[CAST:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
99
+ // OGCG-NEXT: ret <2 x double> [[CAST]]
100
+ return __builtin_ia32_cmpnltpd (A , B );
101
+ }
102
+
0 commit comments