]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Use IN_RANGE in prefetch builtin
authorHaochen Jiang <haochen.jiang@intel.com>
Fri, 1 Nov 2024 08:42:12 +0000 (16:42 +0800)
committerHaochen Jiang <haochen.jiang@intel.com>
Fri, 1 Nov 2024 18:16:53 +0000 (02:16 +0800)
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.

gcc/builtins.cc

index 504b31f84b5135963a4ed77ee6069d06ae37fade..b8684411ea87ed2b87f52ec07eae7344b712c0bc 100644 (file)
@@ -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;