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

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

Open kmpeng opened this issue 3 months ago • 3 comments

Follow-up to #213096.

Following the degrees implementation move, SPIR-V now lowers degrees as a generic fmul instead of the GL extension:

degrees(x) ->
  fmul x, (180 / pi)

We can pattern match this in SPIRVCombine.td and SPIRVCombinerHelper.cpp to

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.

kmpeng avatar Aug 07 '26 23:08 kmpeng

Can take this up

albertbolt1 avatar Aug 09 '26 08:08 albertbolt1

@albertbolt1 Thanks! The issue has been assigned to you. Since it's a follow-up, it's probably best to wait until the parent issue is closed before working on this. It should be closed very soon.

Edit: Follow-up issue has been closed!

kmpeng avatar Aug 11 '26 17:08 kmpeng

Hi @kmpeng I have added the PR to the issue https://github.com/llvm/llvm-project/pull/216506

albertbolt1 avatar Aug 18 '26 16:08 albertbolt1