Skip to content

Commit a826a0c

Browse files
authored
[RISCV] Add tests for reduce.fmaximum/fminimum. NFC (#80553)
This is to add test coverage for crash report in #80340
1 parent a5d206d commit a826a0c

File tree

3 files changed

+2810
-0
lines changed

3 files changed

+2810
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
2+
; RUN: opt < %s -mtriple=riscv32 -mattr=+v -riscv-v-vector-bits-min=256 -passes="print<cost-model>" -cost-kind=throughput 2>&1 -disable-output | FileCheck %s
3+
; RUN: opt < %s -mtriple=riscv64 -mattr=+v -riscv-v-vector-bits-min=256 -passes="print<cost-model>" -cost-kind=throughput 2>&1 -disable-output | FileCheck %s
4+
; RUN: opt < %s -mtriple=riscv32 -mattr=+v -riscv-v-vector-bits-min=256 -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output | FileCheck %s --check-prefix=SIZE
5+
; RUN: opt < %s -mtriple=riscv64 -mattr=+v -riscv-v-vector-bits-min=256 -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output | FileCheck %s --check-prefix=SIZE
6+
7+
define float @reduce_fmaximum_f32(float %arg) {
8+
; CHECK-LABEL: 'reduce_fmaximum_f32'
9+
; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V2 = call float @llvm.vector.reduce.fmaximum.v2f32(<2 x float> undef)
10+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V4 = call float @llvm.vector.reduce.fmaximum.v4f32(<4 x float> undef)
11+
; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V8 = call float @llvm.vector.reduce.fmaximum.v8f32(<8 x float> undef)
12+
; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V16 = call float @llvm.vector.reduce.fmaximum.v16f32(<16 x float> undef)
13+
; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %V32 = call float @llvm.vector.reduce.fmaximum.v32f32(<32 x float> undef)
14+
; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V64 = call float @llvm.vector.reduce.fmaximum.v64f32(<64 x float> undef)
15+
; CHECK-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %V128 = call float @llvm.vector.reduce.fmaximum.v128f32(<128 x float> undef)
16+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret float undef
17+
;
18+
; SIZE-LABEL: 'reduce_fmaximum_f32'
19+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call float @llvm.vector.reduce.fmaximum.v2f32(<2 x float> undef)
20+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V4 = call float @llvm.vector.reduce.fmaximum.v4f32(<4 x float> undef)
21+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8 = call float @llvm.vector.reduce.fmaximum.v8f32(<8 x float> undef)
22+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V16 = call float @llvm.vector.reduce.fmaximum.v16f32(<16 x float> undef)
23+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V32 = call float @llvm.vector.reduce.fmaximum.v32f32(<32 x float> undef)
24+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V64 = call float @llvm.vector.reduce.fmaximum.v64f32(<64 x float> undef)
25+
; SIZE-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V128 = call float @llvm.vector.reduce.fmaximum.v128f32(<128 x float> undef)
26+
; SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret float undef
27+
;
28+
%V2 = call float @llvm.vector.reduce.fmaximum.v2f32(<2 x float> undef)
29+
%V4 = call float @llvm.vector.reduce.fmaximum.v4f32(<4 x float> undef)
30+
%V8 = call float @llvm.vector.reduce.fmaximum.v8f32(<8 x float> undef)
31+
%V16 = call float @llvm.vector.reduce.fmaximum.v16f32(<16 x float> undef)
32+
%V32 = call float @llvm.vector.reduce.fmaximum.v32f32(<32 x float> undef)
33+
%V64 = call float @llvm.vector.reduce.fmaximum.v64f32(<64 x float> undef)
34+
%V128 = call float @llvm.vector.reduce.fmaximum.v128f32(<128 x float> undef)
35+
ret float undef
36+
}
37+
declare float @llvm.vector.reduce.fmaximum.v2f32(<2 x float>)
38+
declare float @llvm.vector.reduce.fmaximum.v4f32(<4 x float>)
39+
declare float @llvm.vector.reduce.fmaximum.v8f32(<8 x float>)
40+
declare float @llvm.vector.reduce.fmaximum.v16f32(<16 x float>)
41+
declare float @llvm.vector.reduce.fmaximum.v32f32(<32 x float>)
42+
declare float @llvm.vector.reduce.fmaximum.v64f32(<64 x float>)
43+
declare float @llvm.vector.reduce.fmaximum.v128f32(<128 x float>)
44+
45+
define double @reduce_fmaximum_f64(double %arg) {
46+
; CHECK-LABEL: 'reduce_fmaximum_f64'
47+
; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V2 = call double @llvm.vector.reduce.fmaximum.v2f64(<2 x double> undef)
48+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V4 = call double @llvm.vector.reduce.fmaximum.v4f64(<4 x double> undef)
49+
; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V8 = call double @llvm.vector.reduce.fmaximum.v8f64(<8 x double> undef)
50+
; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V16 = call double @llvm.vector.reduce.fmaximum.v16f64(<16 x double> undef)
51+
; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %V32 = call double @llvm.vector.reduce.fmaximum.v32f64(<32 x double> undef)
52+
; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V64 = call double @llvm.vector.reduce.fmaximum.v64f64(<64 x double> undef)
53+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret double undef
54+
;
55+
; SIZE-LABEL: 'reduce_fmaximum_f64'
56+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call double @llvm.vector.reduce.fmaximum.v2f64(<2 x double> undef)
57+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V4 = call double @llvm.vector.reduce.fmaximum.v4f64(<4 x double> undef)
58+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8 = call double @llvm.vector.reduce.fmaximum.v8f64(<8 x double> undef)
59+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V16 = call double @llvm.vector.reduce.fmaximum.v16f64(<16 x double> undef)
60+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V32 = call double @llvm.vector.reduce.fmaximum.v32f64(<32 x double> undef)
61+
; SIZE-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V64 = call double @llvm.vector.reduce.fmaximum.v64f64(<64 x double> undef)
62+
; SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double undef
63+
;
64+
%V2 = call double @llvm.vector.reduce.fmaximum.v2f64(<2 x double> undef)
65+
%V4 = call double @llvm.vector.reduce.fmaximum.v4f64(<4 x double> undef)
66+
%V8 = call double @llvm.vector.reduce.fmaximum.v8f64(<8 x double> undef)
67+
%V16 = call double @llvm.vector.reduce.fmaximum.v16f64(<16 x double> undef)
68+
%V32 = call double @llvm.vector.reduce.fmaximum.v32f64(<32 x double> undef)
69+
%V64 = call double @llvm.vector.reduce.fmaximum.v64f64(<64 x double> undef)
70+
ret double undef
71+
}
72+
declare double @llvm.vector.reduce.fmaximum.v2f64(<2 x double>)
73+
declare double @llvm.vector.reduce.fmaximum.v4f64(<4 x double>)
74+
declare double @llvm.vector.reduce.fmaximum.v8f64(<8 x double>)
75+
declare double @llvm.vector.reduce.fmaximum.v16f64(<16 x double>)
76+
declare double @llvm.vector.reduce.fmaximum.v32f64(<32 x double>)
77+
declare double @llvm.vector.reduce.fmaximum.v64f64(<64 x double>)
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
2+
; RUN: opt < %s -mtriple=riscv32 -mattr=+v -riscv-v-vector-bits-min=256 -passes="print<cost-model>" -cost-kind=throughput 2>&1 -disable-output | FileCheck %s
3+
; RUN: opt < %s -mtriple=riscv64 -mattr=+v -riscv-v-vector-bits-min=256 -passes="print<cost-model>" -cost-kind=throughput 2>&1 -disable-output | FileCheck %s
4+
; RUN: opt < %s -mtriple=riscv32 -mattr=+v -riscv-v-vector-bits-min=256 -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output | FileCheck %s --check-prefix=SIZE
5+
; RUN: opt < %s -mtriple=riscv64 -mattr=+v -riscv-v-vector-bits-min=256 -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output | FileCheck %s --check-prefix=SIZE
6+
7+
define float @reduce_fmaximum_f32(float %arg) {
8+
; CHECK-LABEL: 'reduce_fmaximum_f32'
9+
; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V2 = call float @llvm.vector.reduce.fminimum.v2f32(<2 x float> undef)
10+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V4 = call float @llvm.vector.reduce.fminimum.v4f32(<4 x float> undef)
11+
; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V8 = call float @llvm.vector.reduce.fminimum.v8f32(<8 x float> undef)
12+
; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V16 = call float @llvm.vector.reduce.fminimum.v16f32(<16 x float> undef)
13+
; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %V32 = call float @llvm.vector.reduce.fminimum.v32f32(<32 x float> undef)
14+
; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V64 = call float @llvm.vector.reduce.fminimum.v64f32(<64 x float> undef)
15+
; CHECK-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %V128 = call float @llvm.vector.reduce.fminimum.v128f32(<128 x float> undef)
16+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret float undef
17+
;
18+
; SIZE-LABEL: 'reduce_fmaximum_f32'
19+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call float @llvm.vector.reduce.fminimum.v2f32(<2 x float> undef)
20+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V4 = call float @llvm.vector.reduce.fminimum.v4f32(<4 x float> undef)
21+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8 = call float @llvm.vector.reduce.fminimum.v8f32(<8 x float> undef)
22+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V16 = call float @llvm.vector.reduce.fminimum.v16f32(<16 x float> undef)
23+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V32 = call float @llvm.vector.reduce.fminimum.v32f32(<32 x float> undef)
24+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V64 = call float @llvm.vector.reduce.fminimum.v64f32(<64 x float> undef)
25+
; SIZE-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V128 = call float @llvm.vector.reduce.fminimum.v128f32(<128 x float> undef)
26+
; SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret float undef
27+
;
28+
%V2 = call float @llvm.vector.reduce.fminimum.v2f32(<2 x float> undef)
29+
%V4 = call float @llvm.vector.reduce.fminimum.v4f32(<4 x float> undef)
30+
%V8 = call float @llvm.vector.reduce.fminimum.v8f32(<8 x float> undef)
31+
%V16 = call float @llvm.vector.reduce.fminimum.v16f32(<16 x float> undef)
32+
%V32 = call float @llvm.vector.reduce.fminimum.v32f32(<32 x float> undef)
33+
%V64 = call float @llvm.vector.reduce.fminimum.v64f32(<64 x float> undef)
34+
%V128 = call float @llvm.vector.reduce.fminimum.v128f32(<128 x float> undef)
35+
ret float undef
36+
}
37+
declare float @llvm.vector.reduce.fminimum.v2f32(<2 x float>)
38+
declare float @llvm.vector.reduce.fminimum.v4f32(<4 x float>)
39+
declare float @llvm.vector.reduce.fminimum.v8f32(<8 x float>)
40+
declare float @llvm.vector.reduce.fminimum.v16f32(<16 x float>)
41+
declare float @llvm.vector.reduce.fminimum.v32f32(<32 x float>)
42+
declare float @llvm.vector.reduce.fminimum.v64f32(<64 x float>)
43+
declare float @llvm.vector.reduce.fminimum.v128f32(<128 x float>)
44+
45+
define double @reduce_fmaximum_f64(double %arg) {
46+
; CHECK-LABEL: 'reduce_fmaximum_f64'
47+
; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V2 = call double @llvm.vector.reduce.fminimum.v2f64(<2 x double> undef)
48+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V4 = call double @llvm.vector.reduce.fminimum.v4f64(<4 x double> undef)
49+
; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V8 = call double @llvm.vector.reduce.fminimum.v8f64(<8 x double> undef)
50+
; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V16 = call double @llvm.vector.reduce.fminimum.v16f64(<16 x double> undef)
51+
; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %V32 = call double @llvm.vector.reduce.fminimum.v32f64(<32 x double> undef)
52+
; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V64 = call double @llvm.vector.reduce.fminimum.v64f64(<64 x double> undef)
53+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret double undef
54+
;
55+
; SIZE-LABEL: 'reduce_fmaximum_f64'
56+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call double @llvm.vector.reduce.fminimum.v2f64(<2 x double> undef)
57+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V4 = call double @llvm.vector.reduce.fminimum.v4f64(<4 x double> undef)
58+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8 = call double @llvm.vector.reduce.fminimum.v8f64(<8 x double> undef)
59+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V16 = call double @llvm.vector.reduce.fminimum.v16f64(<16 x double> undef)
60+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V32 = call double @llvm.vector.reduce.fminimum.v32f64(<32 x double> undef)
61+
; SIZE-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V64 = call double @llvm.vector.reduce.fminimum.v64f64(<64 x double> undef)
62+
; SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double undef
63+
;
64+
%V2 = call double @llvm.vector.reduce.fminimum.v2f64(<2 x double> undef)
65+
%V4 = call double @llvm.vector.reduce.fminimum.v4f64(<4 x double> undef)
66+
%V8 = call double @llvm.vector.reduce.fminimum.v8f64(<8 x double> undef)
67+
%V16 = call double @llvm.vector.reduce.fminimum.v16f64(<16 x double> undef)
68+
%V32 = call double @llvm.vector.reduce.fminimum.v32f64(<32 x double> undef)
69+
%V64 = call double @llvm.vector.reduce.fminimum.v64f64(<64 x double> undef)
70+
ret double undef
71+
}
72+
declare double @llvm.vector.reduce.fminimum.v2f64(<2 x double>)
73+
declare double @llvm.vector.reduce.fminimum.v4f64(<4 x double>)
74+
declare double @llvm.vector.reduce.fminimum.v8f64(<8 x double>)
75+
declare double @llvm.vector.reduce.fminimum.v16f64(<16 x double>)
76+
declare double @llvm.vector.reduce.fminimum.v32f64(<32 x double>)
77+
declare double @llvm.vector.reduce.fminimum.v64f64(<64 x double>)

0 commit comments

Comments
 (0)