[VE] Change to expand BRCOND

VE doesn't have BRCOND instruction, so need to expand it.  Also add
a regression test.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89173
This commit is contained in:
Kazushi (Jam) Marukawa 2020-10-06 23:15:42 +09:00
parent f1bf41e433
commit 6c32bc4875
2 changed files with 48 additions and 0 deletions

View File

@ -679,6 +679,11 @@ VETargetLowering::VETargetLowering(const TargetMachine &TM,
setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i64, Custom);
/// } Stack
/// Branch {
// VE doesn't have BRCOND
setOperationAction(ISD::BRCOND, MVT::Other, Expand);
/// } Branch
/// Int Ops {
for (MVT IntVT : {MVT::i32, MVT::i64}) {
// VE has no REM or DIVREM operations.

View File

@ -0,0 +1,43 @@
; RUN: llc < %s -mtriple=ve | FileCheck %s
; Function Attrs: nounwind
define void @test_then(i1 zeroext %0) {
; CHECK-LABEL: test_then:
; CHECK: .LBB{{[0-9]+}}_4:
; CHECK-NEXT: breq.w 0, %s0, .LBB{{[0-9]+}}_2
; CHECK-NEXT: # %bb.1:
; CHECK-NEXT: #APP
; CHECK-NEXT: nop
; CHECK-NEXT: #NO_APP
; CHECK-NEXT: .LBB{{[0-9]+}}_2:
; CHECK-NEXT: or %s11, 0, %s9
br i1 %0, label %2, label %3
2: ; preds = %1
tail call void asm sideeffect "nop", ""()
br label %3
3: ; preds = %2, %1
ret void
}
; Function Attrs: nounwind
define void @test_else(i1 zeroext %0) {
; CHECK-LABEL: test_else:
; CHECK: .LBB{{[0-9]+}}_4:
; CHECK-NEXT: brne.w 0, %s0, .LBB{{[0-9]+}}_2
; CHECK-NEXT: # %bb.1:
; CHECK-NEXT: #APP
; CHECK-NEXT: nop
; CHECK-NEXT: #NO_APP
; CHECK-NEXT: .LBB{{[0-9]+}}_2:
; CHECK-NEXT: or %s11, 0, %s9
br i1 %0, label %3, label %2
2: ; preds = %1
tail call void asm sideeffect "nop", ""()
br label %3
3: ; preds = %2, %1
ret void
}