-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[CIR] Upstream CIR codegen for undef x86 builtins #167945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Thibault-Monnier
wants to merge
13
commits into
llvm:main
Choose a base branch
from
Thibault-Monnier:cir-undef-codegen
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+356
−4
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e2cc7e2
Upstream CIR codegen for undef x86 builtins
Thibault-Monnier 713df01
Merge remote-tracking branch 'upstream/main' into cir-undef-codegen
Thibault-Monnier 63e7194
Add OGCG checks + fix labels + re-add header include
Thibault-Monnier 1b7ffc0
Fix failing tests
Thibault-Monnier db1e72a
Merge branch 'main' into cir-undef-codegen
Thibault-Monnier 0458843
Upstream additional undef tests
Thibault-Monnier f517a71
Merge branch 'main' into cir-undef-codegen
Thibault-Monnier 69e51eb
Upstream additional undef tests
Thibault-Monnier 600fb1d
Fix compilation
Thibault-Monnier e73fccf
Merge branch 'main' into cir-undef-codegen
Thibault-Monnier 63f5d26
Merge branch 'main' into cir-undef-codegen
Thibault-Monnier 2f80891
Merge branch 'main' into cir-undef-codegen
Thibault-Monnier d3d50b0
Merge branch 'main' into cir-undef-codegen
Thibault-Monnier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx -fclangir -emit-cir -o %t.cir -Wall -Werror | ||
| // RUN: FileCheck --check-prefixes=CIR --input-file=%t.cir %s | ||
| // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx -fno-signed-char -fclangir -emit-cir -o %t.cir -Wall -Werror | ||
| // RUN: FileCheck --check-prefixes=CIR --input-file=%t.cir %s | ||
|
|
||
| // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx -fclangir -emit-llvm -o %t.ll -Wall -Werror | ||
| // RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s | ||
| // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx -fno-signed-char -fclangir -emit-llvm -o %t.ll -Wall -Werror | ||
| // RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s | ||
|
|
||
| // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx -fclangir -emit-cir -o %t.cir -Wall -Werror | ||
| // RUN: FileCheck --check-prefixes=CIR --input-file=%t.cir %s | ||
| // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx -fno-signed-char -fclangir -emit-cir -o %t.cir -Wall -Werror | ||
| // RUN: FileCheck --check-prefixes=CIR --input-file=%t.cir %s | ||
|
|
||
| // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx -fclangir -emit-llvm -o %t.ll -Wall -Werror | ||
| // RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s | ||
| // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx -fno-signed-char -fclangir -emit-llvm -o %t.ll -Wall -Werror | ||
| // RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s | ||
|
|
||
| // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=OGCG | ||
| // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=OGCG | ||
| // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=OGCG | ||
| // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=OGCG | ||
|
|
||
| // This test mimics clang/test/CodeGen/X86/avx-builtins.c, which eventually | ||
| // CIR shall be able to support fully. | ||
|
|
||
| #include <immintrin.h> | ||
|
|
||
| __m256 test_mm256_undefined_ps(void) { | ||
| // CIR-LABEL: _mm256_undefined_ps | ||
| // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<4 x !cir.double> | ||
| // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<4 x !cir.double> -> !cir.vector<8 x !cir.float> | ||
| // CIR: cir.return %{{.*}} : !cir.vector<8 x !cir.float> | ||
|
|
||
| // LLVM-LABEL: test_mm256_undefined_ps | ||
| // LLVM: store <8 x float> zeroinitializer, ptr %[[A:.*]], align 32 | ||
| // LLVM: %{{.*}} = load <8 x float>, ptr %[[A]], align 32 | ||
| // LLVM: ret <8 x float> %{{.*}} | ||
|
|
||
| // OGCG-LABEL: test_mm256_undefined_ps | ||
| // OGCG: ret <8 x float> zeroinitializer | ||
| return _mm256_undefined_ps(); | ||
| } | ||
|
|
||
| __m256d test_mm256_undefined_pd(void) { | ||
| // CIR-LABEL: _mm256_undefined_pd | ||
| // CIR: %{{.*}} = cir.const #cir.zero : !cir.vector<4 x !cir.double> | ||
| // CIR: cir.return %{{.*}} : !cir.vector<4 x !cir.double> | ||
|
|
||
| // LLVM-LABEL: test_mm256_undefined_pd | ||
| // LLVM: store <4 x double> zeroinitializer, ptr %[[A:.*]], align 32 | ||
| // LLVM: %{{.*}} = load <4 x double>, ptr %[[A]], align 32 | ||
| // LLVM: ret <4 x double> %{{.*}} | ||
|
|
||
| // OGCG-LABEL: test_mm256_undefined_pd | ||
| // OGCG: ret <4 x double> zeroinitializer | ||
| return _mm256_undefined_pd(); | ||
| } | ||
|
|
||
| __m256i test_mm256_undefined_si256(void) { | ||
| // CIR-LABEL: _mm256_undefined_si256 | ||
| // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<4 x !cir.double> | ||
| // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<4 x !cir.double> -> !cir.vector<4 x !s64i> | ||
| // CIR: cir.return %{{.*}} : !cir.vector<4 x !s64i> | ||
|
|
||
| // LLVM-LABEL: test_mm256_undefined_si256 | ||
| // LLVM: store <4 x i64> zeroinitializer, ptr %[[A:.*]], align 32 | ||
| // LLVM: %{{.*}} = load <4 x i64>, ptr %[[A]], align 32 | ||
| // LLVM: ret <4 x i64> %{{.*}} | ||
|
|
||
| // OGCG-LABEL: test_mm256_undefined_si256 | ||
| // OGCG: ret <4 x i64> zeroinitializer | ||
| return _mm256_undefined_si256(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx10.2-512 -fclangir -emit-cir -o %t.cir -Wno-invalid-feature-combination -Wall -Werror -Wsign-conversion | ||
| // RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s | ||
| // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx10.2-512 -fclangir -emit-llvm -o %t.ll -Wno-invalid-feature-combination -Wall -Werror -Wsign-conversion | ||
| // RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s | ||
|
|
||
| // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx10.2 -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=OGCG | ||
| // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx10.2 -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=OGCG | ||
|
|
||
| #include <immintrin.h> | ||
|
|
||
| __m512bh test_mm512_undefined_pbh(void) { | ||
| // CIR-LABEL: _mm512_undefined_pbh | ||
| // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<8 x !cir.double> | ||
| // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<8 x !cir.double> -> !cir.vector<32 x !cir.bf16> | ||
| // CIR: cir.return %{{.*}} : !cir.vector<32 x !cir.bf16> | ||
|
|
||
| // CIR-LABEL: cir.func {{.*}}test_mm512_undefined_pbh | ||
| // CIR: call @_mm512_undefined_pbh | ||
|
|
||
| // LLVM-LABEL: test_mm512_undefined_pbh | ||
| // LLVM: store <32 x bfloat> zeroinitializer, ptr %[[A:.*]], align 64 | ||
| // LLVM: %{{.*}} = load <32 x bfloat>, ptr %[[A]], align 64 | ||
| // LLVM: ret <32 x bfloat> %{{.*}} | ||
|
|
||
| // OGCG-LABEL: test_mm512_undefined_pbh | ||
| // OGCG: ret <32 x bfloat> zeroinitializer | ||
| return _mm512_undefined_pbh(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx10.2-256 -fclangir -emit-cir -o %t.cir -Wno-invalid-feature-combination -Wall -Werror -Wsign-conversion | ||
| // RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s | ||
| // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx10.2-256 -fclangir -emit-llvm -o %t.ll -Wno-invalid-feature-combination -Wall -Werror -Wsign-conversion | ||
| // RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s | ||
|
|
||
| // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx10.2 -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=OGCG | ||
| // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx10.2 -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=OGCG | ||
|
|
||
| #include <immintrin.h> | ||
|
|
||
| __m128bh test_mm_undefined_pbh(void) { | ||
| // CIR-LABEL: _mm_undefined_pbh | ||
| // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<2 x !cir.double> | ||
| // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<2 x !cir.double> -> !cir.vector<8 x !cir.bf16> | ||
| // CIR: cir.return %{{.*}} : !cir.vector<8 x !cir.bf16> | ||
|
|
||
| // CIR-LABEL: cir.func {{.*}}test_mm_undefined_pbh | ||
| // CIR: call @_mm_undefined_pbh | ||
|
|
||
| // LLVM-LABEL: @test_mm_undefined_pbh | ||
| // LLVM: store <8 x bfloat> zeroinitializer, ptr %[[A:.*]], align 16 | ||
| // LLVM: %{{.*}} = load <8 x bfloat>, ptr %[[A]], align 16 | ||
| // LLVM: ret <8 x bfloat> %{{.*}} | ||
|
|
||
| // OGCG-LABEL: test_mm_undefined_pbh | ||
| // OGCG: ret <8 x bfloat> zeroinitializer | ||
| return _mm_undefined_pbh(); | ||
| } | ||
|
|
||
| __m256bh test_mm256_undefined_pbh(void) { | ||
| // CIR-LABEL: _mm256_undefined_pbh | ||
| // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<4 x !cir.double> | ||
| // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<4 x !cir.double> -> !cir.vector<16 x !cir.bf16> | ||
| // CIR: cir.return %{{.*}} : !cir.vector<16 x !cir.bf16> | ||
|
|
||
| // CIR-LABEL: cir.func {{.*}}test_mm256_undefined_pbh | ||
| // CIR: call @_mm256_undefined_pbh | ||
|
|
||
| // LLVM-LABEL: @test_mm256_undefined_pbh | ||
| // LLVM: store <16 x bfloat> zeroinitializer, ptr %[[A:.*]], align 32 | ||
| // LLVM: %{{.*}} = load <16 x bfloat>, ptr %[[A]], align 32 | ||
| // LLVM: ret <16 x bfloat> %{{.*}} | ||
|
|
||
| // OGCG-LABEL: test_mm256_undefined_pbh | ||
| // OGCG: ret <16 x bfloat> zeroinitializer | ||
| return _mm256_undefined_pbh(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| // 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 | ||
| // RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s | ||
| // 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 | ||
| // RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s | ||
|
|
||
| // 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 | ||
| // RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s | ||
| // 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 | ||
| // RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s | ||
|
|
||
| // 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 | ||
| // 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 | ||
| // 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 | ||
| // 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 | ||
|
|
||
| #include <immintrin.h> | ||
|
|
||
| __m512 test_mm512_undefined(void) { | ||
| // CIR-LABEL: _mm512_undefined | ||
| // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<8 x !cir.double> | ||
| // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<8 x !cir.double> -> !cir.vector<16 x !cir.float> | ||
| // CIR: cir.return %{{.*}} : !cir.vector<16 x !cir.float> | ||
|
|
||
| // LLVM-LABEL: test_mm512_undefined | ||
| // LLVM: store <16 x float> zeroinitializer, ptr %[[A:.*]], align 64 | ||
| // LLVM: %{{.*}} = load <16 x float>, ptr %[[A]], align 64 | ||
| // LLVM: ret <16 x float> %{{.*}} | ||
|
|
||
| // OGCG-LABEL: test_mm512_undefined | ||
| // OGCG: ret <16 x float> zeroinitializer | ||
| return _mm512_undefined(); | ||
| } | ||
|
|
||
| __m512 test_mm512_undefined_ps(void) { | ||
| // CIR-LABEL: _mm512_undefined_ps | ||
| // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<8 x !cir.double> | ||
| // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<8 x !cir.double> -> !cir.vector<16 x !cir.float> | ||
| // CIR: cir.return %{{.*}} : !cir.vector<16 x !cir.float> | ||
|
|
||
| // LLVM-LABEL: test_mm512_undefined_ps | ||
| // LLVM: store <16 x float> zeroinitializer, ptr %[[A:.*]], align 64 | ||
| // LLVM: %{{.*}} = load <16 x float>, ptr %[[A]], align 64 | ||
| // LLVM: ret <16 x float> %{{.*}} | ||
|
|
||
| // OGCG-LABEL: test_mm512_undefined_ps | ||
| // OGCG: ret <16 x float> zeroinitializer | ||
| return _mm512_undefined_ps(); | ||
| } | ||
|
|
||
| __m512d test_mm512_undefined_pd(void) { | ||
| // CIR-LABEL: _mm512_undefined_pd | ||
| // CIR: %{{.*}} = cir.const #cir.zero : !cir.vector<8 x !cir.double> | ||
| // CIR: cir.return %{{.*}} : !cir.vector<8 x !cir.double> | ||
|
|
||
| // LLVM-LABEL: test_mm512_undefined_pd | ||
| // LLVM: store <8 x double> zeroinitializer, ptr %[[A:.*]], align 64 | ||
| // LLVM: %{{.*}} = load <8 x double>, ptr %[[A]], align 64 | ||
| // LLVM: ret <8 x double> %{{.*}} | ||
|
|
||
| // OGCG-LABEL: test_mm512_undefined_pd | ||
| // OGCG: ret <8 x double> zeroinitializer | ||
| return _mm512_undefined_pd(); | ||
| } | ||
|
|
||
| __m512i test_mm512_undefined_epi32(void) { | ||
| // CIR-LABEL: _mm512_undefined_epi32 | ||
| // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<8 x !cir.double> | ||
| // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<8 x !cir.double> -> !cir.vector<8 x !s64i> | ||
| // CIR: cir.return %{{.*}} : !cir.vector<8 x !s64i> | ||
|
|
||
| // LLVM-LABEL: test_mm512_undefined_epi32 | ||
| // LLVM: store <8 x i64> zeroinitializer, ptr %[[A:.*]], align 64 | ||
| // LLVM: %{{.*}} = load <8 x i64>, ptr %[[A]], align 64 | ||
| // LLVM: ret <8 x i64> %{{.*}} | ||
|
|
||
| // OGCG-LABEL: test_mm512_undefined_epi32 | ||
| // OGCG: ret <8 x i64> zeroinitializer | ||
| return _mm512_undefined_epi32(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512fp16 -fclangir -emit-cir -o %t.cir -Wall -Werror | ||
| // RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s | ||
| // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512fp16 -fclangir -emit-llvm -o %t.ll -Wall -Werror | ||
| // RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s | ||
|
|
||
| // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512fp16 -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=OGCG | ||
| // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512fp16 -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=OGCG | ||
|
|
||
| #include <immintrin.h> | ||
|
|
||
| __m128h test_mm_undefined_ph(void) { | ||
| // CIR-LABEL: _mm_undefined_ph | ||
| // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<2 x !cir.double> | ||
| // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<2 x !cir.double> -> !cir.vector<8 x !cir.f16> | ||
| // CIR: cir.return %{{.*}} : !cir.vector<8 x !cir.f16> | ||
|
|
||
| // CIR-LABEL: cir.func {{.*}}test_mm_undefined_ph | ||
| // CIR: call @_mm_undefined_ph | ||
|
|
||
| // LLVM-LABEL: @test_mm_undefined_ph | ||
| // LLVM: store <8 x half> zeroinitializer, ptr %[[A:.*]], align 16 | ||
| // LLVM: %{{.*}} = load <8 x half>, ptr %[[A]], align 16 | ||
| // LLVM: ret <8 x half> %{{.*}} | ||
|
|
||
| // OGCG-LABEL: test_mm_undefined_ph | ||
| // OGCG: ret <8 x half> zeroinitializer | ||
| return _mm_undefined_ph(); | ||
| } | ||
|
|
||
| __m256h test_mm256_undefined_ph(void) { | ||
| // CIR-LABEL: _mm256_undefined_ph | ||
| // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<4 x !cir.double> | ||
| // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<4 x !cir.double> -> !cir.vector<16 x !cir.f16> | ||
| // CIR: cir.return %{{.*}} : !cir.vector<16 x !cir.f16> | ||
|
|
||
| // CIR-LABEL: cir.func {{.*}}test_mm256_undefined_ph | ||
| // CIR: call @_mm256_undefined_ph | ||
|
|
||
| // LLVM-LABEL: @test_mm256_undefined_ph | ||
| // LLVM: store <16 x half> zeroinitializer, ptr %[[A:.*]], align 32 | ||
| // LLVM: %{{.*}} = load <16 x half>, ptr %[[A]], align 32 | ||
| // LLVM: ret <16 x half> %{{.*}} | ||
|
|
||
| // OGCG-LABEL: test_mm256_undefined_ph | ||
| // OGCG: ret <16 x half> zeroinitializer | ||
| return _mm256_undefined_ph(); | ||
| } | ||
|
|
||
| __m512h test_mm512_undefined_ph(void) { | ||
| // CIR-LABEL: _mm512_undefined_ph | ||
| // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<8 x !cir.double> | ||
| // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<8 x !cir.double> -> !cir.vector<32 x !cir.f16> | ||
| // CIR: cir.return %{{.*}} : !cir.vector<32 x !cir.f16> | ||
|
|
||
| // CIR-LABEL: cir.func {{.*}}test_mm512_undefined_ph | ||
| // CIR: call @_mm512_undefined_ph | ||
|
|
||
| // LLVM-LABEL: @test_mm512_undefined_ph | ||
| // LLVM: store <32 x half> zeroinitializer, ptr %[[A:.*]], align 64 | ||
| // LLVM: %{{.*}} = load <32 x half>, ptr %[[A]], align 64 | ||
| // LLVM: ret <32 x half> %{{.*}} | ||
|
|
||
| // OGCG-LABEL: test_mm512_undefined_ph | ||
| // OGCG: ret <32 x half> zeroinitializer | ||
| return _mm512_undefined_ph(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.