1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s --check-prefix=X86 3; RUN: llc < %s -mtriple=x86_64-unknown -print-schedule=true -mcpu=haswell| FileCheck %s --check-prefix=X64-HSW 4; RUN: llc < %s -mtriple=x86_64-unknown -print-schedule=true -mcpu=btver2| FileCheck %s --check-prefix=X64-JAG 5; RUN: llc < %s -mtriple=i686-unknown -mul-constant-optimization=false | FileCheck %s --check-prefix=X86-NOOPT 6; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -print-schedule=true -mcpu=haswell| FileCheck %s --check-prefix=HSW-NOOPT 7; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -print-schedule=true -mcpu=btver2| FileCheck %s --check-prefix=JAG-NOOPT 8; RUN: llc < %s -mtriple=x86_64-unknown -print-schedule=true -mcpu=slm| FileCheck %s --check-prefix=X64-SLM 9; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -print-schedule=true -mcpu=slm| FileCheck %s --check-prefix=SLM-NOOPT 10 11define i64 @test_mul_by_1(i64 %x) nounwind { 12; X86-LABEL: test_mul_by_1: 13; X86: # %bb.0: 14; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 15; X86-NEXT: movl {{[0-9]+}}(%esp), %edx 16; X86-NEXT: retl 17; 18; X64-HSW-LABEL: test_mul_by_1: 19; X64-HSW: # %bb.0: 20; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25] 21; X64-HSW-NEXT: retq # sched: [7:1.00] 22; 23; X64-JAG-LABEL: test_mul_by_1: 24; X64-JAG: # %bb.0: 25; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.50] 26; X64-JAG-NEXT: retq # sched: [4:1.00] 27; 28; X86-NOOPT-LABEL: test_mul_by_1: 29; X86-NOOPT: # %bb.0: 30; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax 31; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx 32; X86-NOOPT-NEXT: retl 33; 34; HSW-NOOPT-LABEL: test_mul_by_1: 35; HSW-NOOPT: # %bb.0: 36; HSW-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.25] 37; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 38; 39; JAG-NOOPT-LABEL: test_mul_by_1: 40; JAG-NOOPT: # %bb.0: 41; JAG-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.50] 42; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 43; 44; X64-SLM-LABEL: test_mul_by_1: 45; X64-SLM: # %bb.0: 46; X64-SLM-NEXT: movq %rdi, %rax # sched: [1:0.50] 47; X64-SLM-NEXT: retq # sched: [4:1.00] 48; 49; SLM-NOOPT-LABEL: test_mul_by_1: 50; SLM-NOOPT: # %bb.0: 51; SLM-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.50] 52; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 53 %mul = mul nsw i64 %x, 1 54 ret i64 %mul 55} 56 57define i64 @test_mul_by_2(i64 %x) { 58; X86-LABEL: test_mul_by_2: 59; X86: # %bb.0: 60; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 61; X86-NEXT: movl {{[0-9]+}}(%esp), %edx 62; X86-NEXT: shldl $1, %eax, %edx 63; X86-NEXT: addl %eax, %eax 64; X86-NEXT: retl 65; 66; X64-HSW-LABEL: test_mul_by_2: 67; X64-HSW: # %bb.0: 68; X64-HSW-NEXT: leaq (%rdi,%rdi), %rax # sched: [1:0.50] 69; X64-HSW-NEXT: retq # sched: [7:1.00] 70; 71; X64-JAG-LABEL: test_mul_by_2: 72; X64-JAG: # %bb.0: 73; X64-JAG-NEXT: leaq (%rdi,%rdi), %rax # sched: [1:0.50] 74; X64-JAG-NEXT: retq # sched: [4:1.00] 75; 76; X86-NOOPT-LABEL: test_mul_by_2: 77; X86-NOOPT: # %bb.0: 78; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax 79; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx 80; X86-NOOPT-NEXT: shldl $1, %eax, %edx 81; X86-NOOPT-NEXT: addl %eax, %eax 82; X86-NOOPT-NEXT: retl 83; 84; HSW-NOOPT-LABEL: test_mul_by_2: 85; HSW-NOOPT: # %bb.0: 86; HSW-NOOPT-NEXT: leaq (%rdi,%rdi), %rax # sched: [1:0.50] 87; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 88; 89; JAG-NOOPT-LABEL: test_mul_by_2: 90; JAG-NOOPT: # %bb.0: 91; JAG-NOOPT-NEXT: leaq (%rdi,%rdi), %rax # sched: [1:0.50] 92; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 93; 94; X64-SLM-LABEL: test_mul_by_2: 95; X64-SLM: # %bb.0: 96; X64-SLM-NEXT: leaq (%rdi,%rdi), %rax # sched: [1:1.00] 97; X64-SLM-NEXT: retq # sched: [4:1.00] 98; 99; SLM-NOOPT-LABEL: test_mul_by_2: 100; SLM-NOOPT: # %bb.0: 101; SLM-NOOPT-NEXT: leaq (%rdi,%rdi), %rax # sched: [1:1.00] 102; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 103 %mul = mul nsw i64 %x, 2 104 ret i64 %mul 105} 106 107define i64 @test_mul_by_3(i64 %x) { 108; X86-LABEL: test_mul_by_3: 109; X86: # %bb.0: 110; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 111; X86-NEXT: leal (%eax,%eax,2), %ecx 112; X86-NEXT: movl $3, %eax 113; X86-NEXT: mull {{[0-9]+}}(%esp) 114; X86-NEXT: addl %ecx, %edx 115; X86-NEXT: retl 116; 117; X64-HSW-LABEL: test_mul_by_3: 118; X64-HSW: # %bb.0: 119; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50] 120; X64-HSW-NEXT: retq # sched: [7:1.00] 121; 122; X64-JAG-LABEL: test_mul_by_3: 123; X64-JAG: # %bb.0: 124; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [2:1.00] 125; X64-JAG-NEXT: retq # sched: [4:1.00] 126; 127; X86-NOOPT-LABEL: test_mul_by_3: 128; X86-NOOPT: # %bb.0: 129; X86-NOOPT-NEXT: movl $3, %eax 130; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 131; X86-NOOPT-NEXT: imull $3, {{[0-9]+}}(%esp), %ecx 132; X86-NOOPT-NEXT: addl %ecx, %edx 133; X86-NOOPT-NEXT: retl 134; 135; HSW-NOOPT-LABEL: test_mul_by_3: 136; HSW-NOOPT: # %bb.0: 137; HSW-NOOPT-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50] 138; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 139; 140; JAG-NOOPT-LABEL: test_mul_by_3: 141; JAG-NOOPT: # %bb.0: 142; JAG-NOOPT-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [2:1.00] 143; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 144; 145; X64-SLM-LABEL: test_mul_by_3: 146; X64-SLM: # %bb.0: 147; X64-SLM-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:1.00] 148; X64-SLM-NEXT: retq # sched: [4:1.00] 149; 150; SLM-NOOPT-LABEL: test_mul_by_3: 151; SLM-NOOPT: # %bb.0: 152; SLM-NOOPT-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:1.00] 153; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 154 %mul = mul nsw i64 %x, 3 155 ret i64 %mul 156} 157 158define i64 @test_mul_by_4(i64 %x) { 159; X86-LABEL: test_mul_by_4: 160; X86: # %bb.0: 161; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 162; X86-NEXT: movl {{[0-9]+}}(%esp), %edx 163; X86-NEXT: shldl $2, %eax, %edx 164; X86-NEXT: shll $2, %eax 165; X86-NEXT: retl 166; 167; X64-HSW-LABEL: test_mul_by_4: 168; X64-HSW: # %bb.0: 169; X64-HSW-NEXT: leaq (,%rdi,4), %rax # sched: [1:0.50] 170; X64-HSW-NEXT: retq # sched: [7:1.00] 171; 172; X64-JAG-LABEL: test_mul_by_4: 173; X64-JAG: # %bb.0: 174; X64-JAG-NEXT: leaq (,%rdi,4), %rax # sched: [2:1.00] 175; X64-JAG-NEXT: retq # sched: [4:1.00] 176; 177; X86-NOOPT-LABEL: test_mul_by_4: 178; X86-NOOPT: # %bb.0: 179; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax 180; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx 181; X86-NOOPT-NEXT: shldl $2, %eax, %edx 182; X86-NOOPT-NEXT: shll $2, %eax 183; X86-NOOPT-NEXT: retl 184; 185; HSW-NOOPT-LABEL: test_mul_by_4: 186; HSW-NOOPT: # %bb.0: 187; HSW-NOOPT-NEXT: leaq (,%rdi,4), %rax # sched: [1:0.50] 188; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 189; 190; JAG-NOOPT-LABEL: test_mul_by_4: 191; JAG-NOOPT: # %bb.0: 192; JAG-NOOPT-NEXT: leaq (,%rdi,4), %rax # sched: [2:1.00] 193; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 194; 195; X64-SLM-LABEL: test_mul_by_4: 196; X64-SLM: # %bb.0: 197; X64-SLM-NEXT: leaq (,%rdi,4), %rax # sched: [1:1.00] 198; X64-SLM-NEXT: retq # sched: [4:1.00] 199; 200; SLM-NOOPT-LABEL: test_mul_by_4: 201; SLM-NOOPT: # %bb.0: 202; SLM-NOOPT-NEXT: leaq (,%rdi,4), %rax # sched: [1:1.00] 203; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 204 %mul = mul nsw i64 %x, 4 205 ret i64 %mul 206} 207 208define i64 @test_mul_by_5(i64 %x) { 209; X86-LABEL: test_mul_by_5: 210; X86: # %bb.0: 211; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 212; X86-NEXT: leal (%eax,%eax,4), %ecx 213; X86-NEXT: movl $5, %eax 214; X86-NEXT: mull {{[0-9]+}}(%esp) 215; X86-NEXT: addl %ecx, %edx 216; X86-NEXT: retl 217; 218; X64-HSW-LABEL: test_mul_by_5: 219; X64-HSW: # %bb.0: 220; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50] 221; X64-HSW-NEXT: retq # sched: [7:1.00] 222; 223; X64-JAG-LABEL: test_mul_by_5: 224; X64-JAG: # %bb.0: 225; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [2:1.00] 226; X64-JAG-NEXT: retq # sched: [4:1.00] 227; 228; X86-NOOPT-LABEL: test_mul_by_5: 229; X86-NOOPT: # %bb.0: 230; X86-NOOPT-NEXT: movl $5, %eax 231; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 232; X86-NOOPT-NEXT: imull $5, {{[0-9]+}}(%esp), %ecx 233; X86-NOOPT-NEXT: addl %ecx, %edx 234; X86-NOOPT-NEXT: retl 235; 236; HSW-NOOPT-LABEL: test_mul_by_5: 237; HSW-NOOPT: # %bb.0: 238; HSW-NOOPT-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50] 239; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 240; 241; JAG-NOOPT-LABEL: test_mul_by_5: 242; JAG-NOOPT: # %bb.0: 243; JAG-NOOPT-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [2:1.00] 244; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 245; 246; X64-SLM-LABEL: test_mul_by_5: 247; X64-SLM: # %bb.0: 248; X64-SLM-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:1.00] 249; X64-SLM-NEXT: retq # sched: [4:1.00] 250; 251; SLM-NOOPT-LABEL: test_mul_by_5: 252; SLM-NOOPT: # %bb.0: 253; SLM-NOOPT-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:1.00] 254; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 255 %mul = mul nsw i64 %x, 5 256 ret i64 %mul 257} 258 259define i64 @test_mul_by_6(i64 %x) { 260; X86-LABEL: test_mul_by_6: 261; X86: # %bb.0: 262; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 263; X86-NEXT: leal (%eax,%eax,2), %ecx 264; X86-NEXT: movl $6, %eax 265; X86-NEXT: mull {{[0-9]+}}(%esp) 266; X86-NEXT: leal (%edx,%ecx,2), %edx 267; X86-NEXT: retl 268; 269; X64-HSW-LABEL: test_mul_by_6: 270; X64-HSW: # %bb.0: 271; X64-HSW-NEXT: addq %rdi, %rdi # sched: [1:0.25] 272; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50] 273; X64-HSW-NEXT: retq # sched: [7:1.00] 274; 275; X64-JAG-LABEL: test_mul_by_6: 276; X64-JAG: # %bb.0: 277; X64-JAG-NEXT: addq %rdi, %rdi # sched: [1:0.50] 278; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [2:1.00] 279; X64-JAG-NEXT: retq # sched: [4:1.00] 280; 281; X86-NOOPT-LABEL: test_mul_by_6: 282; X86-NOOPT: # %bb.0: 283; X86-NOOPT-NEXT: movl $6, %eax 284; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 285; X86-NOOPT-NEXT: imull $6, {{[0-9]+}}(%esp), %ecx 286; X86-NOOPT-NEXT: addl %ecx, %edx 287; X86-NOOPT-NEXT: retl 288; 289; HSW-NOOPT-LABEL: test_mul_by_6: 290; HSW-NOOPT: # %bb.0: 291; HSW-NOOPT-NEXT: imulq $6, %rdi, %rax # sched: [3:1.00] 292; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 293; 294; JAG-NOOPT-LABEL: test_mul_by_6: 295; JAG-NOOPT: # %bb.0: 296; JAG-NOOPT-NEXT: imulq $6, %rdi, %rax # sched: [6:4.00] 297; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 298; 299; X64-SLM-LABEL: test_mul_by_6: 300; X64-SLM: # %bb.0: 301; X64-SLM-NEXT: addq %rdi, %rdi # sched: [1:0.50] 302; X64-SLM-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:1.00] 303; X64-SLM-NEXT: retq # sched: [4:1.00] 304; 305; SLM-NOOPT-LABEL: test_mul_by_6: 306; SLM-NOOPT: # %bb.0: 307; SLM-NOOPT-NEXT: imulq $6, %rdi, %rax # sched: [3:1.00] 308; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 309 %mul = mul nsw i64 %x, 6 310 ret i64 %mul 311} 312 313define i64 @test_mul_by_7(i64 %x) { 314; X86-LABEL: test_mul_by_7: 315; X86: # %bb.0: 316; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 317; X86-NEXT: leal (,%eax,8), %ecx 318; X86-NEXT: subl %eax, %ecx 319; X86-NEXT: movl $7, %eax 320; X86-NEXT: mull {{[0-9]+}}(%esp) 321; X86-NEXT: addl %ecx, %edx 322; X86-NEXT: retl 323; 324; X64-HSW-LABEL: test_mul_by_7: 325; X64-HSW: # %bb.0: 326; X64-HSW-NEXT: leaq (,%rdi,8), %rax # sched: [1:0.50] 327; X64-HSW-NEXT: subq %rdi, %rax # sched: [1:0.25] 328; X64-HSW-NEXT: retq # sched: [7:1.00] 329; 330; X64-JAG-LABEL: test_mul_by_7: 331; X64-JAG: # %bb.0: 332; X64-JAG-NEXT: leaq (,%rdi,8), %rax # sched: [2:1.00] 333; X64-JAG-NEXT: subq %rdi, %rax # sched: [1:0.50] 334; X64-JAG-NEXT: retq # sched: [4:1.00] 335; 336; X86-NOOPT-LABEL: test_mul_by_7: 337; X86-NOOPT: # %bb.0: 338; X86-NOOPT-NEXT: movl $7, %eax 339; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 340; X86-NOOPT-NEXT: imull $7, {{[0-9]+}}(%esp), %ecx 341; X86-NOOPT-NEXT: addl %ecx, %edx 342; X86-NOOPT-NEXT: retl 343; 344; HSW-NOOPT-LABEL: test_mul_by_7: 345; HSW-NOOPT: # %bb.0: 346; HSW-NOOPT-NEXT: imulq $7, %rdi, %rax # sched: [3:1.00] 347; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 348; 349; JAG-NOOPT-LABEL: test_mul_by_7: 350; JAG-NOOPT: # %bb.0: 351; JAG-NOOPT-NEXT: imulq $7, %rdi, %rax # sched: [6:4.00] 352; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 353; 354; X64-SLM-LABEL: test_mul_by_7: 355; X64-SLM: # %bb.0: 356; X64-SLM-NEXT: leaq (,%rdi,8), %rax # sched: [1:1.00] 357; X64-SLM-NEXT: subq %rdi, %rax # sched: [1:0.50] 358; X64-SLM-NEXT: retq # sched: [4:1.00] 359; 360; SLM-NOOPT-LABEL: test_mul_by_7: 361; SLM-NOOPT: # %bb.0: 362; SLM-NOOPT-NEXT: imulq $7, %rdi, %rax # sched: [3:1.00] 363; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 364 %mul = mul nsw i64 %x, 7 365 ret i64 %mul 366} 367 368define i64 @test_mul_by_8(i64 %x) { 369; X86-LABEL: test_mul_by_8: 370; X86: # %bb.0: 371; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 372; X86-NEXT: movl {{[0-9]+}}(%esp), %edx 373; X86-NEXT: shldl $3, %eax, %edx 374; X86-NEXT: shll $3, %eax 375; X86-NEXT: retl 376; 377; X64-HSW-LABEL: test_mul_by_8: 378; X64-HSW: # %bb.0: 379; X64-HSW-NEXT: leaq (,%rdi,8), %rax # sched: [1:0.50] 380; X64-HSW-NEXT: retq # sched: [7:1.00] 381; 382; X64-JAG-LABEL: test_mul_by_8: 383; X64-JAG: # %bb.0: 384; X64-JAG-NEXT: leaq (,%rdi,8), %rax # sched: [2:1.00] 385; X64-JAG-NEXT: retq # sched: [4:1.00] 386; 387; X86-NOOPT-LABEL: test_mul_by_8: 388; X86-NOOPT: # %bb.0: 389; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax 390; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx 391; X86-NOOPT-NEXT: shldl $3, %eax, %edx 392; X86-NOOPT-NEXT: shll $3, %eax 393; X86-NOOPT-NEXT: retl 394; 395; HSW-NOOPT-LABEL: test_mul_by_8: 396; HSW-NOOPT: # %bb.0: 397; HSW-NOOPT-NEXT: leaq (,%rdi,8), %rax # sched: [1:0.50] 398; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 399; 400; JAG-NOOPT-LABEL: test_mul_by_8: 401; JAG-NOOPT: # %bb.0: 402; JAG-NOOPT-NEXT: leaq (,%rdi,8), %rax # sched: [2:1.00] 403; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 404; 405; X64-SLM-LABEL: test_mul_by_8: 406; X64-SLM: # %bb.0: 407; X64-SLM-NEXT: leaq (,%rdi,8), %rax # sched: [1:1.00] 408; X64-SLM-NEXT: retq # sched: [4:1.00] 409; 410; SLM-NOOPT-LABEL: test_mul_by_8: 411; SLM-NOOPT: # %bb.0: 412; SLM-NOOPT-NEXT: leaq (,%rdi,8), %rax # sched: [1:1.00] 413; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 414 %mul = mul nsw i64 %x, 8 415 ret i64 %mul 416} 417 418define i64 @test_mul_by_9(i64 %x) { 419; X86-LABEL: test_mul_by_9: 420; X86: # %bb.0: 421; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 422; X86-NEXT: leal (%eax,%eax,8), %ecx 423; X86-NEXT: movl $9, %eax 424; X86-NEXT: mull {{[0-9]+}}(%esp) 425; X86-NEXT: addl %ecx, %edx 426; X86-NEXT: retl 427; 428; X64-HSW-LABEL: test_mul_by_9: 429; X64-HSW: # %bb.0: 430; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50] 431; X64-HSW-NEXT: retq # sched: [7:1.00] 432; 433; X64-JAG-LABEL: test_mul_by_9: 434; X64-JAG: # %bb.0: 435; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [2:1.00] 436; X64-JAG-NEXT: retq # sched: [4:1.00] 437; 438; X86-NOOPT-LABEL: test_mul_by_9: 439; X86-NOOPT: # %bb.0: 440; X86-NOOPT-NEXT: movl $9, %eax 441; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 442; X86-NOOPT-NEXT: imull $9, {{[0-9]+}}(%esp), %ecx 443; X86-NOOPT-NEXT: addl %ecx, %edx 444; X86-NOOPT-NEXT: retl 445; 446; HSW-NOOPT-LABEL: test_mul_by_9: 447; HSW-NOOPT: # %bb.0: 448; HSW-NOOPT-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50] 449; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 450; 451; JAG-NOOPT-LABEL: test_mul_by_9: 452; JAG-NOOPT: # %bb.0: 453; JAG-NOOPT-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [2:1.00] 454; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 455; 456; X64-SLM-LABEL: test_mul_by_9: 457; X64-SLM: # %bb.0: 458; X64-SLM-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:1.00] 459; X64-SLM-NEXT: retq # sched: [4:1.00] 460; 461; SLM-NOOPT-LABEL: test_mul_by_9: 462; SLM-NOOPT: # %bb.0: 463; SLM-NOOPT-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:1.00] 464; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 465 %mul = mul nsw i64 %x, 9 466 ret i64 %mul 467} 468 469define i64 @test_mul_by_10(i64 %x) { 470; X86-LABEL: test_mul_by_10: 471; X86: # %bb.0: 472; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 473; X86-NEXT: leal (%eax,%eax,4), %ecx 474; X86-NEXT: movl $10, %eax 475; X86-NEXT: mull {{[0-9]+}}(%esp) 476; X86-NEXT: leal (%edx,%ecx,2), %edx 477; X86-NEXT: retl 478; 479; X64-HSW-LABEL: test_mul_by_10: 480; X64-HSW: # %bb.0: 481; X64-HSW-NEXT: addq %rdi, %rdi # sched: [1:0.25] 482; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50] 483; X64-HSW-NEXT: retq # sched: [7:1.00] 484; 485; X64-JAG-LABEL: test_mul_by_10: 486; X64-JAG: # %bb.0: 487; X64-JAG-NEXT: addq %rdi, %rdi # sched: [1:0.50] 488; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [2:1.00] 489; X64-JAG-NEXT: retq # sched: [4:1.00] 490; 491; X86-NOOPT-LABEL: test_mul_by_10: 492; X86-NOOPT: # %bb.0: 493; X86-NOOPT-NEXT: movl $10, %eax 494; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 495; X86-NOOPT-NEXT: imull $10, {{[0-9]+}}(%esp), %ecx 496; X86-NOOPT-NEXT: addl %ecx, %edx 497; X86-NOOPT-NEXT: retl 498; 499; HSW-NOOPT-LABEL: test_mul_by_10: 500; HSW-NOOPT: # %bb.0: 501; HSW-NOOPT-NEXT: imulq $10, %rdi, %rax # sched: [3:1.00] 502; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 503; 504; JAG-NOOPT-LABEL: test_mul_by_10: 505; JAG-NOOPT: # %bb.0: 506; JAG-NOOPT-NEXT: imulq $10, %rdi, %rax # sched: [6:4.00] 507; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 508; 509; X64-SLM-LABEL: test_mul_by_10: 510; X64-SLM: # %bb.0: 511; X64-SLM-NEXT: addq %rdi, %rdi # sched: [1:0.50] 512; X64-SLM-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:1.00] 513; X64-SLM-NEXT: retq # sched: [4:1.00] 514; 515; SLM-NOOPT-LABEL: test_mul_by_10: 516; SLM-NOOPT: # %bb.0: 517; SLM-NOOPT-NEXT: imulq $10, %rdi, %rax # sched: [3:1.00] 518; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 519 %mul = mul nsw i64 %x, 10 520 ret i64 %mul 521} 522 523define i64 @test_mul_by_11(i64 %x) { 524; X86-LABEL: test_mul_by_11: 525; X86: # %bb.0: 526; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 527; X86-NEXT: leal (%eax,%eax,4), %ecx 528; X86-NEXT: leal (%eax,%ecx,2), %ecx 529; X86-NEXT: movl $11, %eax 530; X86-NEXT: mull {{[0-9]+}}(%esp) 531; X86-NEXT: addl %ecx, %edx 532; X86-NEXT: retl 533; 534; X64-HSW-LABEL: test_mul_by_11: 535; X64-HSW: # %bb.0: 536; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50] 537; X64-HSW-NEXT: leaq (%rdi,%rax,2), %rax # sched: [1:0.50] 538; X64-HSW-NEXT: retq # sched: [7:1.00] 539; 540; X64-JAG-LABEL: test_mul_by_11: 541; X64-JAG: # %bb.0: 542; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [2:1.00] 543; X64-JAG-NEXT: leaq (%rdi,%rax,2), %rax # sched: [2:1.00] 544; X64-JAG-NEXT: retq # sched: [4:1.00] 545; 546; X86-NOOPT-LABEL: test_mul_by_11: 547; X86-NOOPT: # %bb.0: 548; X86-NOOPT-NEXT: movl $11, %eax 549; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 550; X86-NOOPT-NEXT: imull $11, {{[0-9]+}}(%esp), %ecx 551; X86-NOOPT-NEXT: addl %ecx, %edx 552; X86-NOOPT-NEXT: retl 553; 554; HSW-NOOPT-LABEL: test_mul_by_11: 555; HSW-NOOPT: # %bb.0: 556; HSW-NOOPT-NEXT: imulq $11, %rdi, %rax # sched: [3:1.00] 557; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 558; 559; JAG-NOOPT-LABEL: test_mul_by_11: 560; JAG-NOOPT: # %bb.0: 561; JAG-NOOPT-NEXT: imulq $11, %rdi, %rax # sched: [6:4.00] 562; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 563; 564; X64-SLM-LABEL: test_mul_by_11: 565; X64-SLM: # %bb.0: 566; X64-SLM-NEXT: imulq $11, %rdi, %rax # sched: [3:1.00] 567; X64-SLM-NEXT: retq # sched: [4:1.00] 568; 569; SLM-NOOPT-LABEL: test_mul_by_11: 570; SLM-NOOPT: # %bb.0: 571; SLM-NOOPT-NEXT: imulq $11, %rdi, %rax # sched: [3:1.00] 572; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 573 %mul = mul nsw i64 %x, 11 574 ret i64 %mul 575} 576 577define i64 @test_mul_by_12(i64 %x) { 578; X86-LABEL: test_mul_by_12: 579; X86: # %bb.0: 580; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 581; X86-NEXT: leal (%eax,%eax,2), %ecx 582; X86-NEXT: movl $12, %eax 583; X86-NEXT: mull {{[0-9]+}}(%esp) 584; X86-NEXT: leal (%edx,%ecx,4), %edx 585; X86-NEXT: retl 586; 587; X64-HSW-LABEL: test_mul_by_12: 588; X64-HSW: # %bb.0: 589; X64-HSW-NEXT: shlq $2, %rdi # sched: [1:0.50] 590; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50] 591; X64-HSW-NEXT: retq # sched: [7:1.00] 592; 593; X64-JAG-LABEL: test_mul_by_12: 594; X64-JAG: # %bb.0: 595; X64-JAG-NEXT: shlq $2, %rdi # sched: [1:0.50] 596; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [2:1.00] 597; X64-JAG-NEXT: retq # sched: [4:1.00] 598; 599; X86-NOOPT-LABEL: test_mul_by_12: 600; X86-NOOPT: # %bb.0: 601; X86-NOOPT-NEXT: movl $12, %eax 602; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 603; X86-NOOPT-NEXT: imull $12, {{[0-9]+}}(%esp), %ecx 604; X86-NOOPT-NEXT: addl %ecx, %edx 605; X86-NOOPT-NEXT: retl 606; 607; HSW-NOOPT-LABEL: test_mul_by_12: 608; HSW-NOOPT: # %bb.0: 609; HSW-NOOPT-NEXT: imulq $12, %rdi, %rax # sched: [3:1.00] 610; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 611; 612; JAG-NOOPT-LABEL: test_mul_by_12: 613; JAG-NOOPT: # %bb.0: 614; JAG-NOOPT-NEXT: imulq $12, %rdi, %rax # sched: [6:4.00] 615; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 616; 617; X64-SLM-LABEL: test_mul_by_12: 618; X64-SLM: # %bb.0: 619; X64-SLM-NEXT: shlq $2, %rdi # sched: [1:1.00] 620; X64-SLM-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:1.00] 621; X64-SLM-NEXT: retq # sched: [4:1.00] 622; 623; SLM-NOOPT-LABEL: test_mul_by_12: 624; SLM-NOOPT: # %bb.0: 625; SLM-NOOPT-NEXT: imulq $12, %rdi, %rax # sched: [3:1.00] 626; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 627 %mul = mul nsw i64 %x, 12 628 ret i64 %mul 629} 630 631define i64 @test_mul_by_13(i64 %x) { 632; X86-LABEL: test_mul_by_13: 633; X86: # %bb.0: 634; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 635; X86-NEXT: leal (%eax,%eax,2), %ecx 636; X86-NEXT: leal (%eax,%ecx,4), %ecx 637; X86-NEXT: movl $13, %eax 638; X86-NEXT: mull {{[0-9]+}}(%esp) 639; X86-NEXT: addl %ecx, %edx 640; X86-NEXT: retl 641; 642; X64-HSW-LABEL: test_mul_by_13: 643; X64-HSW: # %bb.0: 644; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50] 645; X64-HSW-NEXT: leaq (%rdi,%rax,4), %rax # sched: [1:0.50] 646; X64-HSW-NEXT: retq # sched: [7:1.00] 647; 648; X64-JAG-LABEL: test_mul_by_13: 649; X64-JAG: # %bb.0: 650; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [2:1.00] 651; X64-JAG-NEXT: leaq (%rdi,%rax,4), %rax # sched: [2:1.00] 652; X64-JAG-NEXT: retq # sched: [4:1.00] 653; 654; X86-NOOPT-LABEL: test_mul_by_13: 655; X86-NOOPT: # %bb.0: 656; X86-NOOPT-NEXT: movl $13, %eax 657; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 658; X86-NOOPT-NEXT: imull $13, {{[0-9]+}}(%esp), %ecx 659; X86-NOOPT-NEXT: addl %ecx, %edx 660; X86-NOOPT-NEXT: retl 661; 662; HSW-NOOPT-LABEL: test_mul_by_13: 663; HSW-NOOPT: # %bb.0: 664; HSW-NOOPT-NEXT: imulq $13, %rdi, %rax # sched: [3:1.00] 665; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 666; 667; JAG-NOOPT-LABEL: test_mul_by_13: 668; JAG-NOOPT: # %bb.0: 669; JAG-NOOPT-NEXT: imulq $13, %rdi, %rax # sched: [6:4.00] 670; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 671; 672; X64-SLM-LABEL: test_mul_by_13: 673; X64-SLM: # %bb.0: 674; X64-SLM-NEXT: imulq $13, %rdi, %rax # sched: [3:1.00] 675; X64-SLM-NEXT: retq # sched: [4:1.00] 676; 677; SLM-NOOPT-LABEL: test_mul_by_13: 678; SLM-NOOPT: # %bb.0: 679; SLM-NOOPT-NEXT: imulq $13, %rdi, %rax # sched: [3:1.00] 680; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 681 %mul = mul nsw i64 %x, 13 682 ret i64 %mul 683} 684 685define i64 @test_mul_by_14(i64 %x) { 686; X86-LABEL: test_mul_by_14: 687; X86: # %bb.0: 688; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 689; X86-NEXT: movl %eax, %ecx 690; X86-NEXT: shll $4, %ecx 691; X86-NEXT: subl %eax, %ecx 692; X86-NEXT: subl %eax, %ecx 693; X86-NEXT: movl $14, %eax 694; X86-NEXT: mull {{[0-9]+}}(%esp) 695; X86-NEXT: addl %ecx, %edx 696; X86-NEXT: retl 697; 698; X64-HSW-LABEL: test_mul_by_14: 699; X64-HSW: # %bb.0: 700; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25] 701; X64-HSW-NEXT: shlq $4, %rax # sched: [1:0.50] 702; X64-HSW-NEXT: subq %rdi, %rax # sched: [1:0.25] 703; X64-HSW-NEXT: subq %rdi, %rax # sched: [1:0.25] 704; X64-HSW-NEXT: retq # sched: [7:1.00] 705; 706; X64-JAG-LABEL: test_mul_by_14: 707; X64-JAG: # %bb.0: 708; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.50] 709; X64-JAG-NEXT: shlq $4, %rax # sched: [1:0.50] 710; X64-JAG-NEXT: subq %rdi, %rax # sched: [1:0.50] 711; X64-JAG-NEXT: subq %rdi, %rax # sched: [1:0.50] 712; X64-JAG-NEXT: retq # sched: [4:1.00] 713; 714; X86-NOOPT-LABEL: test_mul_by_14: 715; X86-NOOPT: # %bb.0: 716; X86-NOOPT-NEXT: movl $14, %eax 717; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 718; X86-NOOPT-NEXT: imull $14, {{[0-9]+}}(%esp), %ecx 719; X86-NOOPT-NEXT: addl %ecx, %edx 720; X86-NOOPT-NEXT: retl 721; 722; HSW-NOOPT-LABEL: test_mul_by_14: 723; HSW-NOOPT: # %bb.0: 724; HSW-NOOPT-NEXT: imulq $14, %rdi, %rax # sched: [3:1.00] 725; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 726; 727; JAG-NOOPT-LABEL: test_mul_by_14: 728; JAG-NOOPT: # %bb.0: 729; JAG-NOOPT-NEXT: imulq $14, %rdi, %rax # sched: [6:4.00] 730; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 731; 732; X64-SLM-LABEL: test_mul_by_14: 733; X64-SLM: # %bb.0: 734; X64-SLM-NEXT: movq %rdi, %rax # sched: [1:0.50] 735; X64-SLM-NEXT: shlq $4, %rax # sched: [1:1.00] 736; X64-SLM-NEXT: subq %rdi, %rax # sched: [1:0.50] 737; X64-SLM-NEXT: subq %rdi, %rax # sched: [1:0.50] 738; X64-SLM-NEXT: retq # sched: [4:1.00] 739; 740; SLM-NOOPT-LABEL: test_mul_by_14: 741; SLM-NOOPT: # %bb.0: 742; SLM-NOOPT-NEXT: imulq $14, %rdi, %rax # sched: [3:1.00] 743; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 744 %mul = mul nsw i64 %x, 14 745 ret i64 %mul 746} 747 748define i64 @test_mul_by_15(i64 %x) { 749; X86-LABEL: test_mul_by_15: 750; X86: # %bb.0: 751; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 752; X86-NEXT: movl $15, %eax 753; X86-NEXT: mull {{[0-9]+}}(%esp) 754; X86-NEXT: leal (%ecx,%ecx,4), %ecx 755; X86-NEXT: leal (%ecx,%ecx,2), %ecx 756; X86-NEXT: addl %ecx, %edx 757; X86-NEXT: retl 758; 759; X64-HSW-LABEL: test_mul_by_15: 760; X64-HSW: # %bb.0: 761; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50] 762; X64-HSW-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:0.50] 763; X64-HSW-NEXT: retq # sched: [7:1.00] 764; 765; X64-JAG-LABEL: test_mul_by_15: 766; X64-JAG: # %bb.0: 767; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [2:1.00] 768; X64-JAG-NEXT: leaq (%rax,%rax,2), %rax # sched: [2:1.00] 769; X64-JAG-NEXT: retq # sched: [4:1.00] 770; 771; X86-NOOPT-LABEL: test_mul_by_15: 772; X86-NOOPT: # %bb.0: 773; X86-NOOPT-NEXT: movl $15, %eax 774; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 775; X86-NOOPT-NEXT: imull $15, {{[0-9]+}}(%esp), %ecx 776; X86-NOOPT-NEXT: addl %ecx, %edx 777; X86-NOOPT-NEXT: retl 778; 779; HSW-NOOPT-LABEL: test_mul_by_15: 780; HSW-NOOPT: # %bb.0: 781; HSW-NOOPT-NEXT: imulq $15, %rdi, %rax # sched: [3:1.00] 782; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 783; 784; JAG-NOOPT-LABEL: test_mul_by_15: 785; JAG-NOOPT: # %bb.0: 786; JAG-NOOPT-NEXT: imulq $15, %rdi, %rax # sched: [6:4.00] 787; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 788; 789; X64-SLM-LABEL: test_mul_by_15: 790; X64-SLM: # %bb.0: 791; X64-SLM-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:1.00] 792; X64-SLM-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:1.00] 793; X64-SLM-NEXT: retq # sched: [4:1.00] 794; 795; SLM-NOOPT-LABEL: test_mul_by_15: 796; SLM-NOOPT: # %bb.0: 797; SLM-NOOPT-NEXT: imulq $15, %rdi, %rax # sched: [3:1.00] 798; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 799 %mul = mul nsw i64 %x, 15 800 ret i64 %mul 801} 802 803define i64 @test_mul_by_16(i64 %x) { 804; X86-LABEL: test_mul_by_16: 805; X86: # %bb.0: 806; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 807; X86-NEXT: movl {{[0-9]+}}(%esp), %edx 808; X86-NEXT: shldl $4, %eax, %edx 809; X86-NEXT: shll $4, %eax 810; X86-NEXT: retl 811; 812; X64-HSW-LABEL: test_mul_by_16: 813; X64-HSW: # %bb.0: 814; X64-HSW-NEXT: shlq $4, %rdi # sched: [1:0.50] 815; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25] 816; X64-HSW-NEXT: retq # sched: [7:1.00] 817; 818; X64-JAG-LABEL: test_mul_by_16: 819; X64-JAG: # %bb.0: 820; X64-JAG-NEXT: shlq $4, %rdi # sched: [1:0.50] 821; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.50] 822; X64-JAG-NEXT: retq # sched: [4:1.00] 823; 824; X86-NOOPT-LABEL: test_mul_by_16: 825; X86-NOOPT: # %bb.0: 826; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax 827; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx 828; X86-NOOPT-NEXT: shldl $4, %eax, %edx 829; X86-NOOPT-NEXT: shll $4, %eax 830; X86-NOOPT-NEXT: retl 831; 832; HSW-NOOPT-LABEL: test_mul_by_16: 833; HSW-NOOPT: # %bb.0: 834; HSW-NOOPT-NEXT: shlq $4, %rdi # sched: [1:0.50] 835; HSW-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.25] 836; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 837; 838; JAG-NOOPT-LABEL: test_mul_by_16: 839; JAG-NOOPT: # %bb.0: 840; JAG-NOOPT-NEXT: shlq $4, %rdi # sched: [1:0.50] 841; JAG-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.50] 842; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 843; 844; X64-SLM-LABEL: test_mul_by_16: 845; X64-SLM: # %bb.0: 846; X64-SLM-NEXT: shlq $4, %rdi # sched: [1:1.00] 847; X64-SLM-NEXT: movq %rdi, %rax # sched: [1:0.50] 848; X64-SLM-NEXT: retq # sched: [4:1.00] 849; 850; SLM-NOOPT-LABEL: test_mul_by_16: 851; SLM-NOOPT: # %bb.0: 852; SLM-NOOPT-NEXT: shlq $4, %rdi # sched: [1:1.00] 853; SLM-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.50] 854; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 855 %mul = mul nsw i64 %x, 16 856 ret i64 %mul 857} 858 859define i64 @test_mul_by_17(i64 %x) { 860; X86-LABEL: test_mul_by_17: 861; X86: # %bb.0: 862; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 863; X86-NEXT: movl %eax, %ecx 864; X86-NEXT: shll $4, %ecx 865; X86-NEXT: addl %eax, %ecx 866; X86-NEXT: movl $17, %eax 867; X86-NEXT: mull {{[0-9]+}}(%esp) 868; X86-NEXT: addl %ecx, %edx 869; X86-NEXT: retl 870; 871; X64-HSW-LABEL: test_mul_by_17: 872; X64-HSW: # %bb.0: 873; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25] 874; X64-HSW-NEXT: shlq $4, %rax # sched: [1:0.50] 875; X64-HSW-NEXT: leaq (%rax,%rdi), %rax # sched: [1:0.50] 876; X64-HSW-NEXT: retq # sched: [7:1.00] 877; 878; X64-JAG-LABEL: test_mul_by_17: 879; X64-JAG: # %bb.0: 880; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.50] 881; X64-JAG-NEXT: shlq $4, %rax # sched: [1:0.50] 882; X64-JAG-NEXT: leaq (%rax,%rdi), %rax # sched: [1:0.50] 883; X64-JAG-NEXT: retq # sched: [4:1.00] 884; 885; X86-NOOPT-LABEL: test_mul_by_17: 886; X86-NOOPT: # %bb.0: 887; X86-NOOPT-NEXT: movl $17, %eax 888; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 889; X86-NOOPT-NEXT: imull $17, {{[0-9]+}}(%esp), %ecx 890; X86-NOOPT-NEXT: addl %ecx, %edx 891; X86-NOOPT-NEXT: retl 892; 893; HSW-NOOPT-LABEL: test_mul_by_17: 894; HSW-NOOPT: # %bb.0: 895; HSW-NOOPT-NEXT: imulq $17, %rdi, %rax # sched: [3:1.00] 896; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 897; 898; JAG-NOOPT-LABEL: test_mul_by_17: 899; JAG-NOOPT: # %bb.0: 900; JAG-NOOPT-NEXT: imulq $17, %rdi, %rax # sched: [6:4.00] 901; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 902; 903; X64-SLM-LABEL: test_mul_by_17: 904; X64-SLM: # %bb.0: 905; X64-SLM-NEXT: movq %rdi, %rax # sched: [1:0.50] 906; X64-SLM-NEXT: shlq $4, %rax # sched: [1:1.00] 907; X64-SLM-NEXT: addq %rdi, %rax # sched: [1:0.50] 908; X64-SLM-NEXT: retq # sched: [4:1.00] 909; 910; SLM-NOOPT-LABEL: test_mul_by_17: 911; SLM-NOOPT: # %bb.0: 912; SLM-NOOPT-NEXT: imulq $17, %rdi, %rax # sched: [3:1.00] 913; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 914 %mul = mul nsw i64 %x, 17 915 ret i64 %mul 916} 917 918define i64 @test_mul_by_18(i64 %x) { 919; X86-LABEL: test_mul_by_18: 920; X86: # %bb.0: 921; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 922; X86-NEXT: leal (%eax,%eax,8), %ecx 923; X86-NEXT: movl $18, %eax 924; X86-NEXT: mull {{[0-9]+}}(%esp) 925; X86-NEXT: leal (%edx,%ecx,2), %edx 926; X86-NEXT: retl 927; 928; X64-HSW-LABEL: test_mul_by_18: 929; X64-HSW: # %bb.0: 930; X64-HSW-NEXT: addq %rdi, %rdi # sched: [1:0.25] 931; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50] 932; X64-HSW-NEXT: retq # sched: [7:1.00] 933; 934; X64-JAG-LABEL: test_mul_by_18: 935; X64-JAG: # %bb.0: 936; X64-JAG-NEXT: addq %rdi, %rdi # sched: [1:0.50] 937; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [2:1.00] 938; X64-JAG-NEXT: retq # sched: [4:1.00] 939; 940; X86-NOOPT-LABEL: test_mul_by_18: 941; X86-NOOPT: # %bb.0: 942; X86-NOOPT-NEXT: movl $18, %eax 943; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 944; X86-NOOPT-NEXT: imull $18, {{[0-9]+}}(%esp), %ecx 945; X86-NOOPT-NEXT: addl %ecx, %edx 946; X86-NOOPT-NEXT: retl 947; 948; HSW-NOOPT-LABEL: test_mul_by_18: 949; HSW-NOOPT: # %bb.0: 950; HSW-NOOPT-NEXT: imulq $18, %rdi, %rax # sched: [3:1.00] 951; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 952; 953; JAG-NOOPT-LABEL: test_mul_by_18: 954; JAG-NOOPT: # %bb.0: 955; JAG-NOOPT-NEXT: imulq $18, %rdi, %rax # sched: [6:4.00] 956; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 957; 958; X64-SLM-LABEL: test_mul_by_18: 959; X64-SLM: # %bb.0: 960; X64-SLM-NEXT: addq %rdi, %rdi # sched: [1:0.50] 961; X64-SLM-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:1.00] 962; X64-SLM-NEXT: retq # sched: [4:1.00] 963; 964; SLM-NOOPT-LABEL: test_mul_by_18: 965; SLM-NOOPT: # %bb.0: 966; SLM-NOOPT-NEXT: imulq $18, %rdi, %rax # sched: [3:1.00] 967; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 968 %mul = mul nsw i64 %x, 18 969 ret i64 %mul 970} 971 972define i64 @test_mul_by_19(i64 %x) { 973; X86-LABEL: test_mul_by_19: 974; X86: # %bb.0: 975; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 976; X86-NEXT: leal (%eax,%eax,8), %ecx 977; X86-NEXT: leal (%eax,%ecx,2), %ecx 978; X86-NEXT: movl $19, %eax 979; X86-NEXT: mull {{[0-9]+}}(%esp) 980; X86-NEXT: addl %ecx, %edx 981; X86-NEXT: retl 982; 983; X64-HSW-LABEL: test_mul_by_19: 984; X64-HSW: # %bb.0: 985; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50] 986; X64-HSW-NEXT: leaq (%rdi,%rax,2), %rax # sched: [1:0.50] 987; X64-HSW-NEXT: retq # sched: [7:1.00] 988; 989; X64-JAG-LABEL: test_mul_by_19: 990; X64-JAG: # %bb.0: 991; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [2:1.00] 992; X64-JAG-NEXT: leaq (%rdi,%rax,2), %rax # sched: [2:1.00] 993; X64-JAG-NEXT: retq # sched: [4:1.00] 994; 995; X86-NOOPT-LABEL: test_mul_by_19: 996; X86-NOOPT: # %bb.0: 997; X86-NOOPT-NEXT: movl $19, %eax 998; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 999; X86-NOOPT-NEXT: imull $19, {{[0-9]+}}(%esp), %ecx 1000; X86-NOOPT-NEXT: addl %ecx, %edx 1001; X86-NOOPT-NEXT: retl 1002; 1003; HSW-NOOPT-LABEL: test_mul_by_19: 1004; HSW-NOOPT: # %bb.0: 1005; HSW-NOOPT-NEXT: imulq $19, %rdi, %rax # sched: [3:1.00] 1006; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1007; 1008; JAG-NOOPT-LABEL: test_mul_by_19: 1009; JAG-NOOPT: # %bb.0: 1010; JAG-NOOPT-NEXT: imulq $19, %rdi, %rax # sched: [6:4.00] 1011; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1012; 1013; X64-SLM-LABEL: test_mul_by_19: 1014; X64-SLM: # %bb.0: 1015; X64-SLM-NEXT: imulq $19, %rdi, %rax # sched: [3:1.00] 1016; X64-SLM-NEXT: retq # sched: [4:1.00] 1017; 1018; SLM-NOOPT-LABEL: test_mul_by_19: 1019; SLM-NOOPT: # %bb.0: 1020; SLM-NOOPT-NEXT: imulq $19, %rdi, %rax # sched: [3:1.00] 1021; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1022 %mul = mul nsw i64 %x, 19 1023 ret i64 %mul 1024} 1025 1026define i64 @test_mul_by_20(i64 %x) { 1027; X86-LABEL: test_mul_by_20: 1028; X86: # %bb.0: 1029; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1030; X86-NEXT: leal (%eax,%eax,4), %ecx 1031; X86-NEXT: movl $20, %eax 1032; X86-NEXT: mull {{[0-9]+}}(%esp) 1033; X86-NEXT: leal (%edx,%ecx,4), %edx 1034; X86-NEXT: retl 1035; 1036; X64-HSW-LABEL: test_mul_by_20: 1037; X64-HSW: # %bb.0: 1038; X64-HSW-NEXT: shlq $2, %rdi # sched: [1:0.50] 1039; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50] 1040; X64-HSW-NEXT: retq # sched: [7:1.00] 1041; 1042; X64-JAG-LABEL: test_mul_by_20: 1043; X64-JAG: # %bb.0: 1044; X64-JAG-NEXT: shlq $2, %rdi # sched: [1:0.50] 1045; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [2:1.00] 1046; X64-JAG-NEXT: retq # sched: [4:1.00] 1047; 1048; X86-NOOPT-LABEL: test_mul_by_20: 1049; X86-NOOPT: # %bb.0: 1050; X86-NOOPT-NEXT: movl $20, %eax 1051; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 1052; X86-NOOPT-NEXT: imull $20, {{[0-9]+}}(%esp), %ecx 1053; X86-NOOPT-NEXT: addl %ecx, %edx 1054; X86-NOOPT-NEXT: retl 1055; 1056; HSW-NOOPT-LABEL: test_mul_by_20: 1057; HSW-NOOPT: # %bb.0: 1058; HSW-NOOPT-NEXT: imulq $20, %rdi, %rax # sched: [3:1.00] 1059; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1060; 1061; JAG-NOOPT-LABEL: test_mul_by_20: 1062; JAG-NOOPT: # %bb.0: 1063; JAG-NOOPT-NEXT: imulq $20, %rdi, %rax # sched: [6:4.00] 1064; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1065; 1066; X64-SLM-LABEL: test_mul_by_20: 1067; X64-SLM: # %bb.0: 1068; X64-SLM-NEXT: shlq $2, %rdi # sched: [1:1.00] 1069; X64-SLM-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:1.00] 1070; X64-SLM-NEXT: retq # sched: [4:1.00] 1071; 1072; SLM-NOOPT-LABEL: test_mul_by_20: 1073; SLM-NOOPT: # %bb.0: 1074; SLM-NOOPT-NEXT: imulq $20, %rdi, %rax # sched: [3:1.00] 1075; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1076 %mul = mul nsw i64 %x, 20 1077 ret i64 %mul 1078} 1079 1080define i64 @test_mul_by_21(i64 %x) { 1081; X86-LABEL: test_mul_by_21: 1082; X86: # %bb.0: 1083; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1084; X86-NEXT: leal (%eax,%eax,4), %ecx 1085; X86-NEXT: leal (%eax,%ecx,4), %ecx 1086; X86-NEXT: movl $21, %eax 1087; X86-NEXT: mull {{[0-9]+}}(%esp) 1088; X86-NEXT: addl %ecx, %edx 1089; X86-NEXT: retl 1090; 1091; X64-HSW-LABEL: test_mul_by_21: 1092; X64-HSW: # %bb.0: 1093; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50] 1094; X64-HSW-NEXT: leaq (%rdi,%rax,4), %rax # sched: [1:0.50] 1095; X64-HSW-NEXT: retq # sched: [7:1.00] 1096; 1097; X64-JAG-LABEL: test_mul_by_21: 1098; X64-JAG: # %bb.0: 1099; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [2:1.00] 1100; X64-JAG-NEXT: leaq (%rdi,%rax,4), %rax # sched: [2:1.00] 1101; X64-JAG-NEXT: retq # sched: [4:1.00] 1102; 1103; X86-NOOPT-LABEL: test_mul_by_21: 1104; X86-NOOPT: # %bb.0: 1105; X86-NOOPT-NEXT: movl $21, %eax 1106; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 1107; X86-NOOPT-NEXT: imull $21, {{[0-9]+}}(%esp), %ecx 1108; X86-NOOPT-NEXT: addl %ecx, %edx 1109; X86-NOOPT-NEXT: retl 1110; 1111; HSW-NOOPT-LABEL: test_mul_by_21: 1112; HSW-NOOPT: # %bb.0: 1113; HSW-NOOPT-NEXT: imulq $21, %rdi, %rax # sched: [3:1.00] 1114; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1115; 1116; JAG-NOOPT-LABEL: test_mul_by_21: 1117; JAG-NOOPT: # %bb.0: 1118; JAG-NOOPT-NEXT: imulq $21, %rdi, %rax # sched: [6:4.00] 1119; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1120; 1121; X64-SLM-LABEL: test_mul_by_21: 1122; X64-SLM: # %bb.0: 1123; X64-SLM-NEXT: imulq $21, %rdi, %rax # sched: [3:1.00] 1124; X64-SLM-NEXT: retq # sched: [4:1.00] 1125; 1126; SLM-NOOPT-LABEL: test_mul_by_21: 1127; SLM-NOOPT: # %bb.0: 1128; SLM-NOOPT-NEXT: imulq $21, %rdi, %rax # sched: [3:1.00] 1129; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1130 %mul = mul nsw i64 %x, 21 1131 ret i64 %mul 1132} 1133 1134define i64 @test_mul_by_22(i64 %x) { 1135; X86-LABEL: test_mul_by_22: 1136; X86: # %bb.0: 1137; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1138; X86-NEXT: leal (%eax,%eax,4), %ecx 1139; X86-NEXT: leal (%eax,%ecx,4), %ecx 1140; X86-NEXT: addl %eax, %ecx 1141; X86-NEXT: movl $22, %eax 1142; X86-NEXT: mull {{[0-9]+}}(%esp) 1143; X86-NEXT: addl %ecx, %edx 1144; X86-NEXT: retl 1145; 1146; X64-HSW-LABEL: test_mul_by_22: 1147; X64-HSW: # %bb.0: 1148; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50] 1149; X64-HSW-NEXT: leaq (%rdi,%rax,4), %rax # sched: [1:0.50] 1150; X64-HSW-NEXT: addq %rdi, %rax # sched: [1:0.25] 1151; X64-HSW-NEXT: retq # sched: [7:1.00] 1152; 1153; X64-JAG-LABEL: test_mul_by_22: 1154; X64-JAG: # %bb.0: 1155; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [2:1.00] 1156; X64-JAG-NEXT: leaq (%rdi,%rax,4), %rax # sched: [2:1.00] 1157; X64-JAG-NEXT: addq %rdi, %rax # sched: [1:0.50] 1158; X64-JAG-NEXT: retq # sched: [4:1.00] 1159; 1160; X86-NOOPT-LABEL: test_mul_by_22: 1161; X86-NOOPT: # %bb.0: 1162; X86-NOOPT-NEXT: movl $22, %eax 1163; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 1164; X86-NOOPT-NEXT: imull $22, {{[0-9]+}}(%esp), %ecx 1165; X86-NOOPT-NEXT: addl %ecx, %edx 1166; X86-NOOPT-NEXT: retl 1167; 1168; HSW-NOOPT-LABEL: test_mul_by_22: 1169; HSW-NOOPT: # %bb.0: 1170; HSW-NOOPT-NEXT: imulq $22, %rdi, %rax # sched: [3:1.00] 1171; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1172; 1173; JAG-NOOPT-LABEL: test_mul_by_22: 1174; JAG-NOOPT: # %bb.0: 1175; JAG-NOOPT-NEXT: imulq $22, %rdi, %rax # sched: [6:4.00] 1176; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1177; 1178; X64-SLM-LABEL: test_mul_by_22: 1179; X64-SLM: # %bb.0: 1180; X64-SLM-NEXT: imulq $22, %rdi, %rax # sched: [3:1.00] 1181; X64-SLM-NEXT: retq # sched: [4:1.00] 1182; 1183; SLM-NOOPT-LABEL: test_mul_by_22: 1184; SLM-NOOPT: # %bb.0: 1185; SLM-NOOPT-NEXT: imulq $22, %rdi, %rax # sched: [3:1.00] 1186; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1187 %mul = mul nsw i64 %x, 22 1188 ret i64 %mul 1189} 1190 1191define i64 @test_mul_by_23(i64 %x) { 1192; X86-LABEL: test_mul_by_23: 1193; X86: # %bb.0: 1194; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1195; X86-NEXT: leal (%eax,%eax,2), %ecx 1196; X86-NEXT: shll $3, %ecx 1197; X86-NEXT: subl %eax, %ecx 1198; X86-NEXT: movl $23, %eax 1199; X86-NEXT: mull {{[0-9]+}}(%esp) 1200; X86-NEXT: addl %ecx, %edx 1201; X86-NEXT: retl 1202; 1203; X64-HSW-LABEL: test_mul_by_23: 1204; X64-HSW: # %bb.0: 1205; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50] 1206; X64-HSW-NEXT: shlq $3, %rax # sched: [1:0.50] 1207; X64-HSW-NEXT: subq %rdi, %rax # sched: [1:0.25] 1208; X64-HSW-NEXT: retq # sched: [7:1.00] 1209; 1210; X64-JAG-LABEL: test_mul_by_23: 1211; X64-JAG: # %bb.0: 1212; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [2:1.00] 1213; X64-JAG-NEXT: shlq $3, %rax # sched: [1:0.50] 1214; X64-JAG-NEXT: subq %rdi, %rax # sched: [1:0.50] 1215; X64-JAG-NEXT: retq # sched: [4:1.00] 1216; 1217; X86-NOOPT-LABEL: test_mul_by_23: 1218; X86-NOOPT: # %bb.0: 1219; X86-NOOPT-NEXT: movl $23, %eax 1220; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 1221; X86-NOOPT-NEXT: imull $23, {{[0-9]+}}(%esp), %ecx 1222; X86-NOOPT-NEXT: addl %ecx, %edx 1223; X86-NOOPT-NEXT: retl 1224; 1225; HSW-NOOPT-LABEL: test_mul_by_23: 1226; HSW-NOOPT: # %bb.0: 1227; HSW-NOOPT-NEXT: imulq $23, %rdi, %rax # sched: [3:1.00] 1228; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1229; 1230; JAG-NOOPT-LABEL: test_mul_by_23: 1231; JAG-NOOPT: # %bb.0: 1232; JAG-NOOPT-NEXT: imulq $23, %rdi, %rax # sched: [6:4.00] 1233; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1234; 1235; X64-SLM-LABEL: test_mul_by_23: 1236; X64-SLM: # %bb.0: 1237; X64-SLM-NEXT: imulq $23, %rdi, %rax # sched: [3:1.00] 1238; X64-SLM-NEXT: retq # sched: [4:1.00] 1239; 1240; SLM-NOOPT-LABEL: test_mul_by_23: 1241; SLM-NOOPT: # %bb.0: 1242; SLM-NOOPT-NEXT: imulq $23, %rdi, %rax # sched: [3:1.00] 1243; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1244 %mul = mul nsw i64 %x, 23 1245 ret i64 %mul 1246} 1247 1248define i64 @test_mul_by_24(i64 %x) { 1249; X86-LABEL: test_mul_by_24: 1250; X86: # %bb.0: 1251; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1252; X86-NEXT: leal (%eax,%eax,2), %ecx 1253; X86-NEXT: movl $24, %eax 1254; X86-NEXT: mull {{[0-9]+}}(%esp) 1255; X86-NEXT: leal (%edx,%ecx,8), %edx 1256; X86-NEXT: retl 1257; 1258; X64-HSW-LABEL: test_mul_by_24: 1259; X64-HSW: # %bb.0: 1260; X64-HSW-NEXT: shlq $3, %rdi # sched: [1:0.50] 1261; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50] 1262; X64-HSW-NEXT: retq # sched: [7:1.00] 1263; 1264; X64-JAG-LABEL: test_mul_by_24: 1265; X64-JAG: # %bb.0: 1266; X64-JAG-NEXT: shlq $3, %rdi # sched: [1:0.50] 1267; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [2:1.00] 1268; X64-JAG-NEXT: retq # sched: [4:1.00] 1269; 1270; X86-NOOPT-LABEL: test_mul_by_24: 1271; X86-NOOPT: # %bb.0: 1272; X86-NOOPT-NEXT: movl $24, %eax 1273; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 1274; X86-NOOPT-NEXT: imull $24, {{[0-9]+}}(%esp), %ecx 1275; X86-NOOPT-NEXT: addl %ecx, %edx 1276; X86-NOOPT-NEXT: retl 1277; 1278; HSW-NOOPT-LABEL: test_mul_by_24: 1279; HSW-NOOPT: # %bb.0: 1280; HSW-NOOPT-NEXT: imulq $24, %rdi, %rax # sched: [3:1.00] 1281; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1282; 1283; JAG-NOOPT-LABEL: test_mul_by_24: 1284; JAG-NOOPT: # %bb.0: 1285; JAG-NOOPT-NEXT: imulq $24, %rdi, %rax # sched: [6:4.00] 1286; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1287; 1288; X64-SLM-LABEL: test_mul_by_24: 1289; X64-SLM: # %bb.0: 1290; X64-SLM-NEXT: shlq $3, %rdi # sched: [1:1.00] 1291; X64-SLM-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:1.00] 1292; X64-SLM-NEXT: retq # sched: [4:1.00] 1293; 1294; SLM-NOOPT-LABEL: test_mul_by_24: 1295; SLM-NOOPT: # %bb.0: 1296; SLM-NOOPT-NEXT: imulq $24, %rdi, %rax # sched: [3:1.00] 1297; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1298 %mul = mul nsw i64 %x, 24 1299 ret i64 %mul 1300} 1301 1302define i64 @test_mul_by_25(i64 %x) { 1303; X86-LABEL: test_mul_by_25: 1304; X86: # %bb.0: 1305; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 1306; X86-NEXT: movl $25, %eax 1307; X86-NEXT: mull {{[0-9]+}}(%esp) 1308; X86-NEXT: leal (%ecx,%ecx,4), %ecx 1309; X86-NEXT: leal (%ecx,%ecx,4), %ecx 1310; X86-NEXT: addl %ecx, %edx 1311; X86-NEXT: retl 1312; 1313; X64-HSW-LABEL: test_mul_by_25: 1314; X64-HSW: # %bb.0: 1315; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50] 1316; X64-HSW-NEXT: leaq (%rax,%rax,4), %rax # sched: [1:0.50] 1317; X64-HSW-NEXT: retq # sched: [7:1.00] 1318; 1319; X64-JAG-LABEL: test_mul_by_25: 1320; X64-JAG: # %bb.0: 1321; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [2:1.00] 1322; X64-JAG-NEXT: leaq (%rax,%rax,4), %rax # sched: [2:1.00] 1323; X64-JAG-NEXT: retq # sched: [4:1.00] 1324; 1325; X86-NOOPT-LABEL: test_mul_by_25: 1326; X86-NOOPT: # %bb.0: 1327; X86-NOOPT-NEXT: movl $25, %eax 1328; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 1329; X86-NOOPT-NEXT: imull $25, {{[0-9]+}}(%esp), %ecx 1330; X86-NOOPT-NEXT: addl %ecx, %edx 1331; X86-NOOPT-NEXT: retl 1332; 1333; HSW-NOOPT-LABEL: test_mul_by_25: 1334; HSW-NOOPT: # %bb.0: 1335; HSW-NOOPT-NEXT: imulq $25, %rdi, %rax # sched: [3:1.00] 1336; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1337; 1338; JAG-NOOPT-LABEL: test_mul_by_25: 1339; JAG-NOOPT: # %bb.0: 1340; JAG-NOOPT-NEXT: imulq $25, %rdi, %rax # sched: [6:4.00] 1341; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1342; 1343; X64-SLM-LABEL: test_mul_by_25: 1344; X64-SLM: # %bb.0: 1345; X64-SLM-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:1.00] 1346; X64-SLM-NEXT: leaq (%rax,%rax,4), %rax # sched: [1:1.00] 1347; X64-SLM-NEXT: retq # sched: [4:1.00] 1348; 1349; SLM-NOOPT-LABEL: test_mul_by_25: 1350; SLM-NOOPT: # %bb.0: 1351; SLM-NOOPT-NEXT: imulq $25, %rdi, %rax # sched: [3:1.00] 1352; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1353 %mul = mul nsw i64 %x, 25 1354 ret i64 %mul 1355} 1356 1357define i64 @test_mul_by_26(i64 %x) { 1358; X86-LABEL: test_mul_by_26: 1359; X86: # %bb.0: 1360; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1361; X86-NEXT: leal (%eax,%eax,4), %ecx 1362; X86-NEXT: leal (%ecx,%ecx,4), %ecx 1363; X86-NEXT: addl %eax, %ecx 1364; X86-NEXT: movl $26, %eax 1365; X86-NEXT: mull {{[0-9]+}}(%esp) 1366; X86-NEXT: addl %ecx, %edx 1367; X86-NEXT: retl 1368; 1369; X64-HSW-LABEL: test_mul_by_26: 1370; X64-HSW: # %bb.0: 1371; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50] 1372; X64-HSW-NEXT: leaq (%rax,%rax,4), %rax # sched: [1:0.50] 1373; X64-HSW-NEXT: addq %rdi, %rax # sched: [1:0.25] 1374; X64-HSW-NEXT: retq # sched: [7:1.00] 1375; 1376; X64-JAG-LABEL: test_mul_by_26: 1377; X64-JAG: # %bb.0: 1378; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [2:1.00] 1379; X64-JAG-NEXT: leaq (%rax,%rax,4), %rax # sched: [2:1.00] 1380; X64-JAG-NEXT: addq %rdi, %rax # sched: [1:0.50] 1381; X64-JAG-NEXT: retq # sched: [4:1.00] 1382; 1383; X86-NOOPT-LABEL: test_mul_by_26: 1384; X86-NOOPT: # %bb.0: 1385; X86-NOOPT-NEXT: movl $26, %eax 1386; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 1387; X86-NOOPT-NEXT: imull $26, {{[0-9]+}}(%esp), %ecx 1388; X86-NOOPT-NEXT: addl %ecx, %edx 1389; X86-NOOPT-NEXT: retl 1390; 1391; HSW-NOOPT-LABEL: test_mul_by_26: 1392; HSW-NOOPT: # %bb.0: 1393; HSW-NOOPT-NEXT: imulq $26, %rdi, %rax # sched: [3:1.00] 1394; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1395; 1396; JAG-NOOPT-LABEL: test_mul_by_26: 1397; JAG-NOOPT: # %bb.0: 1398; JAG-NOOPT-NEXT: imulq $26, %rdi, %rax # sched: [6:4.00] 1399; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1400; 1401; X64-SLM-LABEL: test_mul_by_26: 1402; X64-SLM: # %bb.0: 1403; X64-SLM-NEXT: imulq $26, %rdi, %rax # sched: [3:1.00] 1404; X64-SLM-NEXT: retq # sched: [4:1.00] 1405; 1406; SLM-NOOPT-LABEL: test_mul_by_26: 1407; SLM-NOOPT: # %bb.0: 1408; SLM-NOOPT-NEXT: imulq $26, %rdi, %rax # sched: [3:1.00] 1409; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1410 %mul = mul nsw i64 %x, 26 1411 ret i64 %mul 1412} 1413 1414define i64 @test_mul_by_27(i64 %x) { 1415; X86-LABEL: test_mul_by_27: 1416; X86: # %bb.0: 1417; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 1418; X86-NEXT: movl $27, %eax 1419; X86-NEXT: mull {{[0-9]+}}(%esp) 1420; X86-NEXT: leal (%ecx,%ecx,8), %ecx 1421; X86-NEXT: leal (%ecx,%ecx,2), %ecx 1422; X86-NEXT: addl %ecx, %edx 1423; X86-NEXT: retl 1424; 1425; X64-HSW-LABEL: test_mul_by_27: 1426; X64-HSW: # %bb.0: 1427; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50] 1428; X64-HSW-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:0.50] 1429; X64-HSW-NEXT: retq # sched: [7:1.00] 1430; 1431; X64-JAG-LABEL: test_mul_by_27: 1432; X64-JAG: # %bb.0: 1433; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [2:1.00] 1434; X64-JAG-NEXT: leaq (%rax,%rax,2), %rax # sched: [2:1.00] 1435; X64-JAG-NEXT: retq # sched: [4:1.00] 1436; 1437; X86-NOOPT-LABEL: test_mul_by_27: 1438; X86-NOOPT: # %bb.0: 1439; X86-NOOPT-NEXT: movl $27, %eax 1440; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 1441; X86-NOOPT-NEXT: imull $27, {{[0-9]+}}(%esp), %ecx 1442; X86-NOOPT-NEXT: addl %ecx, %edx 1443; X86-NOOPT-NEXT: retl 1444; 1445; HSW-NOOPT-LABEL: test_mul_by_27: 1446; HSW-NOOPT: # %bb.0: 1447; HSW-NOOPT-NEXT: imulq $27, %rdi, %rax # sched: [3:1.00] 1448; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1449; 1450; JAG-NOOPT-LABEL: test_mul_by_27: 1451; JAG-NOOPT: # %bb.0: 1452; JAG-NOOPT-NEXT: imulq $27, %rdi, %rax # sched: [6:4.00] 1453; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1454; 1455; X64-SLM-LABEL: test_mul_by_27: 1456; X64-SLM: # %bb.0: 1457; X64-SLM-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:1.00] 1458; X64-SLM-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:1.00] 1459; X64-SLM-NEXT: retq # sched: [4:1.00] 1460; 1461; SLM-NOOPT-LABEL: test_mul_by_27: 1462; SLM-NOOPT: # %bb.0: 1463; SLM-NOOPT-NEXT: imulq $27, %rdi, %rax # sched: [3:1.00] 1464; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1465 %mul = mul nsw i64 %x, 27 1466 ret i64 %mul 1467} 1468 1469define i64 @test_mul_by_28(i64 %x) { 1470; X86-LABEL: test_mul_by_28: 1471; X86: # %bb.0: 1472; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1473; X86-NEXT: leal (%eax,%eax,8), %ecx 1474; X86-NEXT: leal (%ecx,%ecx,2), %ecx 1475; X86-NEXT: addl %eax, %ecx 1476; X86-NEXT: movl $28, %eax 1477; X86-NEXT: mull {{[0-9]+}}(%esp) 1478; X86-NEXT: addl %ecx, %edx 1479; X86-NEXT: retl 1480; 1481; X64-HSW-LABEL: test_mul_by_28: 1482; X64-HSW: # %bb.0: 1483; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50] 1484; X64-HSW-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:0.50] 1485; X64-HSW-NEXT: addq %rdi, %rax # sched: [1:0.25] 1486; X64-HSW-NEXT: retq # sched: [7:1.00] 1487; 1488; X64-JAG-LABEL: test_mul_by_28: 1489; X64-JAG: # %bb.0: 1490; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [2:1.00] 1491; X64-JAG-NEXT: leaq (%rax,%rax,2), %rax # sched: [2:1.00] 1492; X64-JAG-NEXT: addq %rdi, %rax # sched: [1:0.50] 1493; X64-JAG-NEXT: retq # sched: [4:1.00] 1494; 1495; X86-NOOPT-LABEL: test_mul_by_28: 1496; X86-NOOPT: # %bb.0: 1497; X86-NOOPT-NEXT: movl $28, %eax 1498; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 1499; X86-NOOPT-NEXT: imull $28, {{[0-9]+}}(%esp), %ecx 1500; X86-NOOPT-NEXT: addl %ecx, %edx 1501; X86-NOOPT-NEXT: retl 1502; 1503; HSW-NOOPT-LABEL: test_mul_by_28: 1504; HSW-NOOPT: # %bb.0: 1505; HSW-NOOPT-NEXT: imulq $28, %rdi, %rax # sched: [3:1.00] 1506; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1507; 1508; JAG-NOOPT-LABEL: test_mul_by_28: 1509; JAG-NOOPT: # %bb.0: 1510; JAG-NOOPT-NEXT: imulq $28, %rdi, %rax # sched: [6:4.00] 1511; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1512; 1513; X64-SLM-LABEL: test_mul_by_28: 1514; X64-SLM: # %bb.0: 1515; X64-SLM-NEXT: imulq $28, %rdi, %rax # sched: [3:1.00] 1516; X64-SLM-NEXT: retq # sched: [4:1.00] 1517; 1518; SLM-NOOPT-LABEL: test_mul_by_28: 1519; SLM-NOOPT: # %bb.0: 1520; SLM-NOOPT-NEXT: imulq $28, %rdi, %rax # sched: [3:1.00] 1521; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1522 %mul = mul nsw i64 %x, 28 1523 ret i64 %mul 1524} 1525 1526define i64 @test_mul_by_29(i64 %x) { 1527; X86-LABEL: test_mul_by_29: 1528; X86: # %bb.0: 1529; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1530; X86-NEXT: leal (%eax,%eax,8), %ecx 1531; X86-NEXT: leal (%ecx,%ecx,2), %ecx 1532; X86-NEXT: addl %eax, %ecx 1533; X86-NEXT: addl %eax, %ecx 1534; X86-NEXT: movl $29, %eax 1535; X86-NEXT: mull {{[0-9]+}}(%esp) 1536; X86-NEXT: addl %ecx, %edx 1537; X86-NEXT: retl 1538; 1539; X64-HSW-LABEL: test_mul_by_29: 1540; X64-HSW: # %bb.0: 1541; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50] 1542; X64-HSW-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:0.50] 1543; X64-HSW-NEXT: addq %rdi, %rax # sched: [1:0.25] 1544; X64-HSW-NEXT: addq %rdi, %rax # sched: [1:0.25] 1545; X64-HSW-NEXT: retq # sched: [7:1.00] 1546; 1547; X64-JAG-LABEL: test_mul_by_29: 1548; X64-JAG: # %bb.0: 1549; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [2:1.00] 1550; X64-JAG-NEXT: leaq (%rax,%rax,2), %rax # sched: [2:1.00] 1551; X64-JAG-NEXT: addq %rdi, %rax # sched: [1:0.50] 1552; X64-JAG-NEXT: addq %rdi, %rax # sched: [1:0.50] 1553; X64-JAG-NEXT: retq # sched: [4:1.00] 1554; 1555; X86-NOOPT-LABEL: test_mul_by_29: 1556; X86-NOOPT: # %bb.0: 1557; X86-NOOPT-NEXT: movl $29, %eax 1558; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 1559; X86-NOOPT-NEXT: imull $29, {{[0-9]+}}(%esp), %ecx 1560; X86-NOOPT-NEXT: addl %ecx, %edx 1561; X86-NOOPT-NEXT: retl 1562; 1563; HSW-NOOPT-LABEL: test_mul_by_29: 1564; HSW-NOOPT: # %bb.0: 1565; HSW-NOOPT-NEXT: imulq $29, %rdi, %rax # sched: [3:1.00] 1566; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1567; 1568; JAG-NOOPT-LABEL: test_mul_by_29: 1569; JAG-NOOPT: # %bb.0: 1570; JAG-NOOPT-NEXT: imulq $29, %rdi, %rax # sched: [6:4.00] 1571; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1572; 1573; X64-SLM-LABEL: test_mul_by_29: 1574; X64-SLM: # %bb.0: 1575; X64-SLM-NEXT: imulq $29, %rdi, %rax # sched: [3:1.00] 1576; X64-SLM-NEXT: retq # sched: [4:1.00] 1577; 1578; SLM-NOOPT-LABEL: test_mul_by_29: 1579; SLM-NOOPT: # %bb.0: 1580; SLM-NOOPT-NEXT: imulq $29, %rdi, %rax # sched: [3:1.00] 1581; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1582 %mul = mul nsw i64 %x, 29 1583 ret i64 %mul 1584} 1585 1586define i64 @test_mul_by_30(i64 %x) { 1587; X86-LABEL: test_mul_by_30: 1588; X86: # %bb.0: 1589; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1590; X86-NEXT: movl %eax, %ecx 1591; X86-NEXT: shll $5, %ecx 1592; X86-NEXT: subl %eax, %ecx 1593; X86-NEXT: subl %eax, %ecx 1594; X86-NEXT: movl $30, %eax 1595; X86-NEXT: mull {{[0-9]+}}(%esp) 1596; X86-NEXT: addl %ecx, %edx 1597; X86-NEXT: retl 1598; 1599; X64-HSW-LABEL: test_mul_by_30: 1600; X64-HSW: # %bb.0: 1601; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25] 1602; X64-HSW-NEXT: shlq $5, %rax # sched: [1:0.50] 1603; X64-HSW-NEXT: subq %rdi, %rax # sched: [1:0.25] 1604; X64-HSW-NEXT: subq %rdi, %rax # sched: [1:0.25] 1605; X64-HSW-NEXT: retq # sched: [7:1.00] 1606; 1607; X64-JAG-LABEL: test_mul_by_30: 1608; X64-JAG: # %bb.0: 1609; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.50] 1610; X64-JAG-NEXT: shlq $5, %rax # sched: [1:0.50] 1611; X64-JAG-NEXT: subq %rdi, %rax # sched: [1:0.50] 1612; X64-JAG-NEXT: subq %rdi, %rax # sched: [1:0.50] 1613; X64-JAG-NEXT: retq # sched: [4:1.00] 1614; 1615; X86-NOOPT-LABEL: test_mul_by_30: 1616; X86-NOOPT: # %bb.0: 1617; X86-NOOPT-NEXT: movl $30, %eax 1618; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 1619; X86-NOOPT-NEXT: imull $30, {{[0-9]+}}(%esp), %ecx 1620; X86-NOOPT-NEXT: addl %ecx, %edx 1621; X86-NOOPT-NEXT: retl 1622; 1623; HSW-NOOPT-LABEL: test_mul_by_30: 1624; HSW-NOOPT: # %bb.0: 1625; HSW-NOOPT-NEXT: imulq $30, %rdi, %rax # sched: [3:1.00] 1626; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1627; 1628; JAG-NOOPT-LABEL: test_mul_by_30: 1629; JAG-NOOPT: # %bb.0: 1630; JAG-NOOPT-NEXT: imulq $30, %rdi, %rax # sched: [6:4.00] 1631; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1632; 1633; X64-SLM-LABEL: test_mul_by_30: 1634; X64-SLM: # %bb.0: 1635; X64-SLM-NEXT: movq %rdi, %rax # sched: [1:0.50] 1636; X64-SLM-NEXT: shlq $5, %rax # sched: [1:1.00] 1637; X64-SLM-NEXT: subq %rdi, %rax # sched: [1:0.50] 1638; X64-SLM-NEXT: subq %rdi, %rax # sched: [1:0.50] 1639; X64-SLM-NEXT: retq # sched: [4:1.00] 1640; 1641; SLM-NOOPT-LABEL: test_mul_by_30: 1642; SLM-NOOPT: # %bb.0: 1643; SLM-NOOPT-NEXT: imulq $30, %rdi, %rax # sched: [3:1.00] 1644; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1645 %mul = mul nsw i64 %x, 30 1646 ret i64 %mul 1647} 1648 1649define i64 @test_mul_by_31(i64 %x) { 1650; X86-LABEL: test_mul_by_31: 1651; X86: # %bb.0: 1652; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1653; X86-NEXT: movl %eax, %ecx 1654; X86-NEXT: shll $5, %ecx 1655; X86-NEXT: subl %eax, %ecx 1656; X86-NEXT: movl $31, %eax 1657; X86-NEXT: mull {{[0-9]+}}(%esp) 1658; X86-NEXT: addl %ecx, %edx 1659; X86-NEXT: retl 1660; 1661; X64-HSW-LABEL: test_mul_by_31: 1662; X64-HSW: # %bb.0: 1663; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25] 1664; X64-HSW-NEXT: shlq $5, %rax # sched: [1:0.50] 1665; X64-HSW-NEXT: subq %rdi, %rax # sched: [1:0.25] 1666; X64-HSW-NEXT: retq # sched: [7:1.00] 1667; 1668; X64-JAG-LABEL: test_mul_by_31: 1669; X64-JAG: # %bb.0: 1670; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.50] 1671; X64-JAG-NEXT: shlq $5, %rax # sched: [1:0.50] 1672; X64-JAG-NEXT: subq %rdi, %rax # sched: [1:0.50] 1673; X64-JAG-NEXT: retq # sched: [4:1.00] 1674; 1675; X86-NOOPT-LABEL: test_mul_by_31: 1676; X86-NOOPT: # %bb.0: 1677; X86-NOOPT-NEXT: movl $31, %eax 1678; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 1679; X86-NOOPT-NEXT: imull $31, {{[0-9]+}}(%esp), %ecx 1680; X86-NOOPT-NEXT: addl %ecx, %edx 1681; X86-NOOPT-NEXT: retl 1682; 1683; HSW-NOOPT-LABEL: test_mul_by_31: 1684; HSW-NOOPT: # %bb.0: 1685; HSW-NOOPT-NEXT: imulq $31, %rdi, %rax # sched: [3:1.00] 1686; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1687; 1688; JAG-NOOPT-LABEL: test_mul_by_31: 1689; JAG-NOOPT: # %bb.0: 1690; JAG-NOOPT-NEXT: imulq $31, %rdi, %rax # sched: [6:4.00] 1691; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1692; 1693; X64-SLM-LABEL: test_mul_by_31: 1694; X64-SLM: # %bb.0: 1695; X64-SLM-NEXT: movq %rdi, %rax # sched: [1:0.50] 1696; X64-SLM-NEXT: shlq $5, %rax # sched: [1:1.00] 1697; X64-SLM-NEXT: subq %rdi, %rax # sched: [1:0.50] 1698; X64-SLM-NEXT: retq # sched: [4:1.00] 1699; 1700; SLM-NOOPT-LABEL: test_mul_by_31: 1701; SLM-NOOPT: # %bb.0: 1702; SLM-NOOPT-NEXT: imulq $31, %rdi, %rax # sched: [3:1.00] 1703; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1704 %mul = mul nsw i64 %x, 31 1705 ret i64 %mul 1706} 1707 1708define i64 @test_mul_by_32(i64 %x) { 1709; X86-LABEL: test_mul_by_32: 1710; X86: # %bb.0: 1711; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1712; X86-NEXT: movl {{[0-9]+}}(%esp), %edx 1713; X86-NEXT: shldl $5, %eax, %edx 1714; X86-NEXT: shll $5, %eax 1715; X86-NEXT: retl 1716; 1717; X64-HSW-LABEL: test_mul_by_32: 1718; X64-HSW: # %bb.0: 1719; X64-HSW-NEXT: shlq $5, %rdi # sched: [1:0.50] 1720; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25] 1721; X64-HSW-NEXT: retq # sched: [7:1.00] 1722; 1723; X64-JAG-LABEL: test_mul_by_32: 1724; X64-JAG: # %bb.0: 1725; X64-JAG-NEXT: shlq $5, %rdi # sched: [1:0.50] 1726; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.50] 1727; X64-JAG-NEXT: retq # sched: [4:1.00] 1728; 1729; X86-NOOPT-LABEL: test_mul_by_32: 1730; X86-NOOPT: # %bb.0: 1731; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax 1732; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx 1733; X86-NOOPT-NEXT: shldl $5, %eax, %edx 1734; X86-NOOPT-NEXT: shll $5, %eax 1735; X86-NOOPT-NEXT: retl 1736; 1737; HSW-NOOPT-LABEL: test_mul_by_32: 1738; HSW-NOOPT: # %bb.0: 1739; HSW-NOOPT-NEXT: shlq $5, %rdi # sched: [1:0.50] 1740; HSW-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.25] 1741; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1742; 1743; JAG-NOOPT-LABEL: test_mul_by_32: 1744; JAG-NOOPT: # %bb.0: 1745; JAG-NOOPT-NEXT: shlq $5, %rdi # sched: [1:0.50] 1746; JAG-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.50] 1747; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1748; 1749; X64-SLM-LABEL: test_mul_by_32: 1750; X64-SLM: # %bb.0: 1751; X64-SLM-NEXT: shlq $5, %rdi # sched: [1:1.00] 1752; X64-SLM-NEXT: movq %rdi, %rax # sched: [1:0.50] 1753; X64-SLM-NEXT: retq # sched: [4:1.00] 1754; 1755; SLM-NOOPT-LABEL: test_mul_by_32: 1756; SLM-NOOPT: # %bb.0: 1757; SLM-NOOPT-NEXT: shlq $5, %rdi # sched: [1:1.00] 1758; SLM-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.50] 1759; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1760 %mul = mul nsw i64 %x, 32 1761 ret i64 %mul 1762} 1763 1764define i64 @test_mul_by_37(i64 %x) { 1765; X86-LABEL: test_mul_by_37: 1766; X86: # %bb.0: 1767; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1768; X86-NEXT: leal (%eax,%eax,8), %ecx 1769; X86-NEXT: leal (%eax,%ecx,4), %ecx 1770; X86-NEXT: movl $37, %eax 1771; X86-NEXT: mull {{[0-9]+}}(%esp) 1772; X86-NEXT: addl %ecx, %edx 1773; X86-NEXT: retl 1774; 1775; X64-HSW-LABEL: test_mul_by_37: 1776; X64-HSW: # %bb.0: 1777; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50] 1778; X64-HSW-NEXT: leaq (%rdi,%rax,4), %rax # sched: [1:0.50] 1779; X64-HSW-NEXT: retq # sched: [7:1.00] 1780; 1781; X64-JAG-LABEL: test_mul_by_37: 1782; X64-JAG: # %bb.0: 1783; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [2:1.00] 1784; X64-JAG-NEXT: leaq (%rdi,%rax,4), %rax # sched: [2:1.00] 1785; X64-JAG-NEXT: retq # sched: [4:1.00] 1786; 1787; X86-NOOPT-LABEL: test_mul_by_37: 1788; X86-NOOPT: # %bb.0: 1789; X86-NOOPT-NEXT: movl $37, %eax 1790; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 1791; X86-NOOPT-NEXT: imull $37, {{[0-9]+}}(%esp), %ecx 1792; X86-NOOPT-NEXT: addl %ecx, %edx 1793; X86-NOOPT-NEXT: retl 1794; 1795; HSW-NOOPT-LABEL: test_mul_by_37: 1796; HSW-NOOPT: # %bb.0: 1797; HSW-NOOPT-NEXT: imulq $37, %rdi, %rax # sched: [3:1.00] 1798; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1799; 1800; JAG-NOOPT-LABEL: test_mul_by_37: 1801; JAG-NOOPT: # %bb.0: 1802; JAG-NOOPT-NEXT: imulq $37, %rdi, %rax # sched: [6:4.00] 1803; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1804; 1805; X64-SLM-LABEL: test_mul_by_37: 1806; X64-SLM: # %bb.0: 1807; X64-SLM-NEXT: imulq $37, %rdi, %rax # sched: [3:1.00] 1808; X64-SLM-NEXT: retq # sched: [4:1.00] 1809; 1810; SLM-NOOPT-LABEL: test_mul_by_37: 1811; SLM-NOOPT: # %bb.0: 1812; SLM-NOOPT-NEXT: imulq $37, %rdi, %rax # sched: [3:1.00] 1813; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1814 %mul = mul nsw i64 %x, 37 1815 ret i64 %mul 1816} 1817 1818define i64 @test_mul_by_41(i64 %x) { 1819; X86-LABEL: test_mul_by_41: 1820; X86: # %bb.0: 1821; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1822; X86-NEXT: leal (%eax,%eax,4), %ecx 1823; X86-NEXT: leal (%eax,%ecx,8), %ecx 1824; X86-NEXT: movl $41, %eax 1825; X86-NEXT: mull {{[0-9]+}}(%esp) 1826; X86-NEXT: addl %ecx, %edx 1827; X86-NEXT: retl 1828; 1829; X64-HSW-LABEL: test_mul_by_41: 1830; X64-HSW: # %bb.0: 1831; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50] 1832; X64-HSW-NEXT: leaq (%rdi,%rax,8), %rax # sched: [1:0.50] 1833; X64-HSW-NEXT: retq # sched: [7:1.00] 1834; 1835; X64-JAG-LABEL: test_mul_by_41: 1836; X64-JAG: # %bb.0: 1837; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [2:1.00] 1838; X64-JAG-NEXT: leaq (%rdi,%rax,8), %rax # sched: [2:1.00] 1839; X64-JAG-NEXT: retq # sched: [4:1.00] 1840; 1841; X86-NOOPT-LABEL: test_mul_by_41: 1842; X86-NOOPT: # %bb.0: 1843; X86-NOOPT-NEXT: movl $41, %eax 1844; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 1845; X86-NOOPT-NEXT: imull $41, {{[0-9]+}}(%esp), %ecx 1846; X86-NOOPT-NEXT: addl %ecx, %edx 1847; X86-NOOPT-NEXT: retl 1848; 1849; HSW-NOOPT-LABEL: test_mul_by_41: 1850; HSW-NOOPT: # %bb.0: 1851; HSW-NOOPT-NEXT: imulq $41, %rdi, %rax # sched: [3:1.00] 1852; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1853; 1854; JAG-NOOPT-LABEL: test_mul_by_41: 1855; JAG-NOOPT: # %bb.0: 1856; JAG-NOOPT-NEXT: imulq $41, %rdi, %rax # sched: [6:4.00] 1857; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1858; 1859; X64-SLM-LABEL: test_mul_by_41: 1860; X64-SLM: # %bb.0: 1861; X64-SLM-NEXT: imulq $41, %rdi, %rax # sched: [3:1.00] 1862; X64-SLM-NEXT: retq # sched: [4:1.00] 1863; 1864; SLM-NOOPT-LABEL: test_mul_by_41: 1865; SLM-NOOPT: # %bb.0: 1866; SLM-NOOPT-NEXT: imulq $41, %rdi, %rax # sched: [3:1.00] 1867; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1868 %mul = mul nsw i64 %x, 41 1869 ret i64 %mul 1870} 1871 1872define i64 @test_mul_by_62(i64 %x) { 1873; X86-LABEL: test_mul_by_62: 1874; X86: # %bb.0: 1875; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1876; X86-NEXT: movl %eax, %ecx 1877; X86-NEXT: shll $6, %ecx 1878; X86-NEXT: subl %eax, %ecx 1879; X86-NEXT: subl %eax, %ecx 1880; X86-NEXT: movl $62, %eax 1881; X86-NEXT: mull {{[0-9]+}}(%esp) 1882; X86-NEXT: addl %ecx, %edx 1883; X86-NEXT: retl 1884; 1885; X64-HSW-LABEL: test_mul_by_62: 1886; X64-HSW: # %bb.0: 1887; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25] 1888; X64-HSW-NEXT: shlq $6, %rax # sched: [1:0.50] 1889; X64-HSW-NEXT: subq %rdi, %rax # sched: [1:0.25] 1890; X64-HSW-NEXT: subq %rdi, %rax # sched: [1:0.25] 1891; X64-HSW-NEXT: retq # sched: [7:1.00] 1892; 1893; X64-JAG-LABEL: test_mul_by_62: 1894; X64-JAG: # %bb.0: 1895; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.50] 1896; X64-JAG-NEXT: shlq $6, %rax # sched: [1:0.50] 1897; X64-JAG-NEXT: subq %rdi, %rax # sched: [1:0.50] 1898; X64-JAG-NEXT: subq %rdi, %rax # sched: [1:0.50] 1899; X64-JAG-NEXT: retq # sched: [4:1.00] 1900; 1901; X86-NOOPT-LABEL: test_mul_by_62: 1902; X86-NOOPT: # %bb.0: 1903; X86-NOOPT-NEXT: movl $62, %eax 1904; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 1905; X86-NOOPT-NEXT: imull $62, {{[0-9]+}}(%esp), %ecx 1906; X86-NOOPT-NEXT: addl %ecx, %edx 1907; X86-NOOPT-NEXT: retl 1908; 1909; HSW-NOOPT-LABEL: test_mul_by_62: 1910; HSW-NOOPT: # %bb.0: 1911; HSW-NOOPT-NEXT: imulq $62, %rdi, %rax # sched: [3:1.00] 1912; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1913; 1914; JAG-NOOPT-LABEL: test_mul_by_62: 1915; JAG-NOOPT: # %bb.0: 1916; JAG-NOOPT-NEXT: imulq $62, %rdi, %rax # sched: [6:4.00] 1917; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1918; 1919; X64-SLM-LABEL: test_mul_by_62: 1920; X64-SLM: # %bb.0: 1921; X64-SLM-NEXT: movq %rdi, %rax # sched: [1:0.50] 1922; X64-SLM-NEXT: shlq $6, %rax # sched: [1:1.00] 1923; X64-SLM-NEXT: subq %rdi, %rax # sched: [1:0.50] 1924; X64-SLM-NEXT: subq %rdi, %rax # sched: [1:0.50] 1925; X64-SLM-NEXT: retq # sched: [4:1.00] 1926; 1927; SLM-NOOPT-LABEL: test_mul_by_62: 1928; SLM-NOOPT: # %bb.0: 1929; SLM-NOOPT-NEXT: imulq $62, %rdi, %rax # sched: [3:1.00] 1930; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1931 %mul = mul nsw i64 %x, 62 1932 ret i64 %mul 1933} 1934 1935define i64 @test_mul_by_66(i64 %x) { 1936; X86-LABEL: test_mul_by_66: 1937; X86: # %bb.0: 1938; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1939; X86-NEXT: movl %eax, %ecx 1940; X86-NEXT: shll $6, %ecx 1941; X86-NEXT: leal (%ecx,%eax,2), %ecx 1942; X86-NEXT: movl $66, %eax 1943; X86-NEXT: mull {{[0-9]+}}(%esp) 1944; X86-NEXT: addl %ecx, %edx 1945; X86-NEXT: retl 1946; 1947; X64-HSW-LABEL: test_mul_by_66: 1948; X64-HSW: # %bb.0: 1949; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25] 1950; X64-HSW-NEXT: shlq $6, %rax # sched: [1:0.50] 1951; X64-HSW-NEXT: leaq (%rax,%rdi,2), %rax # sched: [1:0.50] 1952; X64-HSW-NEXT: retq # sched: [7:1.00] 1953; 1954; X64-JAG-LABEL: test_mul_by_66: 1955; X64-JAG: # %bb.0: 1956; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.50] 1957; X64-JAG-NEXT: shlq $6, %rax # sched: [1:0.50] 1958; X64-JAG-NEXT: leaq (%rax,%rdi,2), %rax # sched: [2:1.00] 1959; X64-JAG-NEXT: retq # sched: [4:1.00] 1960; 1961; X86-NOOPT-LABEL: test_mul_by_66: 1962; X86-NOOPT: # %bb.0: 1963; X86-NOOPT-NEXT: movl $66, %eax 1964; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 1965; X86-NOOPT-NEXT: imull $66, {{[0-9]+}}(%esp), %ecx 1966; X86-NOOPT-NEXT: addl %ecx, %edx 1967; X86-NOOPT-NEXT: retl 1968; 1969; HSW-NOOPT-LABEL: test_mul_by_66: 1970; HSW-NOOPT: # %bb.0: 1971; HSW-NOOPT-NEXT: imulq $66, %rdi, %rax # sched: [3:1.00] 1972; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1973; 1974; JAG-NOOPT-LABEL: test_mul_by_66: 1975; JAG-NOOPT: # %bb.0: 1976; JAG-NOOPT-NEXT: imulq $66, %rdi, %rax # sched: [6:4.00] 1977; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1978; 1979; X64-SLM-LABEL: test_mul_by_66: 1980; X64-SLM: # %bb.0: 1981; X64-SLM-NEXT: movq %rdi, %rax # sched: [1:0.50] 1982; X64-SLM-NEXT: shlq $6, %rax # sched: [1:1.00] 1983; X64-SLM-NEXT: addq %rdi, %rax # sched: [1:0.50] 1984; X64-SLM-NEXT: addq %rdi, %rax # sched: [1:0.50] 1985; X64-SLM-NEXT: retq # sched: [4:1.00] 1986; 1987; SLM-NOOPT-LABEL: test_mul_by_66: 1988; SLM-NOOPT: # %bb.0: 1989; SLM-NOOPT-NEXT: imulq $66, %rdi, %rax # sched: [3:1.00] 1990; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1991 %mul = mul nsw i64 %x, 66 1992 ret i64 %mul 1993} 1994 1995define i64 @test_mul_by_73(i64 %x) { 1996; X86-LABEL: test_mul_by_73: 1997; X86: # %bb.0: 1998; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1999; X86-NEXT: leal (%eax,%eax,8), %ecx 2000; X86-NEXT: leal (%eax,%ecx,8), %ecx 2001; X86-NEXT: movl $73, %eax 2002; X86-NEXT: mull {{[0-9]+}}(%esp) 2003; X86-NEXT: addl %ecx, %edx 2004; X86-NEXT: retl 2005; 2006; X64-HSW-LABEL: test_mul_by_73: 2007; X64-HSW: # %bb.0: 2008; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50] 2009; X64-HSW-NEXT: leaq (%rdi,%rax,8), %rax # sched: [1:0.50] 2010; X64-HSW-NEXT: retq # sched: [7:1.00] 2011; 2012; X64-JAG-LABEL: test_mul_by_73: 2013; X64-JAG: # %bb.0: 2014; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [2:1.00] 2015; X64-JAG-NEXT: leaq (%rdi,%rax,8), %rax # sched: [2:1.00] 2016; X64-JAG-NEXT: retq # sched: [4:1.00] 2017; 2018; X86-NOOPT-LABEL: test_mul_by_73: 2019; X86-NOOPT: # %bb.0: 2020; X86-NOOPT-NEXT: movl $73, %eax 2021; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 2022; X86-NOOPT-NEXT: imull $73, {{[0-9]+}}(%esp), %ecx 2023; X86-NOOPT-NEXT: addl %ecx, %edx 2024; X86-NOOPT-NEXT: retl 2025; 2026; HSW-NOOPT-LABEL: test_mul_by_73: 2027; HSW-NOOPT: # %bb.0: 2028; HSW-NOOPT-NEXT: imulq $73, %rdi, %rax # sched: [3:1.00] 2029; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 2030; 2031; JAG-NOOPT-LABEL: test_mul_by_73: 2032; JAG-NOOPT: # %bb.0: 2033; JAG-NOOPT-NEXT: imulq $73, %rdi, %rax # sched: [6:4.00] 2034; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 2035; 2036; X64-SLM-LABEL: test_mul_by_73: 2037; X64-SLM: # %bb.0: 2038; X64-SLM-NEXT: imulq $73, %rdi, %rax # sched: [3:1.00] 2039; X64-SLM-NEXT: retq # sched: [4:1.00] 2040; 2041; SLM-NOOPT-LABEL: test_mul_by_73: 2042; SLM-NOOPT: # %bb.0: 2043; SLM-NOOPT-NEXT: imulq $73, %rdi, %rax # sched: [3:1.00] 2044; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 2045 %mul = mul nsw i64 %x, 73 2046 ret i64 %mul 2047} 2048 2049define i64 @test_mul_by_520(i64 %x) { 2050; X86-LABEL: test_mul_by_520: 2051; X86: # %bb.0: 2052; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 2053; X86-NEXT: movl %eax, %ecx 2054; X86-NEXT: shll $9, %ecx 2055; X86-NEXT: leal (%ecx,%eax,8), %ecx 2056; X86-NEXT: movl $520, %eax # imm = 0x208 2057; X86-NEXT: mull {{[0-9]+}}(%esp) 2058; X86-NEXT: addl %ecx, %edx 2059; X86-NEXT: retl 2060; 2061; X64-HSW-LABEL: test_mul_by_520: 2062; X64-HSW: # %bb.0: 2063; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25] 2064; X64-HSW-NEXT: shlq $9, %rax # sched: [1:0.50] 2065; X64-HSW-NEXT: leaq (%rax,%rdi,8), %rax # sched: [1:0.50] 2066; X64-HSW-NEXT: retq # sched: [7:1.00] 2067; 2068; X64-JAG-LABEL: test_mul_by_520: 2069; X64-JAG: # %bb.0: 2070; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.50] 2071; X64-JAG-NEXT: shlq $9, %rax # sched: [1:0.50] 2072; X64-JAG-NEXT: leaq (%rax,%rdi,8), %rax # sched: [2:1.00] 2073; X64-JAG-NEXT: retq # sched: [4:1.00] 2074; 2075; X86-NOOPT-LABEL: test_mul_by_520: 2076; X86-NOOPT: # %bb.0: 2077; X86-NOOPT-NEXT: movl $520, %eax # imm = 0x208 2078; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) 2079; X86-NOOPT-NEXT: imull $520, {{[0-9]+}}(%esp), %ecx # imm = 0x208 2080; X86-NOOPT-NEXT: addl %ecx, %edx 2081; X86-NOOPT-NEXT: retl 2082; 2083; HSW-NOOPT-LABEL: test_mul_by_520: 2084; HSW-NOOPT: # %bb.0: 2085; HSW-NOOPT-NEXT: imulq $520, %rdi, %rax # imm = 0x208 2086; HSW-NOOPT-NEXT: # sched: [3:1.00] 2087; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 2088; 2089; JAG-NOOPT-LABEL: test_mul_by_520: 2090; JAG-NOOPT: # %bb.0: 2091; JAG-NOOPT-NEXT: imulq $520, %rdi, %rax # imm = 0x208 2092; JAG-NOOPT-NEXT: # sched: [6:4.00] 2093; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 2094; 2095; X64-SLM-LABEL: test_mul_by_520: 2096; X64-SLM: # %bb.0: 2097; X64-SLM-NEXT: imulq $520, %rdi, %rax # imm = 0x208 2098; X64-SLM-NEXT: # sched: [3:1.00] 2099; X64-SLM-NEXT: retq # sched: [4:1.00] 2100; 2101; SLM-NOOPT-LABEL: test_mul_by_520: 2102; SLM-NOOPT: # %bb.0: 2103; SLM-NOOPT-NEXT: imulq $520, %rdi, %rax # imm = 0x208 2104; SLM-NOOPT-NEXT: # sched: [3:1.00] 2105; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 2106 %mul = mul nsw i64 %x, 520 2107 ret i64 %mul 2108} 2109 2110define i64 @test_mul_by_neg10(i64 %x) { 2111; X86-LABEL: test_mul_by_neg10: 2112; X86: # %bb.0: 2113; X86-NEXT: pushl %esi 2114; X86-NEXT: .cfi_def_cfa_offset 8 2115; X86-NEXT: .cfi_offset %esi, -8 2116; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 2117; X86-NEXT: movl {{[0-9]+}}(%esp), %esi 2118; X86-NEXT: movl $-10, %edx 2119; X86-NEXT: movl %ecx, %eax 2120; X86-NEXT: mull %edx 2121; X86-NEXT: subl %ecx, %edx 2122; X86-NEXT: leal (%esi,%esi,4), %ecx 2123; X86-NEXT: addl %ecx, %ecx 2124; X86-NEXT: subl %ecx, %edx 2125; X86-NEXT: popl %esi 2126; X86-NEXT: .cfi_def_cfa_offset 4 2127; X86-NEXT: retl 2128; 2129; X64-HSW-LABEL: test_mul_by_neg10: 2130; X64-HSW: # %bb.0: 2131; X64-HSW-NEXT: addq %rdi, %rdi # sched: [1:0.25] 2132; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50] 2133; X64-HSW-NEXT: negq %rax # sched: [1:0.25] 2134; X64-HSW-NEXT: retq # sched: [7:1.00] 2135; 2136; X64-JAG-LABEL: test_mul_by_neg10: 2137; X64-JAG: # %bb.0: 2138; X64-JAG-NEXT: addq %rdi, %rdi # sched: [1:0.50] 2139; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [2:1.00] 2140; X64-JAG-NEXT: negq %rax # sched: [1:0.50] 2141; X64-JAG-NEXT: retq # sched: [4:1.00] 2142; 2143; X86-NOOPT-LABEL: test_mul_by_neg10: 2144; X86-NOOPT: # %bb.0: 2145; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %ecx 2146; X86-NOOPT-NEXT: movl $-10, %edx 2147; X86-NOOPT-NEXT: movl %ecx, %eax 2148; X86-NOOPT-NEXT: mull %edx 2149; X86-NOOPT-NEXT: subl %ecx, %edx 2150; X86-NOOPT-NEXT: imull $-10, {{[0-9]+}}(%esp), %ecx 2151; X86-NOOPT-NEXT: addl %ecx, %edx 2152; X86-NOOPT-NEXT: retl 2153; 2154; HSW-NOOPT-LABEL: test_mul_by_neg10: 2155; HSW-NOOPT: # %bb.0: 2156; HSW-NOOPT-NEXT: imulq $-10, %rdi, %rax # sched: [3:1.00] 2157; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 2158; 2159; JAG-NOOPT-LABEL: test_mul_by_neg10: 2160; JAG-NOOPT: # %bb.0: 2161; JAG-NOOPT-NEXT: imulq $-10, %rdi, %rax # sched: [6:4.00] 2162; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 2163; 2164; X64-SLM-LABEL: test_mul_by_neg10: 2165; X64-SLM: # %bb.0: 2166; X64-SLM-NEXT: addq %rdi, %rdi # sched: [1:0.50] 2167; X64-SLM-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:1.00] 2168; X64-SLM-NEXT: negq %rax # sched: [1:0.50] 2169; X64-SLM-NEXT: retq # sched: [4:1.00] 2170; 2171; SLM-NOOPT-LABEL: test_mul_by_neg10: 2172; SLM-NOOPT: # %bb.0: 2173; SLM-NOOPT-NEXT: imulq $-10, %rdi, %rax # sched: [3:1.00] 2174; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 2175 %mul = mul nsw i64 %x, -10 2176 ret i64 %mul 2177} 2178 2179define i64 @test_mul_by_neg36(i64 %x) { 2180; X86-LABEL: test_mul_by_neg36: 2181; X86: # %bb.0: 2182; X86-NEXT: pushl %esi 2183; X86-NEXT: .cfi_def_cfa_offset 8 2184; X86-NEXT: .cfi_offset %esi, -8 2185; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 2186; X86-NEXT: movl {{[0-9]+}}(%esp), %esi 2187; X86-NEXT: movl $-36, %edx 2188; X86-NEXT: movl %ecx, %eax 2189; X86-NEXT: mull %edx 2190; X86-NEXT: subl %ecx, %edx 2191; X86-NEXT: leal (%esi,%esi,8), %ecx 2192; X86-NEXT: shll $2, %ecx 2193; X86-NEXT: subl %ecx, %edx 2194; X86-NEXT: popl %esi 2195; X86-NEXT: .cfi_def_cfa_offset 4 2196; X86-NEXT: retl 2197; 2198; X64-HSW-LABEL: test_mul_by_neg36: 2199; X64-HSW: # %bb.0: 2200; X64-HSW-NEXT: shlq $2, %rdi # sched: [1:0.50] 2201; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50] 2202; X64-HSW-NEXT: negq %rax # sched: [1:0.25] 2203; X64-HSW-NEXT: retq # sched: [7:1.00] 2204; 2205; X64-JAG-LABEL: test_mul_by_neg36: 2206; X64-JAG: # %bb.0: 2207; X64-JAG-NEXT: shlq $2, %rdi # sched: [1:0.50] 2208; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [2:1.00] 2209; X64-JAG-NEXT: negq %rax # sched: [1:0.50] 2210; X64-JAG-NEXT: retq # sched: [4:1.00] 2211; 2212; X86-NOOPT-LABEL: test_mul_by_neg36: 2213; X86-NOOPT: # %bb.0: 2214; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %ecx 2215; X86-NOOPT-NEXT: movl $-36, %edx 2216; X86-NOOPT-NEXT: movl %ecx, %eax 2217; X86-NOOPT-NEXT: mull %edx 2218; X86-NOOPT-NEXT: subl %ecx, %edx 2219; X86-NOOPT-NEXT: imull $-36, {{[0-9]+}}(%esp), %ecx 2220; X86-NOOPT-NEXT: addl %ecx, %edx 2221; X86-NOOPT-NEXT: retl 2222; 2223; HSW-NOOPT-LABEL: test_mul_by_neg36: 2224; HSW-NOOPT: # %bb.0: 2225; HSW-NOOPT-NEXT: imulq $-36, %rdi, %rax # sched: [3:1.00] 2226; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 2227; 2228; JAG-NOOPT-LABEL: test_mul_by_neg36: 2229; JAG-NOOPT: # %bb.0: 2230; JAG-NOOPT-NEXT: imulq $-36, %rdi, %rax # sched: [6:4.00] 2231; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 2232; 2233; X64-SLM-LABEL: test_mul_by_neg36: 2234; X64-SLM: # %bb.0: 2235; X64-SLM-NEXT: shlq $2, %rdi # sched: [1:1.00] 2236; X64-SLM-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:1.00] 2237; X64-SLM-NEXT: negq %rax # sched: [1:0.50] 2238; X64-SLM-NEXT: retq # sched: [4:1.00] 2239; 2240; SLM-NOOPT-LABEL: test_mul_by_neg36: 2241; SLM-NOOPT: # %bb.0: 2242; SLM-NOOPT-NEXT: imulq $-36, %rdi, %rax # sched: [3:1.00] 2243; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 2244 %mul = mul nsw i64 %x, -36 2245 ret i64 %mul 2246} 2247 2248; (x*9+42)*(x*5+2) 2249define i64 @test_mul_spec(i64 %x) nounwind { 2250; X86-LABEL: test_mul_spec: 2251; X86: # %bb.0: 2252; X86-NEXT: pushl %ebx 2253; X86-NEXT: pushl %edi 2254; X86-NEXT: pushl %esi 2255; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 2256; X86-NEXT: movl {{[0-9]+}}(%esp), %edi 2257; X86-NEXT: movl $9, %edx 2258; X86-NEXT: movl %ecx, %eax 2259; X86-NEXT: mull %edx 2260; X86-NEXT: movl %eax, %esi 2261; X86-NEXT: leal (%edi,%edi,8), %ebx 2262; X86-NEXT: addl $42, %esi 2263; X86-NEXT: adcl %edx, %ebx 2264; X86-NEXT: movl $5, %edx 2265; X86-NEXT: movl %ecx, %eax 2266; X86-NEXT: mull %edx 2267; X86-NEXT: movl %eax, %ecx 2268; X86-NEXT: leal (%edi,%edi,4), %edi 2269; X86-NEXT: addl $2, %ecx 2270; X86-NEXT: adcl %edx, %edi 2271; X86-NEXT: movl %esi, %eax 2272; X86-NEXT: mull %ecx 2273; X86-NEXT: imull %esi, %edi 2274; X86-NEXT: addl %edi, %edx 2275; X86-NEXT: imull %ebx, %ecx 2276; X86-NEXT: addl %ecx, %edx 2277; X86-NEXT: popl %esi 2278; X86-NEXT: popl %edi 2279; X86-NEXT: popl %ebx 2280; X86-NEXT: retl 2281; 2282; X64-HSW-LABEL: test_mul_spec: 2283; X64-HSW: # %bb.0: 2284; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rcx # sched: [1:0.50] 2285; X64-HSW-NEXT: addq $42, %rcx # sched: [1:0.25] 2286; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50] 2287; X64-HSW-NEXT: addq $2, %rax # sched: [1:0.25] 2288; X64-HSW-NEXT: imulq %rcx, %rax # sched: [3:1.00] 2289; X64-HSW-NEXT: retq # sched: [7:1.00] 2290; 2291; X64-JAG-LABEL: test_mul_spec: 2292; X64-JAG: # %bb.0: 2293; X64-JAG-NEXT: leaq 42(%rdi,%rdi,8), %rcx # sched: [2:1.00] 2294; X64-JAG-NEXT: leaq 2(%rdi,%rdi,4), %rax # sched: [2:1.00] 2295; X64-JAG-NEXT: imulq %rcx, %rax # sched: [6:4.00] 2296; X64-JAG-NEXT: retq # sched: [4:1.00] 2297; 2298; X86-NOOPT-LABEL: test_mul_spec: 2299; X86-NOOPT: # %bb.0: 2300; X86-NOOPT-NEXT: pushl %ebx 2301; X86-NOOPT-NEXT: pushl %edi 2302; X86-NOOPT-NEXT: pushl %esi 2303; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %ecx 2304; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edi 2305; X86-NOOPT-NEXT: movl $9, %edx 2306; X86-NOOPT-NEXT: movl %ecx, %eax 2307; X86-NOOPT-NEXT: mull %edx 2308; X86-NOOPT-NEXT: movl %eax, %esi 2309; X86-NOOPT-NEXT: leal (%edi,%edi,8), %ebx 2310; X86-NOOPT-NEXT: addl $42, %esi 2311; X86-NOOPT-NEXT: adcl %edx, %ebx 2312; X86-NOOPT-NEXT: movl $5, %edx 2313; X86-NOOPT-NEXT: movl %ecx, %eax 2314; X86-NOOPT-NEXT: mull %edx 2315; X86-NOOPT-NEXT: movl %eax, %ecx 2316; X86-NOOPT-NEXT: leal (%edi,%edi,4), %edi 2317; X86-NOOPT-NEXT: addl $2, %ecx 2318; X86-NOOPT-NEXT: adcl %edx, %edi 2319; X86-NOOPT-NEXT: movl %esi, %eax 2320; X86-NOOPT-NEXT: mull %ecx 2321; X86-NOOPT-NEXT: imull %esi, %edi 2322; X86-NOOPT-NEXT: addl %edi, %edx 2323; X86-NOOPT-NEXT: imull %ebx, %ecx 2324; X86-NOOPT-NEXT: addl %ecx, %edx 2325; X86-NOOPT-NEXT: popl %esi 2326; X86-NOOPT-NEXT: popl %edi 2327; X86-NOOPT-NEXT: popl %ebx 2328; X86-NOOPT-NEXT: retl 2329; 2330; HSW-NOOPT-LABEL: test_mul_spec: 2331; HSW-NOOPT: # %bb.0: 2332; HSW-NOOPT-NEXT: leaq (%rdi,%rdi,8), %rcx # sched: [1:0.50] 2333; HSW-NOOPT-NEXT: addq $42, %rcx # sched: [1:0.25] 2334; HSW-NOOPT-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50] 2335; HSW-NOOPT-NEXT: addq $2, %rax # sched: [1:0.25] 2336; HSW-NOOPT-NEXT: imulq %rcx, %rax # sched: [3:1.00] 2337; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 2338; 2339; JAG-NOOPT-LABEL: test_mul_spec: 2340; JAG-NOOPT: # %bb.0: 2341; JAG-NOOPT-NEXT: leaq 42(%rdi,%rdi,8), %rcx # sched: [2:1.00] 2342; JAG-NOOPT-NEXT: leaq 2(%rdi,%rdi,4), %rax # sched: [2:1.00] 2343; JAG-NOOPT-NEXT: imulq %rcx, %rax # sched: [6:4.00] 2344; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 2345; 2346; X64-SLM-LABEL: test_mul_spec: 2347; X64-SLM: # %bb.0: 2348; X64-SLM-NEXT: leaq 42(%rdi,%rdi,8), %rcx # sched: [1:1.00] 2349; X64-SLM-NEXT: leaq 2(%rdi,%rdi,4), %rax # sched: [1:1.00] 2350; X64-SLM-NEXT: imulq %rcx, %rax # sched: [3:1.00] 2351; X64-SLM-NEXT: retq # sched: [4:1.00] 2352; 2353; SLM-NOOPT-LABEL: test_mul_spec: 2354; SLM-NOOPT: # %bb.0: 2355; SLM-NOOPT-NEXT: leaq 42(%rdi,%rdi,8), %rcx # sched: [1:1.00] 2356; SLM-NOOPT-NEXT: leaq 2(%rdi,%rdi,4), %rax # sched: [1:1.00] 2357; SLM-NOOPT-NEXT: imulq %rcx, %rax # sched: [3:1.00] 2358; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 2359 %mul = mul nsw i64 %x, 9 2360 %add = add nsw i64 %mul, 42 2361 %mul2 = mul nsw i64 %x, 5 2362 %add2 = add nsw i64 %mul2, 2 2363 %mul3 = mul nsw i64 %add, %add2 2364 ret i64 %mul3 2365} 2366