[CostModel][AArch64] Add insert/extract element tests for neoverse cores. NFC.
authorSjoerd Meijer <smeijer@nvidia.com>
Tue, 10 Jan 2023 11:10:42 +0000 (11:10 +0000)
committerSjoerd Meijer <smeijer@nvidia.com>
Tue, 10 Jan 2023 11:26:53 +0000 (11:26 +0000)
llvm/test/Analysis/CostModel/AArch64/insert-extract.ll [new file with mode: 0644]
llvm/test/Analysis/CostModel/AArch64/kryo.ll [deleted file]

diff --git a/llvm/test/Analysis/CostModel/AArch64/insert-extract.ll b/llvm/test/Analysis/CostModel/AArch64/insert-extract.ll
new file mode 100644 (file)
index 0000000..794fa61
--- /dev/null
@@ -0,0 +1,104 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mcpu=kryo | FileCheck %s --check-prefix=KRYO
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mcpu=neoverse-n1 | FileCheck %s --check-prefix=NEO
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mcpu=neoverse-n2 | FileCheck %s --check-prefix=NEO
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mcpu=neoverse-v1 | FileCheck %s --check-prefix=NEO
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mcpu=neoverse-v2 | FileCheck %s --check-prefix=NEO
+
+target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
+target triple = "aarch64--linux-gnu"
+
+define void @vectorInstrCost() {
+; KRYO-LABEL: 'vectorInstrCost'
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t1 = extractelement <8 x i8> undef, i32 0
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t2 = extractelement <8 x i8> undef, i32 1
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t3 = extractelement <4 x i16> undef, i32 0
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t4 = extractelement <4 x i16> undef, i32 1
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t5 = extractelement <2 x i32> undef, i32 0
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t6 = extractelement <2 x i32> undef, i32 1
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t7 = extractelement <2 x i64> undef, i32 0
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t8 = extractelement <2 x i64> undef, i32 1
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %t9 = extractelement <4 x half> undef, i32 0
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t10 = extractelement <4 x half> undef, i32 1
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %t11 = extractelement <2 x float> undef, i32 0
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t12 = extractelement <2 x float> undef, i32 1
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %t13 = extractelement <2 x double> undef, i32 0
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t14 = extractelement <2 x double> undef, i32 1
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t30 = insertelement <8 x i8> undef, i8 0, i32 0
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t40 = insertelement <8 x i8> undef, i8 1, i32 1
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t50 = insertelement <4 x i16> undef, i16 2, i32 0
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t60 = insertelement <4 x i16> undef, i16 3, i32 1
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t70 = insertelement <2 x i32> undef, i32 4, i32 0
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t80 = insertelement <2 x i32> undef, i32 5, i32 1
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t90 = insertelement <2 x i64> undef, i64 6, i32 0
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t100 = insertelement <2 x i64> undef, i64 7, i32 1
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %t110 = insertelement <4 x half> zeroinitializer, half 0xH0000, i64 0
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t120 = insertelement <4 x half> zeroinitializer, half 0xH0000, i64 1
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %t130 = insertelement <2 x float> zeroinitializer, float 0.000000e+00, i64 0
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t140 = insertelement <2 x float> zeroinitializer, float 0.000000e+00, i64 1
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %t150 = insertelement <2 x double> zeroinitializer, double 0.000000e+00, i64 0
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %t160 = insertelement <2 x double> zeroinitializer, double 0.000000e+00, i64 1
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; NEO-LABEL: 'vectorInstrCost'
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t1 = extractelement <8 x i8> undef, i32 0
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t2 = extractelement <8 x i8> undef, i32 1
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t3 = extractelement <4 x i16> undef, i32 0
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t4 = extractelement <4 x i16> undef, i32 1
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t5 = extractelement <2 x i32> undef, i32 0
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t6 = extractelement <2 x i32> undef, i32 1
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t7 = extractelement <2 x i64> undef, i32 0
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t8 = extractelement <2 x i64> undef, i32 1
+; NEO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %t9 = extractelement <4 x half> undef, i32 0
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t10 = extractelement <4 x half> undef, i32 1
+; NEO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %t11 = extractelement <2 x float> undef, i32 0
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t12 = extractelement <2 x float> undef, i32 1
+; NEO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %t13 = extractelement <2 x double> undef, i32 0
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t14 = extractelement <2 x double> undef, i32 1
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t30 = insertelement <8 x i8> undef, i8 0, i32 0
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t40 = insertelement <8 x i8> undef, i8 1, i32 1
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t50 = insertelement <4 x i16> undef, i16 2, i32 0
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t60 = insertelement <4 x i16> undef, i16 3, i32 1
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t70 = insertelement <2 x i32> undef, i32 4, i32 0
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t80 = insertelement <2 x i32> undef, i32 5, i32 1
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t90 = insertelement <2 x i64> undef, i64 6, i32 0
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t100 = insertelement <2 x i64> undef, i64 7, i32 1
+; NEO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %t110 = insertelement <4 x half> zeroinitializer, half 0xH0000, i64 0
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t120 = insertelement <4 x half> zeroinitializer, half 0xH0000, i64 1
+; NEO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %t130 = insertelement <2 x float> zeroinitializer, float 0.000000e+00, i64 0
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t140 = insertelement <2 x float> zeroinitializer, float 0.000000e+00, i64 1
+; NEO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %t150 = insertelement <2 x double> zeroinitializer, double 0.000000e+00, i64 0
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %t160 = insertelement <2 x double> zeroinitializer, double 0.000000e+00, i64 1
+; NEO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+  %t1 = extractelement <8 x i8> undef, i32 0
+  %t2 = extractelement <8 x i8> undef, i32 1
+  %t3 = extractelement <4 x i16> undef, i32 0
+  %t4 = extractelement <4 x i16> undef, i32 1
+  %t5 = extractelement <2 x i32> undef, i32 0
+  %t6 = extractelement <2 x i32> undef, i32 1
+  %t7 = extractelement <2 x i64> undef, i32 0
+  %t8 = extractelement <2 x i64> undef, i32 1
+  %t9 = extractelement <4 x half> undef, i32 0
+  %t10 = extractelement <4 x half> undef, i32 1
+  %t11 = extractelement <2 x float> undef, i32 0
+  %t12 = extractelement <2 x float> undef, i32 1
+  %t13 = extractelement <2 x double> undef, i32 0
+  %t14 = extractelement <2 x double> undef, i32 1
+
+  %t30 = insertelement <8 x i8> undef, i8 0, i32 0
+  %t40 = insertelement <8 x i8> undef, i8 1, i32 1
+  %t50 = insertelement <4 x i16> undef, i16 2, i32 0
+  %t60 = insertelement <4 x i16> undef, i16 3, i32 1
+  %t70 = insertelement <2 x i32> undef, i32 4, i32 0
+  %t80 = insertelement <2 x i32> undef, i32 5, i32 1
+  %t90 = insertelement <2 x i64> undef, i64 6, i32 0
+  %t100 = insertelement <2 x i64> undef, i64 7, i32 1
+  %t110 = insertelement <4 x half> zeroinitializer, half 0.000000e+00, i64 0
+  %t120 = insertelement <4 x half> zeroinitializer, half 0.000000e+00, i64 1
+  %t130 = insertelement <2 x float> zeroinitializer, float 0.000000e+00, i64 0
+  %t140 = insertelement <2 x float> zeroinitializer, float 0.000000e+00, i64 1
+  %t150 = insertelement <2 x double> zeroinitializer, double 0.000000e+00, i64 0
+  %t160 = insertelement <2 x double> zeroinitializer, double 0.000000e+00, i64 1
+  ret void
+}
diff --git a/llvm/test/Analysis/CostModel/AArch64/kryo.ll b/llvm/test/Analysis/CostModel/AArch64/kryo.ll
deleted file mode 100644 (file)
index 0ee72e1..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mcpu=kryo | FileCheck %s
-
-target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
-target triple = "aarch64--linux-gnu"
-
-; CHECK-LABEL: vectorInstrCost
-define void @vectorInstrCost() {
-
-    ; Vector extracts - extracting elements should have a cost of two.
-    ;
-    ; CHECK: cost of 2 {{.*}} extractelement <2 x i64> undef, i32 0
-    ; CHECK: cost of 2 {{.*}} extractelement <2 x i64> undef, i32 1
-    %t1 = extractelement <2 x i64> undef, i32 0
-    %t2 = extractelement <2 x i64> undef, i32 1
-
-    ; Vector inserts - inserting elements should have a cost of two.
-    ;
-    ; CHECK: cost of 2 {{.*}} insertelement <2 x i64> undef, i64 undef, i32 0
-    ; CHECK: cost of 2 {{.*}} insertelement <2 x i64> undef, i64 undef, i32 1
-    %t3 = insertelement <2 x i64> undef, i64 undef, i32 0
-    %t4 = insertelement <2 x i64> undef, i64 undef, i32 1
-    ret void
-}