Skip to content

Commit

Permalink
[AArch64] Update bswap cost test. NFC
Browse files Browse the repository at this point in the history
See D155806
  • Loading branch information
davemgreen committed Jul 20, 2023
1 parent 477ee05 commit 4f578e9
Showing 1 changed file with 48 additions and 75 deletions.
123 changes: 48 additions & 75 deletions llvm/test/Analysis/CostModel/AArch64/bswap.ll
Original file line number Diff line number Diff line change
Expand Up @@ -9,81 +9,54 @@ declare i16 @llvm.bswap.i16(i16)
declare i32 @llvm.bswap.i32(i32)
declare i64 @llvm.bswap.i64(i64)

declare <2 x i32> @llvm.bswap.v2i32(<2 x i32>)
declare <4 x i16> @llvm.bswap.v4i16(<4 x i16>)

declare <2 x i64> @llvm.bswap.v2i64(<2 x i64>)
declare <4 x i32> @llvm.bswap.v4i32(<4 x i32>)
declare <8 x i16> @llvm.bswap.v8i16(<8 x i16>)

define i16 @bswap_i16(i16 %a) {
; CHECK-LABEL: 'bswap_i16'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = tail call i16 @llvm.bswap.i16(i16 %a)
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
;
%bswap = tail call i16 @llvm.bswap.i16(i16 %a)
ret i16 %bswap
}

define i32 @bswap_i32(i32 %a) {
; CHECK-LABEL: 'bswap_i32'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = tail call i32 @llvm.bswap.i32(i32 %a)
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
;
%bswap = tail call i32 @llvm.bswap.i32(i32 %a)
ret i32 %bswap
}

define i64 @bswap_i64(i64 %a) {
; CHECK-LABEL: 'bswap_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = tail call i64 @llvm.bswap.i64(i64 %a)
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
%bswap = tail call i64 @llvm.bswap.i64(i64 %a)
ret i64 %bswap
}

define <2 x i32> @bswap_v2i32(<2 x i32> %a) {
; CHECK-LABEL: 'bswap_v2i32'
; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %bswap = call <2 x i32> @llvm.bswap.v2i32(<2 x i32> %a)
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i32> %bswap
;
%bswap = call <2 x i32> @llvm.bswap.v2i32(<2 x i32> %a)
ret <2 x i32> %bswap
}

define <4 x i16> @bswap_v4i16(<4 x i16> %a) {
; CHECK-LABEL: 'bswap_v4i16'
; CHECK-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %bswap = call <4 x i16> @llvm.bswap.v4i16(<4 x i16> %a)
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i16> %bswap
;
%bswap = call <4 x i16> @llvm.bswap.v4i16(<4 x i16> %a)
ret <4 x i16> %bswap
}

define <2 x i64> @bswap_v2i64(<2 x i64> %a) {
; CHECK-LABEL: 'bswap_v2i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %bswap = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %a)
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %bswap
;
%bswap = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %a)
ret <2 x i64> %bswap
}

define <4 x i32> @bswap_v4i32(<4 x i32> %a) {
; CHECK-LABEL: 'bswap_v4i32'
; CHECK-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %bswap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %a)
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %bswap
;
%bswap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %a)
ret <4 x i32> %bswap
}

define <8 x i16> @bswap_v8i16(<8 x i16> %a) {
; CHECK-LABEL: 'bswap_v8i16'
; CHECK-NEXT: Cost Model: Found an estimated cost of 50 for instruction: %bswap = call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %a)
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %bswap
;
%bswap = call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %a)
ret <8 x i16> %bswap
declare <16 x i16> @llvm.bswap.v16i16(<16 x i16>)
declare <2 x i32> @llvm.bswap.v2i32(<2 x i32>)
declare <4 x i32> @llvm.bswap.v4i32(<4 x i32>)
declare <8 x i32> @llvm.bswap.v8i32(<8 x i32>)
declare <2 x i64> @llvm.bswap.v2i64(<2 x i64>)
declare <4 x i64> @llvm.bswap.v4i64(<4 x i64>)
declare <3 x i32> @llvm.bswap.v3i32(<3 x i32>)
declare <4 x i48> @llvm.bswap.v4i48(<4 x i48>)

define void @scalar() {
; CHECK-LABEL: 'scalar'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b16 = call i16 @llvm.bswap.i16(i16 undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b32 = call i32 @llvm.bswap.i32(i32 undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b64 = call i64 @llvm.bswap.i64(i64 undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%b16 = call i16 @llvm.bswap.i16(i16 undef)
%b32 = call i32 @llvm.bswap.i32(i32 undef)
%b64 = call i64 @llvm.bswap.i64(i64 undef)
ret void
}

define void @neon() {
; CHECK-LABEL: 'neon'
; CHECK-NEXT: Cost Model: Found an estimated cost of 13 for instruction: %v4i16 = call <4 x i16> @llvm.bswap.v4i16(<4 x i16> undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 29 for instruction: %v8i16 = call <8 x i16> @llvm.bswap.v8i16(<8 x i16> undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 58 for instruction: %v16i16 = call <16 x i16> @llvm.bswap.v16i16(<16 x i16> undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v2i32 = call <2 x i32> @llvm.bswap.v2i32(<2 x i32> undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 13 for instruction: %v4i32 = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 26 for instruction: %v8i32 = call <8 x i32> @llvm.bswap.v8i32(<8 x i32> undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v2i64 = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %v4i64 = call <4 x i64> @llvm.bswap.v4i64(<4 x i64> undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v3i32 = call <3 x i32> @llvm.bswap.v3i32(<3 x i32> undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %v4i48 = call <4 x i48> @llvm.bswap.v4i48(<4 x i48> undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%v4i16 = call <4 x i16> @llvm.bswap.v4i16(<4 x i16> undef)
%v8i16 = call <8 x i16> @llvm.bswap.v8i16(<8 x i16> undef)
%v16i16 = call <16 x i16> @llvm.bswap.v16i16(<16 x i16> undef)
%v2i32 = call <2 x i32> @llvm.bswap.v2i32(<2 x i32> undef)
%v4i32 = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> undef)
%v8i32 = call <8 x i32> @llvm.bswap.v8i32(<8 x i32> undef)
%v2i64 = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> undef)
%v4i64 = call <4 x i64> @llvm.bswap.v4i64(<4 x i64> undef)

%v3i32 = call <3 x i32> @llvm.bswap.v3i32(<3 x i32> undef)
%v4i48 = call <4 x i48> @llvm.bswap.v4i48(<4 x i48> undef)
ret void
}

0 comments on commit 4f578e9

Please sign in to comment.