278 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py2; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output | FileCheck %s --check-prefixes=ALL,X643; 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-MOVBE4; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe,+fast-movbe | FileCheck %s --check-prefixes=ALL,X64-FASTMOVBE5 6; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output | FileCheck %s --check-prefixes=ALL,X327; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe | FileCheck %s --check-prefixes=ALL,X32-MOVBE8; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe,+fast-movbe | FileCheck %s --check-prefixes=ALL,X32-FASTMOVBE9 10declare i16 @llvm.bswap.i16(i16)11declare i32 @llvm.bswap.i32(i32)12declare i64 @llvm.bswap.i64(i64)13declare i128 @llvm.bswap.i128(i128)14 15define void @var_bswap_store_i16(i16 %a, ptr %dst) {16; X64-LABEL: 'var_bswap_store_i16'17; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)18; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, ptr %dst, align 119; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void20;21; X64-MOVBE-LABEL: 'var_bswap_store_i16'22; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)23; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, ptr %dst, align 124; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void25;26; X64-FASTMOVBE-LABEL: 'var_bswap_store_i16'27; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)28; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, ptr %dst, align 129; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void30;31; X32-LABEL: 'var_bswap_store_i16'32; X32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)33; X32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, ptr %dst, align 134; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void35;36; X32-MOVBE-LABEL: 'var_bswap_store_i16'37; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)38; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, ptr %dst, align 139; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void40;41; X32-FASTMOVBE-LABEL: 'var_bswap_store_i16'42; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)43; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, ptr %dst, align 144; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void45;46 %bswap = call i16 @llvm.bswap.i16(i16 %a)47 store i16 %bswap, ptr %dst, align 148 49 ret void50}51define void @var_bswap_store_i16_extrause(i16 %a, ptr %dst) {52; ALL-LABEL: 'var_bswap_store_i16_extrause'53; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)54; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, ptr %dst, align 155; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap2 = shl i16 %bswap, 256; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void57;58 %bswap = call i16 @llvm.bswap.i16(i16 %a)59 store i16 %bswap, ptr %dst, align 160 61 %bswap2 = shl i16 %bswap, 2 ; incur an extra use to the bswap62 63 ret void64}65 66define void @var_bswap_store_i32(i32 %a, ptr %dst) {67; X64-LABEL: 'var_bswap_store_i32'68; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)69; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %bswap, ptr %dst, align 170; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void71;72; X64-MOVBE-LABEL: 'var_bswap_store_i32'73; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)74; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %bswap, ptr %dst, align 175; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void76;77; X64-FASTMOVBE-LABEL: 'var_bswap_store_i32'78; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)79; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %bswap, ptr %dst, align 180; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void81;82; X32-LABEL: 'var_bswap_store_i32'83; X32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)84; X32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %bswap, ptr %dst, align 185; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void86;87; X32-MOVBE-LABEL: 'var_bswap_store_i32'88; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)89; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %bswap, ptr %dst, align 190; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void91;92; X32-FASTMOVBE-LABEL: 'var_bswap_store_i32'93; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)94; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %bswap, ptr %dst, align 195; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void96;97 %bswap = call i32 @llvm.bswap.i32(i32 %a)98 store i32 %bswap, ptr %dst, align 199 100 ret void101}102define void @var_bswap_store_i32_extrause(i32 %a, ptr %dst) {103; ALL-LABEL: 'var_bswap_store_i32_extrause'104; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)105; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %bswap, ptr %dst, align 1106; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap2 = shl i32 %bswap, 2107; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void108;109 %bswap = call i32 @llvm.bswap.i32(i32 %a)110 store i32 %bswap, ptr %dst, align 1111 112 %bswap2 = shl i32 %bswap, 2 ; incur an extra use to the bswap113 114 ret void115}116 117define void @var_bswap_store_i64(i64 %a, ptr %dst) {118; X64-LABEL: 'var_bswap_store_i64'119; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)120; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %bswap, ptr %dst, align 1121; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void122;123; X64-MOVBE-LABEL: 'var_bswap_store_i64'124; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)125; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %bswap, ptr %dst, align 1126; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void127;128; X64-FASTMOVBE-LABEL: 'var_bswap_store_i64'129; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)130; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %bswap, ptr %dst, align 1131; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void132;133; X32-LABEL: 'var_bswap_store_i64'134; X32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)135; X32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %bswap, ptr %dst, align 1136; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void137;138; X32-MOVBE-LABEL: 'var_bswap_store_i64'139; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)140; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %bswap, ptr %dst, align 1141; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void142;143; X32-FASTMOVBE-LABEL: 'var_bswap_store_i64'144; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)145; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %bswap, ptr %dst, align 1146; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void147;148 %bswap = call i64 @llvm.bswap.i64(i64 %a)149 store i64 %bswap, ptr %dst, align 1150 151 ret void152}153define void @var_bswap_store_i64_extrause(i64 %a, ptr %dst) {154; X64-LABEL: 'var_bswap_store_i64_extrause'155; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)156; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %bswap, ptr %dst, align 1157; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap2 = shl i64 %bswap, 2158; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void159;160; X64-MOVBE-LABEL: 'var_bswap_store_i64_extrause'161; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)162; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %bswap, ptr %dst, align 1163; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap2 = shl i64 %bswap, 2164; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void165;166; X64-FASTMOVBE-LABEL: 'var_bswap_store_i64_extrause'167; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)168; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %bswap, ptr %dst, align 1169; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap2 = shl i64 %bswap, 2170; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void171;172; X32-LABEL: 'var_bswap_store_i64_extrause'173; X32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)174; X32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %bswap, ptr %dst, align 1175; X32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap2 = shl i64 %bswap, 2176; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void177;178; X32-MOVBE-LABEL: 'var_bswap_store_i64_extrause'179; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)180; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %bswap, ptr %dst, align 1181; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap2 = shl i64 %bswap, 2182; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void183;184; X32-FASTMOVBE-LABEL: 'var_bswap_store_i64_extrause'185; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)186; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %bswap, ptr %dst, align 1187; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap2 = shl i64 %bswap, 2188; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void189;190 %bswap = call i64 @llvm.bswap.i64(i64 %a)191 store i64 %bswap, ptr %dst, align 1192 193 %bswap2 = shl i64 %bswap, 2 ; incur an extra use to the bswap194 195 ret void196}197 198define void @var_bswap_store_i128(i128 %a, ptr %dst) {199; X64-LABEL: 'var_bswap_store_i128'200; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)201; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i128 %bswap, ptr %dst, align 1202; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void203;204; X64-MOVBE-LABEL: 'var_bswap_store_i128'205; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)206; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i128 %bswap, ptr %dst, align 1207; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void208;209; X64-FASTMOVBE-LABEL: 'var_bswap_store_i128'210; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)211; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i128 %bswap, ptr %dst, align 1212; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void213;214; X32-LABEL: 'var_bswap_store_i128'215; X32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)216; X32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %bswap, ptr %dst, align 1217; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void218;219; X32-MOVBE-LABEL: 'var_bswap_store_i128'220; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)221; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %bswap, ptr %dst, align 1222; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void223;224; X32-FASTMOVBE-LABEL: 'var_bswap_store_i128'225; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)226; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %bswap, ptr %dst, align 1227; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void228;229 %bswap = call i128 @llvm.bswap.i128(i128 %a)230 store i128 %bswap, ptr %dst, align 1231 232 ret void233}234define void @var_bswap_store_i128_extrause(i128 %a, ptr %dst) {235; X64-LABEL: 'var_bswap_store_i128_extrause'236; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)237; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i128 %bswap, ptr %dst, align 1238; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap2 = shl i128 %bswap, 2239; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void240;241; X64-MOVBE-LABEL: 'var_bswap_store_i128_extrause'242; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)243; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i128 %bswap, ptr %dst, align 1244; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap2 = shl i128 %bswap, 2245; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void246;247; X64-FASTMOVBE-LABEL: 'var_bswap_store_i128_extrause'248; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)249; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i128 %bswap, ptr %dst, align 1250; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap2 = shl i128 %bswap, 2251; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void252;253; X32-LABEL: 'var_bswap_store_i128_extrause'254; X32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)255; X32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %bswap, ptr %dst, align 1256; X32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap2 = shl i128 %bswap, 2257; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void258;259; X32-MOVBE-LABEL: 'var_bswap_store_i128_extrause'260; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)261; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %bswap, ptr %dst, align 1262; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap2 = shl i128 %bswap, 2263; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void264;265; X32-FASTMOVBE-LABEL: 'var_bswap_store_i128_extrause'266; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)267; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %bswap, ptr %dst, align 1268; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap2 = shl i128 %bswap, 2269; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void270;271 %bswap = call i128 @llvm.bswap.i128(i128 %a)272 store i128 %bswap, ptr %dst, align 1273 274 %bswap2 = shl i128 %bswap, 2 ; incur an extra use to the bswap275 276 ret void277}278