[llvm-branch-commits] [llvm] [AArch64][llvm] Allow FPRCVT insns to run in streaming mode if safe (PR #177334)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 22 05:51:26 PST 2026


================
@@ -20409,6 +20409,9 @@ tryToReplaceScalarFPConversionWithSVE(SDNode *N, SelectionDAG &DAG,
       N->getOpcode() == ISD::FP_TO_UINT_SAT)
     return SDValue();
 
+  if (Subtarget->isStreaming() && Subtarget->hasFPRCVT())
----------------
Lukacma wrote:

As mentioned in previous patch I don't think this is correct guard. Correct me if I am wrong but here is my reasoning in detail. 

Let's take this IR as an example:

```
define i32 @test_fptosi_f16_i32_simd(half %a)  {
  %r = fptosi half %a to i32
  ret i32 %r
}
```

When run with -attr=+sme,+neon,+fullfp16  --force-streaming it lowers to SVE assembly like this:

```
        ptrue   p0.s
                                        // kill: def $h0 killed $h0 def $z0
        fcvtzs  z0.s, p0/m, z0.h
        fmov    w0, s0
```

Even though it could have compiled to just:

```
        fcvtzs  w0, h0
```

As is the case in non-streaming mode. Looking at the patch which introduced it, it seems like it was added to deal with the fact that GPR converts were incorrectly disabled in streaming mode as I don't see a situation in which using SVE converts is better than just using the neon ones, when dealing with fixed length vectors or scalars.

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


More information about the llvm-branch-commits mailing list