llvm-project/llvm/test/MC/RISCV/bigendian-data-directives.s
Djordje Todorovic 5050da7ba1
[RISCV] Add initial assembler/MC layer support for big-endian (#146534)
This patch adds basic assembler and MC layer infrastructure for
RISC-V big-endian targets (riscv32be/riscv64be):
      - Register big-endian targets in RISCVTargetMachine
      - Add big-endian data layout strings
      - Implement endianness-aware fixup application in assembler
        backend
      - Add byte swapping for data fixups on BE cores
      - Update MC layer components (AsmInfo, MCTargetDesc, Disassembler,
        AsmParser)
    
This provides the foundation for BE support but does not yet include:
      - Codegen patterns for BE
      - Load/store instruction handling
      - BE-specific subtarget features
2025-08-22 09:21:10 +02:00

37 lines
1.2 KiB
ArmAsm

# RUN: llvm-mc -filetype=obj -triple=riscv32be %s -o %t.32be.o
# RUN: llvm-objdump -s %t.32be.o | FileCheck -check-prefix=RV32BE %s
# RUN: llvm-mc -filetype=obj -triple=riscv64be %s -o %t.64be.o
# RUN: llvm-objdump -s %t.64be.o | FileCheck -check-prefix=RV64BE %s
# RUN: llvm-mc -filetype=obj -triple=riscv32 %s -o %t.32le.o
# RUN: llvm-objdump -s %t.32le.o | FileCheck -check-prefix=RV32LE %s
# RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.64le.o
# RUN: llvm-objdump -s %t.64le.o | FileCheck -check-prefix=RV64LE %s
# Test that data directives are properly byte-swapped on big-endian RISC-V
.data
byte_data:
.byte 0x11
.byte 0x22
.half 0x3344
.word 0x55667788
.long 0x99aabbcc
.quad 0x1122334455667788
# RV32BE: Contents of section .data:
# RV32BE-NEXT: 0000 11223344 55667788 99aabbcc 11223344
# RV32BE-NEXT: 0010 55667788
# RV64BE: Contents of section .data:
# RV64BE-NEXT: 0000 11223344 55667788 99aabbcc 11223344
# RV64BE-NEXT: 0010 55667788
# RV32LE: Contents of section .data:
# RV32LE-NEXT: 0000 11224433 88776655 ccbbaa99 88776655
# RV32LE-NEXT: 0010 44332211
# RV64LE: Contents of section .data:
# RV64LE-NEXT: 0000 11224433 88776655 ccbbaa99 88776655
# RV64LE-NEXT: 0010 44332211