From: Haochen Jiang Date: Fri, 1 Nov 2024 08:42:12 +0000 (+0800) Subject: Use IN_RANGE in prefetch builtin X-Git-Tag: basepoints/gcc-16~4706 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=79a75b1f551821687e1ce27a82ee39b802ace2b4;p=thirdparty%2Fgcc.git 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 --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;