bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/23013] Assembler not recognizing 3-opt dcbt instruction form on


From: bergner at vnet dot ibm.com
Subject: [Bug gas/23013] Assembler not recognizing 3-opt dcbt instruction form on Power systems
Date: Thu, 29 Mar 2018 19:39:47 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=23013

Peter Bergner <bergner at vnet dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-03-29
     Ever confirmed|0                           |1

--- Comment #1 from Peter Bergner <bergner at vnet dot ibm.com> ---
Maybe Alan can let us know the history of this, but the default cpu gas
assembles for is much more conservative (ie, older) than the default cpu
objdump disassembles for.  This looks to be on purpose.

The 3 operand dcbt instruction (on Power server systems) is new with power4, so
you can assemble the 3 operand form just fine if you use the -mpower4 (or
newer) assembler option:

address@hidden:~/binutils/BUGS/PR23013$ cat bug.s 
lab_1:
        dcbt    0,10,8
address@hidden:~/binutils/BUGS/PR23013$
/home/bergner/binutils/build/binutils-pr23013-debug/gas/as-new bug.s -o bug.o
bug.s: Assembler messages:
bug.s:2: Error: junk at end of line: `8'
address@hidden:~/binutils/BUGS/PR23013$
/home/bergner/binutils/build/binutils-pr23013-debug/gas/as-new -mpower4 bug.s
-o bug.o
address@hidden:~/binutils/BUGS/PR23013$
/home/bergner/binutils/build/binutils-pr23013-debug/binutils/objdump -d bug.o 
[snip]
0000000000000000 <lab_1>:
   0:   2c 52 00 7d     dcbt    0,r10,8

That said, 64-bit LE is only supported on power8 and later hardware, so if
we're targeting powerpc64le-*, we might as well set a more reasonable default
cpu (ie, power8).  The following patch accomplishes that:

diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index ff76221..e3d5d84 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -1403,7 +1403,14 @@ ppc_set_cpu (void)
   if ((ppc_cpu & ~(ppc_cpu_t) PPC_OPCODE_ANY) == 0)
     {
       if (ppc_obj64)
-       ppc_cpu |= PPC_OPCODE_PPC | PPC_OPCODE_64;
+       if (target_big_endian)
+         ppc_cpu |= PPC_OPCODE_PPC | PPC_OPCODE_64;
+       else
+         /* The minimum supported cpu for 64-bit little-endian is power8.  */
+         ppc_cpu |= PPC_OPCODE_PPC | PPC_OPCODE_ISEL | PPC_OPCODE_64
+                    | PPC_OPCODE_POWER4 | PPC_OPCODE_POWER5 |
PPC_OPCODE_POWER6
+                    | PPC_OPCODE_POWER7 | PPC_OPCODE_POWER8
+                    | PPC_OPCODE_ALTIVEC | PPC_OPCODE_VSX;
       else if (strncmp (default_os, "aix", 3) == 0
               && default_os[3] >= '4' && default_os[3] <= '9')
        ppc_cpu |= PPC_OPCODE_COMMON;

With that patch, we now get (on LE, BE would still need -mpower4):

address@hidden:~/binutils/BUGS/PR23013$ cat bug.s 
lab_1:
        dcbt    0,10,8
address@hidden:~/binutils/BUGS/PR23013$
/home/bergner/binutils/build/binutils-pr23013-debug/gas/as-new bug.s -o bug.o
address@hidden:~/binutils/BUGS/PR23013$
/home/bergner/binutils/build/binutils-pr23013-debug/binutils/objdump -d bug.o 
[snip]
0000000000000000 <lab_1>:
   0:   2c 52 00 7d     dcbt    0,r10,8

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]