-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL][NVPTX] Set default fdiv and sqrt for llvm.fpbuiltin #16714
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
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ca71b1f
try
MrSidims 5826911
[SYCL][NVPTX] Set default fdiv and sqrt for llvm.fpbuiltin for 3.0 ma…
MrSidims ee64287
apply comments
MrSidims b16492f
format
MrSidims 01b3032
rename
MrSidims 5ae0e94
typo
MrSidims 6720ed0
typo
MrSidims 5b6411a
formt
MrSidims 32d8f6b
wip
MrSidims 36f8688
fix bug, apply comment
MrSidims cc7333f
format
MrSidims 9ea17f8
Address comment and add 0.5 max error for nvptx
MrSidims 700ae48
format
MrSidims 2df0a72
apply suggestions
MrSidims e86be33
add test
MrSidims 6113cc3
fix typo
MrSidims 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
94 changes: 94 additions & 0 deletions
94
llvm/test/CodeGen/NVPTX/fp-builtin-intrinsics-nvvm-approx.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,94 @@ | ||
; RUN: opt -fpbuiltin-fn-selection -S < %s | FileCheck %s | ||
frasercrmck marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64" | ||
target triple = "nvptx64-nvidia-cuda" | ||
|
||
; CHECK-LABEL: @test_fdiv | ||
; CHECK: %{{.*}} = call float @llvm.nvvm.div.approx.f(float %{{.*}}, float %{{.*}}) | ||
; CHECK: %{{.*}} = fdiv <2 x float> %{{.*}}, %{{.*}} | ||
define void @test_fdiv(float %d1, <2 x float> %v2d1, | ||
float %d2, <2 x float> %v2d2) { | ||
entry: | ||
%t0 = call float @llvm.fpbuiltin.fdiv.f32(float %d1, float %d2) #0 | ||
%t1 = call <2 x float> @llvm.fpbuiltin.fdiv.v2f32(<2 x float> %v2d1, <2 x float> %v2d2) #0 | ||
ret void | ||
} | ||
|
||
; CHECK-LABEL: @test_fdiv_fast | ||
; CHECK: %{{.*}} = call fast float @llvm.nvvm.div.approx.f(float %{{.*}}, float %{{.*}}) | ||
; CHECK: %{{.*}} = fdiv fast <2 x float> %{{.*}}, %{{.*}} | ||
define void @test_fdiv_fast(float %d1, <2 x float> %v2d1, | ||
float %d2, <2 x float> %v2d2) { | ||
entry: | ||
%t0 = call fast float @llvm.fpbuiltin.fdiv.f32(float %d1, float %d2) #0 | ||
%t1 = call fast <2 x float> @llvm.fpbuiltin.fdiv.v2f32(<2 x float> %v2d1, <2 x float> %v2d2) #0 | ||
ret void | ||
} | ||
|
||
; CHECK-LABEL: @test_fdiv_max_error | ||
; CHECK: %{{.*}} = call float @llvm.nvvm.div.approx.f(float %{{.*}}, float %{{.*}}) | ||
; CHECK: %{{.*}} = fdiv <2 x float> %{{.*}}, %{{.*}} | ||
define void @test_fdiv_max_error(float %d1, <2 x float> %v2d1, | ||
float %d2, <2 x float> %v2d2) { | ||
entry: | ||
%t0 = call float @llvm.fpbuiltin.fdiv.f32(float %d1, float %d2) #2 | ||
%t1 = call <2 x float> @llvm.fpbuiltin.fdiv.v2f32(<2 x float> %v2d1, <2 x float> %v2d2) #2 | ||
ret void | ||
} | ||
|
||
declare float @llvm.fpbuiltin.fdiv.f32(float, float) | ||
declare <2 x float> @llvm.fpbuiltin.fdiv.v2f32(<2 x float>, <2 x float>) | ||
|
||
; CHECK-LABEL: @test_fdiv_double | ||
; CHECK: %{{.*}} = fdiv double %{{.*}}, %{{.*}} | ||
; CHECK: %{{.*}} = fdiv <2 x double> %{{.*}}, %{{.*}} | ||
define void @test_fdiv_double(double %d1, <2 x double> %v2d1, | ||
double %d2, <2 x double> %v2d2) { | ||
entry: | ||
%t0 = call double @llvm.fpbuiltin.fdiv.f64(double %d1, double %d2) #0 | ||
%t1 = call <2 x double> @llvm.fpbuiltin.fdiv.v2f64(<2 x double> %v2d1, <2 x double> %v2d2) #0 | ||
ret void | ||
} | ||
|
||
declare double @llvm.fpbuiltin.fdiv.f64(double, double) | ||
declare <2 x double> @llvm.fpbuiltin.fdiv.v2f64(<2 x double>, <2 x double>) | ||
|
||
; CHECK-LABEL: @test_sqrt | ||
; CHECK: %{{.*}} = call float @llvm.nvvm.sqrt.approx.f(float %{{.*}}) | ||
; CHECK: %{{.*}} = call <2 x float> @llvm.sqrt.v2f32(<2 x float> %{{.*}}) | ||
define void @test_sqrt(float %d, <2 x float> %v2d, <4 x float> %v4d) { | ||
entry: | ||
%t0 = call float @llvm.fpbuiltin.sqrt.f32(float %d) #1 | ||
%t1 = call <2 x float> @llvm.fpbuiltin.sqrt.v2f32(<2 x float> %v2d) #1 | ||
ret void | ||
} | ||
|
||
; CHECK-LABEL: @test_sqrt_max_error | ||
; CHECK: %{{.*}} = call float @llvm.nvvm.sqrt.approx.f(float %{{.*}}) | ||
; CHECK: %{{.*}} = call <2 x float> @llvm.sqrt.v2f32(<2 x float> %{{.*}}) | ||
define void @test_sqrt_max_error(float %d, <2 x float> %v2d, <4 x float> %v4d) { | ||
entry: | ||
%t0 = call float @llvm.fpbuiltin.sqrt.f32(float %d) #2 | ||
%t1 = call <2 x float> @llvm.fpbuiltin.sqrt.v2f32(<2 x float> %v2d) #2 | ||
ret void | ||
} | ||
|
||
declare float @llvm.fpbuiltin.sqrt.f32(float) | ||
declare <2 x float> @llvm.fpbuiltin.sqrt.v2f32(<2 x float>) | ||
|
||
; CHECK-LABEL: @test_sqrt_double | ||
; CHECK: %{{.*}} = call double @llvm.sqrt.f64(double %{{.*}}) | ||
; CHECK: %{{.*}} = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %{{.*}}) | ||
define void @test_sqrt_double(double %d, <2 x double> %v2d) { | ||
entry: | ||
%t0 = call double @llvm.fpbuiltin.sqrt.f64(double %d) #1 | ||
%t1 = call <2 x double> @llvm.fpbuiltin.sqrt.v2f64(<2 x double> %v2d) #1 | ||
ret void | ||
} | ||
|
||
declare double @llvm.fpbuiltin.sqrt.f64(double) | ||
declare <2 x double> @llvm.fpbuiltin.sqrt.v2f64(<2 x double>) | ||
|
||
attributes #0 = { "fpbuiltin-max-error"="2.5" } | ||
attributes #1 = { "fpbuiltin-max-error"="3.0" } | ||
attributes #2 = { "fpbuiltin-max-error"="10.0" } |
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.
Uh oh!
There was an error while loading. Please reload this page.