[PATCH] D51854: [Arm builtins] Remove non-necessary IS check

Hugues de Valon via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 10 04:44:19 PDT 2018


hug-dev created this revision.
hug-dev added reviewers: manojgupta, peter.smith, compnerd.
Herald added a reviewer: javed.absar.
Herald added subscribers: Sanitizers, llvm-commits, chrib, kristof.beyls.

This patch removes the instruction set check to make the msr APSR_nzcvq,
ip instruction only execute if Thumb2 is used.
The APSR is a subset of the bits of the CPSR
(B.1.3.3 of the Arm v7 A and R ARM [1]) and is only available for A and
R profiles.
However in section B.9.3.11 of the same document we see that:

- "In the A and R profiles, APSR_nzcvq is the same as CPSR_f"
- "ARM recommends the APSR forms when only the N, Z, C, V, Q, and GE[3:0] bits are being written."

This patch also make those files assemble for Armv8-M Mainline
architecture profile.

The builtins were cross-compiled for Arm, Aarch64 and Armv6-M, Armv7-M
and Armv7E-M targets.
Cross-compiled tests were executed for Arm target.

[1]: https://developer.arm.com/docs/ddi0406/latest/arm-architecture-reference-manual-armv7-a-and-armv7-r-edition


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D51854

Files:
  lib/builtins/arm/aeabi_cdcmp.S
  lib/builtins/arm/aeabi_cfcmp.S


Index: lib/builtins/arm/aeabi_cfcmp.S
===================================================================
--- lib/builtins/arm/aeabi_cfcmp.S
+++ lib/builtins/arm/aeabi_cfcmp.S
@@ -51,12 +51,8 @@
         IT(ne)
         bne __aeabi_cfcmple
 
-#if defined(USE_THUMB_2)
         mov ip, #APSR_C
         msr APSR_nzcvq, ip
-#else
-        msr CPSR_f, #APSR_C
-#endif
         JMP(lr)
 #endif
 END_COMPILERRT_FUNCTION(__aeabi_cfcmpeq)
@@ -115,11 +111,7 @@
         movne ip, #(APSR_C)
 
 1:
-#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
         msr APSR_nzcvq, ip
-#else
-        msr CPSR_f, ip
-#endif
         pop {r0-r3}
         POP_PC()
 #endif
Index: lib/builtins/arm/aeabi_cdcmp.S
===================================================================
--- lib/builtins/arm/aeabi_cdcmp.S
+++ lib/builtins/arm/aeabi_cdcmp.S
@@ -51,12 +51,8 @@
         IT(ne)
         bne __aeabi_cdcmple
 
-#if defined(USE_THUMB_2)
         mov ip, #APSR_C
         msr APSR_nzcvq, ip
-#else
-        msr CPSR_f, #APSR_C
-#endif
         JMP(lr)
 #endif
 END_COMPILERRT_FUNCTION(__aeabi_cdcmpeq)
@@ -115,11 +111,7 @@
         movne ip, #(APSR_C)
 
 1:
-#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
         msr APSR_nzcvq, ip
-#else
-        msr CPSR_f, ip
-#endif
         pop {r0-r3}
         POP_PC()
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51854.164652.patch
Type: text/x-patch
Size: 1322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180910/4f3b03dd/attachment.bin>


More information about the llvm-commits mailing list