[llvm] 34f2c9a - [AArch64] Add tests for FP conversion with 3 element vectors.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 4 12:44:40 PDT 2024
Author: Florian Hahn
Date: 2024-09-04T20:44:14+01:00
New Revision: 34f2c9a9ce73a61b27d75dab7e1eed256491afcc
URL: https://github.com/llvm/llvm-project/commit/34f2c9a9ce73a61b27d75dab7e1eed256491afcc
DIFF: https://github.com/llvm/llvm-project/commit/34f2c9a9ce73a61b27d75dab7e1eed256491afcc.diff
LOG: [AArch64] Add tests for FP conversion with 3 element vectors.
Add tests showing a number of cases where costs for floating point
conversions are overestimated for vectors with 3 elements.
Added:
llvm/test/Analysis/CostModel/AArch64/vec3-fp-conversions.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Analysis/CostModel/AArch64/vec3-fp-conversions.ll b/llvm/test/Analysis/CostModel/AArch64/vec3-fp-conversions.ll
new file mode 100644
index 00000000000000..334c6107eb3832
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/AArch64/vec3-fp-conversions.ll
@@ -0,0 +1,110 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=arm64-apple-macosx < %s | FileCheck %s
+
+define <3 x i32> @fptoui_v3f32_to_v3i32(<3 x float> %in, ptr %dst) {
+; CHECK-LABEL: 'fptoui_v3f32_to_v3i32'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %conv = fptoui <3 x float> %in to <3 x i32>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <3 x i32> %conv
+;
+ %conv = fptoui <3 x float> %in to <3 x i32>
+ ret <3 x i32> %conv
+}
+
+define <3 x i16> @fptoui_v3f32_to_v3i16(<3 x float> %in, ptr %dst) {
+; CHECK-LABEL: 'fptoui_v3f32_to_v3i16'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %conv = fptoui <3 x float> %in to <3 x i16>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <3 x i16> %conv
+;
+ %conv = fptoui <3 x float> %in to <3 x i16>
+ ret <3 x i16> %conv
+}
+
+define <3 x i8> @fptoui_v3f32_to_v3i8(<3 x float> %in, ptr %dst) {
+; CHECK-LABEL: 'fptoui_v3f32_to_v3i8'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %conv = fptoui <3 x float> %in to <3 x i8>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <3 x i8> %conv
+;
+ %conv = fptoui <3 x float> %in to <3 x i8>
+ ret <3 x i8> %conv
+}
+
+define <3 x i32> @fptosi_v3f32_to_v3i32(<3 x float> %in, ptr %dst) {
+; CHECK-LABEL: 'fptosi_v3f32_to_v3i32'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %conv = fptosi <3 x float> %in to <3 x i32>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <3 x i32> %conv
+;
+ %conv = fptosi <3 x float> %in to <3 x i32>
+ ret <3 x i32> %conv
+}
+
+define <3 x i16> @fptosi_v3f32_to_v3i16(<3 x float> %in, ptr %dst) {
+; CHECK-LABEL: 'fptosi_v3f32_to_v3i16'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %conv = fptosi <3 x float> %in to <3 x i16>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <3 x i16> %conv
+;
+ %conv = fptosi <3 x float> %in to <3 x i16>
+ ret <3 x i16> %conv
+}
+
+define <3 x i8> @fptosi_v3f32_to_v3i8(<3 x float> %in, ptr %dst) {
+; CHECK-LABEL: 'fptosi_v3f32_to_v3i8'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %conv = fptosi <3 x float> %in to <3 x i8>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <3 x i8> %conv
+;
+ %conv = fptosi <3 x float> %in to <3 x i8>
+ ret <3 x i8> %conv
+}
+
+define <3 x float> @uitofp_v3i32_to_v3f32(<3 x i32> %in, ptr %dst) {
+; CHECK-LABEL: 'uitofp_v3i32_to_v3f32'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %conv = uitofp <3 x i32> %in to <3 x float>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <3 x float> %conv
+;
+ %conv = uitofp <3 x i32> %in to <3 x float>
+ ret <3 x float> %conv
+}
+
+define <3 x float> @uitofp_v3i16_to_v3f32(<3 x i16> %in, ptr %dst) {
+; CHECK-LABEL: 'uitofp_v3i16_to_v3f32'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %conv = uitofp <3 x i16> %in to <3 x float>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <3 x float> %conv
+;
+ %conv = uitofp <3 x i16> %in to <3 x float>
+ ret <3 x float> %conv
+}
+
+define <3 x float> @uitofp_v3i8_to_v3f32(<3 x i8> %in, ptr %dst) {
+; CHECK-LABEL: 'uitofp_v3i8_to_v3f32'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %conv = uitofp <3 x i8> %in to <3 x float>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <3 x float> %conv
+;
+ %conv = uitofp <3 x i8> %in to <3 x float>
+ ret <3 x float> %conv
+}
+
+define <3 x float> @sitofp_v3i32_to_v3f32(<3 x i32> %in, ptr %dst) {
+; CHECK-LABEL: 'sitofp_v3i32_to_v3f32'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %conv = sitofp <3 x i32> %in to <3 x float>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <3 x float> %conv
+;
+ %conv = sitofp <3 x i32> %in to <3 x float>
+ ret <3 x float> %conv
+}
+
+define <3 x float> @sitofp_v3i16_to_v3f32(<3 x i16> %in, ptr %dst) {
+; CHECK-LABEL: 'sitofp_v3i16_to_v3f32'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %conv = sitofp <3 x i16> %in to <3 x float>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <3 x float> %conv
+;
+ %conv = sitofp <3 x i16> %in to <3 x float>
+ ret <3 x float> %conv
+}
+
+define <3 x float> @sitofp_v3i8_to_v3f32(<3 x i8> %in, ptr %dst) {
+; CHECK-LABEL: 'sitofp_v3i8_to_v3f32'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %conv = sitofp <3 x i8> %in to <3 x float>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <3 x float> %conv
+;
+ %conv = sitofp <3 x i8> %in to <3 x float>
+ ret <3 x float> %conv
+}
More information about the llvm-commits
mailing list