]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Refine predicate of operands[2] in divv4hf3 with register_operand.
authorliuhongt <hongtao.liu@intel.com>
Tue, 10 Oct 2023 03:32:09 +0000 (11:32 +0800)
committerliuhongt <hongtao.liu@intel.com>
Wed, 11 Oct 2023 04:58:17 +0000 (12:58 +0800)
In the expander, it will emit below insn.

rtx tmp = gen_rtx_VEC_CONCAT (V4SFmode, operands[2],
force_reg (V2SFmode, CONST1_RTX (V2SFmode)));

but *vec_concat<mode> only allow register_operand.

gcc/ChangeLog:

PR target/111745
* config/i386/mmx.md (divv4hf3): Refine predicate of
operands[2] with register_operand.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr111745.c: New test.

gcc/config/i386/mmx.md
gcc/testsuite/gcc.target/i386/pr111745.c [new file with mode: 0644]

index c84a37a844434e4a56bb270b15cfeea489501d0c..4707cfae93f6420429088715ec5983d336b2931a 100644 (file)
   [(set (match_operand:V4HF 0 "register_operand")
        (div:V4HF
          (match_operand:V4HF 1 "nonimmediate_operand")
-         (match_operand:V4HF 2 "nonimmediate_operand")))]
+         (match_operand:V4HF 2 "register_operand")))]
   "TARGET_AVX512FP16 && TARGET_AVX512VL && ix86_partial_vec_fp_math"
 {
   rtx op2 = gen_reg_rtx (V8HFmode);
diff --git a/gcc/testsuite/gcc.target/i386/pr111745.c b/gcc/testsuite/gcc.target/i386/pr111745.c
new file mode 100644 (file)
index 0000000..e8989d9
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -mavx512vl -ffloat-store -O2" } */
+
+char c;
+_Float16 __attribute__((__vector_size__ (4 * sizeof (_Float16)))) f;
+_Float16 __attribute__((__vector_size__ (2 * sizeof (_Float16)))) f1;
+
+void
+foo (void)
+{
+  f /= c;
+}
+
+void
+foo1 (void)
+{
+  f1 /= c;
+}