Skip to content

Commit

Permalink
[RISCV] Add cost model coverage for mask reductions requiring legaliz…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
preames committed Jun 10, 2022
1 parent a2cdb97 commit eb91241
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions llvm/test/Analysis/CostModel/RISCV/reduce-and.ll
Expand Up @@ -12,6 +12,9 @@ define i32 @reduce_i1(i32 %arg) {
; RISCV32-NEXT: Cost Model: Found an estimated cost of 33 for instruction: %V32 = call i1 @llvm.vector.reduce.and.v32i1(<32 x i1> undef)
; RISCV32-NEXT: Cost Model: Found an estimated cost of 66 for instruction: %V64 = call i1 @llvm.vector.reduce.and.v64i1(<64 x i1> undef)
; RISCV32-NEXT: Cost Model: Found an estimated cost of 132 for instruction: %V128 = call i1 @llvm.vector.reduce.and.v128i1(<128 x i1> undef)
; RISCV32-NEXT: Cost Model: Found an estimated cost of 264 for instruction: %V256 = call i1 @llvm.vector.reduce.and.v256i1(<256 x i1> undef)
; RISCV32-NEXT: Cost Model: Found an estimated cost of 528 for instruction: %V512 = call i1 @llvm.vector.reduce.and.v512i1(<512 x i1> undef)
; RISCV32-NEXT: Cost Model: Found an estimated cost of 1056 for instruction: %V1024 = call i1 @llvm.vector.reduce.and.v1024i1(<1024 x i1> undef)
; RISCV32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
;
; RISCV64-LABEL: 'reduce_i1'
Expand All @@ -23,6 +26,9 @@ define i32 @reduce_i1(i32 %arg) {
; RISCV64-NEXT: Cost Model: Found an estimated cost of 33 for instruction: %V32 = call i1 @llvm.vector.reduce.and.v32i1(<32 x i1> undef)
; RISCV64-NEXT: Cost Model: Found an estimated cost of 65 for instruction: %V64 = call i1 @llvm.vector.reduce.and.v64i1(<64 x i1> undef)
; RISCV64-NEXT: Cost Model: Found an estimated cost of 130 for instruction: %V128 = call i1 @llvm.vector.reduce.and.v128i1(<128 x i1> undef)
; RISCV64-NEXT: Cost Model: Found an estimated cost of 260 for instruction: %V256 = call i1 @llvm.vector.reduce.and.v256i1(<256 x i1> undef)
; RISCV64-NEXT: Cost Model: Found an estimated cost of 520 for instruction: %V512 = call i1 @llvm.vector.reduce.and.v512i1(<512 x i1> undef)
; RISCV64-NEXT: Cost Model: Found an estimated cost of 1040 for instruction: %V1024 = call i1 @llvm.vector.reduce.and.v1024i1(<1024 x i1> undef)
; RISCV64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
;
%V1 = call i1 @llvm.vector.reduce.and.v1i1(<1 x i1> undef)
Expand All @@ -33,6 +39,9 @@ define i32 @reduce_i1(i32 %arg) {
%V32 = call i1 @llvm.vector.reduce.and.v32i1(<32 x i1> undef)
%V64 = call i1 @llvm.vector.reduce.and.v64i1(<64 x i1> undef)
%V128 = call i1 @llvm.vector.reduce.and.v128i1(<128 x i1> undef)
%V256 = call i1 @llvm.vector.reduce.and.v256i1(<256 x i1> undef)
%V512 = call i1 @llvm.vector.reduce.and.v512i1(<512 x i1> undef)
%V1024 = call i1 @llvm.vector.reduce.and.v1024i1(<1024 x i1> undef)
ret i32 undef
}

Expand Down Expand Up @@ -136,6 +145,9 @@ declare i1 @llvm.vector.reduce.and.v16i1(<16 x i1>)
declare i1 @llvm.vector.reduce.and.v32i1(<32 x i1>)
declare i1 @llvm.vector.reduce.and.v64i1(<64 x i1>)
declare i1 @llvm.vector.reduce.and.v128i1(<128 x i1>)
declare i1 @llvm.vector.reduce.and.v256i1(<256 x i1>)
declare i1 @llvm.vector.reduce.and.v512i1(<512 x i1>)
declare i1 @llvm.vector.reduce.and.v1024i1(<1024 x i1>)
declare i8 @llvm.vector.reduce.and.v1i8(<1 x i8>)
declare i8 @llvm.vector.reduce.and.v2i8(<2 x i8>)
declare i8 @llvm.vector.reduce.and.v4i8(<4 x i8>)
Expand Down
12 changes: 12 additions & 0 deletions llvm/test/Analysis/CostModel/RISCV/reduce-or.ll
Expand Up @@ -12,6 +12,9 @@ define i32 @reduce_i1(i32 %arg) {
; RISCV32-NEXT: Cost Model: Found an estimated cost of 33 for instruction: %V32 = call i1 @llvm.vector.reduce.or.v32i1(<32 x i1> undef)
; RISCV32-NEXT: Cost Model: Found an estimated cost of 66 for instruction: %V64 = call i1 @llvm.vector.reduce.or.v64i1(<64 x i1> undef)
; RISCV32-NEXT: Cost Model: Found an estimated cost of 132 for instruction: %V128 = call i1 @llvm.vector.reduce.or.v128i1(<128 x i1> undef)
; RISCV32-NEXT: Cost Model: Found an estimated cost of 264 for instruction: %V256 = call i1 @llvm.vector.reduce.or.v256i1(<256 x i1> undef)
; RISCV32-NEXT: Cost Model: Found an estimated cost of 528 for instruction: %V512 = call i1 @llvm.vector.reduce.or.v512i1(<512 x i1> undef)
; RISCV32-NEXT: Cost Model: Found an estimated cost of 1056 for instruction: %V1024 = call i1 @llvm.vector.reduce.or.v1024i1(<1024 x i1> undef)
; RISCV32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
;
; RISCV64-LABEL: 'reduce_i1'
Expand All @@ -23,6 +26,9 @@ define i32 @reduce_i1(i32 %arg) {
; RISCV64-NEXT: Cost Model: Found an estimated cost of 33 for instruction: %V32 = call i1 @llvm.vector.reduce.or.v32i1(<32 x i1> undef)
; RISCV64-NEXT: Cost Model: Found an estimated cost of 65 for instruction: %V64 = call i1 @llvm.vector.reduce.or.v64i1(<64 x i1> undef)
; RISCV64-NEXT: Cost Model: Found an estimated cost of 130 for instruction: %V128 = call i1 @llvm.vector.reduce.or.v128i1(<128 x i1> undef)
; RISCV64-NEXT: Cost Model: Found an estimated cost of 260 for instruction: %V256 = call i1 @llvm.vector.reduce.or.v256i1(<256 x i1> undef)
; RISCV64-NEXT: Cost Model: Found an estimated cost of 520 for instruction: %V512 = call i1 @llvm.vector.reduce.or.v512i1(<512 x i1> undef)
; RISCV64-NEXT: Cost Model: Found an estimated cost of 1040 for instruction: %V1024 = call i1 @llvm.vector.reduce.or.v1024i1(<1024 x i1> undef)
; RISCV64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
;
%V1 = call i1 @llvm.vector.reduce.or.v1i1(<1 x i1> undef)
Expand All @@ -33,6 +39,9 @@ define i32 @reduce_i1(i32 %arg) {
%V32 = call i1 @llvm.vector.reduce.or.v32i1(<32 x i1> undef)
%V64 = call i1 @llvm.vector.reduce.or.v64i1(<64 x i1> undef)
%V128 = call i1 @llvm.vector.reduce.or.v128i1(<128 x i1> undef)
%V256 = call i1 @llvm.vector.reduce.or.v256i1(<256 x i1> undef)
%V512 = call i1 @llvm.vector.reduce.or.v512i1(<512 x i1> undef)
%V1024 = call i1 @llvm.vector.reduce.or.v1024i1(<1024 x i1> undef)
ret i32 undef
}

Expand Down Expand Up @@ -136,6 +145,9 @@ declare i1 @llvm.vector.reduce.or.v16i1(<16 x i1>)
declare i1 @llvm.vector.reduce.or.v32i1(<32 x i1>)
declare i1 @llvm.vector.reduce.or.v64i1(<64 x i1>)
declare i1 @llvm.vector.reduce.or.v128i1(<128 x i1>)
declare i1 @llvm.vector.reduce.or.v256i1(<256 x i1>)
declare i1 @llvm.vector.reduce.or.v512i1(<512 x i1>)
declare i1 @llvm.vector.reduce.or.v1024i1(<1024 x i1>)
declare i8 @llvm.vector.reduce.or.v1i8(<1 x i8>)
declare i8 @llvm.vector.reduce.or.v2i8(<2 x i8>)
declare i8 @llvm.vector.reduce.or.v4i8(<4 x i8>)
Expand Down

0 comments on commit eb91241

Please sign in to comment.