summaryrefslogtreecommitdiff
path: root/test/CodeGen/Thumb2/bfi.ll
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-07-17 03:30:54 +0000
committerJim Grosbach <grosbach@apple.com>2010-07-17 03:30:54 +0000
commit5423856e44a7e4b173af211b0fb0675c44945a58 (patch)
treebac56b6c0151d1328703beccdcf5e0b34618d6a6 /test/CodeGen/Thumb2/bfi.ll
parent879259faa3b24015949f3a3614ce348a7c20e422 (diff)
downloadllvm-5423856e44a7e4b173af211b0fb0675c44945a58.tar.gz
llvm-5423856e44a7e4b173af211b0fb0675c44945a58.tar.bz2
llvm-5423856e44a7e4b173af211b0fb0675c44945a58.tar.xz
Add combiner patterns to more effectively utilize the BFI (bitfield insert)
instruction for non-constant operands. This includes the case referenced in the README.txt regarding a bitfield copy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108608 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/Thumb2/bfi.ll')
-rw-r--r--test/CodeGen/Thumb2/bfi.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/CodeGen/Thumb2/bfi.ll b/test/CodeGen/Thumb2/bfi.ll
index a256d67800..22473bb35a 100644
--- a/test/CodeGen/Thumb2/bfi.ll
+++ b/test/CodeGen/Thumb2/bfi.ll
@@ -15,3 +15,26 @@ entry:
store i32 %2, i32* bitcast (%struct.F* @X to i32*), align 4
ret void
}
+
+define i32 @f2(i32 %A, i32 %B) nounwind readnone optsize {
+entry:
+; CHECK: f2
+; CHECK: lsrs r1, r1, #7
+; CHECK: bfi r0, r1, #7, #16
+ %and = and i32 %A, -8388481 ; <i32> [#uses=1]
+ %and2 = and i32 %B, 8388480 ; <i32> [#uses=1]
+ %or = or i32 %and2, %and ; <i32> [#uses=1]
+ ret i32 %or
+}
+
+define i32 @f3(i32 %A, i32 %B) nounwind readnone optsize {
+entry:
+; CHECK: f3
+; CHECK: lsrs r2, r0, #7
+; CHECK: mov r0, r1
+; CHECK: bfi r0, r2, #7, #16
+ %and = and i32 %A, 8388480 ; <i32> [#uses=1]
+ %and2 = and i32 %B, -8388481 ; <i32> [#uses=1]
+ %or = or i32 %and2, %and ; <i32> [#uses=1]
+ ret i32 %or
+}