https://gcc.gnu.org/g:79a75b1f551821687e1ce27a82ee39b802ace2b4

commit r15-4847-g79a75b1f551821687e1ce27a82ee39b802ace2b4
Author: Haochen Jiang <haochen.ji...@intel.com>
Date:   Fri Nov 1 16:42:12 2024 +0800

    Use IN_RANGE in prefetch builtin
    
    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.
    
    gcc/ChangeLog:
    
            * builtins.cc (expand_builtin_prefetch): Use IN_RANGE to
            avoid second usage of INTVAL.

Diff:
---
 gcc/builtins.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index 504b31f84b51..b8684411ea87 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;

Reply via email to