[PATCH] D57485: [GlobalISel] Add IRTranslator support for G_FFLOOR
Jessica Paquette via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 30 16:21:52 PST 2019
paquette created this revision.
paquette added a reviewer: aemerson.
Herald added subscribers: Petar.Avramovic, volkan, kristof.beyls, javed.absar, rovka.
Follow-up to https://reviews.llvm.org/D57484
Adds G_FFLOOR to translateKnownIntrinsic and update arm64-irtranslator.ll.
https://reviews.llvm.org/D57485
Files:
lib/CodeGen/GlobalISel/IRTranslator.cpp
test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
Index: test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
===================================================================
--- test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
+++ test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
@@ -2323,3 +2323,11 @@
%y = call float @llvm.sqrt.f32(float %x)
ret float %y
}
+
+declare float @llvm.floor.f32(float)
+define float @test_floor_f32(float %x) {
+ ; CHECK-LABEL: name: test_floor_f32
+ ; CHECK: %{{[0-9]+}}:_(s32) = G_FFLOOR %{{[0-9]+}}
+ %y = call float @llvm.floor.f32(float %x)
+ ret float %y
+}
Index: lib/CodeGen/GlobalISel/IRTranslator.cpp
===================================================================
--- lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -1076,6 +1076,11 @@
.addDef(getOrCreateVReg(CI))
.addUse(getOrCreateVReg(*CI.getArgOperand(0)));
return true;
+ case Intrinsic::floor:
+ MIRBuilder.buildInstr(TargetOpcode::G_FFLOOR)
+ .addDef(getOrCreateVReg(CI))
+ .addUse(getOrCreateVReg(*CI.getArgOperand(0)));
+ return true;
case Intrinsic::cos:
MIRBuilder.buildInstr(TargetOpcode::G_FCOS)
.addDef(getOrCreateVReg(CI))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57485.184399.patch
Type: text/x-patch
Size: 1221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190131/115291da/attachment.bin>
More information about the llvm-commits
mailing list