Skip to content

Commit 0c274d5

Browse files
committed
[RISCV][TTI] Add coverage of odd sized vector loads and stores
1 parent 83fb064 commit 0c274d5

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,3 +493,102 @@ define void @store_of_constant(ptr %p) {
493493

494494
ret void
495495
}
496+
497+
498+
define void @load_oddsize_vectors(ptr %p) {
499+
; CHECK-LABEL: 'load_oddsize_vectors'
500+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = load <1 x i32>, ptr %p, align 4
501+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %2 = load <2 x i32>, ptr %p, align 8
502+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %3 = load <3 x i32>, ptr %p, align 16
503+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %4 = load <4 x i32>, ptr %p, align 16
504+
; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %5 = load <5 x i32>, ptr %p, align 32
505+
; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %6 = load <6 x i32>, ptr %p, align 32
506+
; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %7 = load <7 x i32>, ptr %p, align 32
507+
; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %8 = load <8 x i32>, ptr %p, align 32
508+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %9 = load <9 x i32>, ptr %p, align 64
509+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %10 = load <15 x i32>, ptr %p, align 64
510+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %11 = load <16 x i32>, ptr %p, align 64
511+
; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %12 = load <31 x i32>, ptr %p, align 128
512+
; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %13 = load <32 x i32>, ptr %p, align 128
513+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
514+
;
515+
; CODESIZE-LABEL: 'load_oddsize_vectors'
516+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = load <1 x i32>, ptr %p, align 4
517+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %2 = load <2 x i32>, ptr %p, align 8
518+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %3 = load <3 x i32>, ptr %p, align 16
519+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %4 = load <4 x i32>, ptr %p, align 16
520+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %5 = load <5 x i32>, ptr %p, align 32
521+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %6 = load <6 x i32>, ptr %p, align 32
522+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %7 = load <7 x i32>, ptr %p, align 32
523+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %8 = load <8 x i32>, ptr %p, align 32
524+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %9 = load <9 x i32>, ptr %p, align 64
525+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %10 = load <15 x i32>, ptr %p, align 64
526+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %11 = load <16 x i32>, ptr %p, align 64
527+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %12 = load <31 x i32>, ptr %p, align 128
528+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %13 = load <32 x i32>, ptr %p, align 128
529+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
530+
;
531+
532+
load <1 x i32>, ptr %p
533+
load <2 x i32>, ptr %p
534+
load <3 x i32>, ptr %p
535+
load <4 x i32>, ptr %p
536+
load <5 x i32>, ptr %p
537+
load <6 x i32>, ptr %p
538+
load <7 x i32>, ptr %p
539+
load <8 x i32>, ptr %p
540+
load <9 x i32>, ptr %p
541+
load <15 x i32>, ptr %p
542+
load <16 x i32>, ptr %p
543+
load <31 x i32>, ptr %p
544+
load <32 x i32>, ptr %p
545+
546+
ret void
547+
}
548+
549+
define void @store_oddsize_vectors(ptr %p) {
550+
; CHECK-LABEL: 'store_oddsize_vectors'
551+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <1 x i32> undef, ptr %p, align 4
552+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <2 x i32> undef, ptr %p, align 8
553+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store <3 x i32> undef, ptr %p, align 16
554+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <4 x i32> undef, ptr %p, align 16
555+
; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store <5 x i32> undef, ptr %p, align 32
556+
; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store <6 x i32> undef, ptr %p, align 32
557+
; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store <7 x i32> undef, ptr %p, align 32
558+
; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store <8 x i32> undef, ptr %p, align 32
559+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store <15 x i32> undef, ptr %p, align 64
560+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store <16 x i32> undef, ptr %p, align 64
561+
; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: store <31 x i32> undef, ptr %p, align 128
562+
; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: store <32 x i32> undef, ptr %p, align 128
563+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
564+
;
565+
; CODESIZE-LABEL: 'store_oddsize_vectors'
566+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <1 x i32> undef, ptr %p, align 4
567+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <2 x i32> undef, ptr %p, align 8
568+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <3 x i32> undef, ptr %p, align 16
569+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <4 x i32> undef, ptr %p, align 16
570+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store <5 x i32> undef, ptr %p, align 32
571+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store <6 x i32> undef, ptr %p, align 32
572+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store <7 x i32> undef, ptr %p, align 32
573+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store <8 x i32> undef, ptr %p, align 32
574+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store <15 x i32> undef, ptr %p, align 64
575+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store <16 x i32> undef, ptr %p, align 64
576+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: store <31 x i32> undef, ptr %p, align 128
577+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: store <32 x i32> undef, ptr %p, align 128
578+
; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
579+
;
580+
store <1 x i32> undef, ptr %p
581+
store <2 x i32> undef, ptr %p
582+
store <3 x i32> undef, ptr %p
583+
store <4 x i32> undef, ptr %p
584+
store <5 x i32> undef, ptr %p
585+
store <6 x i32> undef, ptr %p
586+
store <7 x i32> undef, ptr %p
587+
store <8 x i32> undef, ptr %p
588+
store <15 x i32> undef, ptr %p
589+
store <16 x i32> undef, ptr %p
590+
store <31 x i32> undef, ptr %p
591+
store <32 x i32> undef, ptr %p
592+
593+
ret void
594+
}

0 commit comments

Comments
 (0)