1 ; RUN: opt -cost-model -analyze -mtriple=aarch64--linux-gnu < %s | FileCheck %s
3 ; Verify the cost of bswap instructions.
5 declare i16 @llvm.bswap.i16(i16)
6 declare i32 @llvm.bswap.i32(i32)
7 declare i64 @llvm.bswap.i64(i64)
9 declare <2 x i32> @llvm.bswap.v2i32(<2 x i32>)
10 declare <4 x i16> @llvm.bswap.v4i16(<4 x i16>)
12 declare <2 x i64> @llvm.bswap.v2i64(<2 x i64>)
13 declare <4 x i32> @llvm.bswap.v4i32(<4 x i32>)
14 declare <8 x i16> @llvm.bswap.v8i16(<8 x i16>)
16 define i16 @bswap_i16(i16 %a) {
17 ; CHECK: 'Cost Model Analysis' for function 'bswap_i16':
18 ; CHECK: Found an estimated cost of 1 for instruction: %bswap
19 %bswap = tail call i16 @llvm.bswap.i16(i16 %a)
23 define i32 @bswap_i32(i32 %a) {
24 ; CHECK: 'Cost Model Analysis' for function 'bswap_i32':
25 ; CHECK: Found an estimated cost of 1 for instruction: %bswap
26 %bswap = tail call i32 @llvm.bswap.i32(i32 %a)
30 define i64 @bswap_i64(i64 %a) {
31 ; CHECK: 'Cost Model Analysis' for function 'bswap_i64':
32 ; CHECK: Found an estimated cost of 1 for instruction: %bswap
33 %bswap = tail call i64 @llvm.bswap.i64(i64 %a)
37 define <2 x i32> @bswap_v2i32(<2 x i32> %a) {
38 ; CHECK: 'Cost Model Analysis' for function 'bswap_v2i32':
39 ; CHECK: Found an estimated cost of 8 for instruction: %bswap
40 %bswap = call <2 x i32> @llvm.bswap.v2i32(<2 x i32> %a)
44 define <4 x i16> @bswap_v4i16(<4 x i16> %a) {
45 ; CHECK: 'Cost Model Analysis' for function 'bswap_v4i16':
46 ; CHECK: Found an estimated cost of 22 for instruction: %bswap
47 %bswap = call <4 x i16> @llvm.bswap.v4i16(<4 x i16> %a)
51 define <2 x i64> @bswap_v2i64(<2 x i64> %a) {
52 ; CHECK: 'Cost Model Analysis' for function 'bswap_v2i64':
53 ; CHECK: Found an estimated cost of 8 for instruction: %bswap
54 %bswap = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %a)
58 define <4 x i32> @bswap_v4i32(<4 x i32> %a) {
59 ; CHECK: 'Cost Model Analysis' for function 'bswap_v4i32':
60 ; CHECK: Found an estimated cost of 22 for instruction: %bswap
61 %bswap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %a)
65 define <8 x i16> @bswap_v8i16(<8 x i16> %a) {
66 ; CHECK: 'Cost Model Analysis' for function 'bswap_v8i16':
67 ; CHECK: Found an estimated cost of 50 for instruction: %bswap
68 %bswap = call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %a)