[llvm] [X86] Compute `CTLZ` using fp math for `v4i32` on SSE2 targets (PR #190930)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 26 04:34:36 PDT 2026
================
@@ -10870,6 +10870,49 @@ SDValue TargetLowering::expandCTLZ(SDNode *Node, SelectionDAG &DAG) const {
return DAG.getNode(ISD::CTPOP, dl, VT, Op);
}
+SDValue TargetLowering::expandCTLZWithFP(SDNode *Node,
+ SelectionDAG &DAG) const {
+ // pseudocode :
+ // v = v & ~(v >> 8)
+ // v = (f32)v
+ // v = bitcast<i32>(v)
+ // v = v >> 23
+ // v = 158 - v
+ // v = min(v, 32)
+
+ SDLoc dl(Node);
+ EVT VT = Node->getValueType(0);
+ SDValue Op = Node->getOperand(0);
+
+ EVT EltVT = VT.getVectorElementType();
----------------
RKSimon wrote:
No need to make this vector specific:
```suggestion
EVT SVT = VT.getScalarType();
```
https://github.com/llvm/llvm-project/pull/190930
More information about the llvm-commits
mailing list