| 1 |
// RUN: %clang_cc1 -x c -ffreestanding %s -O0 -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 -O0 -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 -O0 -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_max_pd(__m512d __W, double ExtraAddOp){ |
| 8 |
// CIR-LABEL: _mm512_reduce_max_pd |
| 9 |
// CIR: cir.call_llvm_intrinsic "vector.reduce.fmax" %[[V:.*]] : (!cir.vector<8 x !cir.double>) -> !cir.double |
| 10 |
|
| 11 |
// CIR-LABEL: test_mm512_reduce_max_pd |
| 12 |
// CIR: cir.call @_mm512_reduce_max_pd(%[[VEC:.*]]) : (!cir.vector<8 x !cir.double>) -> !cir.double |
| 13 |
|
| 14 |
// LLVM-LABEL: test_mm512_reduce_max_pd |
| 15 |
// LLVM: call double @llvm.vector.reduce.fmax.v8f64(<8 x double> %{{.*}}) |
| 16 |
|
| 17 |
// OGCG-LABEL: test_mm512_reduce_max_pd |
| 18 |
// OGCG-NOT: nnan |
| 19 |
// OGCG: call nnan {{.*}}double @llvm.vector.reduce.fmax.v8f64(<8 x double> %{{.*}}) |
| 20 |
// OGCG-NOT: nnan |
| 21 |
return _mm512_reduce_max_pd(__W) + ExtraAddOp; |
| 22 |
} |
| 23 |
|
| 24 |
double test_mm512_reduce_min_pd(__m512d __W, double ExtraMulOp){ |
| 25 |
// CIR-LABEL: _mm512_reduce_min_pd |
| 26 |
// CIR: cir.call_llvm_intrinsic "vector.reduce.fmin" %[[V:.*]] : (!cir.vector<8 x !cir.double>) -> !cir.double |
| 27 |
|
| 28 |
// CIR-LABEL: test_mm512_reduce_min_pd |
| 29 |
// CIR: cir.call @_mm512_reduce_min_pd(%[[VEC:.*]]) : (!cir.vector<8 x !cir.double>) -> !cir.double |
| 30 |
|
| 31 |
// LLVM-LABEL: test_mm512_reduce_min_pd |
| 32 |
// LLVM: call double @llvm.vector.reduce.fmin.v8f64(<8 x double> %{{.*}}) |
| 33 |
|
| 34 |
// OGCG-LABEL: test_mm512_reduce_min_pd |
| 35 |
// OGCG-NOT: nnan |
| 36 |
// OGCG: call nnan {{.*}}double @llvm.vector.reduce.fmin.v8f64(<8 x double> %{{.*}}) |
| 37 |
// OGCG-NOT: nnan |
| 38 |
return _mm512_reduce_min_pd(__W) * ExtraMulOp; |
| 39 |
} |
| 40 |
|
| 41 |
float test_mm512_reduce_max_ps(__m512 __W){ |
| 42 |
// CIR-LABEL: _mm512_reduce_max_ps |
| 43 |
// CIR: cir.call_llvm_intrinsic "vector.reduce.fmax" %[[V:.*]] : (!cir.vector<16 x !cir.float>) -> !cir.float |
| 44 |
|
| 45 |
// CIR-LABEL: test_mm512_reduce_max_ps |
| 46 |
// CIR: cir.call @_mm512_reduce_max_ps(%[[VEC:.*]]) : (!cir.vector<16 x !cir.float>) -> !cir.float |
| 47 |
|
| 48 |
// LLVM-LABEL: test_mm512_reduce_max_ps |
| 49 |
// LLVM: call float @llvm.vector.reduce.fmax.v16f32(<16 x float> %{{.*}}) |
| 50 |
|
| 51 |
// OGCG-LABEL: test_mm512_reduce_max_ps |
| 52 |
// OGCG: call nnan {{.*}}float @llvm.vector.reduce.fmax.v16f32(<16 x float> %{{.*}}) |
| 53 |
return _mm512_reduce_max_ps(__W); |
| 54 |
} |
| 55 |
|
| 56 |
float test_mm512_reduce_min_ps(__m512 __W){ |
| 57 |
// CIR-LABEL: _mm512_reduce_min_ps |
| 58 |
// CIR: cir.call_llvm_intrinsic "vector.reduce.fmin" %[[V:.*]] : (!cir.vector<16 x !cir.float>) -> !cir.float |
| 59 |
|
| 60 |
// CIR-LABEL: test_mm512_reduce_min_ps |
| 61 |
// CIR: cir.call @_mm512_reduce_min_ps(%[[VEC:.*]]) : (!cir.vector<16 x !cir.float>) -> !cir.float |
| 62 |
|
| 63 |
// LLVM-LABEL: test_mm512_reduce_min_ps |
| 64 |
// LLVM: call float @llvm.vector.reduce.fmin.v16f32(<16 x float> %{{.*}}) |
| 65 |
|
| 66 |
// OGCG-LABEL: test_mm512_reduce_min_ps |
| 67 |
// OGCG: call nnan {{.*}}float @llvm.vector.reduce.fmin.v16f32(<16 x float> %{{.*}}) |
| 68 |
return _mm512_reduce_min_ps(__W); |
| 69 |
} |