Skip to content

[DXIL] Add log, log2, and log10 intrinsic Lowering #86192

Closed
@farzonl

Description

@farzonl

Needs to cover the float and half case for all three: https://godbolt.org/z/64fzEq3nd

This is a perfect candidate for instruction expansion:

  • log2
    • This is the simplest case just call unary dxilop 23
  • log
    • Call log2 DXIL op (ie 23)
    • Create a ln2 const value
      • M_LN2_F 0.693147180559945309417232121458176568f
      • M_LN2_H 0.693147180559945309417232121458176568h
    • Floating point multiply the value of M_LN2 with the return value of log2
    • Reference implementation
  • log10
    • Define M_LN10
      • M_LN10_F 2.30258509299404568401799145468436421f
      • M_LN10_H 2.30258509299404568401799145468436421h
    • Call log2 DXIL op (ie 23)
    • Create a log2_10Const = M_LN2 / M_LN10 const value
  • Floating point multiply the value of log2_10Const with the return value of log2
  • Reference implementation

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions