[llvm] 3e6afa7 - [CostModel][AArch64] Precommit tests for LD1 single-element to lane. NFC.

Sjoerd Meijer via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 08:50:39 PST 2023


Author: Sjoerd Meijer
Date: 2023-01-19T16:50:31Z
New Revision: 3e6afa77b4ec8b5fb5e0b6349f08e4476892c0f8

URL: https://github.com/llvm/llvm-project/commit/3e6afa77b4ec8b5fb5e0b6349f08e4476892c0f8
DIFF: https://github.com/llvm/llvm-project/commit/3e6afa77b4ec8b5fb5e0b6349f08e4476892c0f8.diff

LOG: [CostModel][AArch64] Precommit tests for LD1 single-element to lane. NFC.

Added: 
    

Modified: 
    llvm/test/Analysis/CostModel/AArch64/insert-extract.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/CostModel/AArch64/insert-extract.ll b/llvm/test/Analysis/CostModel/AArch64/insert-extract.ll
index 794fa61e2160..844b23dc52ba 100644
--- a/llvm/test/Analysis/CostModel/AArch64/insert-extract.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/insert-extract.ll
@@ -102,3 +102,73 @@ define void @vectorInstrCost() {
   %t160 = insertelement <2 x double> zeroinitializer, double 0.000000e+00, i64 1
   ret void
 }
+
+;; LD1: Load one single-element structure to one lane of one register.
+
+define <8 x i8> @LD1_B(<8 x i8> %vec, ptr noundef %i) {
+; KRYO-LABEL: 'LD1_B'
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v1 = load i8, ptr %i, align 1
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2 = insertelement <8 x i8> %vec, i8 %v1, i32 1
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i8> %v2
+;
+; NEO-LABEL: 'LD1_B'
+; NEO-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v1 = load i8, ptr %i, align 1
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %v2 = insertelement <8 x i8> %vec, i8 %v1, i32 1
+; NEO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i8> %v2
+;
+entry:
+  %v1 = load i8, ptr %i, align 1
+  %v2 = insertelement <8 x i8> %vec, i8 %v1, i32 1
+  ret <8x i8> %v2
+}
+
+define <4 x i16> @LD1_H(<4 x i16> %vec, ptr noundef %i) {
+; KRYO-LABEL: 'LD1_H'
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v1 = load i16, ptr %i, align 2
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2 = insertelement <4 x i16> %vec, i16 %v1, i32 2
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i16> %v2
+;
+; NEO-LABEL: 'LD1_H'
+; NEO-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v1 = load i16, ptr %i, align 2
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %v2 = insertelement <4 x i16> %vec, i16 %v1, i32 2
+; NEO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i16> %v2
+;
+entry:
+  %v1 = load i16, ptr %i, align 2
+  %v2 = insertelement <4 x i16> %vec, i16 %v1, i32 2
+  ret <4 x i16> %v2
+}
+
+define <4 x i32> @LD1_W(<4 x i32> %vec, ptr noundef %i) {
+; KRYO-LABEL: 'LD1_W'
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v1 = load i32, ptr %i, align 4
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2 = insertelement <4 x i32> %vec, i32 %v1, i32 3
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %v2
+;
+; NEO-LABEL: 'LD1_W'
+; NEO-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v1 = load i32, ptr %i, align 4
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %v2 = insertelement <4 x i32> %vec, i32 %v1, i32 3
+; NEO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %v2
+;
+entry:
+  %v1 = load i32, ptr %i, align 4
+  %v2 = insertelement <4 x i32> %vec, i32 %v1, i32 3
+  ret <4 x i32> %v2
+}
+
+define <2 x i64> @LD1_X(<2 x i64> %vec, ptr noundef %i) {
+; KRYO-LABEL: 'LD1_X'
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v1 = load i64, ptr %i, align 8
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2 = insertelement <2 x i64> %vec, i64 %v1, i32 0
+; KRYO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %v2
+;
+; NEO-LABEL: 'LD1_X'
+; NEO-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v1 = load i64, ptr %i, align 8
+; NEO-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %v2 = insertelement <2 x i64> %vec, i64 %v1, i32 0
+; NEO-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %v2
+;
+entry:
+  %v1 = load i64, ptr %i, align 8
+  %v2 = insertelement <2 x i64> %vec, i64 %v1, i32 0
+  ret <2 x i64> %v2
+}


        


More information about the llvm-commits mailing list