-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[compiler-rt] Add initial ARM64EC builtins support #139279
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
cjacek
wants to merge
1
commit into
llvm:main
Choose a base branch
from
cjacek:arm64ec-compiler-rt
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.
Open
+55
−26
Conversation
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
Use the aarch64 variants of assembly functions. Based on a patch by Billy Laws.
You can test this locally with the following command:git-clang-format --diff HEAD~1 HEAD --extensions h,inc,c -- compiler-rt/lib/builtins/clear_cache.c compiler-rt/lib/builtins/cpu_model/aarch64.c compiler-rt/lib/builtins/cpu_model/aarch64.h compiler-rt/lib/builtins/fp_compare_impl.inc compiler-rt/lib/builtins/fp_lib.h compiler-rt/lib/builtins/udivmodti4.c compiler-rt/test/builtins/Unit/enable_execute_stack_test.c compiler-rt/test/builtins/Unit/fixunstfdi_test.c compiler-rt/test/builtins/Unit/multc3_test.c View the diff from clang-format here.diff --git a/compiler-rt/test/builtins/Unit/fixunstfdi_test.c b/compiler-rt/test/builtins/Unit/fixunstfdi_test.c
index 982f3a462..0a66602fa 100644
--- a/compiler-rt/test/builtins/Unit/fixunstfdi_test.c
+++ b/compiler-rt/test/builtins/Unit/fixunstfdi_test.c
@@ -6,7 +6,7 @@
#if _ARCH_PPC || __aarch64__ || __arm64ec__
-#include "int_lib.h"
+# include "int_lib.h"
// Returns: convert a to a unsigned long long, rounding toward zero.
// Negative values all become zero.
@@ -36,77 +36,77 @@ char assumption_3[sizeof(long double)*CHAR_BIT == 128] = {0};
int main()
{
#if _ARCH_PPC || __aarch64__ || __arm64ec__
- if (test__fixunstfdi(0.0, 0))
- return 1;
-
- if (test__fixunstfdi(0.5, 0))
- return 1;
- if (test__fixunstfdi(0.99, 0))
- return 1;
- if (test__fixunstfdi(1.0, 1))
- return 1;
- if (test__fixunstfdi(1.5, 1))
- return 1;
- if (test__fixunstfdi(1.99, 1))
- return 1;
- if (test__fixunstfdi(2.0, 2))
- return 1;
- if (test__fixunstfdi(2.01, 2))
- return 1;
- if (test__fixunstfdi(-0.5, 0))
- return 1;
- if (test__fixunstfdi(-0.99, 0))
- return 1;
- if (test__fixunstfdi(-1.0, 0))
- return 1;
- if (test__fixunstfdi(-1.5, 0))
- return 1;
- if (test__fixunstfdi(-1.99, 0))
- return 1;
- if (test__fixunstfdi(-2.0, 0))
- return 1;
- if (test__fixunstfdi(-2.01, 0))
- return 1;
-
- if (test__fixunstfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000LL))
- return 1;
- if (test__fixunstfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000LL))
- return 1;
-
- if (test__fixunstfdi(-0x1.FFFFFEp+62, 0))
- return 1;
- if (test__fixunstfdi(-0x1.FFFFFCp+62, 0))
- return 1;
-
- if (test__fixunstfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00LL))
- return 1;
- if (test__fixunstfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800LL))
- return 1;
-
- if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFp+62, 0))
- return 1;
- if (test__fixunstfdi(-0x1.FFFFFFFFFFFFEp+62, 0))
- return 1;
-
- if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFFEp+63L, 0xFFFFFFFFFFFFFFFFLL))
- return 1;
- if (test__fixunstfdi(0x1.0000000000000002p+63L, 0x8000000000000001LL))
- return 1;
- if (test__fixunstfdi(0x1.0000000000000000p+63L, 0x8000000000000000LL))
- return 1;
- if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFFCp+62L, 0x7FFFFFFFFFFFFFFFLL))
- return 1;
- if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFF8p+62L, 0x7FFFFFFFFFFFFFFELL))
- return 1;
- if (test__fixunstfdi(0x1.p+64L, 0xFFFFFFFFFFFFFFFFLL))
- return 1;
-
- if (test__fixunstfdi(-0x1.0000000000000000p+63L, 0))
- return 1;
- if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFFFCp+62L, 0))
- return 1;
- if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFFF8p+62L, 0))
- return 1;
+ if (test__fixunstfdi(0.0, 0))
+ return 1;
+
+ if (test__fixunstfdi(0.5, 0))
+ return 1;
+ if (test__fixunstfdi(0.99, 0))
+ return 1;
+ if (test__fixunstfdi(1.0, 1))
+ return 1;
+ if (test__fixunstfdi(1.5, 1))
+ return 1;
+ if (test__fixunstfdi(1.99, 1))
+ return 1;
+ if (test__fixunstfdi(2.0, 2))
+ return 1;
+ if (test__fixunstfdi(2.01, 2))
+ return 1;
+ if (test__fixunstfdi(-0.5, 0))
+ return 1;
+ if (test__fixunstfdi(-0.99, 0))
+ return 1;
+ if (test__fixunstfdi(-1.0, 0))
+ return 1;
+ if (test__fixunstfdi(-1.5, 0))
+ return 1;
+ if (test__fixunstfdi(-1.99, 0))
+ return 1;
+ if (test__fixunstfdi(-2.0, 0))
+ return 1;
+ if (test__fixunstfdi(-2.01, 0))
+ return 1;
+
+ if (test__fixunstfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000LL))
+ return 1;
+ if (test__fixunstfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000LL))
+ return 1;
+
+ if (test__fixunstfdi(-0x1.FFFFFEp+62, 0))
+ return 1;
+ if (test__fixunstfdi(-0x1.FFFFFCp+62, 0))
+ return 1;
+
+ if (test__fixunstfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00LL))
+ return 1;
+ if (test__fixunstfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800LL))
+ return 1;
+
+ if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFp+62, 0))
+ return 1;
+ if (test__fixunstfdi(-0x1.FFFFFFFFFFFFEp+62, 0))
+ return 1;
+
+ if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFFEp+63L, 0xFFFFFFFFFFFFFFFFLL))
+ return 1;
+ if (test__fixunstfdi(0x1.0000000000000002p+63L, 0x8000000000000001LL))
+ return 1;
+ if (test__fixunstfdi(0x1.0000000000000000p+63L, 0x8000000000000000LL))
+ return 1;
+ if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFFCp+62L, 0x7FFFFFFFFFFFFFFFLL))
+ return 1;
+ if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFF8p+62L, 0x7FFFFFFFFFFFFFFELL))
+ return 1;
+ if (test__fixunstfdi(0x1.p+64L, 0xFFFFFFFFFFFFFFFFLL))
+ return 1;
+
+ if (test__fixunstfdi(-0x1.0000000000000000p+63L, 0))
+ return 1;
+ if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFFFCp+62L, 0))
+ return 1;
+ if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFFF8p+62L, 0))
+ return 1;
#else
printf("skipped\n");
diff --git a/compiler-rt/test/builtins/Unit/multc3_test.c b/compiler-rt/test/builtins/Unit/multc3_test.c
index e9c99a72b..44707c75d 100644
--- a/compiler-rt/test/builtins/Unit/multc3_test.c
+++ b/compiler-rt/test/builtins/Unit/multc3_test.c
@@ -6,9 +6,9 @@
#if _ARCH_PPC || __aarch64__ || __arm64ec__
-#include "int_lib.h"
-#include <math.h>
-#include <complex.h>
+# include "int_lib.h"
+# include <math.h>
+# include <complex.h>
// Returns: the product of a + ib and c + id
@@ -349,16 +349,14 @@ long double x[][2] =
int main()
{
#if _ARCH_PPC || __aarch64__ || __arm64ec__
- const unsigned N = sizeof(x) / sizeof(x[0]);
- unsigned i, j;
- for (i = 0; i < N; ++i)
- {
- for (j = 0; j < N; ++j)
- {
- if (test__multc3(x[i][0], x[i][1], x[j][0], x[j][1]))
- return 1;
- }
+ const unsigned N = sizeof(x) / sizeof(x[0]);
+ unsigned i, j;
+ for (i = 0; i < N; ++i) {
+ for (j = 0; j < N; ++j) {
+ if (test__multc3(x[i][0], x[i][1], x[j][0], x[j][1]))
+ return 1;
}
+ }
#else
printf("skipped\n");
#endif
|
The code formatting errors relate to existing formatting around my changes. Including those in the diff would be misleading, in my opinion. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Use the aarch64 variants of assembly functions.
Based on a patch by Billy Laws.