Skip to content

[AMDGPU] Fix HasFP32Denormals check in FDIV32 lowering#66212

Merged
Pierre-vh merged 1 commit into
llvm:mainfrom
Pierre-vh:fix-fp32denorm-check
Sep 14, 2023
Merged

[AMDGPU] Fix HasFP32Denormals check in FDIV32 lowering#66212
Pierre-vh merged 1 commit into
llvm:mainfrom
Pierre-vh:fix-fp32denorm-check

Conversation

@Pierre-vh

Copy link
Copy Markdown
Contributor

Fixes SWDEV-403219

@Pierre-vh Pierre-vh requested a review from a team as a code owner September 13, 2023 14:12

@arsenm arsenm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing test changes.

This is also a stop gap, we really need to address the fixme later and restore the correct mode

@llvmbot

llvmbot commented Sep 13, 2023

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-llvm-globalisel

@llvm/pr-subscribers-backend-amdgpu

Changes Fixes SWDEV-403219 -- Full diff: https://github.com//pull/66212.diff

1 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/SIISelLowering.cpp (+1-1)
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index 777fe76df1151cd..998904bf08820c0 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -9589,7 +9589,7 @@ SDValue SITargetLowering::LowerFDIV32(SDValue Op, SelectionDAG &DAG) const {
   const SIMachineFunctionInfo *Info = MF.getInfo<SIMachineFunctionInfo>();
   const DenormalMode DenormMode = Info->getMode().FP32Denormals;
 
-  const bool HasFP32Denormals = DenormMode == DenormalMode::getIEEE();
+  const bool HasFP32Denormals = DenormMode != DenormalMode::getPreserveSign();
 
   if (!HasFP32Denormals) {
     // Note we can't use the STRICT_FMA/STRICT_FMUL for the non-strict FDIV

@arsenm arsenm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also need the equivalent change for globalisel

@arsenm arsenm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the dynamic mode restore in a follow up

@@ -4737,7 +4737,7 @@ bool AMDGPULegalizerInfo::legalizeFDIV32(MachineInstr &MI,

// FIXME: This mishandles dynamic denormal mode. We need to query the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still broken, we're just changing the mode incorrectly in the other direction

@Pierre-vh Pierre-vh merged commit 3d03537 into llvm:main Sep 14, 2023
kstoimenov pushed a commit to kstoimenov/llvm-project that referenced this pull request Sep 14, 2023
ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this pull request Sep 19, 2023
@Pierre-vh Pierre-vh deleted the fix-fp32denorm-check branch October 19, 2023 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants