[llvm] [GlobalISel][AArch64] Add G_FPTOSI_SAT/G_FPTOUI_SAT (PR #96297)

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 26 00:57:27 PDT 2024


================
@@ -2130,6 +2130,12 @@ bool AArch64InstructionSelector::preISelLower(MachineInstr &I) {
     }
     return false;
   }
+  case TargetOpcode::G_FPTOSI_SAT:
+    I.setDesc(TII.get(TargetOpcode::G_FPTOSI));
----------------
davemgreen wrote:

Ah yes - I had forgotten I had added this. The SDAG nodes take an extra ValueType variable to specify the width of the saturation, but as far as I can tell that isn't very useful as the instructions will always saturate to the maximum width (and it makes some parts of type legalization more difficult).

It does mean that the existing fp_to_sint_sat nodes will not work naturally. So this just changed the nodes as at this point we know the AArch64 G_FPTOSI instructions will be saturating, and all the existing patterns could apply.

This needs tightening up, but I'm not sure if it can work with the existing patterns work - they don't get imported by the gisel importer as far as I understand.

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


More information about the llvm-commits mailing list