mirrored from git://gcc.gnu.org/git/gcc.git
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch implements the __jcvt ACLE intrinsic [1] that maps down to the FJCVTZS [2] instruction from Armv8.3-a. No fancy mode iterators or nothing. Just a single builtin, UNSPEC and define_insn and the associate plumbing. This patch also defines __ARM_FEATURE_JCVT to indicate when the intrinsic is available. [1] https://developer.arm.com/docs/101028/latest/data-processing-intrinsics [2] https://developer.arm.com/docs/ddi0596/latest/simd-and-floating-point-instructions-alphabetic-order/fjcvtzs-floating-point-javascript-convert-to-signed-fixed-point-rounding-toward-zero gcc/ PR target/71233 * config/aarch64/aarch64.md (UNSPEC_FJCVTZS): Define. (aarch64_fjcvtzs): New define_insn. * config/aarch64/aarch64.h (TARGET_JSCVT): Define. * config/aarch64/aarch64-builtins.c (aarch64_builtins): Add AARCH64_JSCVT. (aarch64_init_builtins): Initialize __builtin_aarch64_jcvtzs. (aarch64_expand_builtin): Handle AARCH64_JSCVT. * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Define __ARM_FEATURE_JCVT where appropriate. * config/aarch64/arm_acle.h (__jcvt): Define. * doc/sourcebuild.texi (aarch64_fjcvtzs_hw) Document new target supports option. gcc/testsuite/ PR target/71233 * gcc.target/aarch64/acle/jcvt_1.c: New test. * gcc.target/aarch64/acle/jcvt_2.c: New testcase. * lib/target-supports.exp (check_effective_target_aarch64_fjcvtzs_hw): Add new check for FJCVTZS hw. Co-Authored-By: Andrea Corallo <andrea.corallo@arm.com> (cherry picked from commit e1d5d19) (cherry picked from commit 2c62952) (cherry picked from commit d2b86e1)
- Loading branch information
Kyrylo Tkachov
committed
Sep 24, 2020
1 parent
6ca87f2
commit 6f06be1
Showing
9 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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,15 @@ | ||
| /* Test the __jcvt ACLE intrinsic. */ | ||
| /* { dg-do compile } */ | ||
| /* { dg-options "-O2 -march=armv8.3-a" } */ | ||
|
|
||
| #include <arm_acle.h> | ||
|
|
||
| #ifdef __ARM_FEATURE_JCVT | ||
| int32_t | ||
| test_jcvt (double a) | ||
| { | ||
| return __jcvt (a); | ||
| } | ||
| #endif | ||
|
|
||
| /* { dg-final { scan-assembler-times "fjcvtzs\tw\[0-9\]+, d\[0-9\]+\n" 1 } } */ |
This file contains 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,33 @@ | ||
| /* Test the __jcvt ACLE intrinsic. */ | ||
| /* { dg-do run } */ | ||
| /* { dg-options "-O2 -march=armv8.3-a -save-temps" } */ | ||
| /* { dg-require-effective-target aarch64_fjcvtzs_hw } */ | ||
|
|
||
| #include <arm_acle.h> | ||
|
|
||
| extern void abort (void); | ||
|
|
||
| #ifdef __ARM_FEATURE_JCVT | ||
| volatile int32_t x; | ||
|
|
||
| int __attribute__((noinline)) | ||
| foo (double a, int b, int c) | ||
| { | ||
| b = b > c; | ||
| x = __jcvt (a); | ||
| return b; | ||
| } | ||
|
|
||
| int | ||
| main (void) | ||
| { | ||
| int x = foo (1.1, 2, 3); | ||
| if (x) | ||
| abort (); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| #endif | ||
|
|
||
| /* { dg-final { scan-assembler-times "fjcvtzs\tw\[0-9\]+, d\[0-9\]+\n" 1 } } */ |
This file contains 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