On Fri, Nov 1, 2024 at 9:47 AM Haochen Jiang <[email protected]> wrote:
>
> Hi all,
>
> These are the last minute changes that should apply to MOVRS patch but
> disappeared in patch.
>
> Using IN_RANGE will avoid second usage of INTVAL for prefetch check.
>
> Also fixed typos in prefetch testcase.
>
> Ok for trunk?
OK.
Thanks,
Uros.
>
> Thx,
> Haochen
>
> gcc/ChangeLog:
>
> * builtins.cc (expand_builtin_prefetch): Use IN_RANGE to
> avoid second usage of INTVAL.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.c-torture/execute/builtin-prefetch-1.c: Fix typo.
> * gcc.dg/builtin-prefetch-1.c: Ditto.
> ---
> gcc/builtins.cc | 4 ++--
> gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-1.c | 2 +-
> gcc/testsuite/gcc.dg/builtin-prefetch-1.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/gcc/builtins.cc b/gcc/builtins.cc
> index 504b31f84b5..b8684411ea8 100644
> --- a/gcc/builtins.cc
> +++ b/gcc/builtins.cc
> @@ -1297,7 +1297,7 @@ expand_builtin_prefetch (tree exp)
> else
> op1 = expand_normal (arg1);
> /* Argument 1 must be 0, 1 or 2. */
> - if (INTVAL (op1) < 0 || INTVAL (op1) > 2)
> + if (IN_RANGE (INTVAL (op1), 0, 2))
> {
> warning (0, "invalid second argument to %<__builtin_prefetch%>;"
> " using zero");
> @@ -1315,7 +1315,7 @@ expand_builtin_prefetch (tree exp)
> else
> op2 = expand_normal (arg2);
> /* Argument 2 must be 0, 1, 2, or 3. */
> - if (INTVAL (op2) < 0 || INTVAL (op2) > 3)
> + if (IN_RANGE (INTVAL (op2), 0, 3))
> {
> warning (0, "invalid third argument to %<__builtin_prefetch%>; using
> zero");
> op2 = const0_rtx;
> diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-1.c
> b/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-1.c
> index 03620c6ea6b..07b490dc1a6 100644
> --- a/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-1.c
> +++ b/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-1.c
> @@ -15,7 +15,7 @@ void exit (int);
> #define READ_ACCESS 0
>
> enum locality { none, low, moderate, high };
> -enum rws { read, write, read-shared };
> +enum rws { read, write, read_shared };
>
> int arr[10];
>
> diff --git a/gcc/testsuite/gcc.dg/builtin-prefetch-1.c
> b/gcc/testsuite/gcc.dg/builtin-prefetch-1.c
> index 7f75353795f..aadbf144cfe 100644
> --- a/gcc/testsuite/gcc.dg/builtin-prefetch-1.c
> +++ b/gcc/testsuite/gcc.dg/builtin-prefetch-1.c
> @@ -8,7 +8,7 @@
> extern void exit (int);
>
> enum locality { none, low, moderate, high, bogus };
> -enum rws { read, write, read-shared };
> +enum rws { read, write, read_shared };
>
> int arr[10];
>
> --
> 2.31.1
>