Hi all,

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.
Bootstrapped and tested on aarch64-none-linux-gnu.
Pushing to master and the branches later.

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.

Attachment: rng.patch
Description: rng.patch

Reply via email to