mirror of
https://github.com/RPCS3/llvm.git
synced 2026-01-31 01:25:19 +01:00
This avoids us doing a completely unneeded "cmp r0, #0" after a flag-setting instruction if we only care about the Z or C flags. Add LSL/LSR to the whitelist while we're here and add testing. This code could really do with a spring clean. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281027 91177308-0d34-0410-b5e6-96231b3b80d8
58 lines
967 B
LLVM
58 lines
967 B
LLVM
; RUN: llc -mtriple=thumbv6m-eabi -verify-machineinstrs < %s | FileCheck %s
|
|
|
|
; CHECK-LABEL: subs:
|
|
; CHECK: subs
|
|
; CHECK-NEXT: b{{eq|ne}}
|
|
define i32 @subs(i32 %a, i32 %b) {
|
|
%c = sub i32 %a, %b
|
|
%d = icmp eq i32 %c, 0
|
|
br i1 %d, label %true, label %false
|
|
|
|
true:
|
|
ret i32 4
|
|
false:
|
|
ret i32 5
|
|
}
|
|
|
|
; CHECK-LABEL: addsrr:
|
|
; CHECK: adds
|
|
; CHECK-NEXT: b{{eq|ne}}
|
|
define i32 @addsrr(i32 %a, i32 %b) {
|
|
%c = add i32 %a, %b
|
|
%d = icmp eq i32 %c, 0
|
|
br i1 %d, label %true, label %false
|
|
|
|
true:
|
|
ret i32 4
|
|
false:
|
|
ret i32 5
|
|
}
|
|
|
|
; CHECK-LABEL: lslri:
|
|
; CHECK: lsls
|
|
; CHECK-NEXT: b{{eq|ne}}
|
|
define i32 @lslri(i32 %a, i32 %b) {
|
|
%c = shl i32 %a, 3
|
|
%d = icmp eq i32 %c, 0
|
|
br i1 %d, label %true, label %false
|
|
|
|
true:
|
|
ret i32 4
|
|
false:
|
|
ret i32 5
|
|
}
|
|
|
|
; CHECK-LABEL: lslrr:
|
|
; CHECK: lsls
|
|
; CHECK-NEXT: b{{eq|ne}}
|
|
define i32 @lslrr(i32 %a, i32 %b) {
|
|
%c = shl i32 %a, %b
|
|
%d = icmp eq i32 %c, 0
|
|
br i1 %d, label %true, label %false
|
|
|
|
true:
|
|
ret i32 4
|
|
false:
|
|
ret i32 5
|
|
}
|