[llvm] 9269752 - [AArch64] Fix assert AArch64TargetLowering::ReplaceNodeResults

Simon Wallis via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 4 08:19:29 PDT 2021


Author: Simon Wallis
Date: 2021-08-04T16:18:19+01:00
New Revision: 926975267175eeef921c6f84e25c93b00a359a05

URL: https://github.com/llvm/llvm-project/commit/926975267175eeef921c6f84e25c93b00a359a05
DIFF: https://github.com/llvm/llvm-project/commit/926975267175eeef921c6f84e25c93b00a359a05.diff

LOG: [AArch64] Fix assert AArch64TargetLowering::ReplaceNodeResults

Don't know how to custom expand this
UNREACHABLE executed at llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:16788

The fix is to provide missing expansions for:
  case ISD::STRICT_FP_TO_UINT:
  case ISD::STRICT_FP_TO_SINT:

A test case is provided.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D107452

Added: 
    llvm/test/CodeGen/AArch64/fptosi-strictfp.ll

Modified: 
    llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 4a13fa2d662a..96ba0aa7b30e 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -17320,6 +17320,8 @@ void AArch64TargetLowering::ReplaceNodeResults(
     return;
   case ISD::FP_TO_UINT:
   case ISD::FP_TO_SINT:
+  case ISD::STRICT_FP_TO_SINT:
+  case ISD::STRICT_FP_TO_UINT:
     assert(N->getValueType(0) == MVT::i128 && "unexpected illegal conversion");
     // Let normal code take care of it by not adding anything to Results.
     return;

diff  --git a/llvm/test/CodeGen/AArch64/fptosi-strictfp.ll b/llvm/test/CodeGen/AArch64/fptosi-strictfp.ll
new file mode 100644
index 000000000000..240775853285
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/fptosi-strictfp.ll
@@ -0,0 +1,23 @@
+; RUN: llc < %s | FileCheck %s
+target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
+target triple = "aarch64-arm-none-eabi"
+
+define i128 @test_fixtfti(fp128 %ld) {
+; CHECK-LABEL: test_fixtfti:
+; CHECK: bl	__fixtfti
+entry:
+  %conv = call i128 @llvm.experimental.constrained.fptosi.i128.f128(fp128 %ld, metadata !"fpexcept.strict")
+  ret i128 %conv
+}
+
+declare i128 @llvm.experimental.constrained.fptosi.i128.f128(fp128, metadata)
+
+define i128 @test_fixtftu(fp128 %ld) {
+; CHECK-LABEL: test_fixtftu:
+; CHECK: bl	__fixunstfti
+entry:
+  %conv = call i128 @llvm.experimental.constrained.fptoui.i128.f128(fp128 %ld, metadata !"fpexcept.strict")
+  ret i128 %conv
+}
+
+declare i128 @llvm.experimental.constrained.fptoui.i128.f128(fp128, metadata)


        


More information about the llvm-commits mailing list