-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[flang] Define ERF, ERFC and ERFC_SCALED intrinsics with Q and D prefix #125217
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
JDPailleux
merged 1 commit into
llvm:main
from
SiPearl:jdp/flang/d_q_prefix_erf_erfc_erfcscaled
Apr 1, 2025
Merged
Changes from all commits
Commits
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
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,16 @@ | ||
! RUN: bbc -emit-fir %s -o - --math-runtime=fast | FileCheck --check-prefixes=ALL,FAST %s | ||
! RUN: %flang_fc1 -emit-fir -mllvm -math-runtime=fast %s -o - | FileCheck --check-prefixes=ALL,FAST %s | ||
! RUN: bbc -emit-fir %s -o - --math-runtime=relaxed | FileCheck --check-prefixes=ALL,RELAXED %s | ||
! RUN: %flang_fc1 -emit-fir -mllvm -math-runtime=relaxed %s -o - | FileCheck --check-prefixes=ALL,RELAXED %s | ||
! RUN: bbc -emit-fir %s -o - --math-runtime=precise | FileCheck --check-prefixes=ALL,PRECISE %s | ||
! RUN: %flang_fc1 -emit-fir -mllvm -math-runtime=precise %s -o - | FileCheck --check-prefixes=ALL,PRECISE %s | ||
|
||
function dtest_real8(x) | ||
real(8) :: x, dtest_real8 | ||
dtest_real8 = derf(x) | ||
end function | ||
|
||
! ALL-LABEL: @_QPdtest_real8 | ||
! FAST: {{%[A-Za-z0-9._]+}} = math.erf {{%[A-Za-z0-9._]+}} {{.*}}: f64 | ||
! RELAXED: {{%[A-Za-z0-9._]+}} = math.erf {{%[A-Za-z0-9._]+}} {{.*}}: f64 | ||
! PRECISE: {{%[A-Za-z0-9._]+}} = fir.call @erf({{%[A-Za-z0-9._]+}}) {{.*}}: (f64) -> f64 |
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
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
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,9 @@ | ||
! REQUIRES: flang-supports-f128-math | ||
! RUN: bbc -emit-fir %s -o - | FileCheck %s | ||
! RUN: bbc --math-runtime=precise -emit-fir %s -o - | FileCheck %s | ||
! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s | ||
|
||
! CHECK: fir.call @_FortranAErfcScaled16({{.*}}) {{.*}}: (f128) -> f128 | ||
real(16) :: a, b | ||
b = qerfc_scaled(a) | ||
end |
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,29 @@ | ||
! RUN: not %flang_fc1 -fsyntax-only %s 2>&1 | FileCheck --check-prefix=ERROR %s | ||
|
||
function derf8_error4(x) | ||
real(kind=8) :: derf8_error4 | ||
real(kind=4) :: x | ||
derf8_error4 = derf(x); | ||
! ERROR: Actual argument for 'x=' has bad type or kind 'REAL(4)' | ||
end function derf8_error4 | ||
|
||
function derf8_error16(x) | ||
real(kind=8) :: derf8_error16 | ||
real(kind=16) :: x | ||
derf8_error16 = derf(x); | ||
! ERROR: Actual argument for 'x=' has bad type or kind 'REAL(16)' | ||
end function derf8_error16 | ||
|
||
function qerf16_error4(x) | ||
real(kind=16) :: qerf16_error4 | ||
real(kind=4) :: x | ||
qerf16_error4 = qerf(x); | ||
! ERROR: Actual argument for 'x=' has bad type or kind 'REAL(4)' | ||
end function qerf16_error4 | ||
|
||
function qerf16_error8(x) | ||
real(kind=16) :: qerf16_error8 | ||
real(kind=8) :: x | ||
qerf16_error8 = qerf(x); | ||
! ERROR: Actual argument for 'x=' has bad type or kind 'REAL(8)' | ||
end function qerf16_error8 |
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,29 @@ | ||
! RUN: not %flang_fc1 -fsyntax-only %s 2>&1 | FileCheck --check-prefix=ERROR %s | ||
|
||
function derfc8_error4(x) | ||
real(kind=8) :: derfc8_error4 | ||
real(kind=4) :: x | ||
derfc8_error4 = derfc(x); | ||
! ERROR: Actual argument for 'x=' has bad type or kind 'REAL(4)' | ||
end function derfc8_error4 | ||
|
||
function derfc8_error16(x) | ||
real(kind=8) :: derfc8_error16 | ||
real(kind=16) :: x | ||
derfc8_error16 = derfc(x); | ||
! ERROR: Actual argument for 'x=' has bad type or kind 'REAL(16)' | ||
end function derfc8_error16 | ||
|
||
function qerfc16_error4(x) | ||
real(kind=16) :: qerfc16_error4 | ||
real(kind=4) :: x | ||
qerfc16_error4 = qerfc(x); | ||
! ERROR: Actual argument for 'x=' has bad type or kind 'REAL(4)' | ||
end function qerfc16_error4 | ||
|
||
function qerfc16_error8(x) | ||
real(kind=16) :: qerfc16_error8 | ||
real(kind=8) :: x | ||
qerfc16_error8 = qerfc(x); | ||
! ERROR: Actual argument for 'x=' has bad type or kind 'REAL(8)' | ||
end function qerfc16_error8 |
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,29 @@ | ||
! RUN: not %flang_fc1 -fsyntax-only %s 2>&1 | FileCheck --check-prefix=ERROR %s | ||
|
||
function derfc_scaled8_error4(x) | ||
real(kind=8) :: derfc_scaled8_error4 | ||
real(kind=4) :: x | ||
derfc_scaled8_error4 = derfc_scaled(x); | ||
! ERROR: Actual argument for 'x=' has bad type or kind 'REAL(4)' | ||
end function derfc_scaled8_error4 | ||
|
||
function derfc_scaled8_error16(x) | ||
real(kind=8) :: derfc_scaled8_error16 | ||
real(kind=16) :: x | ||
derfc_scaled8_error16 = derfc_scaled(x); | ||
! ERROR: Actual argument for 'x=' has bad type or kind 'REAL(16)' | ||
end function derfc_scaled8_error16 | ||
|
||
function qerfc_scaled16_error4(x) | ||
real(kind=16) :: qerfc_scaled16_error4 | ||
real(kind=4) :: x | ||
qerfc_scaled16_error4 = qerfc_scaled(x); | ||
! ERROR: Actual argument for 'x=' has bad type or kind 'REAL(4)' | ||
end function qerfc_scaled16_error4 | ||
|
||
function qerfc_scaled16_error8(x) | ||
real(kind=16) :: qerfc_scaled16_error8 | ||
real(kind=8) :: x | ||
qerfc_scaled16_error8 = qerfc_scaled(x); | ||
! ERROR: Actual argument for 'x=' has bad type or kind 'REAL(8)' | ||
end function qerfc_scaled16_error8 |
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.