[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

Ulrich Weigand via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 18 05:37:36 PST 2025


================
@@ -6470,6 +6540,84 @@ static SDValue lowerAddrSpaceCast(SDValue Op, SelectionDAG &DAG) {
   return Op;
 }
 
+SDValue SystemZTargetLowering::lowerFP_EXTEND(SDValue Op,
+                                              SelectionDAG &DAG) const {
+  SDValue In = Op.getOperand(Op->isStrictFPOpcode() ? 1 : 0);
+  if (In.getSimpleValueType() != MVT::f16)
+    return Op;      // Legal
+  return SDValue(); // Let legalizer emit the libcall.
+}
+
+// Shift the lower 2 bytes of Op to the left in order to insert into the
+// upper 2 bytes of the FP register.
+static SDValue convertToF16(SDValue Op, SelectionDAG &DAG) {
----------------
uweigand wrote:

Huh.  Now you've extracted these subroutines, but there's still only used in one place.  Wasn't the intent to use those for BITCAST in the no-vector case (this logic would still be preferable over an in-memory transfer).

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


More information about the cfe-commits mailing list