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

Joe Ellis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 26 07:00:10 PDT 2021


joechrisellis updated this revision to Diff 340510.
joechrisellis added a comment.

Address review comments.

- @paulwalker-arm and @david-arm:
  - add `CHECK-COUNT-*` lines to new tests.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101042/new/

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,46 @@
   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:
+; CHECK-COUNT-1: ucvt
+  %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:
+; CHECK-COUNT-8: ucvt
+  %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:
+; CHECK-COUNT-16: ucvt
+  %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:
+; CHECK-COUNT-32: ucvt
+  %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.340510.patch
Type: text/x-patch
Size: 2706 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210426/62560523/attachment.bin>


More information about the llvm-commits mailing list