brintos

brintos / llvm-project-archived public Read only

0
0
Text · 40.6 KiB · 4129b44 Raw
1462 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=i686-unknown                                                  | FileCheck %s --check-prefix=X863; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=haswell                                  | FileCheck %s --check-prefixes=X64,X64-HSW4; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=btver2                                   | FileCheck %s --check-prefixes=X64,X64-JAG5; RUN: llc < %s -mtriple=i686-unknown -mul-constant-optimization=false                 | FileCheck %s --check-prefix=X86-NOOPT6; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -mcpu=haswell | FileCheck %s --check-prefixes=X64-NOOPT,HSW-NOOPT7; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -mcpu=btver2  | FileCheck %s --check-prefixes=X64-NOOPT,JAG-NOOPT8; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=slm                                      | FileCheck %s --check-prefixes=X64,X64-SLM9; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -mcpu=slm     | FileCheck %s --check-prefixes=X64-NOOPT,SLM-NOOPT10 11define i32 @test_mul_by_1(i32 %x) {12; X86-LABEL: test_mul_by_1:13; X86:       # %bb.0:14; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax15; X86-NEXT:    retl16;17; X64-LABEL: test_mul_by_1:18; X64:       # %bb.0:19; X64-NEXT:    movl %edi, %eax20; X64-NEXT:    retq21;22; X86-NOOPT-LABEL: test_mul_by_1:23; X86-NOOPT:       # %bb.0:24; X86-NOOPT-NEXT:    movl {{[0-9]+}}(%esp), %eax25; X86-NOOPT-NEXT:    retl26;27; X64-NOOPT-LABEL: test_mul_by_1:28; X64-NOOPT:       # %bb.0:29; X64-NOOPT-NEXT:    movl %edi, %eax30; X64-NOOPT-NEXT:    retq31  %mul = mul nsw i32 %x, 132  ret i32 %mul33}34 35define i32 @test_mul_by_2(i32 %x) {36; X86-LABEL: test_mul_by_2:37; X86:       # %bb.0:38; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax39; X86-NEXT:    addl %eax, %eax40; X86-NEXT:    retl41;42; X64-LABEL: test_mul_by_2:43; X64:       # %bb.0:44; X64-NEXT:    # kill: def $edi killed $edi def $rdi45; X64-NEXT:    leal (%rdi,%rdi), %eax46; X64-NEXT:    retq47;48; X86-NOOPT-LABEL: test_mul_by_2:49; X86-NOOPT:       # %bb.0:50; X86-NOOPT-NEXT:    movl {{[0-9]+}}(%esp), %eax51; X86-NOOPT-NEXT:    addl %eax, %eax52; X86-NOOPT-NEXT:    retl53;54; X64-NOOPT-LABEL: test_mul_by_2:55; X64-NOOPT:       # %bb.0:56; X64-NOOPT-NEXT:    # kill: def $edi killed $edi def $rdi57; X64-NOOPT-NEXT:    leal (%rdi,%rdi), %eax58; X64-NOOPT-NEXT:    retq59  %mul = mul nsw i32 %x, 260  ret i32 %mul61}62 63define i32 @test_mul_by_3(i32 %x) {64; X86-LABEL: test_mul_by_3:65; X86:       # %bb.0:66; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax67; X86-NEXT:    leal (%eax,%eax,2), %eax68; X86-NEXT:    retl69;70; X64-LABEL: test_mul_by_3:71; X64:       # %bb.0:72; X64-NEXT:    # kill: def $edi killed $edi def $rdi73; X64-NEXT:    leal (%rdi,%rdi,2), %eax74; X64-NEXT:    retq75;76; X86-NOOPT-LABEL: test_mul_by_3:77; X86-NOOPT:       # %bb.0:78; X86-NOOPT-NEXT:    imull $3, {{[0-9]+}}(%esp), %eax79; X86-NOOPT-NEXT:    retl80;81; X64-NOOPT-LABEL: test_mul_by_3:82; X64-NOOPT:       # %bb.0:83; X64-NOOPT-NEXT:    # kill: def $edi killed $edi def $rdi84; X64-NOOPT-NEXT:    leal (%rdi,%rdi,2), %eax85; X64-NOOPT-NEXT:    retq86  %mul = mul nsw i32 %x, 387  ret i32 %mul88}89 90define i32 @test_mul_by_4(i32 %x) {91; X86-LABEL: test_mul_by_4:92; X86:       # %bb.0:93; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax94; X86-NEXT:    shll $2, %eax95; X86-NEXT:    retl96;97; X64-LABEL: test_mul_by_4:98; X64:       # %bb.0:99; X64-NEXT:    # kill: def $edi killed $edi def $rdi100; X64-NEXT:    leal (,%rdi,4), %eax101; X64-NEXT:    retq102;103; X86-NOOPT-LABEL: test_mul_by_4:104; X86-NOOPT:       # %bb.0:105; X86-NOOPT-NEXT:    movl {{[0-9]+}}(%esp), %eax106; X86-NOOPT-NEXT:    shll $2, %eax107; X86-NOOPT-NEXT:    retl108;109; X64-NOOPT-LABEL: test_mul_by_4:110; X64-NOOPT:       # %bb.0:111; X64-NOOPT-NEXT:    # kill: def $edi killed $edi def $rdi112; X64-NOOPT-NEXT:    leal (,%rdi,4), %eax113; X64-NOOPT-NEXT:    retq114  %mul = mul nsw i32 %x, 4115  ret i32 %mul116}117 118define i32 @test_mul_by_5(i32 %x) {119; X86-LABEL: test_mul_by_5:120; X86:       # %bb.0:121; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax122; X86-NEXT:    leal (%eax,%eax,4), %eax123; X86-NEXT:    retl124;125; X64-LABEL: test_mul_by_5:126; X64:       # %bb.0:127; X64-NEXT:    # kill: def $edi killed $edi def $rdi128; X64-NEXT:    leal (%rdi,%rdi,4), %eax129; X64-NEXT:    retq130;131; X86-NOOPT-LABEL: test_mul_by_5:132; X86-NOOPT:       # %bb.0:133; X86-NOOPT-NEXT:    imull $5, {{[0-9]+}}(%esp), %eax134; X86-NOOPT-NEXT:    retl135;136; X64-NOOPT-LABEL: test_mul_by_5:137; X64-NOOPT:       # %bb.0:138; X64-NOOPT-NEXT:    # kill: def $edi killed $edi def $rdi139; X64-NOOPT-NEXT:    leal (%rdi,%rdi,4), %eax140; X64-NOOPT-NEXT:    retq141  %mul = mul nsw i32 %x, 5142  ret i32 %mul143}144 145define i32 @test_mul_by_6(i32 %x) {146; X86-LABEL: test_mul_by_6:147; X86:       # %bb.0:148; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax149; X86-NEXT:    addl %eax, %eax150; X86-NEXT:    leal (%eax,%eax,2), %eax151; X86-NEXT:    retl152;153; X64-LABEL: test_mul_by_6:154; X64:       # %bb.0:155; X64-NEXT:    # kill: def $edi killed $edi def $rdi156; X64-NEXT:    addl %edi, %edi157; X64-NEXT:    leal (%rdi,%rdi,2), %eax158; X64-NEXT:    retq159;160; X86-NOOPT-LABEL: test_mul_by_6:161; X86-NOOPT:       # %bb.0:162; X86-NOOPT-NEXT:    imull $6, {{[0-9]+}}(%esp), %eax163; X86-NOOPT-NEXT:    retl164;165; X64-NOOPT-LABEL: test_mul_by_6:166; X64-NOOPT:       # %bb.0:167; X64-NOOPT-NEXT:    imull $6, %edi, %eax168; X64-NOOPT-NEXT:    retq169  %mul = mul nsw i32 %x, 6170  ret i32 %mul171}172 173define i32 @test_mul_by_7(i32 %x) {174; X86-LABEL: test_mul_by_7:175; X86:       # %bb.0:176; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx177; X86-NEXT:    leal (,%ecx,8), %eax178; X86-NEXT:    subl %ecx, %eax179; X86-NEXT:    retl180;181; X64-LABEL: test_mul_by_7:182; X64:       # %bb.0:183; X64-NEXT:    # kill: def $edi killed $edi def $rdi184; X64-NEXT:    leal (,%rdi,8), %eax185; X64-NEXT:    subl %edi, %eax186; X64-NEXT:    retq187;188; X86-NOOPT-LABEL: test_mul_by_7:189; X86-NOOPT:       # %bb.0:190; X86-NOOPT-NEXT:    imull $7, {{[0-9]+}}(%esp), %eax191; X86-NOOPT-NEXT:    retl192;193; X64-NOOPT-LABEL: test_mul_by_7:194; X64-NOOPT:       # %bb.0:195; X64-NOOPT-NEXT:    imull $7, %edi, %eax196; X64-NOOPT-NEXT:    retq197  %mul = mul nsw i32 %x, 7198  ret i32 %mul199}200 201define i32 @test_mul_by_8(i32 %x) {202; X86-LABEL: test_mul_by_8:203; X86:       # %bb.0:204; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax205; X86-NEXT:    shll $3, %eax206; X86-NEXT:    retl207;208; X64-LABEL: test_mul_by_8:209; X64:       # %bb.0:210; X64-NEXT:    # kill: def $edi killed $edi def $rdi211; X64-NEXT:    leal (,%rdi,8), %eax212; X64-NEXT:    retq213;214; X86-NOOPT-LABEL: test_mul_by_8:215; X86-NOOPT:       # %bb.0:216; X86-NOOPT-NEXT:    movl {{[0-9]+}}(%esp), %eax217; X86-NOOPT-NEXT:    shll $3, %eax218; X86-NOOPT-NEXT:    retl219;220; X64-NOOPT-LABEL: test_mul_by_8:221; X64-NOOPT:       # %bb.0:222; X64-NOOPT-NEXT:    # kill: def $edi killed $edi def $rdi223; X64-NOOPT-NEXT:    leal (,%rdi,8), %eax224; X64-NOOPT-NEXT:    retq225  %mul = mul nsw i32 %x, 8226  ret i32 %mul227}228 229define i32 @test_mul_by_9(i32 %x) {230; X86-LABEL: test_mul_by_9:231; X86:       # %bb.0:232; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax233; X86-NEXT:    leal (%eax,%eax,8), %eax234; X86-NEXT:    retl235;236; X64-LABEL: test_mul_by_9:237; X64:       # %bb.0:238; X64-NEXT:    # kill: def $edi killed $edi def $rdi239; X64-NEXT:    leal (%rdi,%rdi,8), %eax240; X64-NEXT:    retq241;242; X86-NOOPT-LABEL: test_mul_by_9:243; X86-NOOPT:       # %bb.0:244; X86-NOOPT-NEXT:    imull $9, {{[0-9]+}}(%esp), %eax245; X86-NOOPT-NEXT:    retl246;247; X64-NOOPT-LABEL: test_mul_by_9:248; X64-NOOPT:       # %bb.0:249; X64-NOOPT-NEXT:    # kill: def $edi killed $edi def $rdi250; X64-NOOPT-NEXT:    leal (%rdi,%rdi,8), %eax251; X64-NOOPT-NEXT:    retq252  %mul = mul nsw i32 %x, 9253  ret i32 %mul254}255 256define i32 @test_mul_by_10(i32 %x) {257; X86-LABEL: test_mul_by_10:258; X86:       # %bb.0:259; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax260; X86-NEXT:    addl %eax, %eax261; X86-NEXT:    leal (%eax,%eax,4), %eax262; X86-NEXT:    retl263;264; X64-LABEL: test_mul_by_10:265; X64:       # %bb.0:266; X64-NEXT:    # kill: def $edi killed $edi def $rdi267; X64-NEXT:    addl %edi, %edi268; X64-NEXT:    leal (%rdi,%rdi,4), %eax269; X64-NEXT:    retq270;271; X86-NOOPT-LABEL: test_mul_by_10:272; X86-NOOPT:       # %bb.0:273; X86-NOOPT-NEXT:    imull $10, {{[0-9]+}}(%esp), %eax274; X86-NOOPT-NEXT:    retl275;276; X64-NOOPT-LABEL: test_mul_by_10:277; X64-NOOPT:       # %bb.0:278; X64-NOOPT-NEXT:    imull $10, %edi, %eax279; X64-NOOPT-NEXT:    retq280  %mul = mul nsw i32 %x, 10281  ret i32 %mul282}283 284define i32 @test_mul_by_11(i32 %x) {285; X86-LABEL: test_mul_by_11:286; X86:       # %bb.0:287; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax288; X86-NEXT:    leal (%eax,%eax,4), %ecx289; X86-NEXT:    leal (%eax,%ecx,2), %eax290; X86-NEXT:    retl291;292; X64-HSW-LABEL: test_mul_by_11:293; X64-HSW:       # %bb.0:294; X64-HSW-NEXT:    # kill: def $edi killed $edi def $rdi295; X64-HSW-NEXT:    leal (%rdi,%rdi,4), %eax296; X64-HSW-NEXT:    leal (%rdi,%rax,2), %eax297; X64-HSW-NEXT:    retq298;299; X64-JAG-LABEL: test_mul_by_11:300; X64-JAG:       # %bb.0:301; X64-JAG-NEXT:    # kill: def $edi killed $edi def $rdi302; X64-JAG-NEXT:    leal (%rdi,%rdi,4), %eax303; X64-JAG-NEXT:    leal (%rdi,%rax,2), %eax304; X64-JAG-NEXT:    retq305;306; X86-NOOPT-LABEL: test_mul_by_11:307; X86-NOOPT:       # %bb.0:308; X86-NOOPT-NEXT:    imull $11, {{[0-9]+}}(%esp), %eax309; X86-NOOPT-NEXT:    retl310;311; X64-NOOPT-LABEL: test_mul_by_11:312; X64-NOOPT:       # %bb.0:313; X64-NOOPT-NEXT:    imull $11, %edi, %eax314; X64-NOOPT-NEXT:    retq315;316; X64-SLM-LABEL: test_mul_by_11:317; X64-SLM:       # %bb.0:318; X64-SLM-NEXT:    imull $11, %edi, %eax319; X64-SLM-NEXT:    retq320  %mul = mul nsw i32 %x, 11321  ret i32 %mul322}323 324define i32 @test_mul_by_12(i32 %x) {325; X86-LABEL: test_mul_by_12:326; X86:       # %bb.0:327; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax328; X86-NEXT:    shll $2, %eax329; X86-NEXT:    leal (%eax,%eax,2), %eax330; X86-NEXT:    retl331;332; X64-LABEL: test_mul_by_12:333; X64:       # %bb.0:334; X64-NEXT:    # kill: def $edi killed $edi def $rdi335; X64-NEXT:    shll $2, %edi336; X64-NEXT:    leal (%rdi,%rdi,2), %eax337; X64-NEXT:    retq338;339; X86-NOOPT-LABEL: test_mul_by_12:340; X86-NOOPT:       # %bb.0:341; X86-NOOPT-NEXT:    imull $12, {{[0-9]+}}(%esp), %eax342; X86-NOOPT-NEXT:    retl343;344; X64-NOOPT-LABEL: test_mul_by_12:345; X64-NOOPT:       # %bb.0:346; X64-NOOPT-NEXT:    imull $12, %edi, %eax347; X64-NOOPT-NEXT:    retq348  %mul = mul nsw i32 %x, 12349  ret i32 %mul350}351 352define i32 @test_mul_by_13(i32 %x) {353; X86-LABEL: test_mul_by_13:354; X86:       # %bb.0:355; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax356; X86-NEXT:    leal (%eax,%eax,2), %ecx357; X86-NEXT:    leal (%eax,%ecx,4), %eax358; X86-NEXT:    retl359;360; X64-HSW-LABEL: test_mul_by_13:361; X64-HSW:       # %bb.0:362; X64-HSW-NEXT:    # kill: def $edi killed $edi def $rdi363; X64-HSW-NEXT:    leal (%rdi,%rdi,2), %eax364; X64-HSW-NEXT:    leal (%rdi,%rax,4), %eax365; X64-HSW-NEXT:    retq366;367; X64-JAG-LABEL: test_mul_by_13:368; X64-JAG:       # %bb.0:369; X64-JAG-NEXT:    # kill: def $edi killed $edi def $rdi370; X64-JAG-NEXT:    leal (%rdi,%rdi,2), %eax371; X64-JAG-NEXT:    leal (%rdi,%rax,4), %eax372; X64-JAG-NEXT:    retq373;374; X86-NOOPT-LABEL: test_mul_by_13:375; X86-NOOPT:       # %bb.0:376; X86-NOOPT-NEXT:    imull $13, {{[0-9]+}}(%esp), %eax377; X86-NOOPT-NEXT:    retl378;379; X64-NOOPT-LABEL: test_mul_by_13:380; X64-NOOPT:       # %bb.0:381; X64-NOOPT-NEXT:    imull $13, %edi, %eax382; X64-NOOPT-NEXT:    retq383;384; X64-SLM-LABEL: test_mul_by_13:385; X64-SLM:       # %bb.0:386; X64-SLM-NEXT:    imull $13, %edi, %eax387; X64-SLM-NEXT:    retq388  %mul = mul nsw i32 %x, 13389  ret i32 %mul390}391 392define i32 @test_mul_by_14(i32 %x) {393; X86-LABEL: test_mul_by_14:394; X86:       # %bb.0:395; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax396; X86-NEXT:    leal (%eax,%eax), %ecx397; X86-NEXT:    shll $4, %eax398; X86-NEXT:    subl %ecx, %eax399; X86-NEXT:    retl400;401; X64-LABEL: test_mul_by_14:402; X64:       # %bb.0:403; X64-NEXT:    movl %edi, %eax404; X64-NEXT:    leal (%rax,%rax), %ecx405; X64-NEXT:    shll $4, %eax406; X64-NEXT:    subl %ecx, %eax407; X64-NEXT:    # kill: def $eax killed $eax killed $rax408; X64-NEXT:    retq409;410; X86-NOOPT-LABEL: test_mul_by_14:411; X86-NOOPT:       # %bb.0:412; X86-NOOPT-NEXT:    imull $14, {{[0-9]+}}(%esp), %eax413; X86-NOOPT-NEXT:    retl414;415; X64-NOOPT-LABEL: test_mul_by_14:416; X64-NOOPT:       # %bb.0:417; X64-NOOPT-NEXT:    imull $14, %edi, %eax418; X64-NOOPT-NEXT:    retq419  %mul = mul nsw i32 %x, 14420  ret i32 %mul421}422 423define i32 @test_mul_by_15(i32 %x) {424; X86-LABEL: test_mul_by_15:425; X86:       # %bb.0:426; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax427; X86-NEXT:    leal (%eax,%eax,4), %eax428; X86-NEXT:    leal (%eax,%eax,2), %eax429; X86-NEXT:    retl430;431; X64-LABEL: test_mul_by_15:432; X64:       # %bb.0:433; X64-NEXT:    # kill: def $edi killed $edi def $rdi434; X64-NEXT:    leal (%rdi,%rdi,4), %eax435; X64-NEXT:    leal (%rax,%rax,2), %eax436; X64-NEXT:    retq437;438; X86-NOOPT-LABEL: test_mul_by_15:439; X86-NOOPT:       # %bb.0:440; X86-NOOPT-NEXT:    imull $15, {{[0-9]+}}(%esp), %eax441; X86-NOOPT-NEXT:    retl442;443; X64-NOOPT-LABEL: test_mul_by_15:444; X64-NOOPT:       # %bb.0:445; X64-NOOPT-NEXT:    imull $15, %edi, %eax446; X64-NOOPT-NEXT:    retq447  %mul = mul nsw i32 %x, 15448  ret i32 %mul449}450 451define i32 @test_mul_by_16(i32 %x) {452; X86-LABEL: test_mul_by_16:453; X86:       # %bb.0:454; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax455; X86-NEXT:    shll $4, %eax456; X86-NEXT:    retl457;458; X64-LABEL: test_mul_by_16:459; X64:       # %bb.0:460; X64-NEXT:    movl %edi, %eax461; X64-NEXT:    shll $4, %eax462; X64-NEXT:    retq463;464; X86-NOOPT-LABEL: test_mul_by_16:465; X86-NOOPT:       # %bb.0:466; X86-NOOPT-NEXT:    movl {{[0-9]+}}(%esp), %eax467; X86-NOOPT-NEXT:    shll $4, %eax468; X86-NOOPT-NEXT:    retl469;470; X64-NOOPT-LABEL: test_mul_by_16:471; X64-NOOPT:       # %bb.0:472; X64-NOOPT-NEXT:    movl %edi, %eax473; X64-NOOPT-NEXT:    shll $4, %eax474; X64-NOOPT-NEXT:    retq475  %mul = mul nsw i32 %x, 16476  ret i32 %mul477}478 479define i32 @test_mul_by_17(i32 %x) {480; X86-LABEL: test_mul_by_17:481; X86:       # %bb.0:482; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx483; X86-NEXT:    movl %ecx, %eax484; X86-NEXT:    shll $4, %eax485; X86-NEXT:    addl %ecx, %eax486; X86-NEXT:    retl487;488; X64-LABEL: test_mul_by_17:489; X64:       # %bb.0:490; X64-NEXT:    movl %edi, %eax491; X64-NEXT:    shll $4, %eax492; X64-NEXT:    addl %edi, %eax493; X64-NEXT:    retq494;495; X86-NOOPT-LABEL: test_mul_by_17:496; X86-NOOPT:       # %bb.0:497; X86-NOOPT-NEXT:    imull $17, {{[0-9]+}}(%esp), %eax498; X86-NOOPT-NEXT:    retl499;500; X64-NOOPT-LABEL: test_mul_by_17:501; X64-NOOPT:       # %bb.0:502; X64-NOOPT-NEXT:    imull $17, %edi, %eax503; X64-NOOPT-NEXT:    retq504  %mul = mul nsw i32 %x, 17505  ret i32 %mul506}507 508define i32 @test_mul_by_18(i32 %x) {509; X86-LABEL: test_mul_by_18:510; X86:       # %bb.0:511; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax512; X86-NEXT:    addl %eax, %eax513; X86-NEXT:    leal (%eax,%eax,8), %eax514; X86-NEXT:    retl515;516; X64-LABEL: test_mul_by_18:517; X64:       # %bb.0:518; X64-NEXT:    # kill: def $edi killed $edi def $rdi519; X64-NEXT:    addl %edi, %edi520; X64-NEXT:    leal (%rdi,%rdi,8), %eax521; X64-NEXT:    retq522;523; X86-NOOPT-LABEL: test_mul_by_18:524; X86-NOOPT:       # %bb.0:525; X86-NOOPT-NEXT:    imull $18, {{[0-9]+}}(%esp), %eax526; X86-NOOPT-NEXT:    retl527;528; X64-NOOPT-LABEL: test_mul_by_18:529; X64-NOOPT:       # %bb.0:530; X64-NOOPT-NEXT:    imull $18, %edi, %eax531; X64-NOOPT-NEXT:    retq532  %mul = mul nsw i32 %x, 18533  ret i32 %mul534}535 536define i32 @test_mul_by_19(i32 %x) {537; X86-LABEL: test_mul_by_19:538; X86:       # %bb.0:539; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax540; X86-NEXT:    leal (%eax,%eax,8), %ecx541; X86-NEXT:    leal (%eax,%ecx,2), %eax542; X86-NEXT:    retl543;544; X64-HSW-LABEL: test_mul_by_19:545; X64-HSW:       # %bb.0:546; X64-HSW-NEXT:    # kill: def $edi killed $edi def $rdi547; X64-HSW-NEXT:    leal (%rdi,%rdi,8), %eax548; X64-HSW-NEXT:    leal (%rdi,%rax,2), %eax549; X64-HSW-NEXT:    retq550;551; X64-JAG-LABEL: test_mul_by_19:552; X64-JAG:       # %bb.0:553; X64-JAG-NEXT:    # kill: def $edi killed $edi def $rdi554; X64-JAG-NEXT:    leal (%rdi,%rdi,8), %eax555; X64-JAG-NEXT:    leal (%rdi,%rax,2), %eax556; X64-JAG-NEXT:    retq557;558; X86-NOOPT-LABEL: test_mul_by_19:559; X86-NOOPT:       # %bb.0:560; X86-NOOPT-NEXT:    imull $19, {{[0-9]+}}(%esp), %eax561; X86-NOOPT-NEXT:    retl562;563; X64-NOOPT-LABEL: test_mul_by_19:564; X64-NOOPT:       # %bb.0:565; X64-NOOPT-NEXT:    imull $19, %edi, %eax566; X64-NOOPT-NEXT:    retq567;568; X64-SLM-LABEL: test_mul_by_19:569; X64-SLM:       # %bb.0:570; X64-SLM-NEXT:    imull $19, %edi, %eax571; X64-SLM-NEXT:    retq572  %mul = mul nsw i32 %x, 19573  ret i32 %mul574}575 576define i32 @test_mul_by_20(i32 %x) {577; X86-LABEL: test_mul_by_20:578; X86:       # %bb.0:579; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax580; X86-NEXT:    shll $2, %eax581; X86-NEXT:    leal (%eax,%eax,4), %eax582; X86-NEXT:    retl583;584; X64-LABEL: test_mul_by_20:585; X64:       # %bb.0:586; X64-NEXT:    # kill: def $edi killed $edi def $rdi587; X64-NEXT:    shll $2, %edi588; X64-NEXT:    leal (%rdi,%rdi,4), %eax589; X64-NEXT:    retq590;591; X86-NOOPT-LABEL: test_mul_by_20:592; X86-NOOPT:       # %bb.0:593; X86-NOOPT-NEXT:    imull $20, {{[0-9]+}}(%esp), %eax594; X86-NOOPT-NEXT:    retl595;596; X64-NOOPT-LABEL: test_mul_by_20:597; X64-NOOPT:       # %bb.0:598; X64-NOOPT-NEXT:    imull $20, %edi, %eax599; X64-NOOPT-NEXT:    retq600  %mul = mul nsw i32 %x, 20601  ret i32 %mul602}603 604define i32 @test_mul_by_21(i32 %x) {605; X86-LABEL: test_mul_by_21:606; X86:       # %bb.0:607; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax608; X86-NEXT:    leal (%eax,%eax,4), %ecx609; X86-NEXT:    leal (%eax,%ecx,4), %eax610; X86-NEXT:    retl611;612; X64-HSW-LABEL: test_mul_by_21:613; X64-HSW:       # %bb.0:614; X64-HSW-NEXT:    # kill: def $edi killed $edi def $rdi615; X64-HSW-NEXT:    leal (%rdi,%rdi,4), %eax616; X64-HSW-NEXT:    leal (%rdi,%rax,4), %eax617; X64-HSW-NEXT:    retq618;619; X64-JAG-LABEL: test_mul_by_21:620; X64-JAG:       # %bb.0:621; X64-JAG-NEXT:    # kill: def $edi killed $edi def $rdi622; X64-JAG-NEXT:    leal (%rdi,%rdi,4), %eax623; X64-JAG-NEXT:    leal (%rdi,%rax,4), %eax624; X64-JAG-NEXT:    retq625;626; X86-NOOPT-LABEL: test_mul_by_21:627; X86-NOOPT:       # %bb.0:628; X86-NOOPT-NEXT:    imull $21, {{[0-9]+}}(%esp), %eax629; X86-NOOPT-NEXT:    retl630;631; X64-NOOPT-LABEL: test_mul_by_21:632; X64-NOOPT:       # %bb.0:633; X64-NOOPT-NEXT:    imull $21, %edi, %eax634; X64-NOOPT-NEXT:    retq635;636; X64-SLM-LABEL: test_mul_by_21:637; X64-SLM:       # %bb.0:638; X64-SLM-NEXT:    imull $21, %edi, %eax639; X64-SLM-NEXT:    retq640  %mul = mul nsw i32 %x, 21641  ret i32 %mul642}643 644define i32 @test_mul_by_22(i32 %x) {645; X86-LABEL: test_mul_by_22:646; X86:       # %bb.0:647; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx648; X86-NEXT:    leal (%ecx,%ecx,4), %eax649; X86-NEXT:    leal (%ecx,%eax,4), %eax650; X86-NEXT:    addl %ecx, %eax651; X86-NEXT:    retl652;653; X64-HSW-LABEL: test_mul_by_22:654; X64-HSW:       # %bb.0:655; X64-HSW-NEXT:    # kill: def $edi killed $edi def $rdi656; X64-HSW-NEXT:    leal (%rdi,%rdi,4), %eax657; X64-HSW-NEXT:    leal (%rdi,%rax,4), %eax658; X64-HSW-NEXT:    addl %edi, %eax659; X64-HSW-NEXT:    retq660;661; X64-JAG-LABEL: test_mul_by_22:662; X64-JAG:       # %bb.0:663; X64-JAG-NEXT:    # kill: def $edi killed $edi def $rdi664; X64-JAG-NEXT:    leal (%rdi,%rdi,4), %eax665; X64-JAG-NEXT:    leal (%rdi,%rax,4), %eax666; X64-JAG-NEXT:    addl %edi, %eax667; X64-JAG-NEXT:    retq668;669; X86-NOOPT-LABEL: test_mul_by_22:670; X86-NOOPT:       # %bb.0:671; X86-NOOPT-NEXT:    imull $22, {{[0-9]+}}(%esp), %eax672; X86-NOOPT-NEXT:    retl673;674; X64-NOOPT-LABEL: test_mul_by_22:675; X64-NOOPT:       # %bb.0:676; X64-NOOPT-NEXT:    imull $22, %edi, %eax677; X64-NOOPT-NEXT:    retq678;679; X64-SLM-LABEL: test_mul_by_22:680; X64-SLM:       # %bb.0:681; X64-SLM-NEXT:    imull $22, %edi, %eax682; X64-SLM-NEXT:    retq683  %mul = mul nsw i32 %x, 22684  ret i32 %mul685}686 687define i32 @test_mul_by_23(i32 %x) {688; X86-LABEL: test_mul_by_23:689; X86:       # %bb.0:690; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx691; X86-NEXT:    leal (%ecx,%ecx,2), %eax692; X86-NEXT:    shll $3, %eax693; X86-NEXT:    subl %ecx, %eax694; X86-NEXT:    retl695;696; X64-HSW-LABEL: test_mul_by_23:697; X64-HSW:       # %bb.0:698; X64-HSW-NEXT:    # kill: def $edi killed $edi def $rdi699; X64-HSW-NEXT:    leal (%rdi,%rdi,2), %eax700; X64-HSW-NEXT:    shll $3, %eax701; X64-HSW-NEXT:    subl %edi, %eax702; X64-HSW-NEXT:    retq703;704; X64-JAG-LABEL: test_mul_by_23:705; X64-JAG:       # %bb.0:706; X64-JAG-NEXT:    # kill: def $edi killed $edi def $rdi707; X64-JAG-NEXT:    leal (%rdi,%rdi,2), %eax708; X64-JAG-NEXT:    shll $3, %eax709; X64-JAG-NEXT:    subl %edi, %eax710; X64-JAG-NEXT:    retq711;712; X86-NOOPT-LABEL: test_mul_by_23:713; X86-NOOPT:       # %bb.0:714; X86-NOOPT-NEXT:    imull $23, {{[0-9]+}}(%esp), %eax715; X86-NOOPT-NEXT:    retl716;717; X64-NOOPT-LABEL: test_mul_by_23:718; X64-NOOPT:       # %bb.0:719; X64-NOOPT-NEXT:    imull $23, %edi, %eax720; X64-NOOPT-NEXT:    retq721;722; X64-SLM-LABEL: test_mul_by_23:723; X64-SLM:       # %bb.0:724; X64-SLM-NEXT:    imull $23, %edi, %eax725; X64-SLM-NEXT:    retq726  %mul = mul nsw i32 %x, 23727  ret i32 %mul728}729 730define i32 @test_mul_by_24(i32 %x) {731; X86-LABEL: test_mul_by_24:732; X86:       # %bb.0:733; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax734; X86-NEXT:    shll $3, %eax735; X86-NEXT:    leal (%eax,%eax,2), %eax736; X86-NEXT:    retl737;738; X64-LABEL: test_mul_by_24:739; X64:       # %bb.0:740; X64-NEXT:    # kill: def $edi killed $edi def $rdi741; X64-NEXT:    shll $3, %edi742; X64-NEXT:    leal (%rdi,%rdi,2), %eax743; X64-NEXT:    retq744;745; X86-NOOPT-LABEL: test_mul_by_24:746; X86-NOOPT:       # %bb.0:747; X86-NOOPT-NEXT:    imull $24, {{[0-9]+}}(%esp), %eax748; X86-NOOPT-NEXT:    retl749;750; X64-NOOPT-LABEL: test_mul_by_24:751; X64-NOOPT:       # %bb.0:752; X64-NOOPT-NEXT:    imull $24, %edi, %eax753; X64-NOOPT-NEXT:    retq754  %mul = mul nsw i32 %x, 24755  ret i32 %mul756}757 758define i32 @test_mul_by_25(i32 %x) {759; X86-LABEL: test_mul_by_25:760; X86:       # %bb.0:761; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax762; X86-NEXT:    leal (%eax,%eax,4), %eax763; X86-NEXT:    leal (%eax,%eax,4), %eax764; X86-NEXT:    retl765;766; X64-LABEL: test_mul_by_25:767; X64:       # %bb.0:768; X64-NEXT:    # kill: def $edi killed $edi def $rdi769; X64-NEXT:    leal (%rdi,%rdi,4), %eax770; X64-NEXT:    leal (%rax,%rax,4), %eax771; X64-NEXT:    retq772;773; X86-NOOPT-LABEL: test_mul_by_25:774; X86-NOOPT:       # %bb.0:775; X86-NOOPT-NEXT:    imull $25, {{[0-9]+}}(%esp), %eax776; X86-NOOPT-NEXT:    retl777;778; X64-NOOPT-LABEL: test_mul_by_25:779; X64-NOOPT:       # %bb.0:780; X64-NOOPT-NEXT:    imull $25, %edi, %eax781; X64-NOOPT-NEXT:    retq782  %mul = mul nsw i32 %x, 25783  ret i32 %mul784}785 786define i32 @test_mul_by_26(i32 %x) {787; X86-LABEL: test_mul_by_26:788; X86:       # %bb.0:789; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx790; X86-NEXT:    leal (%ecx,%ecx,4), %eax791; X86-NEXT:    leal (%eax,%eax,4), %eax792; X86-NEXT:    addl %ecx, %eax793; X86-NEXT:    retl794;795; X64-HSW-LABEL: test_mul_by_26:796; X64-HSW:       # %bb.0:797; X64-HSW-NEXT:    # kill: def $edi killed $edi def $rdi798; X64-HSW-NEXT:    leal (%rdi,%rdi,4), %eax799; X64-HSW-NEXT:    leal (%rax,%rax,4), %eax800; X64-HSW-NEXT:    addl %edi, %eax801; X64-HSW-NEXT:    retq802;803; X64-JAG-LABEL: test_mul_by_26:804; X64-JAG:       # %bb.0:805; X64-JAG-NEXT:    # kill: def $edi killed $edi def $rdi806; X64-JAG-NEXT:    leal (%rdi,%rdi,4), %eax807; X64-JAG-NEXT:    leal (%rax,%rax,4), %eax808; X64-JAG-NEXT:    addl %edi, %eax809; X64-JAG-NEXT:    retq810;811; X86-NOOPT-LABEL: test_mul_by_26:812; X86-NOOPT:       # %bb.0:813; X86-NOOPT-NEXT:    imull $26, {{[0-9]+}}(%esp), %eax814; X86-NOOPT-NEXT:    retl815;816; X64-NOOPT-LABEL: test_mul_by_26:817; X64-NOOPT:       # %bb.0:818; X64-NOOPT-NEXT:    imull $26, %edi, %eax819; X64-NOOPT-NEXT:    retq820;821; X64-SLM-LABEL: test_mul_by_26:822; X64-SLM:       # %bb.0:823; X64-SLM-NEXT:    imull $26, %edi, %eax824; X64-SLM-NEXT:    retq825  %mul = mul nsw i32 %x, 26826  ret i32 %mul827}828 829define i32 @test_mul_by_27(i32 %x) {830; X86-LABEL: test_mul_by_27:831; X86:       # %bb.0:832; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax833; X86-NEXT:    leal (%eax,%eax,8), %eax834; X86-NEXT:    leal (%eax,%eax,2), %eax835; X86-NEXT:    retl836;837; X64-LABEL: test_mul_by_27:838; X64:       # %bb.0:839; X64-NEXT:    # kill: def $edi killed $edi def $rdi840; X64-NEXT:    leal (%rdi,%rdi,8), %eax841; X64-NEXT:    leal (%rax,%rax,2), %eax842; X64-NEXT:    retq843;844; X86-NOOPT-LABEL: test_mul_by_27:845; X86-NOOPT:       # %bb.0:846; X86-NOOPT-NEXT:    imull $27, {{[0-9]+}}(%esp), %eax847; X86-NOOPT-NEXT:    retl848;849; X64-NOOPT-LABEL: test_mul_by_27:850; X64-NOOPT:       # %bb.0:851; X64-NOOPT-NEXT:    imull $27, %edi, %eax852; X64-NOOPT-NEXT:    retq853  %mul = mul nsw i32 %x, 27854  ret i32 %mul855}856 857define i32 @test_mul_by_28(i32 %x) {858; X86-LABEL: test_mul_by_28:859; X86:       # %bb.0:860; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx861; X86-NEXT:    leal (%ecx,%ecx,8), %eax862; X86-NEXT:    leal (%eax,%eax,2), %eax863; X86-NEXT:    addl %ecx, %eax864; X86-NEXT:    retl865;866; X64-HSW-LABEL: test_mul_by_28:867; X64-HSW:       # %bb.0:868; X64-HSW-NEXT:    # kill: def $edi killed $edi def $rdi869; X64-HSW-NEXT:    leal (%rdi,%rdi,8), %eax870; X64-HSW-NEXT:    leal (%rax,%rax,2), %eax871; X64-HSW-NEXT:    addl %edi, %eax872; X64-HSW-NEXT:    retq873;874; X64-JAG-LABEL: test_mul_by_28:875; X64-JAG:       # %bb.0:876; X64-JAG-NEXT:    # kill: def $edi killed $edi def $rdi877; X64-JAG-NEXT:    leal (%rdi,%rdi,8), %eax878; X64-JAG-NEXT:    leal (%rax,%rax,2), %eax879; X64-JAG-NEXT:    addl %edi, %eax880; X64-JAG-NEXT:    retq881;882; X86-NOOPT-LABEL: test_mul_by_28:883; X86-NOOPT:       # %bb.0:884; X86-NOOPT-NEXT:    imull $28, {{[0-9]+}}(%esp), %eax885; X86-NOOPT-NEXT:    retl886;887; X64-NOOPT-LABEL: test_mul_by_28:888; X64-NOOPT:       # %bb.0:889; X64-NOOPT-NEXT:    imull $28, %edi, %eax890; X64-NOOPT-NEXT:    retq891;892; X64-SLM-LABEL: test_mul_by_28:893; X64-SLM:       # %bb.0:894; X64-SLM-NEXT:    imull $28, %edi, %eax895; X64-SLM-NEXT:    retq896  %mul = mul nsw i32 %x, 28897  ret i32 %mul898}899 900define i32 @test_mul_by_29(i32 %x) {901; X86-LABEL: test_mul_by_29:902; X86:       # %bb.0:903; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax904; X86-NEXT:    leal (%eax,%eax,8), %ecx905; X86-NEXT:    leal (%ecx,%ecx,2), %ecx906; X86-NEXT:    addl %eax, %eax907; X86-NEXT:    addl %ecx, %eax908; X86-NEXT:    retl909;910; X64-HSW-LABEL: test_mul_by_29:911; X64-HSW:       # %bb.0:912; X64-HSW-NEXT:    # kill: def $edi killed $edi def $rdi913; X64-HSW-NEXT:    leal (%rdi,%rdi,8), %eax914; X64-HSW-NEXT:    leal (%rax,%rax,2), %eax915; X64-HSW-NEXT:    addl %edi, %eax916; X64-HSW-NEXT:    addl %edi, %eax917; X64-HSW-NEXT:    retq918;919; X64-JAG-LABEL: test_mul_by_29:920; X64-JAG:       # %bb.0:921; X64-JAG-NEXT:    # kill: def $edi killed $edi def $rdi922; X64-JAG-NEXT:    leal (%rdi,%rdi,8), %eax923; X64-JAG-NEXT:    leal (%rax,%rax,2), %eax924; X64-JAG-NEXT:    addl %edi, %eax925; X64-JAG-NEXT:    addl %edi, %eax926; X64-JAG-NEXT:    retq927;928; X86-NOOPT-LABEL: test_mul_by_29:929; X86-NOOPT:       # %bb.0:930; X86-NOOPT-NEXT:    imull $29, {{[0-9]+}}(%esp), %eax931; X86-NOOPT-NEXT:    retl932;933; X64-NOOPT-LABEL: test_mul_by_29:934; X64-NOOPT:       # %bb.0:935; X64-NOOPT-NEXT:    imull $29, %edi, %eax936; X64-NOOPT-NEXT:    retq937;938; X64-SLM-LABEL: test_mul_by_29:939; X64-SLM:       # %bb.0:940; X64-SLM-NEXT:    imull $29, %edi, %eax941; X64-SLM-NEXT:    retq942  %mul = mul nsw i32 %x, 29943  ret i32 %mul944}945 946define i32 @test_mul_by_30(i32 %x) {947; X86-LABEL: test_mul_by_30:948; X86:       # %bb.0:949; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax950; X86-NEXT:    leal (%eax,%eax), %ecx951; X86-NEXT:    shll $5, %eax952; X86-NEXT:    subl %ecx, %eax953; X86-NEXT:    retl954;955; X64-LABEL: test_mul_by_30:956; X64:       # %bb.0:957; X64-NEXT:    movl %edi, %eax958; X64-NEXT:    leal (%rax,%rax), %ecx959; X64-NEXT:    shll $5, %eax960; X64-NEXT:    subl %ecx, %eax961; X64-NEXT:    # kill: def $eax killed $eax killed $rax962; X64-NEXT:    retq963;964; X86-NOOPT-LABEL: test_mul_by_30:965; X86-NOOPT:       # %bb.0:966; X86-NOOPT-NEXT:    imull $30, {{[0-9]+}}(%esp), %eax967; X86-NOOPT-NEXT:    retl968;969; X64-NOOPT-LABEL: test_mul_by_30:970; X64-NOOPT:       # %bb.0:971; X64-NOOPT-NEXT:    imull $30, %edi, %eax972; X64-NOOPT-NEXT:    retq973  %mul = mul nsw i32 %x, 30974  ret i32 %mul975}976 977define i32 @test_mul_by_31(i32 %x) {978; X86-LABEL: test_mul_by_31:979; X86:       # %bb.0:980; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx981; X86-NEXT:    movl %ecx, %eax982; X86-NEXT:    shll $5, %eax983; X86-NEXT:    subl %ecx, %eax984; X86-NEXT:    retl985;986; X64-LABEL: test_mul_by_31:987; X64:       # %bb.0:988; X64-NEXT:    movl %edi, %eax989; X64-NEXT:    shll $5, %eax990; X64-NEXT:    subl %edi, %eax991; X64-NEXT:    retq992;993; X86-NOOPT-LABEL: test_mul_by_31:994; X86-NOOPT:       # %bb.0:995; X86-NOOPT-NEXT:    imull $31, {{[0-9]+}}(%esp), %eax996; X86-NOOPT-NEXT:    retl997;998; X64-NOOPT-LABEL: test_mul_by_31:999; X64-NOOPT:       # %bb.0:1000; X64-NOOPT-NEXT:    imull $31, %edi, %eax1001; X64-NOOPT-NEXT:    retq1002  %mul = mul nsw i32 %x, 311003  ret i32 %mul1004}1005 1006define i32 @test_mul_by_32(i32 %x) {1007; X86-LABEL: test_mul_by_32:1008; X86:       # %bb.0:1009; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax1010; X86-NEXT:    shll $5, %eax1011; X86-NEXT:    retl1012;1013; X64-LABEL: test_mul_by_32:1014; X64:       # %bb.0:1015; X64-NEXT:    movl %edi, %eax1016; X64-NEXT:    shll $5, %eax1017; X64-NEXT:    retq1018;1019; X86-NOOPT-LABEL: test_mul_by_32:1020; X86-NOOPT:       # %bb.0:1021; X86-NOOPT-NEXT:    movl {{[0-9]+}}(%esp), %eax1022; X86-NOOPT-NEXT:    shll $5, %eax1023; X86-NOOPT-NEXT:    retl1024;1025; X64-NOOPT-LABEL: test_mul_by_32:1026; X64-NOOPT:       # %bb.0:1027; X64-NOOPT-NEXT:    movl %edi, %eax1028; X64-NOOPT-NEXT:    shll $5, %eax1029; X64-NOOPT-NEXT:    retq1030  %mul = mul nsw i32 %x, 321031  ret i32 %mul1032}1033 1034define i32 @test_mul_by_37(i32 %x) {1035; X86-LABEL: test_mul_by_37:1036; X86:       # %bb.0:1037; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax1038; X86-NEXT:    leal (%eax,%eax,8), %ecx1039; X86-NEXT:    leal (%eax,%ecx,4), %eax1040; X86-NEXT:    retl1041;1042; X64-HSW-LABEL: test_mul_by_37:1043; X64-HSW:       # %bb.0:1044; X64-HSW-NEXT:    # kill: def $edi killed $edi def $rdi1045; X64-HSW-NEXT:    leal (%rdi,%rdi,8), %eax1046; X64-HSW-NEXT:    leal (%rdi,%rax,4), %eax1047; X64-HSW-NEXT:    retq1048;1049; X64-JAG-LABEL: test_mul_by_37:1050; X64-JAG:       # %bb.0:1051; X64-JAG-NEXT:    # kill: def $edi killed $edi def $rdi1052; X64-JAG-NEXT:    leal (%rdi,%rdi,8), %eax1053; X64-JAG-NEXT:    leal (%rdi,%rax,4), %eax1054; X64-JAG-NEXT:    retq1055;1056; X86-NOOPT-LABEL: test_mul_by_37:1057; X86-NOOPT:       # %bb.0:1058; X86-NOOPT-NEXT:    imull $37, {{[0-9]+}}(%esp), %eax1059; X86-NOOPT-NEXT:    retl1060;1061; X64-NOOPT-LABEL: test_mul_by_37:1062; X64-NOOPT:       # %bb.0:1063; X64-NOOPT-NEXT:    imull $37, %edi, %eax1064; X64-NOOPT-NEXT:    retq1065;1066; X64-SLM-LABEL: test_mul_by_37:1067; X64-SLM:       # %bb.0:1068; X64-SLM-NEXT:    imull $37, %edi, %eax1069; X64-SLM-NEXT:    retq1070  %mul = mul nsw i32 %x, 371071  ret i32 %mul1072}1073 1074define i32 @test_mul_by_41(i32 %x) {1075; X86-LABEL: test_mul_by_41:1076; X86:       # %bb.0:1077; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax1078; X86-NEXT:    leal (%eax,%eax,4), %ecx1079; X86-NEXT:    leal (%eax,%ecx,8), %eax1080; X86-NEXT:    retl1081;1082; X64-HSW-LABEL: test_mul_by_41:1083; X64-HSW:       # %bb.0:1084; X64-HSW-NEXT:    # kill: def $edi killed $edi def $rdi1085; X64-HSW-NEXT:    leal (%rdi,%rdi,4), %eax1086; X64-HSW-NEXT:    leal (%rdi,%rax,8), %eax1087; X64-HSW-NEXT:    retq1088;1089; X64-JAG-LABEL: test_mul_by_41:1090; X64-JAG:       # %bb.0:1091; X64-JAG-NEXT:    # kill: def $edi killed $edi def $rdi1092; X64-JAG-NEXT:    leal (%rdi,%rdi,4), %eax1093; X64-JAG-NEXT:    leal (%rdi,%rax,8), %eax1094; X64-JAG-NEXT:    retq1095;1096; X86-NOOPT-LABEL: test_mul_by_41:1097; X86-NOOPT:       # %bb.0:1098; X86-NOOPT-NEXT:    imull $41, {{[0-9]+}}(%esp), %eax1099; X86-NOOPT-NEXT:    retl1100;1101; X64-NOOPT-LABEL: test_mul_by_41:1102; X64-NOOPT:       # %bb.0:1103; X64-NOOPT-NEXT:    imull $41, %edi, %eax1104; X64-NOOPT-NEXT:    retq1105;1106; X64-SLM-LABEL: test_mul_by_41:1107; X64-SLM:       # %bb.0:1108; X64-SLM-NEXT:    imull $41, %edi, %eax1109; X64-SLM-NEXT:    retq1110  %mul = mul nsw i32 %x, 411111  ret i32 %mul1112}1113 1114define i32 @test_mul_by_62(i32 %x) {1115; X86-LABEL: test_mul_by_62:1116; X86:       # %bb.0:1117; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax1118; X86-NEXT:    leal (%eax,%eax), %ecx1119; X86-NEXT:    shll $6, %eax1120; X86-NEXT:    subl %ecx, %eax1121; X86-NEXT:    retl1122;1123; X64-LABEL: test_mul_by_62:1124; X64:       # %bb.0:1125; X64-NEXT:    movl %edi, %eax1126; X64-NEXT:    leal (%rax,%rax), %ecx1127; X64-NEXT:    shll $6, %eax1128; X64-NEXT:    subl %ecx, %eax1129; X64-NEXT:    # kill: def $eax killed $eax killed $rax1130; X64-NEXT:    retq1131;1132; X86-NOOPT-LABEL: test_mul_by_62:1133; X86-NOOPT:       # %bb.0:1134; X86-NOOPT-NEXT:    imull $62, {{[0-9]+}}(%esp), %eax1135; X86-NOOPT-NEXT:    retl1136;1137; X64-NOOPT-LABEL: test_mul_by_62:1138; X64-NOOPT:       # %bb.0:1139; X64-NOOPT-NEXT:    imull $62, %edi, %eax1140; X64-NOOPT-NEXT:    retq1141  %mul = mul nsw i32 %x, 621142  ret i32 %mul1143}1144 1145define i32 @test_mul_by_66(i32 %x) {1146; X86-LABEL: test_mul_by_66:1147; X86:       # %bb.0:1148; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax1149; X86-NEXT:    movl %eax, %ecx1150; X86-NEXT:    shll $6, %ecx1151; X86-NEXT:    leal (%ecx,%eax,2), %eax1152; X86-NEXT:    retl1153;1154; X64-HSW-LABEL: test_mul_by_66:1155; X64-HSW:       # %bb.0:1156; X64-HSW-NEXT:    # kill: def $edi killed $edi def $rdi1157; X64-HSW-NEXT:    movl %edi, %eax1158; X64-HSW-NEXT:    shll $6, %edi1159; X64-HSW-NEXT:    leal (%rdi,%rax,2), %eax1160; X64-HSW-NEXT:    retq1161;1162; X64-JAG-LABEL: test_mul_by_66:1163; X64-JAG:       # %bb.0:1164; X64-JAG-NEXT:    # kill: def $edi killed $edi def $rdi1165; X64-JAG-NEXT:    movl %edi, %eax1166; X64-JAG-NEXT:    shll $6, %edi1167; X64-JAG-NEXT:    leal (%rdi,%rax,2), %eax1168; X64-JAG-NEXT:    retq1169;1170; X86-NOOPT-LABEL: test_mul_by_66:1171; X86-NOOPT:       # %bb.0:1172; X86-NOOPT-NEXT:    imull $66, {{[0-9]+}}(%esp), %eax1173; X86-NOOPT-NEXT:    retl1174;1175; X64-NOOPT-LABEL: test_mul_by_66:1176; X64-NOOPT:       # %bb.0:1177; X64-NOOPT-NEXT:    imull $66, %edi, %eax1178; X64-NOOPT-NEXT:    retq1179;1180; X64-SLM-LABEL: test_mul_by_66:1181; X64-SLM:       # %bb.0:1182; X64-SLM-NEXT:    # kill: def $edi killed $edi def $rdi1183; X64-SLM-NEXT:    leal (%rdi,%rdi), %eax1184; X64-SLM-NEXT:    shll $6, %edi1185; X64-SLM-NEXT:    addl %edi, %eax1186; X64-SLM-NEXT:    retq1187  %mul = mul nsw i32 %x, 661188  ret i32 %mul1189}1190 1191define i32 @test_mul_by_73(i32 %x) {1192; X86-LABEL: test_mul_by_73:1193; X86:       # %bb.0:1194; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax1195; X86-NEXT:    leal (%eax,%eax,8), %ecx1196; X86-NEXT:    leal (%eax,%ecx,8), %eax1197; X86-NEXT:    retl1198;1199; X64-HSW-LABEL: test_mul_by_73:1200; X64-HSW:       # %bb.0:1201; X64-HSW-NEXT:    # kill: def $edi killed $edi def $rdi1202; X64-HSW-NEXT:    leal (%rdi,%rdi,8), %eax1203; X64-HSW-NEXT:    leal (%rdi,%rax,8), %eax1204; X64-HSW-NEXT:    retq1205;1206; X64-JAG-LABEL: test_mul_by_73:1207; X64-JAG:       # %bb.0:1208; X64-JAG-NEXT:    # kill: def $edi killed $edi def $rdi1209; X64-JAG-NEXT:    leal (%rdi,%rdi,8), %eax1210; X64-JAG-NEXT:    leal (%rdi,%rax,8), %eax1211; X64-JAG-NEXT:    retq1212;1213; X86-NOOPT-LABEL: test_mul_by_73:1214; X86-NOOPT:       # %bb.0:1215; X86-NOOPT-NEXT:    imull $73, {{[0-9]+}}(%esp), %eax1216; X86-NOOPT-NEXT:    retl1217;1218; X64-NOOPT-LABEL: test_mul_by_73:1219; X64-NOOPT:       # %bb.0:1220; X64-NOOPT-NEXT:    imull $73, %edi, %eax1221; X64-NOOPT-NEXT:    retq1222;1223; X64-SLM-LABEL: test_mul_by_73:1224; X64-SLM:       # %bb.0:1225; X64-SLM-NEXT:    imull $73, %edi, %eax1226; X64-SLM-NEXT:    retq1227  %mul = mul nsw i32 %x, 731228  ret i32 %mul1229}1230 1231define i32 @test_mul_by_520(i32 %x) {1232; X86-LABEL: test_mul_by_520:1233; X86:       # %bb.0:1234; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax1235; X86-NEXT:    movl %eax, %ecx1236; X86-NEXT:    shll $9, %ecx1237; X86-NEXT:    leal (%ecx,%eax,8), %eax1238; X86-NEXT:    retl1239;1240; X64-HSW-LABEL: test_mul_by_520:1241; X64-HSW:       # %bb.0:1242; X64-HSW-NEXT:    # kill: def $edi killed $edi def $rdi1243; X64-HSW-NEXT:    movl %edi, %eax1244; X64-HSW-NEXT:    shll $9, %edi1245; X64-HSW-NEXT:    leal (%rdi,%rax,8), %eax1246; X64-HSW-NEXT:    retq1247;1248; X64-JAG-LABEL: test_mul_by_520:1249; X64-JAG:       # %bb.0:1250; X64-JAG-NEXT:    # kill: def $edi killed $edi def $rdi1251; X64-JAG-NEXT:    movl %edi, %eax1252; X64-JAG-NEXT:    shll $9, %edi1253; X64-JAG-NEXT:    leal (%rdi,%rax,8), %eax1254; X64-JAG-NEXT:    retq1255;1256; X86-NOOPT-LABEL: test_mul_by_520:1257; X86-NOOPT:       # %bb.0:1258; X86-NOOPT-NEXT:    imull $520, {{[0-9]+}}(%esp), %eax # imm = 0x2081259; X86-NOOPT-NEXT:    retl1260;1261; X64-NOOPT-LABEL: test_mul_by_520:1262; X64-NOOPT:       # %bb.0:1263; X64-NOOPT-NEXT:    imull $520, %edi, %eax # imm = 0x2081264; X64-NOOPT-NEXT:    retq1265;1266; X64-SLM-LABEL: test_mul_by_520:1267; X64-SLM:       # %bb.0:1268; X64-SLM-NEXT:    imull $520, %edi, %eax # imm = 0x2081269; X64-SLM-NEXT:    retq1270  %mul = mul nsw i32 %x, 5201271  ret i32 %mul1272}1273 1274define i32 @test_mul_by_neg10(i32 %x) {1275; X86-LABEL: test_mul_by_neg10:1276; X86:       # %bb.0:1277; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax1278; X86-NEXT:    addl %eax, %eax1279; X86-NEXT:    leal (%eax,%eax,4), %eax1280; X86-NEXT:    negl %eax1281; X86-NEXT:    retl1282;1283; X64-LABEL: test_mul_by_neg10:1284; X64:       # %bb.0:1285; X64-NEXT:    # kill: def $edi killed $edi def $rdi1286; X64-NEXT:    addl %edi, %edi1287; X64-NEXT:    leal (%rdi,%rdi,4), %eax1288; X64-NEXT:    negl %eax1289; X64-NEXT:    retq1290;1291; X86-NOOPT-LABEL: test_mul_by_neg10:1292; X86-NOOPT:       # %bb.0:1293; X86-NOOPT-NEXT:    imull $-10, {{[0-9]+}}(%esp), %eax1294; X86-NOOPT-NEXT:    retl1295;1296; X64-NOOPT-LABEL: test_mul_by_neg10:1297; X64-NOOPT:       # %bb.0:1298; X64-NOOPT-NEXT:    imull $-10, %edi, %eax1299; X64-NOOPT-NEXT:    retq1300  %mul = mul nsw i32 %x, -101301  ret i32 %mul1302}1303 1304define i32 @test_mul_by_neg36(i32 %x) {1305; X86-LABEL: test_mul_by_neg36:1306; X86:       # %bb.0:1307; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax1308; X86-NEXT:    shll $2, %eax1309; X86-NEXT:    leal (%eax,%eax,8), %eax1310; X86-NEXT:    negl %eax1311; X86-NEXT:    retl1312;1313; X64-LABEL: test_mul_by_neg36:1314; X64:       # %bb.0:1315; X64-NEXT:    # kill: def $edi killed $edi def $rdi1316; X64-NEXT:    shll $2, %edi1317; X64-NEXT:    leal (%rdi,%rdi,8), %eax1318; X64-NEXT:    negl %eax1319; X64-NEXT:    retq1320;1321; X86-NOOPT-LABEL: test_mul_by_neg36:1322; X86-NOOPT:       # %bb.0:1323; X86-NOOPT-NEXT:    imull $-36, {{[0-9]+}}(%esp), %eax1324; X86-NOOPT-NEXT:    retl1325;1326; X64-NOOPT-LABEL: test_mul_by_neg36:1327; X64-NOOPT:       # %bb.0:1328; X64-NOOPT-NEXT:    imull $-36, %edi, %eax1329; X64-NOOPT-NEXT:    retq1330  %mul = mul nsw i32 %x, -361331  ret i32 %mul1332}1333 1334; (x*9+42)*(x*5+2)1335define i32 @test_mul_spec(i32 %x) nounwind {1336; X86-LABEL: test_mul_spec:1337; X86:       # %bb.0:1338; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax1339; X86-NEXT:    leal 42(%eax,%eax,8), %ecx1340; X86-NEXT:    leal 2(%eax,%eax,4), %eax1341; X86-NEXT:    imull %ecx, %eax1342; X86-NEXT:    retl1343;1344; X64-HSW-LABEL: test_mul_spec:1345; X64-HSW:       # %bb.0:1346; X64-HSW-NEXT:    # kill: def $edi killed $edi def $rdi1347; X64-HSW-NEXT:    leal (%rdi,%rdi,8), %ecx1348; X64-HSW-NEXT:    addl $42, %ecx1349; X64-HSW-NEXT:    leal (%rdi,%rdi,4), %eax1350; X64-HSW-NEXT:    addl $2, %eax1351; X64-HSW-NEXT:    imull %ecx, %eax1352; X64-HSW-NEXT:    retq1353;1354; X64-JAG-LABEL: test_mul_spec:1355; X64-JAG:       # %bb.0:1356; X64-JAG-NEXT:    # kill: def $edi killed $edi def $rdi1357; X64-JAG-NEXT:    leal 42(%rdi,%rdi,8), %ecx1358; X64-JAG-NEXT:    leal 2(%rdi,%rdi,4), %eax1359; X64-JAG-NEXT:    imull %ecx, %eax1360; X64-JAG-NEXT:    retq1361;1362; X86-NOOPT-LABEL: test_mul_spec:1363; X86-NOOPT:       # %bb.0:1364; X86-NOOPT-NEXT:    movl {{[0-9]+}}(%esp), %eax1365; X86-NOOPT-NEXT:    leal 42(%eax,%eax,8), %ecx1366; X86-NOOPT-NEXT:    leal 2(%eax,%eax,4), %eax1367; X86-NOOPT-NEXT:    imull %ecx, %eax1368; X86-NOOPT-NEXT:    retl1369;1370; HSW-NOOPT-LABEL: test_mul_spec:1371; HSW-NOOPT:       # %bb.0:1372; HSW-NOOPT-NEXT:    # kill: def $edi killed $edi def $rdi1373; HSW-NOOPT-NEXT:    leal (%rdi,%rdi,8), %ecx1374; HSW-NOOPT-NEXT:    addl $42, %ecx1375; HSW-NOOPT-NEXT:    leal (%rdi,%rdi,4), %eax1376; HSW-NOOPT-NEXT:    addl $2, %eax1377; HSW-NOOPT-NEXT:    imull %ecx, %eax1378; HSW-NOOPT-NEXT:    retq1379;1380; JAG-NOOPT-LABEL: test_mul_spec:1381; JAG-NOOPT:       # %bb.0:1382; JAG-NOOPT-NEXT:    # kill: def $edi killed $edi def $rdi1383; JAG-NOOPT-NEXT:    leal 42(%rdi,%rdi,8), %ecx1384; JAG-NOOPT-NEXT:    leal 2(%rdi,%rdi,4), %eax1385; JAG-NOOPT-NEXT:    imull %ecx, %eax1386; JAG-NOOPT-NEXT:    retq1387;1388; X64-SLM-LABEL: test_mul_spec:1389; X64-SLM:       # %bb.0:1390; X64-SLM-NEXT:    # kill: def $edi killed $edi def $rdi1391; X64-SLM-NEXT:    leal 42(%rdi,%rdi,8), %ecx1392; X64-SLM-NEXT:    leal 2(%rdi,%rdi,4), %eax1393; X64-SLM-NEXT:    imull %ecx, %eax1394; X64-SLM-NEXT:    retq1395;1396; SLM-NOOPT-LABEL: test_mul_spec:1397; SLM-NOOPT:       # %bb.0:1398; SLM-NOOPT-NEXT:    # kill: def $edi killed $edi def $rdi1399; SLM-NOOPT-NEXT:    leal 42(%rdi,%rdi,8), %ecx1400; SLM-NOOPT-NEXT:    leal 2(%rdi,%rdi,4), %eax1401; SLM-NOOPT-NEXT:    imull %ecx, %eax1402; SLM-NOOPT-NEXT:    retq1403  %mul = mul nsw i32 %x, 91404  %add = add nsw i32 %mul, 421405  %mul2 = mul nsw i32 %x, 51406  %add2 = add nsw i32 %mul2, 21407  %mul3 = mul nsw i32 %add, %add21408  ret i32 %mul31409}1410 1411; This makes sure we are able to fold the negate generated by the mul expansion1412; into the next instruction.1413; FIXME: We make this work.1414define i32 @mul_neg_fold(i32 %a, i32 %b) {1415; X86-LABEL: mul_neg_fold:1416; X86:       # %bb.0:1417; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax1418; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx1419; X86-NEXT:    leal (%ecx,%ecx,8), %ecx1420; X86-NEXT:    subl %ecx, %eax1421; X86-NEXT:    retl1422;1423; X64-HSW-LABEL: mul_neg_fold:1424; X64-HSW:       # %bb.0:1425; X64-HSW-NEXT:    movl %esi, %eax1426; X64-HSW-NEXT:    # kill: def $edi killed $edi def $rdi1427; X64-HSW-NEXT:    leal (%rdi,%rdi,8), %ecx1428; X64-HSW-NEXT:    subl %ecx, %eax1429; X64-HSW-NEXT:    retq1430;1431; X64-JAG-LABEL: mul_neg_fold:1432; X64-JAG:       # %bb.0:1433; X64-JAG-NEXT:    # kill: def $edi killed $edi def $rdi1434; X64-JAG-NEXT:    leal (%rdi,%rdi,8), %ecx1435; X64-JAG-NEXT:    movl %esi, %eax1436; X64-JAG-NEXT:    subl %ecx, %eax1437; X64-JAG-NEXT:    retq1438;1439; X86-NOOPT-LABEL: mul_neg_fold:1440; X86-NOOPT:       # %bb.0:1441; X86-NOOPT-NEXT:    imull $-9, {{[0-9]+}}(%esp), %eax1442; X86-NOOPT-NEXT:    addl {{[0-9]+}}(%esp), %eax1443; X86-NOOPT-NEXT:    retl1444;1445; X64-NOOPT-LABEL: mul_neg_fold:1446; X64-NOOPT:       # %bb.0:1447; X64-NOOPT-NEXT:    imull $-9, %edi, %eax1448; X64-NOOPT-NEXT:    addl %esi, %eax1449; X64-NOOPT-NEXT:    retq1450;1451; X64-SLM-LABEL: mul_neg_fold:1452; X64-SLM:       # %bb.0:1453; X64-SLM-NEXT:    # kill: def $edi killed $edi def $rdi1454; X64-SLM-NEXT:    movl %esi, %eax1455; X64-SLM-NEXT:    leal (%rdi,%rdi,8), %ecx1456; X64-SLM-NEXT:    subl %ecx, %eax1457; X64-SLM-NEXT:    retq1458  %c = mul i32 %a, -91459  %d = add i32 %b, %c1460  ret i32 %d1461}1462