aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/ARM/bfi.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/ARM/bfi.ll')
-rw-r--r--test/CodeGen/ARM/bfi.ll95
1 files changed, 95 insertions, 0 deletions
diff --git a/test/CodeGen/ARM/bfi.ll b/test/CodeGen/ARM/bfi.ll
index 0661960d1ae0..893fef3add7e 100644
--- a/test/CodeGen/ARM/bfi.ll
+++ b/test/CodeGen/ARM/bfi.ll
@@ -74,3 +74,98 @@ entry:
%or = or i32 %shl, %and
ret i32 %or
}
+
+define i32 @f7(i32 %x, i32 %y) {
+; CHECK-LABEL: f7:
+; CHECK: bfi r1, r0, #4, #1
+ %y2 = and i32 %y, 4294967040 ; 0xFFFFFF00
+ %and = and i32 %x, 4
+ %or = or i32 %y2, 16
+ %cmp = icmp ne i32 %and, 0
+ %sel = select i1 %cmp, i32 %or, i32 %y2
+ ret i32 %sel
+}
+
+define i32 @f8(i32 %x, i32 %y) {
+; CHECK-LABEL: f8:
+; CHECK: bfi r1, r0, #4, #1
+; CHECK: bfi r1, r0, #5, #1
+ %y2 = and i32 %y, 4294967040 ; 0xFFFFFF00
+ %and = and i32 %x, 4
+ %or = or i32 %y2, 48
+ %cmp = icmp ne i32 %and, 0
+ %sel = select i1 %cmp, i32 %or, i32 %y2
+ ret i32 %sel
+}
+
+define i32 @f9(i32 %x, i32 %y) {
+; CHECK-LABEL: f9:
+; CHECK-NOT: bfi
+ %y2 = and i32 %y, 4294967040 ; 0xFFFFFF00
+ %and = and i32 %x, 4
+ %or = or i32 %y2, 48
+ %cmp = icmp ne i32 %and, 0
+ %sel = select i1 %cmp, i32 %y2, i32 %or
+ ret i32 %sel
+}
+
+define i32 @f10(i32 %x, i32 %y) {
+; CHECK-LABEL: f10:
+; CHECK: bfi r1, r0, #4, #2
+ %y2 = and i32 %y, 4294967040 ; 0xFFFFFF00
+ %and = and i32 %x, 4
+ %or = or i32 %y2, 32
+ %cmp = icmp ne i32 %and, 0
+ %sel = select i1 %cmp, i32 %or, i32 %y2
+
+ %aand = and i32 %x, 2
+ %aor = or i32 %sel, 16
+ %acmp = icmp ne i32 %aand, 0
+ %asel = select i1 %acmp, i32 %aor, i32 %sel
+
+ ret i32 %asel
+}
+
+define i32 @f11(i32 %x, i32 %y) {
+; CHECK-LABEL: f11:
+; CHECK: bfi r1, r0, #4, #3
+ %y2 = and i32 %y, 4294967040 ; 0xFFFFFF00
+ %and = and i32 %x, 4
+ %or = or i32 %y2, 32
+ %cmp = icmp ne i32 %and, 0
+ %sel = select i1 %cmp, i32 %or, i32 %y2
+
+ %aand = and i32 %x, 2
+ %aor = or i32 %sel, 16
+ %acmp = icmp ne i32 %aand, 0
+ %asel = select i1 %acmp, i32 %aor, i32 %sel
+
+ %band = and i32 %x, 8
+ %bor = or i32 %asel, 64
+ %bcmp = icmp ne i32 %band, 0
+ %bsel = select i1 %bcmp, i32 %bor, i32 %asel
+
+ ret i32 %bsel
+}
+
+define i32 @f12(i32 %x, i32 %y) {
+; CHECK-LABEL: f12:
+; CHECK: bfi r1, r0, #4, #1
+ %y2 = and i32 %y, 4294967040 ; 0xFFFFFF00
+ %and = and i32 %x, 4
+ %or = or i32 %y2, 16
+ %cmp = icmp eq i32 %and, 0
+ %sel = select i1 %cmp, i32 %y2, i32 %or
+ ret i32 %sel
+}
+
+define i32 @f13(i32 %x, i32 %y) {
+; CHECK-LABEL: f13:
+; CHECK-NOT: bfi
+ %y2 = and i32 %y, 4294967040 ; 0xFFFFFF00
+ %and = and i32 %x, 4
+ %or = or i32 %y2, 16
+ %cmp = icmp eq i32 %and, 42 ; Not comparing against zero!
+ %sel = select i1 %cmp, i32 %y2, i32 %or
+ ret i32 %sel
+}