Debian Codegraph @

clang/test/CIR/CodeGenBuiltins/X86/avx512vp2intersect-builtins.c

raw
1 // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512vp2intersect -fclangir -emit-cir -o %t.cir -Wall -Werror
2 // RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
3 // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512vp2intersect -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 +avx512vp2intersect -fclangir -emit-cir -o %t.cir -Wall -Werror
7 // RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
8 // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512vp2intersect -fclangir -emit-llvm -o %t.ll -Wall -Werror
9 // RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s
10
11 // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512vp2intersect -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=OGCG
12 // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512vp2intersect -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=OGCG
13
14 #include <immintrin.h>
15
16
17 // CIR: !rec_anon_struct = !cir.record<struct {!cir.vector<16 x !cir.bool>, !cir.vector<16 x !cir.bool>}>
18 // CIR: !rec_anon_struct1 = !cir.record<struct {!cir.vector<8 x !cir.bool>, !cir.vector<8 x !cir.bool>}>
19 void test_mm512_2intersect_epi32(__m512i a, __m512i b, __mmask16 *m0, __mmask16 *m1) {
20 // CIR-LABEL: mm512_2intersect_epi32
21 // CIR: %[[RES:.*]] = cir.call_llvm_intrinsic "x86.avx512.vp2intersect.d.512" %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>) -> !rec_anon_struct
22 // CIR: %[[VAL1:.*]] = cir.extract_member %[[RES]][0] : !rec_anon_struct -> !cir.vector<16 x !cir.bool>
23 // CIR: %[[CAST1:.*]] = cir.cast bitcast %[[VAL1]] : !cir.vector<16 x !cir.bool> -> !u16i
24 // CIR: cir.store align(2) %[[CAST1]], %{{.*}} : !u16i, !cir.ptr<!u16i>
25 // CIR: %[[VAL2:.*]] = cir.extract_member %[[RES]][1] : !rec_anon_struct -> !cir.vector<16 x !cir.bool>
26 // CIR: %[[CAST2:.*]] = cir.cast bitcast %[[VAL2]] : !cir.vector<16 x !cir.bool> -> !u16i
27 // CIR: cir.store align(2) %[[CAST2]], %{{.*}} : !u16i, !cir.ptr<!u16i>
28
29 // LLVM-LABEL: test_mm512_2intersect_epi32
30 // LLVM: %[[RES:.*]] = call { <16 x i1>, <16 x i1> } @llvm.x86.avx512.vp2intersect.d.512(<16 x i32> %{{.*}}, <16 x i32> %{{.*}})
31 // LLVM: %[[VAL1:.*]] = extractvalue { <16 x i1>, <16 x i1> } %[[RES]], 0
32 // LLVM: %[[CAST1:.*]] = bitcast <16 x i1> %[[VAL1]] to i16
33 // LLVM: store i16 %[[CAST1]], ptr %{{.*}}, align 2
34 // LLVM: %[[VAL2:.*]] = extractvalue { <16 x i1>, <16 x i1> } %[[RES]], 1
35 // LLVM: %[[CAST2:.*]] = bitcast <16 x i1> %[[VAL2]] to i16
36 // LLVM: store i16 %[[CAST2]], ptr %{{.*}}, align 2
37
38 // OGCG-LABEL: test_mm512_2intersect_epi32
39 // OGCG: %[[RES:.*]] = call { <16 x i1>, <16 x i1> } @llvm.x86.avx512.vp2intersect.d.512(<16 x i32> %{{.*}}, <16 x i32> %{{.*}})
40 // OGCG: %[[VAL1:.*]] = extractvalue { <16 x i1>, <16 x i1> } %[[RES]], 0
41 // OGCG: %[[CAST1:.*]] = bitcast <16 x i1> %[[VAL1]] to i16
42 // OGCG: store i16 %[[CAST1]], ptr %{{.*}}, align 2
43 // OGCG: %[[VAL2:.*]] = extractvalue { <16 x i1>, <16 x i1> } %[[RES]], 1
44 // OGCG: %[[CAST2:.*]] = bitcast <16 x i1> %[[VAL2]] to i16
45 // OGCG: store i16 %[[CAST2]], ptr %{{.*}}, align 2
46 _mm512_2intersect_epi32(a, b, m0, m1);
47 }
48
49 void test_mm512_2intersect_epi64(__m512i a, __m512i b, __mmask8 *m0, __mmask8 *m1) {
50 // CIR-LABEL: mm512_2intersect_epi64
51 // CIR: %[[RES:.*]] = cir.call_llvm_intrinsic "x86.avx512.vp2intersect.q.512" %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !rec_anon_struct1
52 // CIR: %[[VAL1:.*]] = cir.extract_member %[[RES]][0] : !rec_anon_struct1 -> !cir.vector<8 x !cir.bool>
53 // CIR: %[[CAST1:.*]] = cir.cast bitcast %[[VAL1]] : !cir.vector<8 x !cir.bool> -> !u8i
54 // CIR: cir.store align(1) %[[CAST1]], %{{.*}} : !u8i, !cir.ptr<!u8i>
55 // CIR: %[[VAL2:.*]] = cir.extract_member %[[RES]][1] : !rec_anon_struct1 -> !cir.vector<8 x !cir.bool>
56 // CIR: %[[CAST2:.*]] = cir.cast bitcast %[[VAL2]] : !cir.vector<8 x !cir.bool> -> !u8i
57 // CIR: cir.store align(1) %[[CAST2]], %{{.*}} : !u8i, !cir.ptr<!u8i>
58
59 // LLVM-LABEL: test_mm512_2intersect_epi64
60 // LLVM: %[[RES:.*]] = call { <8 x i1>, <8 x i1> } @llvm.x86.avx512.vp2intersect.q.512(<8 x i64> %{{.*}}, <8 x i64> %{{.*}})
61 // LLVM: %[[VAL1:.*]] = extractvalue { <8 x i1>, <8 x i1> } %[[RES]], 0
62 // LLVM: %[[CAST1:.*]] = bitcast <8 x i1> %[[VAL1]] to i8
63 // LLVM: store i8 %[[CAST1]], ptr %{{.*}}, align 1
64 // LLVM: %[[VAL2:.*]] = extractvalue { <8 x i1>, <8 x i1> } %[[RES]], 1
65 // LLVM: %[[CAST2:.*]] = bitcast <8 x i1> %[[VAL2]] to i8
66 // LLVM: store i8 %[[CAST2]], ptr %{{.*}}, align 1
67
68 // OGCG-LABEL: test_mm512_2intersect_epi64
69 // OGCG: %[[RES:.*]] = call { <8 x i1>, <8 x i1> } @llvm.x86.avx512.vp2intersect.q.512(<8 x i64> %{{.*}}, <8 x i64> %{{.*}})
70 // OGCG: %[[VAL1:.*]] = extractvalue { <8 x i1>, <8 x i1> } %[[RES]], 0
71 // OGCG: %[[CAST1:.*]] = bitcast <8 x i1> %[[VAL1]] to i8
72 // OGCG: store i8 %[[CAST1]], ptr %{{.*}}, align 1
73 // OGCG: %[[VAL2:.*]] = extractvalue { <8 x i1>, <8 x i1> } %[[RES]], 1
74 // OGCG: %[[CAST2:.*]] = bitcast <8 x i1> %[[VAL2]] to i8
75 // OGCG: store i8 %[[CAST2]], ptr %{{.*}}, align 1
76 _mm512_2intersect_epi64(a, b, m0, m1);
77 }