On 64-bit target, when doing i64 BR_CC where one of the comparison operands is a constant zero, try to fold the compare and BPcc into a BPr instruction. For all integers, EQ and NE comparison are available, additionally for signed integers, GT, GE, LT, and LE is also available. Reviewed By: arsenm Differential Revision: https://reviews.llvm.org/D142461
36 lines
875 B
LLVM
36 lines
875 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc < %s -verify-machineinstrs | FileCheck %s
|
|
|
|
target datalayout = "E-m:e-i64:64-n32:64-S128"
|
|
target triple = "sparc64-unknown-linux-gnu"
|
|
|
|
define void @f(i64 %a0) align 2 {
|
|
; CHECK-LABEL: f:
|
|
; CHECK: .cfi_startproc
|
|
; CHECK-NEXT: ! %bb.0: ! %entry
|
|
; CHECK-NEXT: brz %o0, .LBB0_2
|
|
; CHECK-NEXT: nop
|
|
; CHECK-NEXT: ! %bb.1: ! %cond.false
|
|
; CHECK-NEXT: .LBB0_2: ! %targetblock
|
|
; CHECK-NEXT: cmp %g0, 0
|
|
; CHECK-NEXT: bne %icc, .LBB0_4
|
|
; CHECK-NEXT: nop
|
|
; CHECK-NEXT: ! %bb.3: ! %cond.false.i83
|
|
; CHECK-NEXT: .LBB0_4: ! %exit.i85
|
|
entry:
|
|
%cmp = icmp eq i64 %a0, 0
|
|
br i1 %cmp, label %targetblock, label %cond.false
|
|
|
|
cond.false:
|
|
unreachable
|
|
|
|
targetblock:
|
|
br i1 undef, label %cond.false.i83, label %exit.i85
|
|
|
|
cond.false.i83:
|
|
unreachable
|
|
|
|
exit.i85:
|
|
unreachable
|
|
}
|