Skip to content

Commit 27b5dc4

Browse files
authored
Add target-byteorder for cases where endian in target triple is what matters (#107915)
I came across the subtly when setting up lit for z/OS and running it on a Linux on Power machine. Linux on Power is little endian. This was resulting in all of these tests being run even though the target triple was z/OS which is big endian. The lit should really be checking if the target is little endian not the host. The previous way didn't handle cross compilation while running lit.
1 parent 8a9f66c commit 27b5dc4

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

llvm/test/CodeGen/Generic/allow-check.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; Avoid `!DL->isLittleEndian() && !CLI->enableBigEndian()` missmatch on PPC64BE.
2-
; REQUIRES: host-byteorder-little-endian
2+
; REQUIRES: target-byteorder-little-endian
33

44
; -global-isel=1 is unsupported.
55
; XFAIL: target=loongarch{{.*}}

llvm/test/lit.cfg.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,14 @@ def version_int(ver):
364364
config.available_features.add("llvm-64-bits")
365365

366366
config.available_features.add("host-byteorder-" + sys.byteorder + "-endian")
367+
if config.target_triple:
368+
if re.match(
369+
r"(aarch64_be|arc|armeb|bpfeb|lanai|m68k|mips|mips64|powerpc|powerpc64|sparc|sparcv9|s390x|s390|tce|thumbeb)-.*",
370+
config.target_triple,
371+
):
372+
config.available_features.add("target-byteorder-big-endian")
373+
else:
374+
config.available_features.add("target-byteorder-little-endian")
367375

368376
if sys.platform in ["win32"]:
369377
# ExecutionEngine, no weak symbols in COFF.

0 commit comments

Comments
 (0)