This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

C6X: assembler check for multiple instructions in execute packet sharing a functional unit


On the TI C6X there are many constraints on what operations are not 
permitted to occur in parallel, some of which can be checked by the 
assembler and some of which cannot (in general, only constraints within a 
single execute packet can be checked except in an SPLOOP context).  This 
patch adds checks for one of the simplest such constraints: two 
instructions in the same execute packet may not share a functional unit 
even if oppositely predicated.  Checks for other constraints will follow 
in due course.

Tested with no regressions with cross to c6x-elf and committed.

Index: gas/ChangeLog
===================================================================
RCS file: /cvs/src/src/gas/ChangeLog,v
retrieving revision 1.4171
diff -u -r1.4171 ChangeLog
--- gas/ChangeLog	16 Jun 2010 00:36:02 -0000	1.4171
+++ gas/ChangeLog	18 Jun 2010 22:43:23 -0000
@@ -1,3 +1,12 @@
+2010-06-18  Joseph Myers  <joseph@codesourcery.com>
+
+	* config/tc-tic6x.h (tic6x_segment_info_type): Add field
+	func_units_used.
+	* config/tc-tic6x.c (tic6x_cons_align: Clear func_units_used.
+	(md_assemble): Clear func_units_used for new execute packet.
+	Check for duplicate functional units and update func_units_used
+	for instructions using a functional unit.
+
 2010-06-15  Joseph Myers  <joseph@codesourcery.com>
 
 	* config/tc-tic6x.c: Include elf/tic6x.h.
Index: gas/config/tc-tic6x.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-tic6x.c,v
retrieving revision 1.4
diff -u -r1.4 tc-tic6x.c
--- gas/config/tc-tic6x.c	16 Jun 2010 00:36:02 -0000	1.4
+++ gas/config/tc-tic6x.c	18 Jun 2010 22:43:23 -0000
@@ -633,6 +633,7 @@
   seginfo->tc_segment_info_data.execute_packet_frag = NULL;
   seginfo->tc_segment_info_data.last_insn_lsb = NULL;
   seginfo->tc_segment_info_data.spmask_addr = NULL;
+  seginfo->tc_segment_info_data.func_units_used = 0;
 }
 
 /* Handle an alignment directive.  Return TRUE if the
@@ -3155,6 +3156,7 @@
       tic6x_label_list *l;
 
       seginfo->tc_segment_info_data.spmask_addr = NULL;
+      seginfo->tc_segment_info_data.func_units_used = 0;
 
       /* Start a new frag for this execute packet.  */
       if (frag_now_fix () != 0)
@@ -3184,6 +3186,18 @@
 	= tic6x_can_cross_fp_boundary;
     }
 
+  if (func_unit_base != tic6x_func_unit_nfu)
+    {
+      unsigned int func_unit_enc;
+
+      func_unit_enc = tic6x_encode_spmask (func_unit_base, func_unit_side);
+
+      if (seginfo->tc_segment_info_data.func_units_used & func_unit_enc)
+	as_bad (_("functional unit already used in this execute packet"));
+
+      seginfo->tc_segment_info_data.func_units_used |= func_unit_enc;
+    }
+
   if (opct->flags & TIC6X_FLAG_SPLOOP)
     {
       if (seginfo->tc_segment_info_data.sploop_ii)
Index: gas/config/tc-tic6x.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-tic6x.h,v
retrieving revision 1.4
diff -u -r1.4 tc-tic6x.h
--- gas/config/tc-tic6x.h	16 Jun 2010 00:36:02 -0000	1.4
+++ gas/config/tc-tic6x.h	18 Jun 2010 22:43:23 -0000
@@ -67,6 +67,11 @@
      ||^); otherwise NULL.  */
   char *spmask_addr;
 
