Debian Codegraph @

clang/test/CIR/CodeGenBuiltins/X86/avx512-reduceIntrin.c

raw
1 // RUN: %clang_cc1 -x c -ffreestanding %s -O2 -triple=x86_64-apple-darwin -target-cpu skylake-avx512 -fclangir -emit-cir -o - -Wall -Werror | FileCheck %s --check-prefixes=CIR
2 // RUN: %clang_cc1 -x c -ffreestanding %s -O2 -triple=x86_64-apple-darwin -target-cpu skylake-avx512 -fclangir -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=LLVM
3 // RUN: %clang_cc1 -x c -ffreestanding %s -O2 -triple=x86_64-apple-darwin -target-cpu skylake-avx512 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=OGCG
4
5 #include <immintrin.h>
6
7 double test_mm512_reduce_add_pd(__m512d __W, double ExtraAddOp){
8
9 // CIR-LABEL: _mm512_reduce_add_pd
10 // CIR: cir.call_llvm_intrinsic "vector.reduce.fadd" %[[R:.*]], %[[V:.*]] : (!cir.double, !cir.vector<8 x !cir.double>) -> !cir.double
11
12 // CIR-LABEL: test_mm512_reduce_add_pd
13 // CIR: cir.call @_mm512_reduce_add_pd(%[[VEC:.*]]) : (!cir.vector<8 x !cir.double>) -> !cir.double
14
15 // LLVM-LABEL: test_mm512_reduce_add_pd
16 // LLVM: call double @llvm.vector.reduce.fadd.v8f64(double -0.000000e+00, <8 x double> %{{.*}})
17
18 // OGCG-LABEL: test_mm512_reduce_add_pd
19 // OGCG-NOT: reassoc
20 // OGCG: call reassoc {{.*}}double @llvm.vector.reduce.fadd.v8f64(double -0.000000e+00, <8 x double> %{{.*}})
21 // OGCG-NOT: reassoc
22 return _mm512_reduce_add_pd(__W) + ExtraAddOp;
23 }
24
25 double test_mm512_reduce_mul_pd(__m512d __W, double ExtraMulOp){
26 // CIR-LABEL: _mm512_reduce_mul_pd
27 // CIR: cir.call_llvm_intrinsic "vector.reduce.fmul" %[[R:.*]], %[[V:.*]] : (!cir.double, !cir.vector<8 x !cir.double>) -> !cir.double
28
29 // CIR-LABEL: test_mm512_reduce_mul_pd
30 // CIR: cir.call @_mm512_reduce_mul_pd(%[[VEC:.*]]) : (!cir.vector<8 x !cir.double>) -> !cir.double
31
32 // LLVM-LABEL: test_mm512_reduce_mul_pd
33 // LLVM: call double @llvm.vector.reduce.fmul.v8f64(double 1.000000e+00, <8 x double> %{{.*}})
34
35 // OGCG-LABEL: test_mm512_reduce_mul_pd
36 // OGCG-NOT: reassoc
37 // OGCG: call reassoc {{.*}}double @llvm.vector.reduce.fmul.v8f64(double 1.000000e+00, <8 x double> %{{.*}})
38 // OGCG-NOT: reassoc
39 return _mm512_reduce_mul_pd(__W) * ExtraMulOp;
40 }
41
42
43 float test_mm512_reduce_add_ps(__m512 __W){
44 // CIR-LABEL: _mm512_reduce_add_ps
45 // CIR: cir.call_llvm_intrinsic "vector.reduce.fadd" %[[R:.*]], %[[V:.*]] : (!cir.float, !cir.vector<16 x !cir.float>) -> !cir.float
46
47 // CIR-LABEL: test_mm512_reduce_add_ps
48 // CIR: cir.call @_mm512_reduce_add_ps(%[[VEC:.*]]) : (!cir.vector<16 x !cir.float>) -> !cir.float
49
50 // LLVM-LABEL: test_mm512_reduce_add_ps
51 // LLVM: call float @llvm.vector.reduce.fadd.v16f32(float -0.000000e+00, <16 x float> %{{.*}})
52
53 // OGCG-LABEL: test_mm512_reduce_add_ps
54 // OGCG: call reassoc {{.*}}float @llvm.vector.reduce.fadd.v16f32(float -0.000000e+00, <16 x float> %{{.*}})
55 return _mm512_reduce_add_ps(__W);
56 }
57
58 float test_mm512_reduce_mul_ps(__m512 __W){
59 // CIR-LABEL: _mm512_reduce_mul_ps
60 // CIR: cir.call_llvm_intrinsic "vector.reduce.fmul" %[[R:.*]], %[[V:.*]] : (!cir.float, !cir.vector<16 x !cir.float>) -> !cir.float
61
62 // CIR-LABEL: test_mm512_reduce_mul_ps
63 // CIR: cir.call @_mm512_reduce_mul_ps(%[[VEC:.*]]) : (!cir.vector<16 x !cir.float>) -> !cir.float
64
65 // LLVM-LABEL: test_mm512_reduce_mul_ps
66 // LLVM: call float @llvm.vector.reduce.fmul.v16f32(float 1.000000e+00, <16 x float> %{{.*}})
67
68 // OGCG-LABEL: test_mm512_reduce_mul_ps
69 // OGCG: call reassoc {{.*}}float @llvm.vector.reduce.fmul.v16f32(float 1.000000e+00, <16 x float> %{{.*}})
70 return _mm512_reduce_mul_ps(__W);
71 }