[compiler-rt] 6f4f102 - [compiler-rt] [Arm] Make the tests for the runtime functions __aeabi_c{d,f} work on Big-Endian.

Simi Pallipurath via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 04:27:38 PDT 2023


Author: Simi Pallipurath
Date: 2023-07-17T12:27:32+01:00
New Revision: 6f4f1023fafec4a470d8b7e8ea884c1953fe5291

URL: https://github.com/llvm/llvm-project/commit/6f4f1023fafec4a470d8b7e8ea884c1953fe5291
DIFF: https://github.com/llvm/llvm-project/commit/6f4f1023fafec4a470d8b7e8ea884c1953fe5291.diff

LOG: [compiler-rt] [Arm] Make the tests for the runtime functions __aeabi_c{d,f} work on Big-Endian.

We are trying to build the compiler-rt as big-endian. And found that the tests compiler-rt/test/builtins/Unit/arm/aeabi_cdcmpeq_test.c and compiler-rt/test/builtins/Unit/arm/aeabi_cfcmpeq_test.c do not work on big endian at the moment. This patch makes these tests work on big endian as well.

Reviewed By: peter.smith, simon_tatham

Differential Revision: https://reviews.llvm.org/D155208

Added: 
    

Modified: 
    compiler-rt/lib/builtins/arm/aeabi_cdcmp.S
    compiler-rt/lib/builtins/arm/aeabi_cfcmp.S
    compiler-rt/test/builtins/Unit/arm/call_apsr.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/arm/aeabi_cdcmp.S b/compiler-rt/lib/builtins/arm/aeabi_cdcmp.S
index bd039a0329ea28..c7abdb003a68c9 100644
--- a/compiler-rt/lib/builtins/arm/aeabi_cdcmp.S
+++ b/compiler-rt/lib/builtins/arm/aeabi_cdcmp.S
@@ -8,10 +8,6 @@
 
 #include "../assembly.h"
 
-#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
-#error big endian support not implemented
-#endif
-
 #define APSR_Z (1 << 30)
 #define APSR_C (1 << 29)
 

diff  --git a/compiler-rt/lib/builtins/arm/aeabi_cfcmp.S b/compiler-rt/lib/builtins/arm/aeabi_cfcmp.S
index a26cb2a3ce16ad..81c47661c8b5f5 100644
--- a/compiler-rt/lib/builtins/arm/aeabi_cfcmp.S
+++ b/compiler-rt/lib/builtins/arm/aeabi_cfcmp.S
@@ -8,10 +8,6 @@
 
 #include "../assembly.h"
 
-#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
-#error big endian support not implemented
-#endif
-
 #define APSR_Z (1 << 30)
 #define APSR_C (1 << 29)
 

diff  --git a/compiler-rt/test/builtins/Unit/arm/call_apsr.h b/compiler-rt/test/builtins/Unit/arm/call_apsr.h
index 87a7a74cb2a5ec..09de115d4edac4 100644
--- a/compiler-rt/test/builtins/Unit/arm/call_apsr.h
+++ b/compiler-rt/test/builtins/Unit/arm/call_apsr.h
@@ -1,21 +1,34 @@
 #ifndef CALL_APSR_H
 #define CALL_APSR_H
 
-#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
-#error big endian support not implemented
-#endif
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 
 union cpsr {
-    struct {
-        uint32_t filler: 28;
-        uint32_t v: 1;
-        uint32_t c: 1;
-        uint32_t z: 1;
-        uint32_t n: 1;
-    } flags;
-    uint32_t value;
+  struct {
+    uint32_t filler : 28;
+    uint32_t v : 1;
+    uint32_t c : 1;
+    uint32_t z : 1;
+    uint32_t n : 1;
+  } flags;
+  uint32_t value;
 };
 
+#else
+
+union cpsr {
+  struct {
+    uint32_t n : 1;
+    uint32_t z : 1;
+    uint32_t c : 1;
+    uint32_t v : 1;
+    uint32_t filler : 28;
+  } flags;
+  uint32_t value;
+};
+
+#endif
+
 __attribute__((noinline, pcs("aapcs"))) static uint32_t call_apsr_f(float a, float b,
                                                                     __attribute__((pcs("aapcs"))) void (*fn)(float, float)) {
   uint32_t result;


        


More information about the llvm-commits mailing list