[PATCH] D12856: Always promote f16

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 09:41:47 PDT 2015


ab added inline comments.

================
Comment at: lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp:424-425
@@ -423,2 +423,4 @@
     Op = GetSoftenedFloat(Op);
+  else if (getTypeAction(Op.getValueType()) == TargetLowering::TypePromoteFloat)
+    Op = GetPromotedFloat(Op);
   assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported FP_EXTEND!");
----------------
IIUC, this means we'll do something like:

  (f32 (fpext (f16 ...)))
  (i32 (fpext (f32 <promoted f16 ...>)))
  (i32 (__gnu_h2f_ieee (f32 ...)))
  (i32 (__gnu_h2f_ieee (i32 ...)))

even though __gnu_h2f_ieee expects uint16_t. On ARM uint16_t will get promoted to i32, but now we're interpreting a full f32-softened-to-i32 as an i16-promoted-to-i32, no?

Doesn't this mean it's possible to get stuff like:

  (i32 (__gnu_h2f_ieee
    (i32 (__gnu_h2f_ieee
      (i32 (load zext from i16 ...))
    ))
  ))

by legalizing:

  (f32 (fpext (f16 (load ...))))

?


http://reviews.llvm.org/D12856





More information about the llvm-commits mailing list