llvm / llvm/llvm-project

[SPIRV] Add PreLegalizer pattern matching for `degrees` GL extension

Open
#214,882 3 comments 0 reactions 1 assignee Claimed by @albertbolt1 View on GitHub
backend:SPIR-V
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Follow-up to #213096.

Following the `degrees` implementation move, SPIR-V now lowers `degrees` as a generic `fmul` instead of the GL extension:
```asm
degrees(x) ->
fmul x, (180 / pi)
```
We can pattern match this in `SPIRVCombine.td` and `SPIRVCombinerHelper.cpp` to
```llvm
fmul(
x,
(180 / pi))
```
which would allow us to change `fmul(x, 180/pi)` back into `degrees(x)` so that SPIR-V emits the GL extension again.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.