1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze | FileCheck %s --check-prefixes=ALL,X64
3 ; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+movbe | FileCheck %s --check-prefixes=ALL,X64
4 ; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -cost-model -analyze | FileCheck %s --check-prefixes=ALL,X86
5 ; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -cost-model -analyze -mattr=+movbe | FileCheck %s --check-prefixes=ALL,X86
7 declare i16 @llvm.bswap.i16(i16)
8 declare i32 @llvm.bswap.i32(i32)
9 declare i64 @llvm.bswap.i64(i64)
10 declare i128 @llvm.bswap.i128(i128)
12 ; Verify the cost of scalar bswap instructions.
14 define i16 @var_bswap_i16(i16 %a) {
15 ; ALL-LABEL: 'var_bswap_i16'
16 ; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
17 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
19 %bswap = call i16 @llvm.bswap.i16(i16 %a)
23 define i32 @var_bswap_i32(i32 %a) {
24 ; ALL-LABEL: 'var_bswap_i32'
25 ; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
26 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
28 %bswap = call i32 @llvm.bswap.i32(i32 %a)
32 define i64 @var_bswap_i64(i64 %a) {
33 ; X64-LABEL: 'var_bswap_i64'
34 ; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
35 ; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
37 ; X86-LABEL: 'var_bswap_i64'
38 ; X86-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
39 ; X86-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
41 %bswap = call i64 @llvm.bswap.i64(i64 %a)
45 define i128 @var_bswap_i128(i128 %a) {
46 ; X64-LABEL: 'var_bswap_i128'
47 ; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
48 ; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
50 ; X86-LABEL: 'var_bswap_i128'
51 ; X86-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
52 ; X86-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
54 %bswap = call i128 @llvm.bswap.i128(i128 %a)