llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[SPIRV][DirectX][HLSL] Move `radians` implementation to `hlsl_intrinsics.h`

Open farzonl opened this issue 4 months ago • 4 comments

  1. Remove Intrinsic::dx_ radians and Intrinsic::spv_radians
  2. Remove BI__builtin_hlsl_ radians
  3. Remove BI__builtin_hlsl_ radians Sema checks from clang/lib/Sema/SemaHLSL.cpp
  4. Remove getRadiansIntrinsic from clang/lib/CodeGen/CGHLSLRuntime.h
  5. Remove emitting intrinsic from clang/lib/CodeGen/CGBuiltin.cpp
  6. Remove expandRadiansIntrinsic in llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp
  7. Implement radians algorithm in hlsl_intrinsics.h via tablegen
  8. (Follow-up) add a pattern match for radians as an InstCombine in llvm/lib/Target/SPIRV/SPIRVPreLegalizerCombiner.cpp to be able to still emit the radians GL extension.

farzonl avatar Jul 30 '26 18:07 farzonl

For any future implementer I would like the pattern matching to be a separate pr from the movement to the code from the backends to the HLSL header.

farzonl avatar Jul 30 '26 18:07 farzonl

Pattern matching will be a separate follow-up issue: https://github.com/llvm/llvm-project/issues/214880

kmpeng avatar Aug 07 '26 23:08 kmpeng

@llvm/issue-subscribers-clang-codegen

Author: Farzon Lotfi (farzonl)

1. Remove `Intrinsic::dx_ radians ` and `Intrinsic::spv_radians ` 2. Remove `BI__builtin_hlsl_ radians ` 3. Remove `BI__builtin_hlsl_ radians ` Sema checks from `clang/lib/Sema/SemaHLSL.cpp` 4. Remove `getRadiansIntrinsic` from `clang/lib/CodeGen/CGHLSLRuntime.h` 5. Remove emitting intrinsic from `clang/lib/CodeGen/CGBuiltin.cpp` 6. Remove `expandRadiansIntrinsic` in `llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp` 7. Implement radians algorithm in `hlsl_intrinsics.h` via tablegen 8. (Follow-up) add a pattern match for radians as an InstCombine in `llvm/lib/Target/SPIRV/SPIRVPreLegalizerCombiner.cpp` to be able to still emit the radians GL extension.

@llvm/issue-subscribers-clang-frontend

Author: Farzon Lotfi (farzonl)

1. Remove `Intrinsic::dx_ radians ` and `Intrinsic::spv_radians ` 2. Remove `BI__builtin_hlsl_ radians ` 3. Remove `BI__builtin_hlsl_ radians ` Sema checks from `clang/lib/Sema/SemaHLSL.cpp` 4. Remove `getRadiansIntrinsic` from `clang/lib/CodeGen/CGHLSLRuntime.h` 5. Remove emitting intrinsic from `clang/lib/CodeGen/CGBuiltin.cpp` 6. Remove `expandRadiansIntrinsic` in `llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp` 7. Implement radians algorithm in `hlsl_intrinsics.h` via tablegen 8. (Follow-up) add a pattern match for radians as an InstCombine in `llvm/lib/Target/SPIRV/SPIRVPreLegalizerCombiner.cpp` to be able to still emit the radians GL extension.