https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127264

--- Comment #10 from Haochen Jiang <haochen.jiang at intel dot com> ---
(In reply to Haochen Jiang from comment #9)
> (In reply to Haochen Jiang from comment #7)
> > (In reply to Zdenek Sojka from comment #6)
> > > Hello,
> > > 
> > > 
> > > 
> > > RTL checking needs to be enabled on order to see the RTL check issue.
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> > I see your point. Then I will suspect we might have the same issue on
> > cmpccxadd since they are quite similar here.
> > 
> > Let me have a look based on that.
> 
> Ah I forgot that it is INTVAL went wrong. I will have a fix on that.

A simple fix for this would be:

diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index 7fa9d7f6b8d..2afbdd1fbba 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -14771,21 +14771,16 @@ ix86_expand_ace_builtin (const struct
builtin_description *d, tree exp,
       arg = CALL_EXPR_ARG (exp, i);
       op = ix86_expand_unsigned_small_int_cst_argument (arg);

-      if (i == 0 || i == constant)
+      if ((i == 0 || i == constant)
+         && !insn_p->operand[i + arg_adjust].predicate(op, SImode))
        {
-         if (i == 0 && !IN_RANGE (INTVAL (op), 0, 7))
-           {
-             /* This must be the tmm reg number constant.  */
-             error ("the tmm register number argument must be between 0 to
7");
-             return const0_rtx;
-           }
-         else if (!insn_p->operand[i + arg_adjust].predicate(op, SImode))
-           {
-             /* This must be the constant.  */
-             error ("the argument must be constant");
-             return const0_rtx;
-           }
-
+         if (i == 0)
+           /* This must be the tmm reg number constant.  */
+           error ("the tmm register number argument must be between 0 to 7");
+         else
+           /* This must be the constant.  */
+           error ("the argument must be constant");
+         return const0_rtx;
        }
       else
        {

Reply via email to