[llvm] 937d782 - [AArch64] add cost model test for scalable vector math; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 05:52:52 PDT 2020


Author: Sanjay Patel
Date: 2020-10-13T08:39:04-04:00
New Revision: 937d782e38d44d078342cb6358c41db7a5795d00

URL: https://github.com/llvm/llvm-project/commit/937d782e38d44d078342cb6358c41db7a5795d00
DIFF: https://github.com/llvm/llvm-project/commit/937d782e38d44d078342cb6358c41db7a5795d00.diff

LOG: [AArch64] add cost model test for scalable vector math; NFC

Testing for the various cost model "TargetCostKind" is limited,
and testing for scalable vectors is limited. The motivating
example of an intrinsic is not included here yet because that
just crashes.

Added: 
    llvm/test/Analysis/CostModel/AArch64/sve-math.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/CostModel/AArch64/sve-math.ll b/llvm/test/Analysis/CostModel/AArch64/sve-math.ll
new file mode 100644
index 000000000000..5bd9d2659a9d
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/AArch64/sve-math.ll
@@ -0,0 +1,28 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt -mtriple=aarch64-- -mattr=+sve -cost-model -analyze -cost-kind=throughput < %s | FileCheck %s --check-prefix=THRU
+; RUN: opt -mtriple=aarch64-- -mattr=+sve -cost-model -analyze -cost-kind=latency < %s | FileCheck %s --check-prefix=LATE
+; RUN: opt -mtriple=aarch64- --mattr=+sve -cost-model -analyze -cost-kind=code-size < %s | FileCheck %s --check-prefix=SIZE
+; RUN: opt -mtriple=aarch64-- -mattr=+sve -cost-model -analyze -cost-kind=size-latency < %s | FileCheck %s --check-prefix=SIZE_LATE
+
+declare <vscale x 2 x double> @llvm.sqrt.v2f64(<vscale x 2 x double>)
+
+define <vscale x 2 x double> @fadd_v2f64(<vscale x 2 x double> %a, <vscale x 2 x double> %b) {
+; THRU-LABEL: 'fadd_v2f64'
+; THRU-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = fadd <vscale x 2 x double> %a, %b
+; THRU-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 2 x double> %r
+;
+; LATE-LABEL: 'fadd_v2f64'
+; LATE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r = fadd <vscale x 2 x double> %a, %b
+; LATE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <vscale x 2 x double> %r
+;
+; SIZE-LABEL: 'fadd_v2f64'
+; SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = fadd <vscale x 2 x double> %a, %b
+; SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <vscale x 2 x double> %r
+;
+; SIZE_LATE-LABEL: 'fadd_v2f64'
+; SIZE_LATE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = fadd <vscale x 2 x double> %a, %b
+; SIZE_LATE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <vscale x 2 x double> %r
+;
+  %r = fadd <vscale x 2 x double> %a, %b
+  ret <vscale x 2 x double> %r
+}


        


More information about the llvm-commits mailing list