diff --git a/llvm/docs/CommandGuide/llvm-objdump.rst b/llvm/docs/CommandGuide/llvm-objdump.rst --- a/llvm/docs/CommandGuide/llvm-objdump.rst +++ b/llvm/docs/CommandGuide/llvm-objdump.rst @@ -28,7 +28,7 @@ .. option:: -d, --disassemble Disassemble all executable sections found in the input files. On some - architectures (AArch64, x86), all known instructions are disassembled by + architectures (AArch64, PPC64, x86), all known instructions are disassembled by default. On the others, :option:`--mcpu` or :option:`--mattr` is needed to enable some instruction sets. Disabled instructions are displayed as ````. diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -358,6 +358,8 @@ switch (getEMachine()) { case ELF::EM_AMDGPU: return getAMDGPUCPUName(); + case ELF::EM_PPC64: + return StringRef("future"); default: return None; } diff --git a/llvm/test/MC/PowerPC/ppc64-prefix-align-labels.s b/llvm/test/MC/PowerPC/ppc64-prefix-align-labels.s --- a/llvm/test/MC/PowerPC/ppc64-prefix-align-labels.s +++ b/llvm/test/MC/PowerPC/ppc64-prefix-align-labels.s @@ -38,11 +38,9 @@ 3: blr # CHECK-BE: 3c: 60 00 00 00 nop -# CHECK-BE-NEXT: 40: 06 01 ff ff -# CHECK-BE-NEXT: 44: 38 22 ff f0 +# CHECK-BE-NEXT: 40: 06 01 ff ff 38 22 ff f0 paddi 1, 2, 8589934576, 0 # CHECK-BE-NEXT: 48: 4e 80 00 20 # CHECK-LE: 3c: 00 00 00 60 nop -# CHECK-LE-NEXT: 40: ff ff 01 06 -# CHECK-LE-NEXT: 44: f0 ff 22 38 +# CHECK-LE-NEXT: 40: ff ff 01 06 f0 ff 22 38 paddi 1, 2, 8589934576, 0 # CHECK-LE-NEXT: 48: 20 00 80 4e diff --git a/llvm/test/MC/PowerPC/ppc64-prefix-align.s b/llvm/test/MC/PowerPC/ppc64-prefix-align.s --- a/llvm/test/MC/PowerPC/ppc64-prefix-align.s +++ b/llvm/test/MC/PowerPC/ppc64-prefix-align.s @@ -29,12 +29,10 @@ # instruction can start at 40: which is 64 bytes aligned. # CHECK-BE: 38: 38 43 00 0f # CHECK-BE-NEXT: 3c: 60 00 00 00 nop -# CHECK-BE-NEXT: 40: 06 01 ff ff -# CHECK-BE-NEXT: 44: 38 22 ff f0 +# CHECK-BE-NEXT: 40: 06 01 ff ff 38 22 ff f0 paddi 1, 2, 8589934576, 0 # CHECK-LE: 38: 0f 00 43 38 # CHECK-LE-NEXT: 3c: 00 00 00 60 nop -# CHECK-LE-NEXT: 40: ff ff 01 06 -# CHECK-LE-NEXT: 44: f0 ff 22 38 +# CHECK-LE-NEXT: 40: ff ff 01 06 f0 ff 22 38 paddi 1, 2, 8589934576, 0 paddi 1, 2, 8589934576, 0 paddi 1, 2, 8589934576, 0 paddi 1, 2, 8589934576, 0 @@ -54,13 +52,11 @@ # CHECK-BE: b8: 38 43 00 0f # CHECK-BE-NEXT: bc: 60 00 00 00 nop # CHECK-BE: : -# CHECK-BE-NEXT: c0: 06 01 ff ff -# CHECK-BE-NEXT: c4: 38 22 ff f0 +# CHECK-BE-NEXT: c0: 06 01 ff ff 38 22 ff f0 paddi 1, 2, 8589934576, 0 # CHECK-LE: b8: 0f 00 43 38 # CHECK-LE-NEXT: bc: 00 00 00 60 nop # CHECK-LE: : -# CHECK-LE-NEXT: c0: ff ff 01 06 -# CHECK-LE-NEXT: c4: f0 ff 22 38 +# CHECK-LE-NEXT: c0: ff ff 01 06 f0 ff 22 38 paddi 1, 2, 8589934576, 0 LAB1: paddi 1, 2, 8589934576, 0 paddi 1, 2, 8589934576, 0 paddi 1, 2, 8589934576, 0 @@ -72,13 +68,11 @@ # CHECK-BE: f8: 38 43 00 0f # CHECK-BE: : # CHECK-BE-NEXT: fc: 60 00 00 00 nop -# CHECK-BE-NEXT: 100: 06 01 ff ff -# CHECK-BE-NEXT: 104: 38 22 ff f0 +# CHECK-BE-NEXT: 100: 06 01 ff ff 38 22 ff f0 paddi 1, 2, 8589934576, 0 # CHECK-LE: f8: 0f 00 43 38 # CHECK-LE: : # CHECK-LE-NEXT: fc: 00 00 00 60 nop -# CHECK-LE-NEXT: 100: ff ff 01 06 -# CHECK-LE-NEXT: 104: f0 ff 22 38 +# CHECK-LE-NEXT: 100: ff ff 01 06 f0 ff 22 38 paddi 1, 2, 8589934576, 0 LAB2: paddi 1, 2, 8589934576, 0 diff --git a/llvm/test/tools/llvm-objdump/ELF/PowerPC/mcpu.s b/llvm/test/tools/llvm-objdump/ELF/PowerPC/mcpu.s new file mode 100644 --- /dev/null +++ b/llvm/test/tools/llvm-objdump/ELF/PowerPC/mcpu.s @@ -0,0 +1,15 @@ +## Test that we default to --mcpu=future and disassemble all known instructions. +## The default is different from producers (e.g. Clang). +# RUN: llvm-mc -triple=powerpc64le -filetype=obj %s -o %t +# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s --check-prefixes=CHECK,FUTURE +# RUN: llvm-objdump -d --no-show-raw-insn --mcpu=future %t | FileCheck %s --check-prefixes=CHECK,FUTURE +# RUN: llvm-objdump -d --no-show-raw-insn --mcpu=pwr9 %t | FileCheck %s --check-prefixes=CHECK,UNKNOWN + +# CHECK-LABEL: <_start>: +# FUTURE-NEXT: pld 3, 0(0), 1 +# UNKNOWN-COUNT-2: +# CHECK-EMPTY: + +.globl _start +_start: + pld 3, 0(0), 1