1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/CodeGen/Thumb/thumb1-cmp.ll
Eli Friedman 88aaf1ecd8 [ARM] Testcase for Thumb1 cmp with constants.
Even if a comparison isn't legal, we should try to prefer constants
which can be materialized with a two-instruction sequence. (Thinking
about it a bit more, there might be some more clever sequence we could
generate for certain comparisons invoving powers of two, but I'm not
sure exactly what that would look like.)

llvm-svn: 335003
2018-06-19 00:12:13 +00:00

111 lines
1.8 KiB
LLVM

; RUN: llc < %s -mtriple thumbv6m-eabi | FileCheck %s
define i32 @slt_poweroftwo(i32 %a) {
; CHECK-LABEL: slt_poweroftwo:
; CHECK: .long 4095
%b = icmp slt i32 %a, 4096
br i1 %b, label %true, label %false
true:
ret i32 1
false:
ret i32 2
}
define i32 @sle_poweroftwo(i32 %a) {
; CHECK-LABEL: sle_poweroftwo:
; CHECK: movs r1, #1
; CHECK: lsls r1, r1, #12
%b = icmp sle i32 %a, 4096
br i1 %b, label %true, label %false
true:
ret i32 1
false:
ret i32 2
}
define i32 @sge_poweroftwo(i32 %a) {
; CHECK-LABEL: sge_poweroftwo:
; CHECK: movs r1, #1
; CHECK: lsls r1, r1, #12
%b = icmp sge i32 %a, 4096
br i1 %b, label %true, label %false
true:
ret i32 1
false:
ret i32 2
}
define i32 @sgt_poweroftwo(i32 %a) {
; CHECK-LABEL: sgt_poweroftwo:
; CHECK: .long 4097
%b = icmp sgt i32 %a, 4096
br i1 %b, label %true, label %false
true:
ret i32 1
false:
ret i32 2
}
define i32 @slt_nearpoweroftwo(i32 %a) {
; CHECK-LABEL: slt_nearpoweroftwo:
; CHECK: movs r1, #1
; CHECK: lsls r1, r1, #12
%b = icmp slt i32 %a, 4097
br i1 %b, label %true, label %false
true:
ret i32 1
false:
ret i32 2
}
define i32 @sle_nearpoweroftwo(i32 %a) {
; CHECK-LABEL: sle_nearpoweroftwo:
; CHECK: .long 4095
%b = icmp sle i32 %a, 4095
br i1 %b, label %true, label %false
true:
ret i32 1
false:
ret i32 2
}
define i32 @sge_nearpoweroftwo(i32 %a) {
; CHECK-LABEL: sge_nearpoweroftwo:
; CHECK: .long 4097
%b = icmp sge i32 %a, 4097
br i1 %b, label %true, label %false
true:
ret i32 1
false:
ret i32 2
}
define i32 @sgt_nearpoweroftwo(i32 %a) {
; CHECK-LABEL: sgt_nearpoweroftwo:
; CHECK: movs r1, #1
; CHECK: lsls r1, r1, #12
%b = icmp sgt i32 %a, 4095
br i1 %b, label %true, label %false
true:
ret i32 1
false:
ret i32 2
}