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]

[PATCH] Accept Altivec instructions when using -mpower6 and -mcell


This patch fixes a couple of related problems.  First, gas' -mpower6 and -mcell
options were not enabling the PPC_OPCODE_ALTIVEC flag similarly to -m74**,
so we could not assemble Altivec instructions without an explicit -maltivec.
Secondly, after adding some Altivec instructions to the CELL gas testcase,
I noticed it wasn't being executed.  This was due to them only being executed
if we are targeting powerpc64*-*-*, so I moved it to powerpc*-*-*.  I have
also added a POWER6 testcase.

Lastly, after attempting to move the POWER4 gas testcase to powerpc*-*-*
(which I am not doing in this patch), I noticed that the assembler option
"-a64" was flagged as an illegal option when I configured with:

  --target=powerpc-linux --enable-targets=all

but passes just fine when configured with

  --target=powerpc-linux --enable-targets=powerpc64-linux

I tracked this down to we are not setting want64 to true in bfd/configure
when configuring with --enable-targets=all.

This passed bootstrap and make check.  Ok for mainline?

Peter


bfd/
	* configure.in: Set want64 to true if --enable-targets=all is used.
	* configure: Regenerate.

gas/
	* config/tc-ppc.c (parse_cpu) <power6>: Accept Altivec instructions.
	<cell>: Likewise.

gas/testsuite/
	* gas/ppc/cell.s: Add altivec instructions.
	* gas/ppc/cell.d: Update expected output.
	* gas/ppc/power6.d: New.
	* gas/ppc/power6.s: Likewise.
	* gas/ppc/ppc.exp (powerpc64*-*-*): Move cell from here to...
	(powerpc*-*-*): Here.  Run power6 test.

Index: bfd/configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.241
diff -u -p -r1.241 configure.in
--- bfd/configure.in	10 Jul 2008 01:32:22 -0000	1.241
+++ bfd/configure.in	28 Jul 2008 22:03:03 -0000
@@ -533,6 +533,7 @@ for targ in $target $canon_targets
 do
     if test "x$targ" = "xall"; then
         all_targets=true
+	want64=true
 	assocvecs="$assocvecs $targ_defvec $targ_selvecs"
     else
 	. $srcdir/config.bfd
Index: gas/config/tc-ppc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
retrieving revision 1.138
diff -u -p -r1.138 tc-ppc.c
--- gas/config/tc-ppc.c	25 Jun 2008 16:49:02 -0000	1.138
+++ gas/config/tc-ppc.c	28 Jul 2008 22:03:03 -0000
@@ -931,13 +931,14 @@ parse_cpu (const char *arg)
     {
       ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC
 		 | PPC_OPCODE_64 | PPC_OPCODE_POWER4
-		 | PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6);
+		 | PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6
+		 | PPC_OPCODE_ALTIVEC);
     }
   else if (strcmp (arg, "cell") == 0)
     {
       ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC
 		 | PPC_OPCODE_64 | PPC_OPCODE_POWER4
-		 | PPC_OPCODE_CELL);
+		 | PPC_OPCODE_CELL | PPC_OPCODE_ALTIVEC);
     }
   /* -mcom means assemble for the common intersection between Power
      and PowerPC.  At present, we just allow the union, rather
Index: gas/testsuite/gas/ppc/cell.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/ppc/cell.d,v
retrieving revision 1.1
diff -u -p -r1.1 cell.d
--- gas/testsuite/gas/ppc/cell.d	24 Oct 2006 01:27:29 -0000	1.1
+++ gas/testsuite/gas/ppc/cell.d	28 Jul 2008 22:03:04 -0000
@@ -1,6 +1,6 @@
 #as: -mcell
 #objdump: -dr -Mcell
-#name: Cell tests
+#name: Cell tests (includes Altivec)
 
 
 .*: +file format elf(32)?(64)?-powerpc.*
@@ -8,7 +8,7 @@
 
 Disassembly of section \.text:
 
-0000000000000000 <.text>:
+0+00 <.text>:
    0:	7c 01 14 0e 	lvlx    v0,r1,r2
    4:	7c 00 14 0e 	lvlx    v0,0,r2
    8:	7c 01 16 0e 	lvlxl   v0,r1,r2
@@ -29,3 +29,9 @@ Disassembly of section \.text:
   44:	7c 01 14 28 	ldbrx   r0,r1,r2
   48:	7c 00 0d 28 	stdbrx  r0,0,r1
   4c:	7c 01 15 28 	stdbrx  r0,r1,r2
+  50:	7c 60 06 6c 	dss     3
+  54:	7e 00 06 6c 	dssall
+  58:	7c 25 22 ac 	dst     r5,r4,1
+  5c:	7e 08 3a ac 	dstt    r8,r7,0
+  60:	7c 65 32 ec 	dstst   r5,r6,3
+  64:	7e 44 2a ec 	dststt  r4,r5,2
Index: gas/testsuite/gas/ppc/cell.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/ppc/cell.s,v
retrieving revision 1.1
diff -u -p -r1.1 cell.s
--- gas/testsuite/gas/ppc/cell.s	24 Oct 2006 01:27:29 -0000	1.1
+++ gas/testsuite/gas/ppc/cell.s	28 Jul 2008 22:03:04 -0000
@@ -22,3 +22,10 @@
 
 	stdbrx %r0, 0, %r1
 	stdbrx %r0, %r1, %r2
+
+	dss	3
+	dssall	
+	dst	5,4,1
+	dstt	8,7,0
+	dstst	5,6,3
+	dststt	4,5,2
Index: gas/testsuite/gas/ppc/power4.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/ppc/power4.d,v
retrieving revision 1.6
diff -u -p -r1.6 power4.d
--- gas/testsuite/gas/ppc/power4.d	2 Mar 2005 13:25:01 -0000	1.6
+++ gas/testsuite/gas/ppc/power4.d	28 Jul 2008 22:03:04 -0000
@@ -1,5 +1,5 @@
 #objdump: -drx -Mpower4
-#as: -mpower4
+#as: -a64 -mpower4
 #name: Power4 instructions
 
 .*: +file format elf64-powerpc
Index: gas/testsuite/gas/ppc/ppc.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/ppc/ppc.exp,v
retrieving revision 1.18
diff -u -p -r1.18 ppc.exp
--- gas/testsuite/gas/ppc/ppc.exp	30 Apr 2008 06:47:24 -0000	1.18
+++ gas/testsuite/gas/ppc/ppc.exp	28 Jul 2008 22:03:04 -0000
@@ -10,8 +10,6 @@ if { [istarget powerpc64*-*-*] || [istar
     run_dump_test "astest64"
     run_dump_test "astest2_64"
     run_dump_test "test1elf64"
-    run_dump_test "power4"
-    run_dump_test "cell"
     run_list_test "range64" "-a64"
 } elseif { [istarget powerpc*-*aix*] } then {
     run_dump_test "test1xcoff32"
@@ -45,5 +43,8 @@ if { [istarget powerpc*-*-*] } then {
 	run_list_test "range" "-a32"
 	run_dump_test "ppc750ps"
 	run_dump_test "e500mc"
+	run_dump_test "power4"
+	run_dump_test "cell"
+	run_dump_test "power6"
     }
 }


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