Hi all,

This patch is going to fix PR127264.

Bootstrapped and regtested on x86_64-pc-linux-gnu. Ok for trunk?

Thx,
Haochen

gcc/ChangeLog:

        PR target/127264
        * config/i386/i386-expand.cc (ix86_expand_ace_builtin):
        Revise logic to avoid INTVAL check for non-constant
        operands.

gcc/testsuite/ChangeLog:

        PR target/127264
        * gcc.target/i386/pr127264.c: New test.
---
 gcc/config/i386/i386-expand.cc           | 17 +++++++----------
 gcc/testsuite/gcc.target/i386/pr127264.c |  7 +++++++
 2 files changed, 14 insertions(+), 10 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr127264.c

diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index 1b76fe91ca2..2add62bc613 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -14773,19 +14773,16 @@ ix86_expand_ace_builtin (const struct 
builtin_description *d, tree exp,
 
       if (i == 0 || i == constant)
        {
-         if (i == 0 && !IN_RANGE (INTVAL (op), 0, 7))
+         if (!insn_p->operand[i + arg_adjust].predicate(op, SImode))
            {
-             /* 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");
+             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
        {
diff --git a/gcc/testsuite/gcc.target/i386/pr127264.c 
b/gcc/testsuite/gcc.target/i386/pr127264.c
new file mode 100644
index 00000000000..c83362f4b05
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr127264.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -macev1" } */
+
+void ace (char c)
+{
+  __builtin_ia32_tilezero (c); /* { dg-error "the tmm register number argument 
must be between 0 to 7" "" { target { ! ia32 } } 0 } */
+}
-- 
2.31.1

Reply via email to