Skip to content

Commit ce3959b

Browse files
Add missing tests
1 parent db1e72a commit ce3959b

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx10.2-256 -fclangir -emit-cir -o %t.cir -Wno-invalid-feature-combination -Wall -Werror -Wsign-conversion
2+
// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
3+
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx10.2-256 -fclangir -emit-llvm -o %t.ll -Wno-invalid-feature-combination -Wall -Werror -Wsign-conversion
4+
// RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s
5+
6+
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx10.2 -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=OGCG
7+
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx10.2 -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=OGCG
8+
9+
#include <immintrin.h>
10+
11+
__m128bh test_mm_undefined_pbh(void) {
12+
// CIR-LABEL: _mm_undefined_pbh
13+
// CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<2 x !cir.double>
14+
// CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<2 x !cir.double> -> !cir.vector<8 x !cir.bf16>
15+
// CIR: cir.return %{{.*}} : !cir.vector<8 x !cir.bf16>
16+
17+
// LLVM-LABEL: @test_mm_undefined_pbh
18+
// LLVM: store <8 x bfloat> zeroinitializer, ptr %[[A:.*]], align 16
19+
// LLVM: %{{.*}} = load <8 x bfloat>, ptr %[[A]], align 16
20+
// LLVM: ret <8 x bfloat> %{{.*}}
21+
22+
// OGCG-LABEL: test_mm_undefined_pbh
23+
// OGCG: ret <8 x bfloat> zeroinitializer
24+
return _mm_undefined_pbh();
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512fp16 -fclangir -emit-cir -o %t.cir -Wall -Werror
2+
// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
3+
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512fp16 -fclangir -emit-llvm -o %t.ll -Wall -Werror
4+
// RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s
5+
6+
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512fp16 -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=OGCG
7+
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512fp16 -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=OGCG
8+
9+
#include <immintrin.h>
10+
11+
__m128h test_mm_undefined_ph(void) {
12+
// CIR-LABEL: _mm_undefined_ph
13+
// CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<2 x !cir.double>
14+
// CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<2 x !cir.double> -> !cir.vector<8 x !cir.f16>
15+
// CIR: cir.return %{{.*}} : !cir.vector<8 x !cir.f16>
16+
17+
// LLVM-LABEL: @test_mm_undefined_ph
18+
// LLVM: store <8 x half> zeroinitializer, ptr %[[A:.*]], align 16
19+
// LLVM: %{{.*}} = load <8 x half>, ptr %[[A]], align 16
20+
// LLVM: ret <8 x half> %{{.*}}
21+
22+
// OGCG-LABEL: test_mm_undefined_ph
23+
// OGCG: ret <8 x half> zeroinitializer
24+
return _mm_undefined_ph();
25+
}

clang/test/CIR/CodeGen/X86/sse-builtins.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,19 @@ void test_mm_sfence(void) {
2626
// LLVM: call void @llvm.x86.sse.sfence()
2727
// OGCG: call void @llvm.x86.sse.sfence()
2828
}
29+
30+
__m128 test_mm_undefined_ps(void) {
31+
// CIR-LABEL: _mm_undefined_ps
32+
// CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<2 x !cir.double>
33+
// CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<2 x !cir.double> -> !cir.vector<4 x !cir.float>
34+
// CIR: cir.return %{{.*}} : !cir.vector<4 x !cir.float>
35+
36+
// LLVM-LABEL: test_mm_undefined_ps
37+
// LLVM: store <4 x float> zeroinitializer, ptr %[[A:.*]], align 16
38+
// LLVM: %{{.*}} = load <4 x float>, ptr %[[A]], align 16
39+
// LLVM: ret <4 x float> %{{.*}}
40+
41+
// OGCG-LABEL: test_mm_undefined_ps
42+
// OGCG: ret <4 x float> zeroinitializer
43+
return _mm_undefined_ps();
44+
}

0 commit comments

Comments
 (0)