Skip to content

Commit

Permalink
[GlobalISel] Translate @llvm.llround.* -> G_LLROUND
Browse files Browse the repository at this point in the history
Translate it using `IRTranslator::translateSimpleIntrinsic`.

Differential Revision: https://reviews.llvm.org/D108563
  • Loading branch information
Jessica Paquette committed Aug 23, 2021
1 parent c2574e6 commit 6760e2a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
Expand Up @@ -1765,6 +1765,8 @@ unsigned IRTranslator::getSimpleIntrinsicOpcode(Intrinsic::ID ID) {
return TargetOpcode::G_VECREDUCE_UMIN;
case Intrinsic::lround:
return TargetOpcode::G_LROUND;
case Intrinsic::llround:
return TargetOpcode::G_LLROUND;
}
return Intrinsic::not_intrinsic;
}
Expand Down
13 changes: 13 additions & 0 deletions llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
Expand Up @@ -2470,3 +2470,16 @@ define i64 @lround(float %x) {
%lround = tail call i64 @llvm.lround.i64.f32(float %x)
ret i64 %lround
}

declare i64 @llvm.llround.i64.f32(float) nounwind readnone
define i64 @llround(float %x) {
; CHECK-LABEL: name: llround
; CHECK: bb.1 (%ir-block.0):
; CHECK: liveins: $s0
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $s0
; CHECK: [[LLROUND:%[0-9]+]]:_(s64) = G_LLROUND [[COPY]](s32)
; CHECK: $x0 = COPY [[LLROUND]](s64)
; CHECK: RET_ReallyLR implicit $x0
%lround = tail call i64 @llvm.llround.i64.f32(float %x)
ret i64 %lround
}

0 comments on commit 6760e2a

Please sign in to comment.