|
| 1 | +// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512f -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 +avx512f -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 +avx512f -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 +avx512f -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 +avx512f -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 +avx512f -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 +avx512f -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 +avx512f -emit-llvm -o - -Wall -Werror -Wsign-conversion | FileCheck %s --check-prefixes=OGCG |
| 15 | + |
| 16 | +#include <immintrin.h> |
| 17 | + |
| 18 | +__m512 test_mm512_undefined(void) { |
| 19 | + // CIR-LABEL: _mm512_undefined |
| 20 | + // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<8 x !cir.double> |
| 21 | + // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<8 x !cir.double> -> !cir.vector<16 x !cir.float> |
| 22 | + // CIR: cir.return %{{.*}} : !cir.vector<16 x !cir.float> |
| 23 | + |
| 24 | + // LLVM-LABEL: test_mm512_undefined |
| 25 | + // LLVM: store <16 x float> zeroinitializer, ptr %[[A:.*]], align 64 |
| 26 | + // LLVM: %{{.*}} = load <16 x float>, ptr %[[A]], align 64 |
| 27 | + // LLVM: ret <16 x float> %{{.*}} |
| 28 | + |
| 29 | + // OGCG-LABEL: test_mm512_undefined |
| 30 | + // OGCG: ret <16 x float> zeroinitializer |
| 31 | + return _mm512_undefined(); |
| 32 | +} |
| 33 | + |
| 34 | +__m512 test_mm512_undefined_ps(void) { |
| 35 | + // CIR-LABEL: _mm512_undefined_ps |
| 36 | + // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<8 x !cir.double> |
| 37 | + // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<8 x !cir.double> -> !cir.vector<16 x !cir.float> |
| 38 | + // CIR: cir.return %{{.*}} : !cir.vector<16 x !cir.float> |
| 39 | + |
| 40 | + // LLVM-LABEL: test_mm512_undefined_ps |
| 41 | + // LLVM: store <16 x float> zeroinitializer, ptr %[[A:.*]], align 64 |
| 42 | + // LLVM: %{{.*}} = load <16 x float>, ptr %[[A]], align 64 |
| 43 | + // LLVM: ret <16 x float> %{{.*}} |
| 44 | + |
| 45 | + // OGCG-LABEL: test_mm512_undefined_ps |
| 46 | + // OGCG: ret <16 x float> zeroinitializer |
| 47 | + return _mm512_undefined_ps(); |
| 48 | +} |
| 49 | + |
| 50 | +__m512d test_mm512_undefined_pd(void) { |
| 51 | + // CIR-LABEL: _mm512_undefined_pd |
| 52 | + // CIR: %{{.*}} = cir.const #cir.zero : !cir.vector<8 x !cir.double> |
| 53 | + // CIR: cir.return %{{.*}} : !cir.vector<8 x !cir.double> |
| 54 | + |
| 55 | + // LLVM-LABEL: test_mm512_undefined_pd |
| 56 | + // LLVM: store <8 x double> zeroinitializer, ptr %[[A:.*]], align 64 |
| 57 | + // LLVM: %{{.*}} = load <8 x double>, ptr %[[A]], align 64 |
| 58 | + // LLVM: ret <8 x double> %{{.*}} |
| 59 | + |
| 60 | + // OGCG-LABEL: test_mm512_undefined_pd |
| 61 | + // OGCG: ret <8 x double> zeroinitializer |
| 62 | + return _mm512_undefined_pd(); |
| 63 | +} |
| 64 | + |
| 65 | +__m512i test_mm512_undefined_epi32(void) { |
| 66 | + // CIR-LABEL: _mm512_undefined_epi32 |
| 67 | + // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<8 x !cir.double> |
| 68 | + // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<8 x !cir.double> -> !cir.vector<8 x !s64i> |
| 69 | + // CIR: cir.return %{{.*}} : !cir.vector<8 x !s64i> |
| 70 | + |
| 71 | + // LLVM-LABEL: test_mm512_undefined_epi32 |
| 72 | + // LLVM: store <8 x i64> zeroinitializer, ptr %[[A:.*]], align 64 |
| 73 | + // LLVM: %{{.*}} = load <8 x i64>, ptr %[[A]], align 64 |
| 74 | + // LLVM: ret <8 x i64> %{{.*}} |
| 75 | + |
| 76 | + // OGCG-LABEL: test_mm512_undefined_epi32 |
| 77 | + // OGCG: ret <8 x i64> zeroinitializer |
| 78 | + return _mm512_undefined_epi32(); |
| 79 | +} |
0 commit comments