Skip to content

Commit bd7ac30

Browse files
author
Jessica Paquette
committed
[GlobalISel] Add IRTranslator support for G_FNEARBYINT
Translate llvm.nearbyint into G_FNEARBYINT as a simple intrinsic. Update arm64-irtranslator.ll. Differential Revision: https://reviews.llvm.org/D60922 llvm-svn: 359203
1 parent 79e7e43 commit bd7ac30

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,8 @@ unsigned IRTranslator::getSimpleIntrinsicOpcode(Intrinsic::ID ID) {
788788
return TargetOpcode::G_FLOG2;
789789
case Intrinsic::log10:
790790
return TargetOpcode::G_FLOG10;
791+
case Intrinsic::nearbyint:
792+
return TargetOpcode::G_FNEARBYINT;
791793
case Intrinsic::pow:
792794
return TargetOpcode::G_FPOW;
793795
case Intrinsic::rint:

llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2333,6 +2333,14 @@ define float @test_floor_f32(float %x) {
23332333
ret float %y
23342334
}
23352335

2336+
declare float @llvm.nearbyint.f32(float)
2337+
define float @test_nearbyint_f32(float %x) {
2338+
; CHECK-LABEL: name: test_nearbyint_f32
2339+
; CHECK: %{{[0-9]+}}:_(s32) = G_FNEARBYINT %{{[0-9]+}}
2340+
%y = call float @llvm.nearbyint.f32(float %x)
2341+
ret float %y
2342+
}
2343+
23362344
; CHECK-LABEL: name: test_llvm.aarch64.neon.ld3.v4i32.p0i32
23372345
; CHECK: %1:_(<4 x s32>), %2:_(<4 x s32>), %3:_(<4 x s32>) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.aarch64.neon.ld3), %0(p0) :: (load 48 from %ir.ptr, align 64)
23382346
define void @test_llvm.aarch64.neon.ld3.v4i32.p0i32(i32* %ptr) {

0 commit comments

Comments
 (0)