[PATCH] D12856: Always promote f16

Pirama Arumuga Nainar via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 22:02:32 PDT 2015


pirama 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!");
----------------
ab wrote:
> 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 ...))))
> 
> ?
You are right.  I completely missed testing this.  Also, Op isn't legalized yet at this point.  I'll fix this and upload a new revision.


http://reviews.llvm.org/D12856





More information about the llvm-commits mailing list