This patch converts clamp at DAG level in DAGCombiner.cpp. For example, the following code:
float clamp(float a)
{
const float b = 255.0;
const float c = 0.0;
if(b < a)
return b;
if(a < c)
return c;
return a;
}could be compiled:
clamp: // @clamp
// BB#0: // %entry
adrp x8, .LCPI0_0
ldr s1, [x8, :lo12:.LCPI0_0]
fmov s2, wzr
fmaxnm s0, s0, s2
fminnm s0, s0, s1
retI work with @hiraditya on this patch.
The || should go at the end of the line