+  /* The functional units used in the current execute packet, recorded
+     by setting the same bits as would be set in the 32-bit SPMASK
+     instruction.  */
+  unsigned int func_units_used;
+
   /* If an SPLOOP-family instruction has been seen, and a following
      SPKERNEL-family instruction has not yet been seen, the ii value
      from the SPLOOP instruction (in the range 1 to 14); otherwise
Index: gas/testsuite/ChangeLog
===================================================================
RCS file: /cvs/src/src/gas/testsuite/ChangeLog,v
retrieving revision 1.1679
diff -u -r1.1679 ChangeLog
--- gas/testsuite/ChangeLog	16 Jun 2010 16:27:36 -0000	1.1679
+++ gas/testsuite/ChangeLog	18 Jun 2010 22:43:23 -0000
@@ -1,3 +1,12 @@
+2010-06-18  Joseph Myers  <joseph@codesourcery.com>
+
+	* gas/tic6x/resource-func-unit-1.d,
+	gas/tic6x/resource-func-unit-1.l,
+	gas/tic6x/resource-func-unit-1.s,
+	gas/tic6x/resource-func-unit-2.d,
+	gas/tic6x/resource-func-unit-2.l,
+	gas/tic6x/resource-func-unit-2.s: New.
+
 2010-06-16  Vincent Rivière  <vincent.riviere@freesbee.fr>
 
 	PR gas/11673
Index: gas/testsuite/gas/tic6x/resource-func-unit-1.d
===================================================================
RCS file: gas/testsuite/gas/tic6x/resource-func-unit-1.d
diff -N gas/testsuite/gas/tic6x/resource-func-unit-1.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/tic6x/resource-func-unit-1.d	18 Jun 2010 22:43:23 -0000
@@ -0,0 +1,2 @@
+#name: C6X parallel instructions on same functional unit
+#error-output: resource-func-unit-1.l
Index: gas/testsuite/gas/tic6x/resource-func-unit-1.l
===================================================================
RCS file: gas/testsuite/gas/tic6x/resource-func-unit-1.l
diff -N gas/testsuite/gas/tic6x/resource-func-unit-1.l
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/tic6x/resource-func-unit-1.l	18 Jun 2010 22:43:23 -0000
@@ -0,0 +1,2 @@
+[^:]*: Assembler messages:
+[^:]*:9: Error: functional unit already used in this execute packet
Index: gas/testsuite/gas/tic6x/resource-func-unit-1.s
===================================================================
RCS file: gas/testsuite/gas/tic6x/resource-func-unit-1.s
diff -N gas/testsuite/gas/tic6x/resource-func-unit-1.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/tic6x/resource-func-unit-1.s	18 Jun 2010 22:43:23 -0000
@@ -0,0 +1,9 @@
+# Test parallel instructions on same functional unit.
+.text
+.globl f
+f:
+	add .L1 a1,a2,a3
+	nop
+	|| [b1] add .L1 a1,a2,a3
+	|| nop
+	|| [!b1] add .L1 a4,a5,a6
Index: gas/testsuite/gas/tic6x/resource-func-unit-2.d
===================================================================
RCS file: gas/testsuite/gas/tic6x/resource-func-unit-2.d
diff -N gas/testsuite/gas/tic6x/resource-func-unit-2.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/tic6x/resource-func-unit-2.d	18 Jun 2010 22:43:23 -0000
@@ -0,0 +1,2 @@
+#name: C6X parallel instructions on same functional unit, multiple sections
+#error-output: resource-func-unit-2.l
Index: gas/testsuite/gas/tic6x/resource-func-unit-2.l
===================================================================
RCS file: gas/testsuite/gas/tic6x/resource-func-unit-2.l
diff -N gas/testsuite/gas/tic6x/resource-func-unit-2.l
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/tic6x/resource-func-unit-2.l	18 Jun 2010 22:43:23 -0000
@@ -0,0 +1,3 @@
+[^:]*: Assembler messages:
+[^:]*:17: Error: functional unit already used in this execute packet
+[^:]*:19: Error: functional unit already used in this execute packet
Index: gas/testsuite/gas/tic6x/resource-func-unit-2.s
===================================================================
RCS file: gas/testsuite/gas/tic6x/resource-func-unit-2.s
diff -N gas/testsuite/gas/tic6x/resource-func-unit-2.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/tic6x/resource-func-unit-2.s	18 Jun 2010 22:43:23 -0000
@@ -0,0 +1,19 @@
+# Test parallel instructions on same functional unit, with section switching.
+.section .text.f1,"ax",%progbits
+.globl f1
+f1:
+	add .L1 a1,a2,a3
+	nop
+	|| [b1] add .L1 a1,a2,a3
+.section .text.f2,"ax",%progbits
+.globl f2
+f2:
+	add .L2 b1,b2,b3
+	nop
+	|| [b1] add .L2 b1,b2,b3
+	|| nop
+.section .text.f1,"ax",%progbits
+	|| nop
+	|| [!b1] add .L1 a4,a5,a6
+.section .text.f2,"ax",%progbits
+	|| [!b1] add .L2 b4,b5,b6

-- 
Joseph S. Myers
joseph@codesourcery.com

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