Debian Codegraph @

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

raw
1 // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +sse4.1 -fclangir -emit-cir -o %t.cir -Wall -Werror -Wsign-conversion
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 +sse4.1 -fclangir -emit-llvm -o %t.ll -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 +sse4.1 -fclangir -emit-cir -o %t.cir -Wall -Werror -Wsign-conversion
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 +sse4.1 -fclangir -emit-llvm -o %t.ll -Wall -Werror -Wsign-conversion
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-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror -Wsign-conversion | FileCheck %s --check-prefixes=OGCG
12 // RUN: %clang_cc1 -x c -flax-vector-conversions=none -fms-extensions -fms-compatibility -ffreestanding %s -triple=x86_64-windows-msvc -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror -Wsign-conversion | FileCheck %s --check-prefixes=OGCG
13 // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror -Wsign-conversion | FileCheck %s --check-prefixes=OGCG
14 // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -fms-extensions -fms-compatibility -ffreestanding %s -triple=x86_64-windows-msvc -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror -Wsign-conversion | FileCheck %s --check-prefixes=OGCG
15
16 #include <immintrin.h>
17
18 __m128i test_mm_mul_epi32(__m128i x, __m128i y) {
19 // CIR-LABEL: _mm_mul_epi32
20 // CIR: [[A64:%.*]] = cir.cast bitcast %{{.*}} : {{.*}} -> !cir.vector<2 x !s64i>
21 // CIR: [[B64:%.*]] = cir.cast bitcast %{{.*}} : {{.*}} -> !cir.vector<2 x !s64i>
22 // CIR: [[SC:%.*]] = cir.const #cir.int<32> : !s64i
23 // CIR: [[SV:%.*]] = cir.vec.splat [[SC]] : !s64i, !cir.vector<2 x !s64i>
24 // CIR: [[SHL_A:%.*]] = cir.shift(left, [[A64]] : !cir.vector<2 x !s64i>, [[SV]] : !cir.vector<2 x !s64i>)
25 // CIR: [[ASHR_A:%.*]] = cir.shift(right, [[SHL_A]] : !cir.vector<2 x !s64i>, [[SV]] : !cir.vector<2 x !s64i>)
26 // CIR: [[SHL_B:%.*]] = cir.shift(left, [[B64]] : !cir.vector<2 x !s64i>, [[SV]] : !cir.vector<2 x !s64i>)
27 // CIR: [[ASHR_B:%.*]] = cir.shift(right, [[SHL_B]] : !cir.vector<2 x !s64i>, [[SV]] : !cir.vector<2 x !s64i>)
28 // CIR: [[MUL:%.*]] = cir.binop(mul, [[ASHR_A]], [[ASHR_B]])
29
30 // LLVM-LABEL: _mm_mul_epi32
31 // LLVM: shl <2 x i64> %{{.*}}, splat (i64 32)
32 // LLVM: ashr <2 x i64> %{{.*}}, splat (i64 32)
33 // LLVM: shl <2 x i64> %{{.*}}, splat (i64 32)
34 // LLVM: ashr <2 x i64> %{{.*}}, splat (i64 32)
35 // LLVM: mul <2 x i64> %{{.*}}, %{{.*}}
36
37 // OGCG-LABEL: _mm_mul_epi32
38 // OGCG: shl <2 x i64> %{{.*}}, splat (i64 32)
39 // OGCG: ashr <2 x i64> %{{.*}}, splat (i64 32)
40 // OGCG: shl <2 x i64> %{{.*}}, splat (i64 32)
41 // OGCG: ashr <2 x i64> %{{.*}}, splat (i64 32)
42 // OGCG: mul <2 x i64> %{{.*}}, %{{.*}}
43
44 return _mm_mul_epi32(x, y);
45 }