[all-commits] [llvm/llvm-project] de1a97: [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Low...

Farzon Lotfi via All-commits all-commits at lists.llvm.org
Thu Mar 14 17:26:19 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: de1a97db3948608822a6d099cc3460690132e1cb
      https://github.com/llvm/llvm-project/commit/de1a97db3948608822a6d099cc3460690132e1cb
  Author: Farzon Lotfi <1802579+farzonl at users.noreply.github.com>
  Date:   2024-03-14 (Thu, 14 Mar 2024)

  Changed paths:
    M clang/include/clang/AST/Type.h
    M clang/include/clang/Basic/Builtins.td
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/Sema/SemaChecking.cpp
    M clang/test/CodeGenHLSL/builtins/lerp-builtin.hlsl
    M clang/test/CodeGenHLSL/builtins/lerp.hlsl
    M clang/test/SemaHLSL/BuiltIns/frac-errors.hlsl
    M clang/test/SemaHLSL/BuiltIns/isinf-errors.hlsl
    M clang/test/SemaHLSL/BuiltIns/lerp-errors.hlsl
    M clang/test/SemaHLSL/BuiltIns/rsqrt-errors.hlsl
    M llvm/include/llvm/IR/IntrinsicsDirectX.td
    M llvm/lib/Target/DirectX/CMakeLists.txt
    A llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp
    A llvm/lib/Target/DirectX/DXILIntrinsicExpansion.h
    M llvm/lib/Target/DirectX/DXILOpLowering.cpp
    M llvm/lib/Target/DirectX/DirectX.h
    M llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
    A llvm/test/CodeGen/DirectX/any.ll
    A llvm/test/CodeGen/DirectX/exp-vec.ll
    A llvm/test/CodeGen/DirectX/exp.ll
    A llvm/test/CodeGen/DirectX/lerp.ll
    A llvm/test/CodeGen/DirectX/rcp.ll

  Log Message:
  -----------
  [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Lowering (#84526)

This change implements lowering for #70076, #70100, #70072, & #70102 
`CGBuiltin.cpp` - - simplify `lerp` intrinsic
`IntrinsicsDirectX.td` - simplify `lerp` intrinsic
`SemaChecking.cpp` - remove unnecessary check
`DXILIntrinsicExpansion.*` - add intrinsic to instruction expansion
cases
`DXILOpLowering.cpp` - make sure `DXILIntrinsicExpansion` happens first
`DirectX.h` - changes to support new pass
`DirectXTargetMachine.cpp` - changes to support new pass

Why `any`, and `lerp` as instruction expansion just for DXIL?
- SPIR-V there is an
[OpAny](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpAny)
- SPIR-V has a GLSL lerp extension via
[Fmix](https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#FMix)

Why `exp` instruction expansion?
- We have an `exp2` opcode and `exp` reuses that opcode. So instruction
expansion is a convenient way to do preprocessing.
- Further SPIR-V has a GLSL exp extension via
[Exp](https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#Exp)
and
[Exp2](https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#Exp2)

Why `rcp` as instruction expansion?
This one is a bit of the odd man out and might have to move to
`cgbuiltins` when we better understand SPIRV requirements. However I
included it because it seems like [fast math mode has an AllowRecip
flag](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_fp_fast_math_mode)
which lets you compute the reciprocal without performing the division.
We don't have that in DXIL so thought to include it.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list