================
@@ -678,6 +682,71 @@ fp::ExceptionBehavior CallBase::getExceptionBehavior() 
const {
   return fp::ebIgnore;
 }
 
+DenormalMode::DenormalModeKind CallBase::getInputDenormMode() const {
+  if (auto InDenormBundle = getOperandBundle(LLVMContext::OB_fp_control)) {
+    auto DenormOperand =
+        getBundleOperandByPrefix(*InDenormBundle, "denorm.in=");
+    if (DenormOperand) {
+      if (auto Mode = parseDenormalKindFromOperandBundle(*DenormOperand))
+        return *Mode;
+    } else {
+      return DenormalMode::IEEE;
+    }
+  }
+
+  if (!getParent())
+    return DenormalMode::IEEE;
+  const Function *F = getFunction();
+  if (!F)
+    return DenormalMode::IEEE;
+
+  Type *Ty = nullptr;
+  for (auto &A : args())
+    if (auto *T = A.get()->getType(); T->isFPOrFPVectorTy()) {
+      Ty = T;
+      break;
+    }
+  assert(Ty && "Some input argument must be of floating-point type");
----------------
arsenm wrote:

This probably can't be an assert 

What happens if there are multiple input floating point type arguments, and 
each one has a differently controllable denormal mode?

For example, AMDGPU has some instructions with mixed half and float inputs, but 
those read from different FP mode controls (I haven't actually checked the 
right input mode bits are respected in these cases).

I'd probably just stop trying to report the mode if there are multiple input 
types 




https://github.com/llvm/llvm-project/pull/136501
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to