[PATCH] D101042: [AArch64] Add missing UINT_TO_FP promotions for v16i8

Joe Ellis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 03:12:25 PDT 2021


joechrisellis created this revision.
joechrisellis added reviewers: peterwaller-arm, paulwalker-arm, DavidTruby, bsmith.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls.
joechrisellis requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101042

Files:
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/test/CodeGen/AArch64/sve-fixed-length-fp-converts.ll


Index: llvm/test/CodeGen/AArch64/sve-fixed-length-fp-converts.ll
===================================================================
--- llvm/test/CodeGen/AArch64/sve-fixed-length-fp-converts.ll
+++ llvm/test/CodeGen/AArch64/sve-fixed-length-fp-converts.ll
@@ -165,4 +165,42 @@
   ret void
 }
 
+;
+; vector uint_to_fp i8 -> f32
+; AArch64 doesn't have a direct vector->f32 conversion instructions for
+; elements smaller than i32, so make sure inputs are promoted to i32 first.
+;
+
+define void @uitofp_v4i8_v4f32(<4 x i8>* %in, <4 x float>* %out) #0 {
+; CHECK-LABEL: uitofp_v4i8_v4f32:
+  %vec = load <4 x i8>, <4 x i8>* %in
+  %conv = uitofp <4 x i8> %vec to <4 x float>
+  store <4 x float> %conv, <4 x float>* %out
+  ret void
+}
+
+define void @uitofp_v8i8_v8f32(<8 x i8>* %in, <8 x float>* %out) #0 {
+; CHECK-LABEL: uitofp_v8i8_v8f32:
+  %vec = load <8 x i8>, <8 x i8>* %in
+  %conv = uitofp <8 x i8> %vec to <8 x float>
+  store <8 x float> %conv, <8 x float>* %out
+  ret void
+}
+
+define void @uitofp_v16i8_v16f32(<16 x i8>* %in, <16 x float>* %out) #0 {
+; CHECK-LABEL: uitofp_v16i8_v16f32:
+  %vec = load <16 x i8>, <16 x i8>* %in
+  %conv = uitofp <16 x i8> %vec to <16 x float>
+  store <16 x float> %conv, <16 x float>* %out
+  ret void
+}
+
+define void @uitofp_v32i8_v32f32(<32 x i8>* %in, <32 x float>* %out) #0 {
+; CHECK-LABEL: uitofp_v32i8_v32f32:
+  %vec = load <32 x i8>, <32 x i8>* %in
+  %conv = uitofp <32 x i8> %vec to <32 x float>
+  store <32 x float> %conv, <32 x float>* %out
+  ret void
+}
+
 attributes #0 = { nounwind "target-features"="+sve" }
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -985,9 +985,11 @@
     // elements smaller than i32, so promote the input to i32 first.
     setOperationPromotedToType(ISD::UINT_TO_FP, MVT::v4i8, MVT::v4i32);
     setOperationPromotedToType(ISD::SINT_TO_FP, MVT::v4i8, MVT::v4i32);
-    // i8 vector elements also need promotion to i32 for v8i8
     setOperationPromotedToType(ISD::SINT_TO_FP, MVT::v8i8, MVT::v8i32);
     setOperationPromotedToType(ISD::UINT_TO_FP, MVT::v8i8, MVT::v8i32);
+    setOperationPromotedToType(ISD::UINT_TO_FP, MVT::v16i8, MVT::v16i32);
+    setOperationPromotedToType(ISD::SINT_TO_FP, MVT::v16i8, MVT::v16i32);
+
     // Similarly, there is no direct i32 -> f64 vector conversion instruction.
     setOperationAction(ISD::SINT_TO_FP, MVT::v2i32, Custom);
     setOperationAction(ISD::UINT_TO_FP, MVT::v2i32, Custom);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101042.339545.patch
Type: text/x-patch
Size: 2612 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210422/8208cf63/attachment.bin>


More information about the llvm-commits mailing list