]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Analysis/CostModel/AArch64/bswap.ll
Vendor import of llvm trunk r291274:
[FreeBSD/FreeBSD.git] / test / Analysis / CostModel / AArch64 / bswap.ll
1 ; RUN: opt -cost-model -analyze -mtriple=aarch64--linux-gnu < %s | FileCheck %s
2
3 ; Verify the cost of bswap instructions.
4
5 declare i16 @llvm.bswap.i16(i16)
6 declare i32 @llvm.bswap.i32(i32)
7 declare i64 @llvm.bswap.i64(i64)
8
9 declare <2 x i32> @llvm.bswap.v2i32(<2 x i32>)
10 declare <4 x i16> @llvm.bswap.v4i16(<4 x i16>)
11
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>)
15
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)
20   ret i16 %bswap
21 }
22
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)
27   ret i32 %bswap
28 }
29
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)
34   ret i64 %bswap
35 }
36
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)
41   ret <2 x i32> %bswap
42 }
43
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)
48   ret <4 x i16> %bswap
49 }
50
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)
55   ret <2 x i64> %bswap
56 }
57
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)
62   ret <4 x i32> %bswap
63 }
64
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)
69   ret <8 x i16> %bswap
70 }