[llvm] Support STRICT_UINT_TO_FP and STRICT_SINT_TO_FP (PR #102503)

Mikhail R. Gadelha via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 12:05:00 PDT 2024


================
@@ -3359,6 +3349,16 @@ SDValue DAGTypeLegalizer::SoftPromoteHalfRes_XINT_TO_FP(SDNode *N) {
   EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), OVT);
   SDLoc dl(N);
 
+  if (N->isStrictFPOpcode()) {
+    SDValue Op = DAG.getNode(N->getOpcode(), dl, {NVT, MVT::Other},
+                             {N->getOperand(0), N->getOperand(1)});
+    Op = DAG.getNode(GetPromotionOpcodeStrict(NVT, OVT), dl,
+                     {MVT::i16, MVT::Other}, {Op.getValue(1), Op});
+    ReplaceValueWith(SDValue(N, 1), Op.getValue(1));
+    DAG.ReplaceAllUsesOfValueWith(SDValue(N, 1), Op.getValue(1));
----------------
mikhailramalho wrote:

I just tried and we don't need it anymore.

I'm a bit surprised, we would fail when doing:
```
Legalizing node: t4: i16 = truncate t3
Analyzing result type: i16
```
llvm would crash with an illegal return type...

I'll remove these lines and update the commit message

https://github.com/llvm/llvm-project/pull/102503


More information about the llvm-commits mailing list