[SPIRV] Add PreLegalizer pattern matching for `radians` GL extension
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Follow-up to #213095.
Following the `radians` implementation move, SPIR-V now lowers `radians` as a generic `fmul` instead of the GL extension:
```asm
radians(x) ->
fmul x, (pi / 180)
```
We can pattern match this in `SPIRVCombine.td` and `SPIRVCombinerHelper.cpp` to
```llvm
fmul(
x,
(pi / 180))
```
which would allow us to change `fmul(x, pi/180)` back into `radians(x)` so that SPIR-V emits the GL extension again.
Contributor guide
Research direction
Start by reading the existing radians lowering and the related pattern-matching code in SPIRVCombine.td and SPIRVCombinerHelper.cpp, with follow-up issue #213095 as context. Verify that the fmul form using pi / 180 is recognized and that SPIR-V emits the radians GL extension again.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100