-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[AArch64]SIMD fpcvt codegen for rounding nodes #165546
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
Merged
+615
−0
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6377946
[AArch64][GlobalISel] SIMD fpcvt codegen for rounding nodes
Lukacma cec5513
Merge branch 'llvm:main' into cvt-round
Lukacma d74cd15
Merge branch 'main' into cvt-round
Lukacma 3821797
Added patterns for legalized rounding nodes
Lukacma 0f90db6
split tests
Lukacma ed50a6a
test fix
Lukacma 10877d2
delete s file
Lukacma 21a0c8d
Remove globalISel work
Lukacma da01d0a
Merge branch 'main' into cvt-round
Lukacma 7e1c284
Adjust tests for clarity
Lukacma f085f44
Merge branch 'main' into cvt-round
Lukacma 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
199 changes: 199 additions & 0 deletions
199
llvm/test/CodeGen/AArch64/arm64-cvt-simd-round-rint-strictfp.ll
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,199 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
| ; RUN: llc < %s -mtriple aarch64-unknown-unknown -mattr=+fprcvt,+fullfp16 | FileCheck %s --check-prefixes=CHECK | ||
|
|
||
| ; | ||
| ; (L/LL)Round experimental | ||
| ; | ||
|
|
||
| define float @lround_i32_f16_simd_exp(half %x) { | ||
| ; CHECK-LABEL: lround_i32_f16_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: fcvtas s0, h0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i32 @llvm.experimental.constrained.lround.i32.f16(half %x, metadata !"fpexcept.strict") | ||
| %sum = bitcast i32 %val to float | ||
| ret float %sum | ||
| } | ||
|
|
||
| define double @lround_i64_f16_simd_exp(half %x) { | ||
| ; CHECK-LABEL: lround_i64_f16_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: fcvtas d0, h0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i64 @llvm.experimental.constrained.lround.i64.f16(half %x, metadata !"fpexcept.strict") | ||
| %bc = bitcast i64 %val to double | ||
| ret double %bc | ||
| } | ||
|
|
||
| define double @lround_i64_f32_simd_exp(float %x) { | ||
| ; CHECK-LABEL: lround_i64_f32_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: fcvtas d0, s0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i64 @llvm.experimental.constrained.lround.i64.f32(float %x, metadata !"fpexcept.strict") | ||
| %bc = bitcast i64 %val to double | ||
| ret double %bc | ||
| } | ||
|
|
||
| define float @lround_i32_f64_simd_exp(double %x) { | ||
| ; CHECK-LABEL: lround_i32_f64_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: fcvtas s0, d0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i32 @llvm.experimental.constrained.lround.i32.f64(double %x, metadata !"fpexcept.strict") | ||
| %bc = bitcast i32 %val to float | ||
| ret float %bc | ||
| } | ||
|
|
||
| define float @lround_i32_f32_simd_exp(float %x) { | ||
| ; CHECK-LABEL: lround_i32_f32_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: fcvtas s0, s0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i32 @llvm.experimental.constrained.lround.i32.f32(float %x, metadata !"fpexcept.strict") | ||
| %bc = bitcast i32 %val to float | ||
| ret float %bc | ||
| } | ||
|
|
||
| define double @lround_i64_f64_simd_exp(double %x) { | ||
| ; CHECK-LABEL: lround_i64_f64_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: fcvtas d0, d0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i64 @llvm.experimental.constrained.lround.i64.f64(double %x, metadata !"fpexcept.strict") | ||
| %bc = bitcast i64 %val to double | ||
| ret double %bc | ||
| } | ||
|
|
||
| define double @llround_i64_f16_simd_exp(half %x) { | ||
| ; CHECK-LABEL: llround_i64_f16_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: fcvtas d0, h0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i64 @llvm.experimental.constrained.llround.i64.f16(half %x, metadata !"fpexcept.strict") | ||
| %sum = bitcast i64 %val to double | ||
| ret double %sum | ||
| } | ||
|
|
||
| define double @llround_i64_f32_simd_exp(float %x) { | ||
| ; CHECK-LABEL: llround_i64_f32_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: fcvtas d0, s0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i64 @llvm.experimental.constrained.llround.i64.f32(float %x, metadata !"fpexcept.strict") | ||
| %bc = bitcast i64 %val to double | ||
| ret double %bc | ||
| } | ||
|
|
||
| define double @llround_i64_f64_simd_exp(double %x) { | ||
| ; CHECK-LABEL: llround_i64_f64_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: fcvtas d0, d0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i64 @llvm.experimental.constrained.llround.i64.f64(double %x, metadata !"fpexcept.strict") | ||
| %bc = bitcast i64 %val to double | ||
| ret double %bc | ||
| } | ||
|
|
||
| ; | ||
| ; (L/LL)Rint experimental | ||
| ; | ||
|
|
||
| define float @lrint_i32_f16_simd_exp(half %x) { | ||
| ; CHECK-LABEL: lrint_i32_f16_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: frintx h0, h0 | ||
| ; CHECK-NEXT: fcvtzs s0, h0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i32 @llvm.experimental.constrained.lrint.i32.f16(half %x, metadata !"round.tonearest", metadata !"fpexcept.strict") | ||
| %sum = bitcast i32 %val to float | ||
| ret float %sum | ||
| } | ||
|
|
||
| define double @lrint_i64_f16_simd_exp(half %x) { | ||
| ; CHECK-LABEL: lrint_i64_f16_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: frintx h0, h0 | ||
| ; CHECK-NEXT: fcvtzs d0, h0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i64 @llvm.experimental.constrained.lrint.i53.f16(half %x, metadata !"round.tonearest", metadata !"fpexcept.strict") | ||
| %bc = bitcast i64 %val to double | ||
| ret double %bc | ||
| } | ||
|
|
||
| define double @lrint_i64_f32_simd_exp(float %x) { | ||
| ; CHECK-LABEL: lrint_i64_f32_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: frintx s0, s0 | ||
| ; CHECK-NEXT: fcvtzs d0, s0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i64 @llvm.experimental.constrained.lrint.i64.f32(float %x, metadata !"round.tonearest", metadata !"fpexcept.strict") | ||
| %bc = bitcast i64 %val to double | ||
| ret double %bc | ||
| } | ||
|
|
||
| define float @lrint_i32_f64_simd_exp(double %x) { | ||
| ; CHECK-LABEL: lrint_i32_f64_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: frintx d0, d0 | ||
| ; CHECK-NEXT: fcvtzs s0, d0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i32 @llvm.experimental.constrained.lrint.i32.f64(double %x, metadata !"round.tonearest", metadata !"fpexcept.strict") | ||
| %bc = bitcast i32 %val to float | ||
| ret float %bc | ||
| } | ||
|
|
||
| define float @lrint_i32_f32_simd_exp(float %x) { | ||
| ; CHECK-LABEL: lrint_i32_f32_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: frintx s0, s0 | ||
| ; CHECK-NEXT: fcvtzs s0, s0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i32 @llvm.experimental.constrained.lrint.i32.f32(float %x, metadata !"round.tonearest", metadata !"fpexcept.strict") | ||
| %bc = bitcast i32 %val to float | ||
| ret float %bc | ||
| } | ||
|
|
||
| define double @lrint_i64_f64_simd_exp(double %x) { | ||
| ; CHECK-LABEL: lrint_i64_f64_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: frintx d0, d0 | ||
| ; CHECK-NEXT: fcvtzs d0, d0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i64 @llvm.experimental.constrained.lrint.i64.f64(double %x, metadata !"round.tonearest", metadata !"fpexcept.strict") | ||
| %bc = bitcast i64 %val to double | ||
| ret double %bc | ||
| } | ||
|
|
||
| define double @llrint_i64_f16_simd_exp(half %x) { | ||
| ; CHECK-LABEL: llrint_i64_f16_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: frintx h0, h0 | ||
| ; CHECK-NEXT: fcvtzs d0, h0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i64 @llvm.experimental.constrained.llrint.i64.f16(half %x, metadata !"round.tonearest", metadata !"fpexcept.strict") | ||
| %sum = bitcast i64 %val to double | ||
| ret double %sum | ||
| } | ||
|
|
||
| define double @llrint_i64_f32_simd_exp(float %x) { | ||
| ; CHECK-LABEL: llrint_i64_f32_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: frintx s0, s0 | ||
| ; CHECK-NEXT: fcvtzs d0, s0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i64 @llvm.experimental.constrained.llrint.i64.f32(float %x, metadata !"round.tonearest", metadata !"fpexcept.strict") | ||
| %bc = bitcast i64 %val to double | ||
| ret double %bc | ||
| } | ||
|
|
||
| define double @llrint_i64_f64_simd_exp(double %x) { | ||
| ; CHECK-LABEL: llrint_i64_f64_simd_exp: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: frintx d0, d0 | ||
| ; CHECK-NEXT: fcvtzs d0, d0 | ||
| ; CHECK-NEXT: ret | ||
| %val = call i64 @llvm.experimental.constrained.llrint.i64.f64(double %x, metadata !"round.tonearest", metadata !"fpexcept.strict") | ||
| %bc = bitcast i64 %val to double | ||
| ret double %bc | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
experimental->constrained fporstrictfp.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done