]> gcc.gnu.org Git - gcc.git/commit
aarch64: Fix status return logic in RNG intrinsics
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>
Wed, 17 Mar 2021 18:21:05 +0000 (18:21 +0000)
committerKyrylo Tkachov <kyrylo.tkachov@arm.com>
Wed, 17 Mar 2021 18:21:05 +0000 (18:21 +0000)
commitf7581eb38eeaa8af64f3cdfe2faf764f5883f16f
treed4eea38c38257195c866a5b645ee3f31481efdc8
parentadf14bdbc10d4114865a08cf20020a2616039057
aarch64: Fix status return logic in RNG intrinsics

There is a bug with the RNG intrinsics in their return code. The definition says:

"Stores a 64-bit random number into the object pointed to by the argument and returns zero.
If the implementation could not generate a random number within a reasonable period of time
the object pointed to by the input is set to zero and a non-zero value is returned."

This means we should be testing whether to return non-zero with:
CSET W0, EQ
rather than NE.

This patch fixes that.

gcc/ChangeLog:

* config/aarch64/aarch64-builtins.c (aarch64_expand_rng_builtin): Use EQ
to compare against CC_REG rather than NE.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/acle/rng_2.c: New test.
gcc/config/aarch64/aarch64-builtins.c
gcc/testsuite/gcc.target/aarch64/acle/rng_2.c [new file with mode: 0644]
This page took 0.060583 seconds and 5 git commands to generate.