aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/ARM
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-09-10 21:43:18 +0000
committerChris Lattner <sabre@nondot.org>2007-09-10 21:43:18 +0000
commitbf8ae84a21011a7263c2a4183fdfd8e5755765a1 (patch)
treec3afb5a8cee68d395e2cc00a629c71b27cc65a7f /lib/Target/ARM
parent61c5ff460b18b970aa651115c4ac78dfc0d602d7 (diff)
downloadexternal_llvm-bf8ae84a21011a7263c2a4183fdfd8e5755765a1.zip
external_llvm-bf8ae84a21011a7263c2a4183fdfd8e5755765a1.tar.gz
external_llvm-bf8ae84a21011a7263c2a4183fdfd8e5755765a1.tar.bz2
Add some notes about better flag handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41808 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM')
-rw-r--r--lib/Target/ARM/README.txt45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/Target/ARM/README.txt b/lib/Target/ARM/README.txt
index 3db8f54..f05ae1c 100644
--- a/lib/Target/ARM/README.txt
+++ b/lib/Target/ARM/README.txt
@@ -528,3 +528,48 @@ _foo:
This apparently occurs in real code.
//===---------------------------------------------------------------------===//
+
+This:
+ #include <algorithm>
+ std::pair<unsigned, bool> full_add(unsigned a, unsigned b)
+ { return std::make_pair(a + b, a + b < a); }
+ bool no_overflow(unsigned a, unsigned b)
+ { return !full_add(a, b).second; }
+
+Should compile to:
+
+_Z8full_addjj:
+ adds r2, r1, r2
+ movcc r1, #0
+ movcs r1, #1
+ str r2, [r0, #0]
+ strb r1, [r0, #4]
+ mov pc, lr
+
+_Z11no_overflowjj:
+ cmn r0, r1
+ movcs r0, #0
+ movcc r0, #1
+ mov pc, lr
+
+not:
+
+__Z8full_addjj:
+ add r3, r2, r1
+ str r3, [r0]
+ mov r2, #1
+ mov r12, #0
+ cmp r3, r1
+ movlo r12, r2
+ str r12, [r0, #+4]
+ bx lr
+__Z11no_overflowjj:
+ add r3, r1, r0
+ mov r2, #1
+ mov r1, #0
+ cmp r3, r0
+ movhs r1, r2
+ mov r0, r1
+ bx lr
+
+//===---------------------------------------------------------------------===//