[PATCH] D103169: [FPEnv][InstSimplify] Constrained FP support for undef, poison, and NaN

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 26 11:58:42 PDT 2021


spatel added a comment.

There's a lot going on here. I think we need to break this up to make sure we're testing the corner cases.

What if we start with plain constant folding? I don't see any existing tests for these intrinsics in `llvm/test/Transforms/InstSimplify/ConstProp`. See `fp-undef.ll` in that dir for test ideas.
For example, what can we do with this set of tests:

  define float @fadd_undef_strict(float %x) #0 {
    %r = call float @llvm.experimental.constrained.fadd.f32(float undef, float undef, metadata !"round.dynamic", metadata !"fpexcept.strict") #0
    ret float %r
  }
  
  define float @fadd_undef_maytrap(float %x) #0 {
    %r = call float @llvm.experimental.constrained.fadd.f32(float undef, float undef, metadata !"round.dynamic", metadata !"fpexcept.maytrap") #0
    ret float %r
  }
  
  define float @fadd_undef_upward(float %x) #0 {
    %r = call float @llvm.experimental.constrained.fadd.f32(float undef, float undef, metadata !"round.upward", metadata !"fpexcept.ignore") #0
    ret float %r
  }
  
  define float @fadd_undef_defaultfp(float %x) #0 {
    %r = call float @llvm.experimental.constrained.fadd.f32(float undef, float undef, metadata !"round.tonearest", metadata !"fpexcept.ignore") #0
    ret float %r
  }

What should happen if we replace each of those undef values with a constant number, NaN, etc?


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