[llvm] Add PreLegalizer pattern matching for degrees GL extension (PR #216506)
Kaitlin Peng via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 26 01:54:56 PDT 2026
================
@@ -45,6 +45,24 @@ entry:
ret <4 x half> %elt.degrees
}
+; CHECK-LABEL: Begin function fmul_to_degrees
+define noundef float @fmul_to_degrees(float noundef %x) {
+entry:
+; CHECK: %[[#arg:]] = OpFunctionParameter %[[#float_32]]
+; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_glsl]] Degrees %[[#arg]]
+ %mul = fmul reassoc nnan ninf nsz arcp afn float %x, f0x42652EE1
+ ret float %mul
+}
+
+; CHECK-LABEL: Begin function fmul_to_degrees_vector
+define hidden noundef nofpclass(nan inf) <4 x float> @fmul_to_degrees_vector(<4 x float> noundef nofpclass(nan inf) %v) local_unnamed_addr #0 {
+entry:
+; CHECK: %[[#arg:]] = OpFunctionParameter %[[#vec4_float_32]]
+; CHECK: %[[#]] = OpExtInst %[[#vec4_float_32]] %[[#op_ext_glsl]] Degrees %[[#arg]]
+ %mul.i = fmul reassoc nnan ninf nsz arcp afn <4 x float> %v, splat (float f0x42652EE1)
+ ret <4 x float> %mul.i
----------------
kmpeng wrote:
I don't see a change for this? Either way it's fine if you don't want to change it, just a nit.
https://github.com/llvm/llvm-project/pull/216506
More information about the llvm-commits
mailing list