11// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O2 -fclangir -emit-cir %s -o - | FileCheck %s --check-prefix=CIR
22// 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
44
55typedef float __m128 __attribute__((__vector_size__ (16 ), __aligned__ (16 )));
66typedef double __m128d __attribute__((__vector_size__ (16 ), __aligned__ (16 )));
77
88__m128 test_cmpnleps (__m128 A , __m128 B ) {
9-
109 // CIR-LABEL: @test_cmpnleps
1110 // CIR: [[CMP:%.*]] = cir.vec.cmp(le, [[A:%.*]], [[B:%.*]]) : !cir.vector<!cir.float x 4>, !cir.vector<!s32i x 4>
1211 // 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) {
2120 // LLVM-NEXT: [[CAST:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float>
2221 // LLVM-NEXT: ret <4 x float> [[CAST]]
2322
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]]
2928 return __builtin_ia32_cmpnleps (A , B );
3029}
3130
3231
3332__m128d test_cmpnlepd (__m128d A , __m128d B ) {
34-
3533 // CIR-LABEL: @test_cmpnlepd
3634 // CIR: [[CMP:%.*]] = cir.vec.cmp(le, [[A:%.*]], [[B:%.*]]) : !cir.vector<!cir.double x 2>, !cir.vector<!s64i x 2>
3735 // 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) {
4644 // LLVM-NEXT: [[CAST:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
4745 // LLVM-NEXT: ret <2 x double> [[CAST]]
4846
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]]
5452 return __builtin_ia32_cmpnlepd (A , B );
5553}
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