1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py 2; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output | FileCheck %s --check-prefixes=ALL,X64 3; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe | FileCheck %s --check-prefixes=ALL,X64 4; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output | FileCheck %s --check-prefixes=ALL,X86 5; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe | FileCheck %s --check-prefixes=ALL,X86 6 7declare i16 @llvm.bswap.i16(i16) 8declare i32 @llvm.bswap.i32(i32) 9declare i64 @llvm.bswap.i64(i64) 10declare i128 @llvm.bswap.i128(i128) 11 12; Verify the cost of scalar bswap instructions. 13 14define 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 18; 19 %bswap = call i16 @llvm.bswap.i16(i16 %a) 20 ret i16 %bswap 21} 22 23define 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 27; 28 %bswap = call i32 @llvm.bswap.i32(i32 %a) 29 ret i32 %bswap 30} 31 32define 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 36; 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 40; 41 %bswap = call i64 @llvm.bswap.i64(i64 %a) 42 ret i64 %bswap 43} 44 45define 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 49; 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 53; 54 %bswap = call i128 @llvm.bswap.i128(i128 %a) 55 ret i128 %bswap 56} 57