From 3e6afa77b4ec8b5fb5e0b6349f08e4476892c0f8 Mon Sep 17 00:00:00 2001 From: Sjoerd Meijer Date: Wed, 11 Jan 2023 14:41:10 +0000 Subject: [PATCH] [CostModel][AArch64] Precommit tests for LD1 single-element to lane. NFC. --- .../Analysis/CostModel/AArch64/insert-extract.ll | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/llvm/test/Analysis/CostModel/AArch64/insert-extract.ll b/llvm/test/Analysis/CostModel/AArch64/insert-extract.ll index 794fa61..844b23d 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 +} -- 2.7.4