Delete redundant ppc opcode flags
Andreas Schwab
schwab@linux-m68k.org
Sat Jul 3 08:10:00 GMT 2010
More information about the Binutils mailing list
Sat Jul 3 08:10:00 GMT 2010
- Previous message (by thread): Delete redundant ppc opcode flags
- Next message (by thread): Delete redundant ppc opcode flags
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Alan Modra <amodra@gmail.com> writes: > @@ -243,15 +227,9 @@ powerpc_init_dialect (struct disassemble > if ((new_cpu = ppc_parse_cpu (dialect, arg)) != 0) > dialect = new_cpu; > else if (strcmp (arg, "32") == 0) > - { > - dialect &= ~PPC_OPCODE_64; > - dialect |= PPC_OPCODE_32; > - } > + dialect &= ~PPC_OPCODE_64; That does not work (and was always broken): ~PPC_OPCODE_64 is a 32-bit mask which is zero-extended to 64 bits and thus clears all upper bits of dialect (of which only PPC_OPCODE_E500 is defined now). All negated masks either need to be cast to ppc_cpu_t first or the masks need to be 64 bit in the first place. The assembler has the same problem, so that as -me500 misassembles lwsync. Andreas. 2010-07-03 Andreas Schwab <schwab@linux-m68k.org> gas/: * config/tc-ppc.c (ppc_set_cpu): Cast PPC_OPCODE_xxx to ppc_cpu_t before inverting. opcodes/: * ppc-dis.c (powerpc_init_dialect): Cast PPC_OPCODE_xxx to ppc_cpu_t before inverting. --- gas/config/tc-ppc.c.~1.170.~ 2010-07-03 09:13:02.000000000 +0200 +++ gas/config/tc-ppc.c 2010-07-03 09:46:37.000000000 +0200 @@ -1248,7 +1248,7 @@ ppc_set_cpu (void) const char *default_os = TARGET_OS; const char *default_cpu = TARGET_CPU; - if ((ppc_cpu & ~PPC_OPCODE_ANY) == 0) + if ((ppc_cpu & ~(ppc_cpu_t) PPC_OPCODE_ANY) == 0) { if (ppc_obj64) ppc_cpu |= PPC_OPCODE_PPC | PPC_OPCODE_64; --- opcodes/ppc-dis.c.~1.49.~ 2010-07-03 09:13:57.000000000 +0200 +++ opcodes/ppc-dis.c 2010-07-03 10:05:49.000000000 +0200 @@ -189,8 +189,8 @@ ppc_parse_cpu (ppc_cpu_t ppc_cpu, const if (ppc_opts[i].sticky) { retain_flags |= ppc_opts[i].sticky; - if ((ppc_cpu & ~(PPC_OPCODE_ALTIVEC | PPC_OPCODE_VSX - | PPC_OPCODE_SPE | PPC_OPCODE_ANY)) != 0) + if ((ppc_cpu & ~(ppc_cpu_t) (PPC_OPCODE_ALTIVEC | PPC_OPCODE_VSX + | PPC_OPCODE_SPE | PPC_OPCODE_ANY)) != 0) break; } ppc_cpu = ppc_opts[i].cpu; @@ -227,7 +227,7 @@ powerpc_init_dialect (struct disassemble if ((new_cpu = ppc_parse_cpu (dialect, arg)) != 0) dialect = new_cpu; else if (strcmp (arg, "32") == 0) - dialect &= ~PPC_OPCODE_64; + dialect &= ~(ppc_cpu_t) PPC_OPCODE_64; else if (strcmp (arg, "64") == 0) dialect |= PPC_OPCODE_64; else @@ -238,12 +238,12 @@ powerpc_init_dialect (struct disassemble arg = end; } - if ((dialect & ~PPC_OPCODE_64) == 0) + if ((dialect & ~(ppc_cpu_t) PPC_OPCODE_64) == 0) { if (info->mach == bfd_mach_ppc64) dialect |= PPC_OPCODE_64; else - dialect &= ~PPC_OPCODE_64; + dialect &= ~(ppc_cpu_t) PPC_OPCODE_64; /* Choose a reasonable default. */ dialect |= (PPC_OPCODE_PPC | PPC_OPCODE_COMMON | PPC_OPCODE_601 | PPC_OPCODE_ALTIVEC); @@ -505,7 +505,7 @@ print_insn_powerpc (bfd_vma memaddr, if ((dialect & PPC_OPCODE_ANY) != 0) { - dialect = ~PPC_OPCODE_ANY; + dialect = ~(ppc_cpu_t) PPC_OPCODE_ANY; goto again; } -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
- Previous message (by thread): Delete redundant ppc opcode flags
- Next message (by thread): Delete redundant ppc opcode flags
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list