brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.7 KiB · 309fc28 Raw
181 lines · c
1// RUN: %clang_cc1 -x c -ffreestanding %s -O0 -triple=x86_64-apple-darwin -target-cpu skylake-avx512 -emit-llvm -o - -Wall -Werror | FileCheck %s2// RUN: %clang_cc1 -x c -ffreestanding %s -O0 -triple=i386-apple-darwin -target-cpu skylake-avx512 -emit-llvm -o - -Wall -Werror | FileCheck %s3// RUN: %clang_cc1 -x c++ -ffreestanding %s -O0 -triple=x86_64-apple-darwin -target-cpu skylake-avx512 -emit-llvm -o - -Wall -Werror | FileCheck %s4// RUN: %clang_cc1 -x c++ -ffreestanding %s -O0 -triple=i386-apple-darwin -target-cpu skylake-avx512 -emit-llvm -o - -Wall -Werror | FileCheck %s5 6// RUN: %clang_cc1 -x c -ffreestanding %s -O0 -triple=x86_64-apple-darwin -target-cpu skylake-avx512 -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s7// RUN: %clang_cc1 -x c -ffreestanding %s -O0 -triple=i386-apple-darwin -target-cpu skylake-avx512 -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s8// RUN: %clang_cc1 -x c++ -ffreestanding %s -O0 -triple=x86_64-apple-darwin -target-cpu skylake-avx512 -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s9// RUN: %clang_cc1 -x c++ -ffreestanding %s -O0 -triple=i386-apple-darwin -target-cpu skylake-avx512 -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s10 11#include <immintrin.h>12#include "builtin_test_helpers.h"13 14long long test_mm512_reduce_max_epi64(__m512i __W){15// CHECK-LABEL: test_mm512_reduce_max_epi6416// CHECK:    call {{.*}}i64 @llvm.vector.reduce.smax.v8i64(<8 x i64> %{{.*}})17  return _mm512_reduce_max_epi64(__W);18}19TEST_CONSTEXPR(_mm512_reduce_max_epi64((__m512i)(__v8di){-4, -3, -2, -1, 0, 1, 2, 3}) == 3);20 21unsigned long long test_mm512_reduce_max_epu64(__m512i __W){22// CHECK-LABEL: test_mm512_reduce_max_epu6423// CHECK:    call {{.*}}i64 @llvm.vector.reduce.umax.v8i64(<8 x i64> %{{.*}})24  return _mm512_reduce_max_epu64(__W);25}26TEST_CONSTEXPR(_mm512_reduce_max_epu64((__m512i)(__v8du){0, 1, 2, 3, 4, 5, 6, 7}) == 7);27 28double test_mm512_reduce_max_pd(__m512d __W, double ExtraAddOp){29// CHECK-LABEL: test_mm512_reduce_max_pd30// CHECK-NOT: nnan31// CHECK:    call nnan {{.*}}double @llvm.vector.reduce.fmax.v8f64(<8 x double> %{{.*}})32// CHECK-NOT: nnan33  return _mm512_reduce_max_pd(__W) + ExtraAddOp;34}35 36long long test_mm512_reduce_min_epi64(__m512i __W){37// CHECK-LABEL: test_mm512_reduce_min_epi6438// CHECK:    call {{.*}}i64 @llvm.vector.reduce.smin.v8i64(<8 x i64> %{{.*}})39  return _mm512_reduce_min_epi64(__W);40}41TEST_CONSTEXPR(_mm512_reduce_min_epi64((__m512i)(__v8di){-4, -3, -2, -1, 0, 1, 2, 3}) == -4);42 43unsigned long long test_mm512_reduce_min_epu64(__m512i __W){44// CHECK-LABEL: test_mm512_reduce_min_epu6445// CHECK:    call {{.*}}i64 @llvm.vector.reduce.umin.v8i64(<8 x i64> %{{.*}})46  return _mm512_reduce_min_epu64(__W);47}48TEST_CONSTEXPR(_mm512_reduce_min_epu64((__m512i)(__v8du){0, 1, 2, 3, 4, 5, 6, 7}) == 0);49 50double test_mm512_reduce_min_pd(__m512d __W, double ExtraMulOp){51// CHECK-LABEL: test_mm512_reduce_min_pd52// CHECK-NOT: nnan53// CHECK:    call nnan {{.*}}double @llvm.vector.reduce.fmin.v8f64(<8 x double> %{{.*}})54// CHECK-NOT: nnan55  return _mm512_reduce_min_pd(__W) * ExtraMulOp;56}57 58long long test_mm512_mask_reduce_max_epi64(__mmask8 __M, __m512i __W){59// CHECK-LABEL: test_mm512_mask_reduce_max_epi6460// CHECK:    select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}61// CHECK:    call {{.*}}i64 @llvm.vector.reduce.smax.v8i64(<8 x i64> %{{.*}})62  return _mm512_mask_reduce_max_epi64(__M, __W);63}64 65unsigned long test_mm512_mask_reduce_max_epu64(__mmask8 __M, __m512i __W){66// CHECK-LABEL: test_mm512_mask_reduce_max_epu6467// CHECK:    select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}68// CHECK:    call {{.*}}i64 @llvm.vector.reduce.umax.v8i64(<8 x i64> %{{.*}})69  return _mm512_mask_reduce_max_epu64(__M, __W);70}71 72double test_mm512_mask_reduce_max_pd(__mmask8 __M, __m512d __W){73// CHECK-LABEL: test_mm512_mask_reduce_max_pd74// CHECK:    select <8 x i1> %{{.*}}, <8 x double> %{{.*}}, <8 x double> %{{.*}}75// CHECK:    call nnan {{.*}}double @llvm.vector.reduce.fmax.v8f64(<8 x double> %{{.*}})76  return _mm512_mask_reduce_max_pd(__M, __W);77}78 79long long test_mm512_mask_reduce_min_epi64(__mmask8 __M, __m512i __W){80// CHECK-LABEL: test_mm512_mask_reduce_min_epi6481// CHECK:    select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}82// CHECK:    call {{.*}}i64 @llvm.vector.reduce.smin.v8i64(<8 x i64> %{{.*}})83  return _mm512_mask_reduce_min_epi64(__M, __W);84}85 86unsigned long long test_mm512_mask_reduce_min_epu64(__mmask8 __M, __m512i __W){87// CHECK-LABEL: test_mm512_mask_reduce_min_epu6488// CHECK:    select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}89// CHECK:    call {{.*}}i64 @llvm.vector.reduce.umin.v8i64(<8 x i64> %{{.*}})90  return _mm512_mask_reduce_min_epu64(__M, __W);91}92 93double test_mm512_mask_reduce_min_pd(__mmask8 __M, __m512d __W){94// CHECK-LABEL: test_mm512_mask_reduce_min_pd95// CHECK:    select <8 x i1> %{{.*}}, <8 x double> %{{.*}}, <8 x double> %{{.*}}96// CHECK:    call nnan {{.*}}double @llvm.vector.reduce.fmin.v8f64(<8 x double> %{{.*}})97  return _mm512_mask_reduce_min_pd(__M, __W);98}99 100int test_mm512_reduce_max_epi32(__m512i __W){101// CHECK-LABEL: test_mm512_reduce_max_epi32102// CHECK:    call {{.*}}i32 @llvm.vector.reduce.smax.v16i32(<16 x i32> %{{.*}})103  return _mm512_reduce_max_epi32(__W);104}105TEST_CONSTEXPR(_mm512_reduce_max_epi32((__m512i)(__v16si){-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7}) == 7);106 107unsigned int test_mm512_reduce_max_epu32(__m512i __W){108// CHECK-LABEL: test_mm512_reduce_max_epu32109// CHECK:    call {{.*}}i32 @llvm.vector.reduce.umax.v16i32(<16 x i32> %{{.*}})110  return _mm512_reduce_max_epu32(__W);111}112TEST_CONSTEXPR(_mm512_reduce_max_epu32((__m512i)(__v16su){0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}) == 15);113 114float test_mm512_reduce_max_ps(__m512 __W){115// CHECK-LABEL: test_mm512_reduce_max_ps116// CHECK:    call nnan {{.*}}float @llvm.vector.reduce.fmax.v16f32(<16 x float> %{{.*}})117  return _mm512_reduce_max_ps(__W);118}119 120int test_mm512_reduce_min_epi32(__m512i __W){121// CHECK-LABEL: test_mm512_reduce_min_epi32122// CHECK:    call {{.*}}i32 @llvm.vector.reduce.smin.v16i32(<16 x i32> %{{.*}})123  return _mm512_reduce_min_epi32(__W);124}125TEST_CONSTEXPR(_mm512_reduce_min_epi32((__m512i)(__v16si){-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7}) == -8);126 127unsigned int test_mm512_reduce_min_epu32(__m512i __W){128// CHECK-LABEL: test_mm512_reduce_min_epu32129// CHECK:    call {{.*}}i32 @llvm.vector.reduce.umin.v16i32(<16 x i32> %{{.*}})130  return _mm512_reduce_min_epu32(__W);131}132TEST_CONSTEXPR(_mm512_reduce_min_epu32((__m512i)(__v16su){0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}) == 0);133 134float test_mm512_reduce_min_ps(__m512 __W){135// CHECK-LABEL: test_mm512_reduce_min_ps136// CHECK:    call nnan {{.*}}float @llvm.vector.reduce.fmin.v16f32(<16 x float> %{{.*}})137  return _mm512_reduce_min_ps(__W);138}139 140int test_mm512_mask_reduce_max_epi32(__mmask16 __M, __m512i __W){141// CHECK-LABEL: test_mm512_mask_reduce_max_epi32142// CHECK:    select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}143// CHECK:    call {{.*}}i32 @llvm.vector.reduce.smax.v16i32(<16 x i32> %{{.*}})144  return _mm512_mask_reduce_max_epi32(__M, __W);145}146 147unsigned int test_mm512_mask_reduce_max_epu32(__mmask16 __M, __m512i __W){148// CHECK-LABEL: test_mm512_mask_reduce_max_epu32149// CHECK:    select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}150// CHECK:    call {{.*}}i32 @llvm.vector.reduce.umax.v16i32(<16 x i32> %{{.*}})151  return _mm512_mask_reduce_max_epu32(__M, __W);152}153 154float test_mm512_mask_reduce_max_ps(__mmask16 __M, __m512 __W){155// CHECK-LABEL: test_mm512_mask_reduce_max_ps156// CHECK:    select <16 x i1> %{{.*}}, <16 x float> %{{.*}}, <16 x float> %{{.*}}157// CHECK:    call nnan {{.*}}float @llvm.vector.reduce.fmax.v16f32(<16 x float> %{{.*}})158  return _mm512_mask_reduce_max_ps(__M, __W);159}160 161int test_mm512_mask_reduce_min_epi32(__mmask16 __M, __m512i __W){162// CHECK-LABEL: test_mm512_mask_reduce_min_epi32163// CHECK:    select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}164// CHECK:    call {{.*}}i32 @llvm.vector.reduce.smin.v16i32(<16 x i32> %{{.*}})165  return _mm512_mask_reduce_min_epi32(__M, __W);166}167 168unsigned int test_mm512_mask_reduce_min_epu32(__mmask16 __M, __m512i __W){169// CHECK-LABEL: test_mm512_mask_reduce_min_epu32170// CHECK:    select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}171// CHECK:    call {{.*}}i32 @llvm.vector.reduce.umin.v16i32(<16 x i32> %{{.*}})172  return _mm512_mask_reduce_min_epu32(__M, __W);173}174 175float test_mm512_mask_reduce_min_ps(__mmask16 __M, __m512 __W){176// CHECK-LABEL: test_mm512_mask_reduce_min_ps177// CHECK:    select <16 x i1> %{{.*}}, <16 x float> %{{.*}}, <16 x float> %{{.*}}178// CHECK:    call nnan {{.*}}float @llvm.vector.reduce.fmin.v16f32(<16 x float> %{{.*}})179  return _mm512_mask_reduce_min_ps(__M, __W);180}181