[llvm] 0b74366 - [AArch64] Add cost model tests for fshl intrinsics.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 31 06:25:17 PDT 2023
Author: Florian Hahn
Date: 2023-03-31T14:24:43+01:00
New Revision: 0b7436669d26ca203bff0ea62e1cbd36705643a7
URL: https://github.com/llvm/llvm-project/commit/0b7436669d26ca203bff0ea62e1cbd36705643a7
DIFF: https://github.com/llvm/llvm-project/commit/0b7436669d26ca203bff0ea62e1cbd36705643a7.diff
LOG: [AArch64] Add cost model tests for fshl intrinsics.
Tests for D147322.
Added:
llvm/test/Analysis/CostModel/AArch64/fshl.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Analysis/CostModel/AArch64/fshl.ll b/llvm/test/Analysis/CostModel/AArch64/fshl.ll
new file mode 100644
index 0000000000000..a2b5604bed80d
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/AArch64/fshl.ll
@@ -0,0 +1,236 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 2
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=arm64-apple-ios < %s 2>&1 | FileCheck %s
+
+target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
+
+define i8 @fshl_i8_3rd_arg_const(i8 %a, i8 %b) {
+; CHECK-LABEL: 'fshl_i8_3rd_arg_const'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %fshl = tail call i8 @llvm.fshl.i8(i8 %a, i8 %b, i8 9)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %fshl
+;
+entry:
+ %fshl = tail call i8 @llvm.fshl.i8(i8 %a, i8 %b, i8 9)
+ ret i8 %fshl
+}
+
+define i8 @fshl_i8_3rd_arg_var(i8 %a, i8 %b, i8 %c) {
+; CHECK-LABEL: 'fshl_i8_3rd_arg_var'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %fshl = tail call i8 @llvm.fshl.i8(i8 %a, i8 %b, i8 %c)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %fshl
+;
+entry:
+ %fshl = tail call i8 @llvm.fshl.i8(i8 %a, i8 %b, i8 %c)
+ ret i8 %fshl
+}
+
+declare i8 @llvm.fshl.i8(i8, i8, i8)
+
+define i16 @fshl_i16(i16 %a, i16 %b) {
+; CHECK-LABEL: 'fshl_i16'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %fshl = tail call i16 @llvm.fshl.i16(i16 %a, i16 %b, i16 9)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %fshl
+;
+entry:
+ %fshl = tail call i16 @llvm.fshl.i16(i16 %a, i16 %b, i16 9)
+ ret i16 %fshl
+}
+
+declare i16 @llvm.fshl.i16(i16, i16, i16)
+
+define i32 @fshl_i32_3rd_arg_const(i32 %a, i32 %b) {
+; CHECK-LABEL: 'fshl_i32_3rd_arg_const'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %fshl = tail call i32 @llvm.fshl.i32(i32 %a, i32 %b, i32 9)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %fshl
+;
+entry:
+ %fshl = tail call i32 @llvm.fshl.i32(i32 %a, i32 %b, i32 9)
+ ret i32 %fshl
+}
+
+define i32 @fshl_i32_3rd_arg_var(i32 %a, i32 %b, i32 %c) {
+; CHECK-LABEL: 'fshl_i32_3rd_arg_var'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %fshl = tail call i32 @llvm.fshl.i32(i32 %a, i32 %b, i32 %c)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %fshl
+;
+entry:
+ %fshl = tail call i32 @llvm.fshl.i32(i32 %a, i32 %b, i32 %c)
+ ret i32 %fshl
+}
+
+declare i32 @llvm.fshl.i32(i32, i32, i32)
+
+define i64 @fshl_i64_3rd_arg_const(i64 %a, i64 %b) {
+; CHECK-LABEL: 'fshl_i64_3rd_arg_const'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %fshl = tail call i64 @llvm.fshl.i64(i64 %a, i64 %b, i64 9)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %fshl
+;
+entry:
+ %fshl = tail call i64 @llvm.fshl.i64(i64 %a, i64 %b, i64 9)
+ ret i64 %fshl
+}
+
+define i64 @fshl_i64_3rd_arg_var(i64 %a, i64 %b, i64 %c) {
+; CHECK-LABEL: 'fshl_i64_3rd_arg_var'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %fshl = tail call i64 @llvm.fshl.i64(i64 %a, i64 %b, i64 %c)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %fshl
+;
+entry:
+ %fshl = tail call i64 @llvm.fshl.i64(i64 %a, i64 %b, i64 %c)
+ ret i64 %fshl
+}
+
+declare i64 @llvm.fshl.i64(i64, i64, i64)
+
+define i19 @fshl_i19(i19 %a, i19 %b) {
+; CHECK-LABEL: 'fshl_i19'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %fshl = tail call i19 @llvm.fshl.i19(i19 %a, i19 %b, i19 9)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i19 %fshl
+;
+entry:
+ %fshl = tail call i19 @llvm.fshl.i19(i19 %a, i19 %b, i19 9)
+ ret i19 %fshl
+}
+
+declare i19 @llvm.fshl.i19(i19, i19, i19)
+
+
+define <16 x i8> @fshl_v16i8_3rd_arg_vec_const_all_lanes_same(<16 x i8> %a, <16 x i8> %b) {
+; CHECK-LABEL: 'fshl_v16i8_3rd_arg_vec_const_all_lanes_same'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %fshl = tail call <16 x i8> @llvm.fshl.v16i8(<16 x i8> %a, <16 x i8> %b, <16 x i8> <i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3>)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %fshl
+;
+entry:
+ %fshl = tail call <16 x i8> @llvm.fshl.v16i8(<16 x i8> %a, <16 x i8> %b, <16 x i8> <i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3>)
+ ret <16 x i8> %fshl
+}
+
+define <16 x i8> @fshl_v16i8_3rd_arg_vec_const_lanes_
diff erent(<16 x i8> %a, <16 x i8> %b) {
+; CHECK-LABEL: 'fshl_v16i8_3rd_arg_vec_const_lanes_
diff erent'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %fshl = tail call <16 x i8> @llvm.fshl.v16i8(<16 x i8> %a, <16 x i8> %b, <16 x i8> <i8 9, i8 1, i8 13, i8 7, i8 31, i8 23, i8 43, i8 51, i8 3, i8 3, i8 17, i8 3, i8 11, i8 15, i8 3, i8 3>)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %fshl
+;
+entry:
+ %fshl = tail call <16 x i8> @llvm.fshl.v16i8(<16 x i8> %a, <16 x i8> %b, <16 x i8> <i8 9, i8 1, i8 13, i8 7, i8 31, i8 23, i8 43, i8 51, i8 3, i8 3, i8 17, i8 3, i8 11, i8 15, i8 3, i8 3>)
+ ret <16 x i8> %fshl
+}
+
+define <16 x i8> @fshl_v16i8_3rd_arg_var(<16 x i8> %a, <16 x i8> %b, <16 x i8> %c) {
+; CHECK-LABEL: 'fshl_v16i8_3rd_arg_var'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 144 for instruction: %fshl = tail call <16 x i8> @llvm.fshl.v16i8(<16 x i8> %a, <16 x i8> %b, <16 x i8> %c)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %fshl
+;
+entry:
+ %fshl = tail call <16 x i8> @llvm.fshl.v16i8(<16 x i8> %a, <16 x i8> %b, <16 x i8> %c)
+ ret <16 x i8> %fshl
+}
+
+declare <16 x i8> @llvm.fshl.v16i8(<16 x i8>, <16 x i8>, <16 x i8>)
+
+define <8 x i16> @fshl_v8i16_3rd_arg_vec_const_all_lanes_same(<8 x i16> %a, <8 x i16> %b) {
+; CHECK-LABEL: 'fshl_v8i16_3rd_arg_vec_const_all_lanes_same'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %fshl = tail call <8 x i16> @llvm.fshl.v8i16(<8 x i16> %a, <8 x i16> %b, <8 x i16> <i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3>)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %fshl
+;
+entry:
+ %fshl = tail call <8 x i16> @llvm.fshl.v8i16(<8 x i16> %a, <8 x i16> %b, <8 x i16> <i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3>)
+ ret <8 x i16> %fshl
+}
+
+define <8 x i16> @fshl_v8i16_3rd_arg_vec_const_lanes_
diff erent(<8 x i16> %a, <8 x i16> %b) {
+; CHECK-LABEL: 'fshl_v8i16_3rd_arg_vec_const_lanes_
diff erent'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %fshl = tail call <8 x i16> @llvm.fshl.v8i16(<8 x i16> %a, <8 x i16> %b, <8 x i16> <i16 3, i16 1, i16 13, i16 8, i16 7, i16 31, i16 43, i16 51>)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %fshl
+;
+entry:
+ %fshl = tail call <8 x i16> @llvm.fshl.v8i16(<8 x i16> %a, <8 x i16> %b, <8 x i16> <i16 3, i16 1, i16 13, i16 8, i16 7, i16 31, i16 43, i16 51>)
+ ret <8 x i16> %fshl
+}
+
+define <8 x i16> @fshl_v8i16_3rd_arg_var(<8 x i16> %a, <8 x i16> %b, <8 x i16> %c) {
+; CHECK-LABEL: 'fshl_v8i16_3rd_arg_var'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 72 for instruction: %fshl = tail call <8 x i16> @llvm.fshl.v8i16(<8 x i16> %a, <8 x i16> %b, <8 x i16> %c)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %fshl
+;
+entry:
+ %fshl = tail call <8 x i16> @llvm.fshl.v8i16(<8 x i16> %a, <8 x i16> %b, <8 x i16> %c)
+ ret <8 x i16> %fshl
+}
+
+declare <8 x i16> @llvm.fshl.v8i16(<8 x i16>, <8 x i16>, <8 x i16>)
+
+define <4 x i32> @fshl_v4i32_3rd_arg_vec_const_all_lanes_same(<4 x i32> %a, <4 x i32> %b) {
+; CHECK-LABEL: 'fshl_v4i32_3rd_arg_vec_const_all_lanes_same'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %fshl = tail call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 3>)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %fshl
+;
+entry:
+ %fshl = tail call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 3>)
+ ret <4 x i32> %fshl
+}
+
+define <4 x i32> @fshl_v4i32_3rd_arg_vec_const_lanes_
diff erent(<4 x i32> %a, <4 x i32> %b) {
+; CHECK-LABEL: 'fshl_v4i32_3rd_arg_vec_const_lanes_
diff erent'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %fshl = tail call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 3, i32 11, i32 2>)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %fshl
+;
+entry:
+ %fshl = tail call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 3, i32 11, i32 2>)
+ ret <4 x i32> %fshl
+}
+
+define <4 x i32> @fshl_v4i32_3rd_arg_var(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c) {
+; CHECK-LABEL: 'fshl_v4i32_3rd_arg_var'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 36 for instruction: %fshl = tail call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %fshl
+;
+entry:
+ %fshl = tail call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c)
+ ret <4 x i32> %fshl
+}
+
+declare <4 x i32> @llvm.fshl.v4i32(<4 x i32>, <4 x i32>, <4 x i32>)
+
+define <2 x i64> @fshl_v2i64_3rd_arg_vec_const_all_lanes_same(<2 x i64> %a, <2 x i64> %b) {
+; CHECK-LABEL: 'fshl_v2i64_3rd_arg_vec_const_all_lanes_same'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %fshl = tail call <2 x i64> @llvm.fshl.v2i64(<2 x i64> %a, <2 x i64> %b, <2 x i64> <i64 1, i64 1>)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %fshl
+;
+entry:
+ %fshl = tail call <2 x i64> @llvm.fshl.v4i64(<2 x i64> %a, <2 x i64> %b, <2 x i64> <i64 1, i64 1>)
+ ret <2 x i64> %fshl
+}
+
+define <2 x i64> @fshl_v2i64_3rd_arg_vec_const_lanes_
diff erent(<2 x i64> %a, <2 x i64> %b) {
+; CHECK-LABEL: 'fshl_v2i64_3rd_arg_vec_const_lanes_
diff erent'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %fshl = tail call <2 x i64> @llvm.fshl.v2i64(<2 x i64> %a, <2 x i64> %b, <2 x i64> <i64 1, i64 2>)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %fshl
+;
+entry:
+ %fshl = tail call <2 x i64> @llvm.fshl.v4i64(<2 x i64> %a, <2 x i64> %b, <2 x i64> <i64 1, i64 2>)
+ ret <2 x i64> %fshl
+}
+
+define <2 x i64> @fshl_v2i64_3rd_arg_var(<2 x i64> %a, <2 x i64> %b, <2 x i64> %c) {
+; CHECK-LABEL: 'fshl_v2i64_3rd_arg_var'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %fshl = tail call <2 x i64> @llvm.fshl.v2i64(<2 x i64> %a, <2 x i64> %b, <2 x i64> %c)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %fshl
+;
+entry:
+ %fshl = tail call <2 x i64> @llvm.fshl.v4i64(<2 x i64> %a, <2 x i64> %b, <2 x i64> %c)
+ ret <2 x i64> %fshl
+}
+
+declare <2 x i64> @llvm.fshl.v4i64(<2 x i64>, <2 x i64>, <2 x i64>)
+
+define <4 x i30> @fshl_v4i30_3rd_arg_var(<4 x i30> %a, <4 x i30> %b, <4 x i30> %c) {
+; CHECK-LABEL: 'fshl_v4i30_3rd_arg_var'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 36 for instruction: %fshl = tail call <4 x i30> @llvm.fshl.v4i30(<4 x i30> %a, <4 x i30> %b, <4 x i30> %c)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i30> %fshl
+;
+entry:
+ %fshl = tail call <4 x i30> @llvm.fshl.v4i30(<4 x i30> %a, <4 x i30> %b, <4 x i30> %c)
+ ret <4 x i30> %fshl
+}
+
+declare <4 x i30> @llvm.fshl.v4i30(<4 x i30>, <4 x i30>, <4 x i30>)
+
More information about the llvm-commits
mailing list