This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR target/72748: Convert V1TImode register to TImode in debug insn


TImode register referenced in debug insn can be converted to V1TImode by
scalar to vector optimization.  When converting a TImode store to V1TImode,
we need to check all debug insns on its use chain to convert the V1TImode
register to SUBREG TImode if source register is undefined.

Tested on x86-64.  OK for trunk?

H.J.
---
gcc/

	PR target/72748
	* config/i386/i386.c (timode_scalar_chain::convert_insn): Call
	fix_debug_reg_uses after changing source register mode to
	V1TImode if source register is undefined.

gcc/testsuite/

	* gcc.target/i386/pr72748.c: New test.
---
 gcc/config/i386/i386.c                  |  6 ++++++
 gcc/testsuite/gcc.target/i386/pr72748.c | 27 +++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr72748.c

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 7c8bb17..93eaab1 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3858,6 +3858,12 @@ timode_scalar_chain::convert_insn (rtx_insn *insn)
   switch (GET_CODE (src))
     {
     case REG:
+      PUT_MODE (src, V1TImode);
+      /* Call fix_debug_reg_uses only if SRC is never defined.  */
+      if (!DF_REG_DEF_CHAIN (REGNO (src)))
+	fix_debug_reg_uses (src);
+      break;
+
     case MEM:
       PUT_MODE (src, V1TImode);
       break;
diff --git a/gcc/testsuite/gcc.target/i386/pr72748.c b/gcc/testsuite/gcc.target/i386/pr72748.c
new file mode 100644
index 0000000..0d5e4f5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr72748.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+volatile int a;
+int c, d, e, f, g, h;
+
+int fn1 ()
+{ 
+  int i;
+  for (; d;)
+    { 
+      if (e)
+        break;
+      g = 0;
+      int j[4];
+      for (h = 0; h < 4; h++)
+        g++;
+      for (; c < 2; c++)
+        { 
+          e = j[g];
+          i = j[0];
+          f = 4;
+        }
+      f |= d;
+    }
+  return a;
+}
-- 
2.7.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]