blob: 2d9492cabc0948cece4cd98b404bab761e9d557c [file] [log] [blame]
From 02de9752593d3289804a307dbf628960f417f51e Mon Sep 17 00:00:00 2001
From: David Green <david.green@arm.com>
Date: Wed, 2 Mar 2022 14:47:32 +0000
Subject: [PATCH] [AArch64] Add some tests for the cost of extending an
extract. NFC
---
llvm/test/Analysis/CostModel/AArch64/cast.ll | 41 ++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/llvm/test/Analysis/CostModel/AArch64/cast.ll b/llvm/test/Analysis/CostModel/AArch64/cast.ll
index dbb0581a7d7f..63c84f5ceaa7 100644
--- a/llvm/test/Analysis/CostModel/AArch64/cast.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/cast.ll
@@ -981,4 +981,45 @@ define i32 @store_truncs() {
ret i32 undef
}
+define void @extend_extract() {
+; CHECK-LABEL: 'extend_extract'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %e8 = extractelement <8 x i8> undef, i32 1
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %e16 = extractelement <8 x i16> undef, i32 1
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %e32 = extractelement <8 x i32> undef, i32 1
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %s8_16 = sext i8 %e8 to i16
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %z8_16 = zext i8 %e8 to i16
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %s8_32 = sext i8 %e8 to i32
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %z8_32 = zext i8 %e8 to i32
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %s8_64 = sext i8 %e8 to i64
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %z8_64 = zext i8 %e8 to i64
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %s16_32 = sext i16 %e16 to i32
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %z16_32 = zext i16 %e16 to i32
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %s16_64 = sext i16 %e16 to i64
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %z16_64 = zext i16 %e16 to i64
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %s32_64 = sext i32 %e32 to i64
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %z32_64 = zext i32 %e32 to i64
+; CHECK-NEXT: Cost Model: Found an estimated cost of 13 for instruction: call void @use(i16 %s8_16, i16 %z8_16, i32 %s8_32, i32 %z8_32, i64 %s8_64, i64 %z8_64, i32 %s16_32, i32 %z16_32, i64 %s16_64, i64 %z16_64, i64 %s32_64, i64 %z32_64)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+ %e8 = extractelement <8 x i8> undef, i32 1
+ %e16 = extractelement <8 x i16> undef, i32 1
+ %e32 = extractelement <8 x i32> undef, i32 1
+ %s8_16 = sext i8 %e8 to i16
+ %z8_16 = zext i8 %e8 to i16
+ %s8_32 = sext i8 %e8 to i32
+ %z8_32 = zext i8 %e8 to i32
+ %s8_64 = sext i8 %e8 to i64
+ %z8_64 = zext i8 %e8 to i64
+ %s16_32 = sext i16 %e16 to i32
+ %z16_32 = zext i16 %e16 to i32
+ %s16_64 = sext i16 %e16 to i64
+ %z16_64 = zext i16 %e16 to i64
+ %s32_64 = sext i32 %e32 to i64
+ %z32_64 = zext i32 %e32 to i64
+ call void @use(i16 %s8_16, i16 %z8_16, i32 %s8_32, i32 %z8_32, i64 %s8_64, i64 %z8_64, i32 %s16_32, i32 %z16_32, i64 %s16_64, i64 %z16_64, i64 %s32_64, i64 %z32_64)
+ ret void
+}
+
+declare void @use(i16, i16, i32, i32, i64, i64, i32, i32, i64, i64, i64, i64)
+
attributes #0 = { "target-features"="+sve" }
--
2.36.0.rc0.470.gd361397f0d-goog