[PATCH] D103169: [FPEnv][InstSimplify] Constrained FP support for NaN

Qiu Chaofan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 15 00:04:10 PDT 2021


qiucf added a comment.

Hi, I notice `poison` is generated for `maytrap` constrained `0 * Inf` operation, but `NaN` for non-constrained ones. Is that expected?

  define float @foo() {
  entry:
    %x = tail call ninf contract afn float @llvm.experimental.constrained.fmul.f32(float 0.000000e+00, float 0x7FF0000000000000, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
    ret float %x
  }
  
  # =>
  
  define float @foo() {
  entry:
    ret float poison
  }



  define float @foo() {
  entry:
    %x = fmul ninf contract afn float 0.000000e+00, 0x7FF0000000000000
    ret float %x
  }
  
  # =>
  
  define float @foo() {
  entry:
    ret float 0x7FF8000000000000
  }

Because constrained ones are handled by `simplifyFPOp` while non-constrained ones are handled by `ConstantFoldBinaryInstruction`. Should we make this consistent?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103169/new/

https://reviews.llvm.org/D103169



More information about the llvm-commits mailing list