[AArch64] Update bswap cost test. NFC
authorDavid Green <david.green@arm.com>
Thu, 20 Jul 2023 12:53:18 +0000 (13:53 +0100)
committerDavid Green <david.green@arm.com>
Thu, 20 Jul 2023 12:53:18 +0000 (13:53 +0100)
See D155806

llvm/test/Analysis/CostModel/AArch64/bswap.ll

index aaffb47..8b387cf 100644 (file)
@@ -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
 }