[llvm] 27b5dc4 - Add target-byteorder for cases where endian in target triple is what matters (#107915)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 10:00:47 PDT 2024


Author: Sean Perry
Date: 2024-09-23T13:00:44-04:00
New Revision: 27b5dc422cd3dc15b3d4410ba910d4b12272384d

URL: https://github.com/llvm/llvm-project/commit/27b5dc422cd3dc15b3d4410ba910d4b12272384d
DIFF: https://github.com/llvm/llvm-project/commit/27b5dc422cd3dc15b3d4410ba910d4b12272384d.diff

LOG: 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.

Added: 
    

Modified: 
    llvm/test/CodeGen/Generic/allow-check.ll
    llvm/test/lit.cfg.py

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/Generic/allow-check.ll b/llvm/test/CodeGen/Generic/allow-check.ll
index a08488959862ab..148ee811ea806c 100644
--- a/llvm/test/CodeGen/Generic/allow-check.ll
+++ b/llvm/test/CodeGen/Generic/allow-check.ll
@@ -1,5 +1,5 @@
 ; Avoid `!DL->isLittleEndian() && !CLI->enableBigEndian()` missmatch on PPC64BE.
-; REQUIRES: host-byteorder-little-endian
+; REQUIRES: target-byteorder-little-endian
 
 ; -global-isel=1 is unsupported.
 ; XFAIL: target=loongarch{{.*}}

diff  --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index 1e0dd0a7df34f1..5a03a85386e0aa 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -364,6 +364,14 @@ def version_int(ver):
     config.available_features.add("llvm-64-bits")
 
 config.available_features.add("host-byteorder-" + sys.byteorder + "-endian")
+if config.target_triple:
+    if re.match(
+        r"(aarch64_be|arc|armeb|bpfeb|lanai|m68k|mips|mips64|powerpc|powerpc64|sparc|sparcv9|s390x|s390|tce|thumbeb)-.*",
+        config.target_triple,
+    ):
+        config.available_features.add("target-byteorder-big-endian")
+    else:
+        config.available_features.add("target-byteorder-little-endian")
 
 if sys.platform in ["win32"]:
     # ExecutionEngine, no weak symbols in COFF.


        


More information about the llvm-commits mailing list