[PATCH] D98934: [SVE] Add instruction cost for fptrunc in loops

Nashe Mncube via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 19 08:48:53 PDT 2021


nasherm updated this revision to Diff 331896.
nasherm marked 2 inline comments as done.
nasherm added a comment.

Refactored regression test. Removed clang-format changes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98934

Files:
  llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
  llvm/test/Analysis/CostModel/AArch64/sve-fptrunc.ll


Index: llvm/test/Analysis/CostModel/AArch64/sve-fptrunc.ll
===================================================================
--- /dev/null
+++ llvm/test/Analysis/CostModel/AArch64/sve-fptrunc.ll
@@ -0,0 +1,15 @@
+; RUN: opt -cost-model -analyze -mtriple aarch64-linux-gnu -mattr=+sve -S -o - < %s  2>&1| FileCheck %s
+
+target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
+target triple = "aarch64-unknown-linux-gnu"
+
+define void @sve_fptruncs() {
+  ; CHECK-LABEL: 'sve_fptruncs'
+  ; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %fptrunc_nxv2f64 = fptrunc <vscale x 2 x double> undef to <vscale x 2 x float>
+  ; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %fptrunc_nxv4f64 = fptrunc <vscale x 4 x double> undef to <vscale x 4 x float>
+  ; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %fptrunc_nxv8f64 = fptrunc <vscale x 8 x double> undef to <vscale x 8 x float>
+  %fptrunc_nxv2f64 = fptrunc <vscale x 2 x double> undef to <vscale x 2 x float>
+  %fptrunc_nxv4f64 = fptrunc <vscale x 4 x double> undef to <vscale x 4 x float>
+  %fptrunc_nxv8f64 = fptrunc <vscale x 8 x double> undef to <vscale x 8 x float>
+  ret void
+}
Index: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -466,6 +466,11 @@
     { ISD::FP_TO_UINT, MVT::v2i32, MVT::v2f64, 2 },
     { ISD::FP_TO_UINT, MVT::v2i16, MVT::v2f64, 2 },
     { ISD::FP_TO_UINT, MVT::v2i8,  MVT::v2f64, 2 },
+
+    // From nxvmf32 to nxmf64
+    { ISD::FP_ROUND, MVT::nxv2f32, MVT::nxv2f64, 1 },
+    { ISD::FP_ROUND, MVT::nxv4f32, MVT::nxv4f64, 1 },
+    { ISD::FP_ROUND, MVT::nxv8f32, MVT::nxv8f64, 1 },
   };
 
   if (const auto *Entry = ConvertCostTableLookup(ConversionTbl, ISD,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98934.331896.patch
Type: text/x-patch
Size: 1925 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210319/efa61f65/attachment.bin>


More information about the llvm-commits mailing list