[llvm] 6760e2a - [GlobalISel] Translate @llvm.llround.* -> G_LLROUND
Jessica Paquette via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 23 09:43:10 PDT 2021
Author: Jessica Paquette
Date: 2021-08-23T09:42:53-07:00
New Revision: 6760e2a7bcb27a63b6a27174715f3eb08ed0f4d8
URL: https://github.com/llvm/llvm-project/commit/6760e2a7bcb27a63b6a27174715f3eb08ed0f4d8
DIFF: https://github.com/llvm/llvm-project/commit/6760e2a7bcb27a63b6a27174715f3eb08ed0f4d8.diff
LOG: [GlobalISel] Translate @llvm.llround.* -> G_LLROUND
Translate it using `IRTranslator::translateSimpleIntrinsic`.
Differential Revision: https://reviews.llvm.org/D108563
Added:
Modified:
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index b60b1d311b12a..989caa450009e 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -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;
}
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
index 3bf7a5cdb0488..7d77f8750803a 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
@@ -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
+}
More information about the llvm-commits
mailing list