mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-13 14:46:53 +00:00
47eac58333
As a first step towards real little-endian code generation, this patch changes the PowerPC MC layer to actually generate little-endian object files. This involves passing the little-endian flag through the various layers, including down to createELFObjectWriter so we actually get basic little-endian ELF objects, emitting instructions in little-endian order, and handling fixups and relocations as appropriate for little-endian. The bulk of the patch is to update most test cases in test/MC/PowerPC to verify both big- and little-endian encodings. (The only test cases *not* updated are those that create actual big-endian ABI code, like the TLS tests.) Note that while the object files are now little-endian, the generated code itself is not yet updated, in particular, it still does not adhere to the ELFv2 ABI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204634 91177308-0d34-0410-b5e6-96231b3b80d8
159 lines
6.7 KiB
ArmAsm
159 lines
6.7 KiB
ArmAsm
|
|
# RUN: llvm-mc -triple powerpc64-unknown-unknown --show-encoding %s | FileCheck -check-prefix=CHECK-BE %s
|
|
# RUN: llvm-mc -triple powerpc64le-unknown-unknown --show-encoding %s | FileCheck -check-prefix=CHECK-LE %s
|
|
|
|
# Register operands
|
|
|
|
# CHECK-BE: add 1, 2, 3 # encoding: [0x7c,0x22,0x1a,0x14]
|
|
# CHECK-LE: add 1, 2, 3 # encoding: [0x14,0x1a,0x22,0x7c]
|
|
add 1, 2, 3
|
|
|
|
# CHECK-BE: add 1, 2, 3 # encoding: [0x7c,0x22,0x1a,0x14]
|
|
# CHECK-LE: add 1, 2, 3 # encoding: [0x14,0x1a,0x22,0x7c]
|
|
add %r1, %r2, %r3
|
|
|
|
# CHECK-BE: add 0, 0, 0 # encoding: [0x7c,0x00,0x02,0x14]
|
|
# CHECK-LE: add 0, 0, 0 # encoding: [0x14,0x02,0x00,0x7c]
|
|
add 0, 0, 0
|
|
|
|
# CHECK-BE: add 31, 31, 31 # encoding: [0x7f,0xff,0xfa,0x14]
|
|
# CHECK-LE: add 31, 31, 31 # encoding: [0x14,0xfa,0xff,0x7f]
|
|
add 31, 31, 31
|
|
|
|
# CHECK-BE: addi 1, 0, 0 # encoding: [0x38,0x20,0x00,0x00]
|
|
# CHECK-LE: addi 1, 0, 0 # encoding: [0x00,0x00,0x20,0x38]
|
|
addi 1, 0, 0
|
|
|
|
# CHECK-BE: addi 1, 0, 0 # encoding: [0x38,0x20,0x00,0x00]
|
|
# CHECK-LE: addi 1, 0, 0 # encoding: [0x00,0x00,0x20,0x38]
|
|
addi 1, %r0, 0
|
|
|
|
# Signed 16-bit immediate operands
|
|
|
|
# CHECK-BE: addi 1, 2, 0 # encoding: [0x38,0x22,0x00,0x00]
|
|
# CHECK-LE: addi 1, 2, 0 # encoding: [0x00,0x00,0x22,0x38]
|
|
addi 1, 2, 0
|
|
|
|
# CHECK-BE: addi 1, 0, -32768 # encoding: [0x38,0x20,0x80,0x00]
|
|
# CHECK-LE: addi 1, 0, -32768 # encoding: [0x00,0x80,0x20,0x38]
|
|
addi 1, 0, -32768
|
|
|
|
# CHECK-BE: addi 1, 0, 32767 # encoding: [0x38,0x20,0x7f,0xff]
|
|
# CHECK-LE: addi 1, 0, 32767 # encoding: [0xff,0x7f,0x20,0x38]
|
|
addi 1, 0, 32767
|
|
|
|
# Unsigned 16-bit immediate operands
|
|
|
|
# CHECK-BE: ori 1, 2, 0 # encoding: [0x60,0x41,0x00,0x00]
|
|
# CHECK-LE: ori 1, 2, 0 # encoding: [0x00,0x00,0x41,0x60]
|
|
ori 1, 2, 0
|
|
|
|
# CHECK-BE: ori 1, 2, 65535 # encoding: [0x60,0x41,0xff,0xff]
|
|
# CHECK-LE: ori 1, 2, 65535 # encoding: [0xff,0xff,0x41,0x60]
|
|
ori 1, 2, 65535
|
|
|
|
# Signed 16-bit immediate operands (extended range for addis)
|
|
|
|
# CHECK-BE: addis 1, 0, 0 # encoding: [0x3c,0x20,0x00,0x00]
|
|
# CHECK-LE: addis 1, 0, 0 # encoding: [0x00,0x00,0x20,0x3c]
|
|
addis 1, 0, -65536
|
|
|
|
# CHECK-BE: addis 1, 0, -1 # encoding: [0x3c,0x20,0xff,0xff]
|
|
# CHECK-LE: addis 1, 0, -1 # encoding: [0xff,0xff,0x20,0x3c]
|
|
addis 1, 0, 65535
|
|
|
|
# D-Form memory operands
|
|
|
|
# CHECK-BE: lwz 1, 0(0) # encoding: [0x80,0x20,0x00,0x00]
|
|
# CHECK-LE: lwz 1, 0(0) # encoding: [0x00,0x00,0x20,0x80]
|
|
lwz 1, 0(0)
|
|
|
|
# CHECK-BE: lwz 1, 0(0) # encoding: [0x80,0x20,0x00,0x00]
|
|
# CHECK-LE: lwz 1, 0(0) # encoding: [0x00,0x00,0x20,0x80]
|
|
lwz 1, 0(%r0)
|
|
|
|
# CHECK-BE: lwz 1, 0(31) # encoding: [0x80,0x3f,0x00,0x00]
|
|
# CHECK-LE: lwz 1, 0(31) # encoding: [0x00,0x00,0x3f,0x80]
|
|
lwz 1, 0(31)
|
|
|
|
# CHECK-BE: lwz 1, 0(31) # encoding: [0x80,0x3f,0x00,0x00]
|
|
# CHECK-LE: lwz 1, 0(31) # encoding: [0x00,0x00,0x3f,0x80]
|
|
lwz 1, 0(%r31)
|
|
|
|
# CHECK-BE: lwz 1, -32768(2) # encoding: [0x80,0x22,0x80,0x00]
|
|
# CHECK-LE: lwz 1, -32768(2) # encoding: [0x00,0x80,0x22,0x80]
|
|
lwz 1, -32768(2)
|
|
|
|
# CHECK-BE: lwz 1, 32767(2) # encoding: [0x80,0x22,0x7f,0xff]
|
|
# CHECK-LE: lwz 1, 32767(2) # encoding: [0xff,0x7f,0x22,0x80]
|
|
lwz 1, 32767(2)
|
|
|
|
|
|
# CHECK-BE: ld 1, 0(0) # encoding: [0xe8,0x20,0x00,0x00]
|
|
# CHECK-LE: ld 1, 0(0) # encoding: [0x00,0x00,0x20,0xe8]
|
|
ld 1, 0(0)
|
|
|
|
# CHECK-BE: ld 1, 0(0) # encoding: [0xe8,0x20,0x00,0x00]
|
|
# CHECK-LE: ld 1, 0(0) # encoding: [0x00,0x00,0x20,0xe8]
|
|
ld 1, 0(%r0)
|
|
|
|
# CHECK-BE: ld 1, 0(31) # encoding: [0xe8,0x3f,0x00,0x00]
|
|
# CHECK-LE: ld 1, 0(31) # encoding: [0x00,0x00,0x3f,0xe8]
|
|
ld 1, 0(31)
|
|
|
|
# CHECK-BE: ld 1, 0(31) # encoding: [0xe8,0x3f,0x00,0x00]
|
|
# CHECK-LE: ld 1, 0(31) # encoding: [0x00,0x00,0x3f,0xe8]
|
|
ld 1, 0(%r31)
|
|
|
|
# CHECK-BE: ld 1, -32768(2) # encoding: [0xe8,0x22,0x80,0x00]
|
|
# CHECK-LE: ld 1, -32768(2) # encoding: [0x00,0x80,0x22,0xe8]
|
|
ld 1, -32768(2)
|
|
|
|
# CHECK-BE: ld 1, 32764(2) # encoding: [0xe8,0x22,0x7f,0xfc]
|
|
# CHECK-LE: ld 1, 32764(2) # encoding: [0xfc,0x7f,0x22,0xe8]
|
|
ld 1, 32764(2)
|
|
|
|
# CHECK-BE: ld 1, 4(2) # encoding: [0xe8,0x22,0x00,0x04]
|
|
# CHECK-LE: ld 1, 4(2) # encoding: [0x04,0x00,0x22,0xe8]
|
|
ld 1, 4(2)
|
|
|
|
# CHECK-BE: ld 1, -4(2) # encoding: [0xe8,0x22,0xff,0xfc]
|
|
# CHECK-LE: ld 1, -4(2) # encoding: [0xfc,0xff,0x22,0xe8]
|
|
ld 1, -4(2)
|
|
|
|
|
|
# Immediate branch operands
|
|
|
|
# CHECK-BE: b .+1024 # encoding: [0x48,0x00,0x04,0x00]
|
|
# CHECK-LE: b .+1024 # encoding: [0x00,0x04,0x00,0x48]
|
|
b 1024
|
|
|
|
# CHECK-BE: ba 1024 # encoding: [0x48,0x00,0x04,0x02]
|
|
# CHECK-LE: ba 1024 # encoding: [0x02,0x04,0x00,0x48]
|
|
ba 1024
|
|
|
|
# CHECK-BE: beq 0, .+1024 # encoding: [0x41,0x82,0x04,0x00]
|
|
# CHECK-LE: beq 0, .+1024 # encoding: [0x00,0x04,0x82,0x41]
|
|
beq 1024
|
|
|
|
# CHECK-BE: beqa 0, 1024 # encoding: [0x41,0x82,0x04,0x02]
|
|
# CHECK-LE: beqa 0, 1024 # encoding: [0x02,0x04,0x82,0x41]
|
|
beqa 1024
|
|
|
|
# CHECK-BE: # encoding: [0x42,0x9f,A,0bAAAAAA01]
|
|
# CHECK-LE: # encoding: [0bAAAAAA01,A,0x9f,0x42]
|
|
bcl 20, 31, $+4
|
|
|
|
# CHECK-BE: # encoding: [0x42,0x00,A,0bAAAAAA00]
|
|
# CHECK-LE: # encoding: [0bAAAAAA00,A,0x00,0x42]
|
|
bdnz $-8
|
|
|
|
# CHECK-BE: andi. 0, 3, 32767 # encoding: [0x70,0x60,0x7f,0xff]
|
|
# CHECK-LE: andi. 0, 3, 32767 # encoding: [0xff,0x7f,0x60,0x70]
|
|
andi. %r0,%r3,~0x8000@l
|
|
|
|
# CHECK-BE: andi. 0, 3, 0 # encoding: [0x70,0x60,0x00,0x00]
|
|
# CHECK-LE: andi. 0, 3, 0 # encoding: [0x00,0x00,0x60,0x70]
|
|
andi. %r0,%r3,!0x8000@l
|
|
|