1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 04:52:54 +02:00
llvm-mirror/test/CodeGen/AArch64/arm64-bcc.ll
Gerolf Hoflehner fbd25ba142 [AAarch64] Optimize CSINC-branch sequence
Peephole optimization that generates a single conditional branch
for csinc-branch sequences like in the examples below. This is
possible when the csinc sets or clears a register based on a condition
code and the branch checks that register. Also the condition
code may not be modified between the csinc and the original branch.

Examples:

1. Convert csinc w9, wzr, wzr, <CC>;tbnz w9, #0, 0x44
   to b.<invCC>

2. Convert csinc w9, wzr, wzr, <CC>; tbz w9, #0, 0x44
   to b.<CC>


rdar://problem/18506500

llvm-svn: 219742
2014-10-14 23:07:53 +00:00

27 lines
711 B
LLVM

; RUN: llc < %s -mtriple=arm64-apple-darwint | FileCheck %s
; Checks for conditional branch b.vs
; Function Attrs: nounwind
define i32 @add(i32, i32) {
entry:
%2 = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %0, i32 %1)
%3 = extractvalue { i32, i1 } %2, 1
br i1 %3, label %6, label %4
; <label>:4 ; preds = %entry
%5 = extractvalue { i32, i1 } %2, 0
ret i32 %5
; <label>:6 ; preds = %entry
tail call void @llvm.trap()
unreachable
; CHECK: b.vs
}
; Function Attrs: nounwind readnone
declare { i32, i1 } @llvm.sadd.with.overflow.i32(i32, i32)
; Function Attrs: noreturn nounwind
declare void @llvm.trap()