brintos

brintos / llvm-project-archived public Read only

0
0
Text · 27.9 KiB · 95831d5 Raw
915 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=x86_64-unknown-unknown -O3 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=DEFAULT3; RUN: llc -mtriple=x86_64-unknown-unknown -O3 -cgp-icmp-eq2icmp-st -verify-machineinstrs < %s | FileCheck %s --check-prefixes=EQ2ICMP4 5; Test cases are generated from:6; long long NAME(PARAM a, PARAM b) {7;   if (LHS > RHS)8;     return b;9;   if (LHS < RHS)10;     return a;\11;   return a * b;12; }13; Please note funtion name is defined as <PARAM>_<LHS>_<RHS>. Take ll_a_op_b__114; for example. ll is PARAM, a_op_b (i.e., a << b) is LHS, _1 (i.e., -1) is RHS.15 16target datalayout = "e-m:e-i64:64-n32:64"17 18define i64 @ll_a_op_b__2(i64 %a, i64 %b) {19; DEFAULT-LABEL: ll_a_op_b__2:20; DEFAULT:       # %bb.0: # %entry21; DEFAULT-NEXT:    movq %rsi, %rcx22; DEFAULT-NEXT:    movq %rdi, %rax23; DEFAULT-NEXT:    shlq %cl, %rax24; DEFAULT-NEXT:    cmpq $-2, %rax25; DEFAULT-NEXT:    jle .LBB0_126; DEFAULT-NEXT:  # %bb.2: # %return27; DEFAULT-NEXT:    movq %rcx, %rax28; DEFAULT-NEXT:    retq29; DEFAULT-NEXT:  .LBB0_1: # %if.end30; DEFAULT-NEXT:    movl $1, %eax31; DEFAULT-NEXT:    cmoveq %rcx, %rax32; DEFAULT-NEXT:    imulq %rdi, %rax33; DEFAULT-NEXT:    retq34;35; EQ2ICMP-LABEL: ll_a_op_b__2:36; EQ2ICMP:       # %bb.0: # %entry37; EQ2ICMP-NEXT:    movq %rsi, %rax38; EQ2ICMP-NEXT:    movq %rdi, %rdx39; EQ2ICMP-NEXT:    movl %eax, %ecx40; EQ2ICMP-NEXT:    shlq %cl, %rdx41; EQ2ICMP-NEXT:    cmpq $-2, %rdx42; EQ2ICMP-NEXT:    jg .LBB0_243; EQ2ICMP-NEXT:  # %bb.1: # %if.end44; EQ2ICMP-NEXT:    movl $1, %ecx45; EQ2ICMP-NEXT:    cmovlq %rcx, %rax46; EQ2ICMP-NEXT:    imulq %rdi, %rax47; EQ2ICMP-NEXT:  .LBB0_2: # %return48; EQ2ICMP-NEXT:    retq49entry:50  %shl = shl i64 %a, %b51  %cmp = icmp sgt i64 %shl, -252  br i1 %cmp, label %return, label %if.end53 54if.end:                                           ; preds = %entry55  %cmp2 = icmp eq i64 %shl, -256  %mul = select i1 %cmp2, i64 %b, i64 157  %spec.select = mul nsw i64 %mul, %a58  ret i64 %spec.select59 60return:                                           ; preds = %entry61  ret i64 %b62}63 64define i64 @ll_a_op_b__1(i64 %a, i64 %b) {65; DEFAULT-LABEL: ll_a_op_b__1:66; DEFAULT:       # %bb.0: # %entry67; DEFAULT-NEXT:    movq %rsi, %rcx68; DEFAULT-NEXT:    movq %rdi, %rax69; DEFAULT-NEXT:    shlq %cl, %rax70; DEFAULT-NEXT:    testq %rax, %rax71; DEFAULT-NEXT:    js .LBB1_172; DEFAULT-NEXT:  # %bb.2: # %return73; DEFAULT-NEXT:    movq %rcx, %rax74; DEFAULT-NEXT:    retq75; DEFAULT-NEXT:  .LBB1_1: # %if.end76; DEFAULT-NEXT:    cmpq $-1, %rax77; DEFAULT-NEXT:    movl $1, %eax78; DEFAULT-NEXT:    cmoveq %rcx, %rax79; DEFAULT-NEXT:    imulq %rdi, %rax80; DEFAULT-NEXT:    retq81;82; EQ2ICMP-LABEL: ll_a_op_b__1:83; EQ2ICMP:       # %bb.0: # %entry84; EQ2ICMP-NEXT:    movq %rsi, %rax85; EQ2ICMP-NEXT:    movq %rdi, %rdx86; EQ2ICMP-NEXT:    movl %eax, %ecx87; EQ2ICMP-NEXT:    shlq %cl, %rdx88; EQ2ICMP-NEXT:    testq %rdx, %rdx89; EQ2ICMP-NEXT:    js .LBB1_190; EQ2ICMP-NEXT:  # %bb.2: # %return91; EQ2ICMP-NEXT:    retq92; EQ2ICMP-NEXT:  .LBB1_1: # %if.end93; EQ2ICMP-NEXT:    cmpq $-1, %rdx94; EQ2ICMP-NEXT:    movl $1, %ecx95; EQ2ICMP-NEXT:    cmovlq %rcx, %rax96; EQ2ICMP-NEXT:    imulq %rdi, %rax97; EQ2ICMP-NEXT:    retq98entry:99  %shl = shl i64 %a, %b100  %cmp = icmp sgt i64 %shl, -1101  br i1 %cmp, label %return, label %if.end102 103if.end:                                           ; preds = %entry104  %cmp2 = icmp eq i64 %shl, -1105  %mul = select i1 %cmp2, i64 %b, i64 1106  %spec.select = mul nsw i64 %mul, %a107  ret i64 %spec.select108 109return:                                           ; preds = %entry110  ret i64 %b111}112 113define i64 @ll_a_op_b_0(i64 %a, i64 %b) {114; DEFAULT-LABEL: ll_a_op_b_0:115; DEFAULT:       # %bb.0: # %entry116; DEFAULT-NEXT:    movq %rsi, %rcx117; DEFAULT-NEXT:    movq %rdi, %rax118; DEFAULT-NEXT:    shlq %cl, %rax119; DEFAULT-NEXT:    testq %rax, %rax120; DEFAULT-NEXT:    jle .LBB2_1121; DEFAULT-NEXT:  # %bb.2: # %return122; DEFAULT-NEXT:    movq %rcx, %rax123; DEFAULT-NEXT:    retq124; DEFAULT-NEXT:  .LBB2_1: # %if.end125; DEFAULT-NEXT:    movl $1, %eax126; DEFAULT-NEXT:    cmoveq %rcx, %rax127; DEFAULT-NEXT:    imulq %rdi, %rax128; DEFAULT-NEXT:    retq129;130; EQ2ICMP-LABEL: ll_a_op_b_0:131; EQ2ICMP:       # %bb.0: # %entry132; EQ2ICMP-NEXT:    movq %rsi, %rax133; EQ2ICMP-NEXT:    movq %rdi, %rdx134; EQ2ICMP-NEXT:    movl %eax, %ecx135; EQ2ICMP-NEXT:    shlq %cl, %rdx136; EQ2ICMP-NEXT:    testq %rdx, %rdx137; EQ2ICMP-NEXT:    jle .LBB2_1138; EQ2ICMP-NEXT:  # %bb.2: # %return139; EQ2ICMP-NEXT:    retq140; EQ2ICMP-NEXT:  .LBB2_1: # %if.end141; EQ2ICMP-NEXT:    movl $1, %ecx142; EQ2ICMP-NEXT:    cmovsq %rcx, %rax143; EQ2ICMP-NEXT:    imulq %rdi, %rax144; EQ2ICMP-NEXT:    retq145entry:146  %shl = shl i64 %a, %b147  %cmp = icmp sgt i64 %shl, 0148  br i1 %cmp, label %return, label %if.end149 150if.end:                                           ; preds = %entry151  %cmp2 = icmp eq i64 %shl, 0152  %mul = select i1 %cmp2, i64 %b, i64 1153  %spec.select = mul nsw i64 %mul, %a154  ret i64 %spec.select155 156return:                                           ; preds = %entry157  ret i64 %b158}159 160define i64 @ll_a_op_b_1(i64 %a, i64 %b) {161; DEFAULT-LABEL: ll_a_op_b_1:162; DEFAULT:       # %bb.0: # %entry163; DEFAULT-NEXT:    movq %rsi, %rcx164; DEFAULT-NEXT:    movq %rdi, %rax165; DEFAULT-NEXT:    shlq %cl, %rax166; DEFAULT-NEXT:    cmpq $1, %rax167; DEFAULT-NEXT:    jle .LBB3_1168; DEFAULT-NEXT:  # %bb.2: # %return169; DEFAULT-NEXT:    movq %rcx, %rax170; DEFAULT-NEXT:    retq171; DEFAULT-NEXT:  .LBB3_1: # %if.end172; DEFAULT-NEXT:    movl $1, %eax173; DEFAULT-NEXT:    cmoveq %rcx, %rax174; DEFAULT-NEXT:    imulq %rdi, %rax175; DEFAULT-NEXT:    retq176;177; EQ2ICMP-LABEL: ll_a_op_b_1:178; EQ2ICMP:       # %bb.0: # %entry179; EQ2ICMP-NEXT:    movq %rsi, %rax180; EQ2ICMP-NEXT:    movq %rdi, %rdx181; EQ2ICMP-NEXT:    movl %eax, %ecx182; EQ2ICMP-NEXT:    shlq %cl, %rdx183; EQ2ICMP-NEXT:    cmpq $1, %rdx184; EQ2ICMP-NEXT:    jg .LBB3_2185; EQ2ICMP-NEXT:  # %bb.1: # %if.end186; EQ2ICMP-NEXT:    movl $1, %ecx187; EQ2ICMP-NEXT:    cmovlq %rcx, %rax188; EQ2ICMP-NEXT:    imulq %rdi, %rax189; EQ2ICMP-NEXT:  .LBB3_2: # %return190; EQ2ICMP-NEXT:    retq191entry:192  %shl = shl i64 %a, %b193  %cmp = icmp sgt i64 %shl, 1194  br i1 %cmp, label %return, label %if.end195 196if.end:                                           ; preds = %entry197  %cmp2 = icmp eq i64 %shl, 1198  %mul = select i1 %cmp2, i64 %b, i64 1199  %spec.select = mul nsw i64 %mul, %a200  ret i64 %spec.select201 202return:                                           ; preds = %entry203  ret i64 %b204}205 206define i64 @ll_a_op_b_2(i64 %a, i64 %b) {207; DEFAULT-LABEL: ll_a_op_b_2:208; DEFAULT:       # %bb.0: # %entry209; DEFAULT-NEXT:    movq %rsi, %rcx210; DEFAULT-NEXT:    movq %rdi, %rax211; DEFAULT-NEXT:    shlq %cl, %rax212; DEFAULT-NEXT:    cmpq $2, %rax213; DEFAULT-NEXT:    jle .LBB4_1214; DEFAULT-NEXT:  # %bb.2: # %return215; DEFAULT-NEXT:    movq %rcx, %rax216; DEFAULT-NEXT:    retq217; DEFAULT-NEXT:  .LBB4_1: # %if.end218; DEFAULT-NEXT:    movl $1, %eax219; DEFAULT-NEXT:    cmoveq %rcx, %rax220; DEFAULT-NEXT:    imulq %rdi, %rax221; DEFAULT-NEXT:    retq222;223; EQ2ICMP-LABEL: ll_a_op_b_2:224; EQ2ICMP:       # %bb.0: # %entry225; EQ2ICMP-NEXT:    movq %rsi, %rax226; EQ2ICMP-NEXT:    movq %rdi, %rdx227; EQ2ICMP-NEXT:    movl %eax, %ecx228; EQ2ICMP-NEXT:    shlq %cl, %rdx229; EQ2ICMP-NEXT:    cmpq $2, %rdx230; EQ2ICMP-NEXT:    jg .LBB4_2231; EQ2ICMP-NEXT:  # %bb.1: # %if.end232; EQ2ICMP-NEXT:    movl $1, %ecx233; EQ2ICMP-NEXT:    cmovlq %rcx, %rax234; EQ2ICMP-NEXT:    imulq %rdi, %rax235; EQ2ICMP-NEXT:  .LBB4_2: # %return236; EQ2ICMP-NEXT:    retq237entry:238  %shl = shl i64 %a, %b239  %cmp = icmp sgt i64 %shl, 2240  br i1 %cmp, label %return, label %if.end241 242if.end:                                           ; preds = %entry243  %cmp2 = icmp eq i64 %shl, 2244  %mul = select i1 %cmp2, i64 %b, i64 1245  %spec.select = mul nsw i64 %mul, %a246  ret i64 %spec.select247 248return:                                           ; preds = %entry249  ret i64 %b250}251 252define i64 @ll_a__2(i64 %a, i64 %b) {253; DEFAULT-LABEL: ll_a__2:254; DEFAULT:       # %bb.0: # %entry255; DEFAULT-NEXT:    cmpq $-2, %rdi256; DEFAULT-NEXT:    jle .LBB5_1257; DEFAULT-NEXT:  # %bb.2: # %return258; DEFAULT-NEXT:    movq %rsi, %rax259; DEFAULT-NEXT:    retq260; DEFAULT-NEXT:  .LBB5_1: # %if.end261; DEFAULT-NEXT:    movl $1, %eax262; DEFAULT-NEXT:    cmoveq %rsi, %rax263; DEFAULT-NEXT:    imulq %rdi, %rax264; DEFAULT-NEXT:    retq265;266; EQ2ICMP-LABEL: ll_a__2:267; EQ2ICMP:       # %bb.0: # %entry268; EQ2ICMP-NEXT:    movq %rsi, %rax269; EQ2ICMP-NEXT:    cmpq $-2, %rdi270; EQ2ICMP-NEXT:    jg .LBB5_2271; EQ2ICMP-NEXT:  # %bb.1: # %if.end272; EQ2ICMP-NEXT:    movl $1, %ecx273; EQ2ICMP-NEXT:    cmovlq %rcx, %rax274; EQ2ICMP-NEXT:    imulq %rdi, %rax275; EQ2ICMP-NEXT:  .LBB5_2: # %return276; EQ2ICMP-NEXT:    retq277entry:278  %cmp = icmp sgt i64 %a, -2279  br i1 %cmp, label %return, label %if.end280 281if.end:                                           ; preds = %entry282  %cmp1 = icmp eq i64 %a, -2283  %mul = select i1 %cmp1, i64 %b, i64 1284  %spec.select = mul nsw i64 %mul, %a285  ret i64 %spec.select286 287return:                                           ; preds = %entry288  ret i64 %b289}290 291define i64 @ll_a__1(i64 %a, i64 %b) {292; DEFAULT-LABEL: ll_a__1:293; DEFAULT:       # %bb.0: # %entry294; DEFAULT-NEXT:    testq %rdi, %rdi295; DEFAULT-NEXT:    js .LBB6_1296; DEFAULT-NEXT:  # %bb.2: # %return297; DEFAULT-NEXT:    movq %rsi, %rax298; DEFAULT-NEXT:    retq299; DEFAULT-NEXT:  .LBB6_1: # %if.end300; DEFAULT-NEXT:    cmpq $-1, %rdi301; DEFAULT-NEXT:    movl $1, %eax302; DEFAULT-NEXT:    cmoveq %rsi, %rax303; DEFAULT-NEXT:    imulq %rdi, %rax304; DEFAULT-NEXT:    retq305;306; EQ2ICMP-LABEL: ll_a__1:307; EQ2ICMP:       # %bb.0: # %entry308; EQ2ICMP-NEXT:    movq %rsi, %rax309; EQ2ICMP-NEXT:    testq %rdi, %rdi310; EQ2ICMP-NEXT:    js .LBB6_1311; EQ2ICMP-NEXT:  # %bb.2: # %return312; EQ2ICMP-NEXT:    retq313; EQ2ICMP-NEXT:  .LBB6_1: # %if.end314; EQ2ICMP-NEXT:    cmpq $-1, %rdi315; EQ2ICMP-NEXT:    movl $1, %ecx316; EQ2ICMP-NEXT:    cmovlq %rcx, %rax317; EQ2ICMP-NEXT:    imulq %rdi, %rax318; EQ2ICMP-NEXT:    retq319entry:320  %cmp = icmp sgt i64 %a, -1321  br i1 %cmp, label %return, label %if.end322 323if.end:                                           ; preds = %entry324  %cmp1 = icmp eq i64 %a, -1325  %mul = select i1 %cmp1, i64 %b, i64 1326  %spec.select = mul nsw i64 %mul, %a327  ret i64 %spec.select328 329return:                                           ; preds = %entry330  ret i64 %b331}332 333define i64 @ll_a_0(i64 %a, i64 %b) {334; DEFAULT-LABEL: ll_a_0:335; DEFAULT:       # %bb.0: # %entry336; DEFAULT-NEXT:    testq %rdi, %rdi337; DEFAULT-NEXT:    jle .LBB7_1338; DEFAULT-NEXT:  # %bb.2: # %return339; DEFAULT-NEXT:    movq %rsi, %rax340; DEFAULT-NEXT:    retq341; DEFAULT-NEXT:  .LBB7_1: # %if.end342; DEFAULT-NEXT:    movl $1, %eax343; DEFAULT-NEXT:    cmoveq %rsi, %rax344; DEFAULT-NEXT:    imulq %rdi, %rax345; DEFAULT-NEXT:    retq346;347; EQ2ICMP-LABEL: ll_a_0:348; EQ2ICMP:       # %bb.0: # %entry349; EQ2ICMP-NEXT:    movq %rsi, %rax350; EQ2ICMP-NEXT:    testq %rdi, %rdi351; EQ2ICMP-NEXT:    jle .LBB7_1352; EQ2ICMP-NEXT:  # %bb.2: # %return353; EQ2ICMP-NEXT:    retq354; EQ2ICMP-NEXT:  .LBB7_1: # %if.end355; EQ2ICMP-NEXT:    movl $1, %ecx356; EQ2ICMP-NEXT:    cmovsq %rcx, %rax357; EQ2ICMP-NEXT:    imulq %rdi, %rax358; EQ2ICMP-NEXT:    retq359entry:360  %cmp = icmp sgt i64 %a, 0361  br i1 %cmp, label %return, label %if.end362 363if.end:                                           ; preds = %entry364  %cmp1 = icmp eq i64 %a, 0365  %mul = select i1 %cmp1, i64 %b, i64 1366  %spec.select = mul nsw i64 %mul, %a367  ret i64 %spec.select368 369return:                                           ; preds = %entry370  ret i64 %b371}372 373define i64 @ll_a_1(i64 %a, i64 %b) {374; DEFAULT-LABEL: ll_a_1:375; DEFAULT:       # %bb.0: # %entry376; DEFAULT-NEXT:    cmpq $1, %rdi377; DEFAULT-NEXT:    jle .LBB8_1378; DEFAULT-NEXT:  # %bb.2: # %return379; DEFAULT-NEXT:    movq %rsi, %rax380; DEFAULT-NEXT:    retq381; DEFAULT-NEXT:  .LBB8_1: # %if.end382; DEFAULT-NEXT:    movl $1, %eax383; DEFAULT-NEXT:    cmoveq %rsi, %rax384; DEFAULT-NEXT:    imulq %rdi, %rax385; DEFAULT-NEXT:    retq386;387; EQ2ICMP-LABEL: ll_a_1:388; EQ2ICMP:       # %bb.0: # %entry389; EQ2ICMP-NEXT:    movq %rsi, %rax390; EQ2ICMP-NEXT:    cmpq $1, %rdi391; EQ2ICMP-NEXT:    jg .LBB8_2392; EQ2ICMP-NEXT:  # %bb.1: # %if.end393; EQ2ICMP-NEXT:    movl $1, %ecx394; EQ2ICMP-NEXT:    cmovlq %rcx, %rax395; EQ2ICMP-NEXT:    imulq %rdi, %rax396; EQ2ICMP-NEXT:  .LBB8_2: # %return397; EQ2ICMP-NEXT:    retq398entry:399  %cmp = icmp sgt i64 %a, 1400  br i1 %cmp, label %return, label %if.end401 402if.end:                                           ; preds = %entry403  %cmp1 = icmp eq i64 %a, 1404  %mul = select i1 %cmp1, i64 %b, i64 1405  %spec.select = mul nsw i64 %mul, %a406  ret i64 %spec.select407 408return:                                           ; preds = %entry409  ret i64 %b410}411 412define i64 @ll_a_2(i64 %a, i64 %b) {413; DEFAULT-LABEL: ll_a_2:414; DEFAULT:       # %bb.0: # %entry415; DEFAULT-NEXT:    cmpq $2, %rdi416; DEFAULT-NEXT:    jle .LBB9_1417; DEFAULT-NEXT:  # %bb.2: # %return418; DEFAULT-NEXT:    movq %rsi, %rax419; DEFAULT-NEXT:    retq420; DEFAULT-NEXT:  .LBB9_1: # %if.end421; DEFAULT-NEXT:    movl $1, %eax422; DEFAULT-NEXT:    cmoveq %rsi, %rax423; DEFAULT-NEXT:    imulq %rdi, %rax424; DEFAULT-NEXT:    retq425;426; EQ2ICMP-LABEL: ll_a_2:427; EQ2ICMP:       # %bb.0: # %entry428; EQ2ICMP-NEXT:    movq %rsi, %rax429; EQ2ICMP-NEXT:    cmpq $2, %rdi430; EQ2ICMP-NEXT:    jg .LBB9_2431; EQ2ICMP-NEXT:  # %bb.1: # %if.end432; EQ2ICMP-NEXT:    movl $1, %ecx433; EQ2ICMP-NEXT:    cmovlq %rcx, %rax434; EQ2ICMP-NEXT:    imulq %rdi, %rax435; EQ2ICMP-NEXT:  .LBB9_2: # %return436; EQ2ICMP-NEXT:    retq437entry:438  %cmp = icmp sgt i64 %a, 2439  br i1 %cmp, label %return, label %if.end440 441if.end:                                           ; preds = %entry442  %cmp1 = icmp eq i64 %a, 2443  %mul = select i1 %cmp1, i64 %b, i64 1444  %spec.select = mul nsw i64 %mul, %a445  ret i64 %spec.select446 447return:                                           ; preds = %entry448  ret i64 %b449}450 451define i64 @i_a_op_b__2(i32 signext %a, i32 signext %b) {452; DEFAULT-LABEL: i_a_op_b__2:453; DEFAULT:       # %bb.0: # %entry454; DEFAULT-NEXT:    movl %esi, %ecx455; DEFAULT-NEXT:    movl %edi, %eax456; DEFAULT-NEXT:    shll %cl, %eax457; DEFAULT-NEXT:    cmpl $-2, %eax458; DEFAULT-NEXT:    jg .LBB10_2459; DEFAULT-NEXT:  # %bb.1: # %if.end460; DEFAULT-NEXT:    movl $1, %eax461; DEFAULT-NEXT:    cmovel %ecx, %eax462; DEFAULT-NEXT:    imull %edi, %eax463; DEFAULT-NEXT:    movl %eax, %ecx464; DEFAULT-NEXT:  .LBB10_2: # %return465; DEFAULT-NEXT:    movslq %ecx, %rax466; DEFAULT-NEXT:    retq467;468; EQ2ICMP-LABEL: i_a_op_b__2:469; EQ2ICMP:       # %bb.0: # %entry470; EQ2ICMP-NEXT:    movl %esi, %ecx471; EQ2ICMP-NEXT:    movl %edi, %eax472; EQ2ICMP-NEXT:    shll %cl, %eax473; EQ2ICMP-NEXT:    cmpl $-2, %eax474; EQ2ICMP-NEXT:    jg .LBB10_2475; EQ2ICMP-NEXT:  # %bb.1: # %if.end476; EQ2ICMP-NEXT:    movl $1, %eax477; EQ2ICMP-NEXT:    cmovll %eax, %ecx478; EQ2ICMP-NEXT:    imull %edi, %ecx479; EQ2ICMP-NEXT:  .LBB10_2: # %return480; EQ2ICMP-NEXT:    movslq %ecx, %rax481; EQ2ICMP-NEXT:    retq482entry:483  %shl = shl i32 %a, %b484  %cmp = icmp sgt i32 %shl, -2485  br i1 %cmp, label %return, label %if.end486 487if.end:                                           ; preds = %entry488  %cmp2 = icmp eq i32 %shl, -2489  %mul = select i1 %cmp2, i32 %b, i32 1490  %spec.select = mul nsw i32 %mul, %a491  br label %return492 493return:                                           ; preds = %if.end, %entry494  %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]495  %retval.0 = sext i32 %retval.0.in to i64496  ret i64 %retval.0497}498 499define i64 @i_a_op_b__1(i32 signext %a, i32 signext %b) {500; DEFAULT-LABEL: i_a_op_b__1:501; DEFAULT:       # %bb.0: # %entry502; DEFAULT-NEXT:    movl %esi, %ecx503; DEFAULT-NEXT:    movl %edi, %eax504; DEFAULT-NEXT:    shll %cl, %eax505; DEFAULT-NEXT:    testl %eax, %eax506; DEFAULT-NEXT:    js .LBB11_1507; DEFAULT-NEXT:  # %bb.2: # %return508; DEFAULT-NEXT:    movslq %ecx, %rax509; DEFAULT-NEXT:    retq510; DEFAULT-NEXT:  .LBB11_1: # %if.end511; DEFAULT-NEXT:    cmpl $-1, %eax512; DEFAULT-NEXT:    movl $1, %eax513; DEFAULT-NEXT:    cmovel %ecx, %eax514; DEFAULT-NEXT:    imull %edi, %eax515; DEFAULT-NEXT:    movl %eax, %ecx516; DEFAULT-NEXT:    movslq %ecx, %rax517; DEFAULT-NEXT:    retq518;519; EQ2ICMP-LABEL: i_a_op_b__1:520; EQ2ICMP:       # %bb.0: # %entry521; EQ2ICMP-NEXT:    movl %esi, %ecx522; EQ2ICMP-NEXT:    movl %edi, %eax523; EQ2ICMP-NEXT:    shll %cl, %eax524; EQ2ICMP-NEXT:    testl %eax, %eax525; EQ2ICMP-NEXT:    js .LBB11_1526; EQ2ICMP-NEXT:  # %bb.2: # %return527; EQ2ICMP-NEXT:    movslq %ecx, %rax528; EQ2ICMP-NEXT:    retq529; EQ2ICMP-NEXT:  .LBB11_1: # %if.end530; EQ2ICMP-NEXT:    cmpl $-1, %eax531; EQ2ICMP-NEXT:    movl $1, %eax532; EQ2ICMP-NEXT:    cmovll %eax, %ecx533; EQ2ICMP-NEXT:    imull %edi, %ecx534; EQ2ICMP-NEXT:    movslq %ecx, %rax535; EQ2ICMP-NEXT:    retq536entry:537  %shl = shl i32 %a, %b538  %cmp = icmp sgt i32 %shl, -1539  br i1 %cmp, label %return, label %if.end540 541if.end:                                           ; preds = %entry542  %cmp2 = icmp eq i32 %shl, -1543  %mul = select i1 %cmp2, i32 %b, i32 1544  %spec.select = mul nsw i32 %mul, %a545  br label %return546 547return:                                           ; preds = %if.end, %entry548  %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]549  %retval.0 = sext i32 %retval.0.in to i64550  ret i64 %retval.0551}552 553define i64 @i_a_op_b_0(i32 signext %a, i32 signext %b) {554; DEFAULT-LABEL: i_a_op_b_0:555; DEFAULT:       # %bb.0: # %entry556; DEFAULT-NEXT:    movl %esi, %ecx557; DEFAULT-NEXT:    movl %edi, %eax558; DEFAULT-NEXT:    shll %cl, %eax559; DEFAULT-NEXT:    testl %eax, %eax560; DEFAULT-NEXT:    jle .LBB12_1561; DEFAULT-NEXT:  # %bb.2: # %return562; DEFAULT-NEXT:    movslq %ecx, %rax563; DEFAULT-NEXT:    retq564; DEFAULT-NEXT:  .LBB12_1: # %if.end565; DEFAULT-NEXT:    movl $1, %eax566; DEFAULT-NEXT:    cmovel %ecx, %eax567; DEFAULT-NEXT:    imull %edi, %eax568; DEFAULT-NEXT:    movl %eax, %ecx569; DEFAULT-NEXT:    movslq %ecx, %rax570; DEFAULT-NEXT:    retq571;572; EQ2ICMP-LABEL: i_a_op_b_0:573; EQ2ICMP:       # %bb.0: # %entry574; EQ2ICMP-NEXT:    movl %esi, %ecx575; EQ2ICMP-NEXT:    movl %edi, %eax576; EQ2ICMP-NEXT:    shll %cl, %eax577; EQ2ICMP-NEXT:    testl %eax, %eax578; EQ2ICMP-NEXT:    jle .LBB12_1579; EQ2ICMP-NEXT:  # %bb.2: # %return580; EQ2ICMP-NEXT:    movslq %ecx, %rax581; EQ2ICMP-NEXT:    retq582; EQ2ICMP-NEXT:  .LBB12_1: # %if.end583; EQ2ICMP-NEXT:    movl $1, %eax584; EQ2ICMP-NEXT:    cmovsl %eax, %ecx585; EQ2ICMP-NEXT:    imull %edi, %ecx586; EQ2ICMP-NEXT:    movslq %ecx, %rax587; EQ2ICMP-NEXT:    retq588entry:589  %shl = shl i32 %a, %b590  %cmp = icmp sgt i32 %shl, 0591  br i1 %cmp, label %return, label %if.end592 593if.end:                                           ; preds = %entry594  %cmp2 = icmp eq i32 %shl, 0595  %mul = select i1 %cmp2, i32 %b, i32 1596  %spec.select = mul nsw i32 %mul, %a597  br label %return598 599return:                                           ; preds = %if.end, %entry600  %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]601  %retval.0 = sext i32 %retval.0.in to i64602  ret i64 %retval.0603}604 605define i64 @i_a_op_b_1(i32 signext %a, i32 signext %b) {606; DEFAULT-LABEL: i_a_op_b_1:607; DEFAULT:       # %bb.0: # %entry608; DEFAULT-NEXT:    movl %esi, %ecx609; DEFAULT-NEXT:    movl %edi, %eax610; DEFAULT-NEXT:    shll %cl, %eax611; DEFAULT-NEXT:    cmpl $1, %eax612; DEFAULT-NEXT:    jg .LBB13_2613; DEFAULT-NEXT:  # %bb.1: # %if.end614; DEFAULT-NEXT:    movl $1, %eax615; DEFAULT-NEXT:    cmovel %ecx, %eax616; DEFAULT-NEXT:    imull %edi, %eax617; DEFAULT-NEXT:    movl %eax, %ecx618; DEFAULT-NEXT:  .LBB13_2: # %return619; DEFAULT-NEXT:    movslq %ecx, %rax620; DEFAULT-NEXT:    retq621;622; EQ2ICMP-LABEL: i_a_op_b_1:623; EQ2ICMP:       # %bb.0: # %entry624; EQ2ICMP-NEXT:    movl %esi, %ecx625; EQ2ICMP-NEXT:    movl %edi, %eax626; EQ2ICMP-NEXT:    shll %cl, %eax627; EQ2ICMP-NEXT:    cmpl $1, %eax628; EQ2ICMP-NEXT:    jg .LBB13_2629; EQ2ICMP-NEXT:  # %bb.1: # %if.end630; EQ2ICMP-NEXT:    movl $1, %eax631; EQ2ICMP-NEXT:    cmovll %eax, %ecx632; EQ2ICMP-NEXT:    imull %edi, %ecx633; EQ2ICMP-NEXT:  .LBB13_2: # %return634; EQ2ICMP-NEXT:    movslq %ecx, %rax635; EQ2ICMP-NEXT:    retq636entry:637  %shl = shl i32 %a, %b638  %cmp = icmp sgt i32 %shl, 1639  br i1 %cmp, label %return, label %if.end640 641if.end:                                           ; preds = %entry642  %cmp2 = icmp eq i32 %shl, 1643  %mul = select i1 %cmp2, i32 %b, i32 1644  %spec.select = mul nsw i32 %mul, %a645  br label %return646 647return:                                           ; preds = %if.end, %entry648  %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]649  %retval.0 = sext i32 %retval.0.in to i64650  ret i64 %retval.0651}652 653define i64 @i_a_op_b_2(i32 signext %a, i32 signext %b) {654; DEFAULT-LABEL: i_a_op_b_2:655; DEFAULT:       # %bb.0: # %entry656; DEFAULT-NEXT:    movl %esi, %ecx657; DEFAULT-NEXT:    movl %edi, %eax658; DEFAULT-NEXT:    shll %cl, %eax659; DEFAULT-NEXT:    cmpl $2, %eax660; DEFAULT-NEXT:    jg .LBB14_2661; DEFAULT-NEXT:  # %bb.1: # %if.end662; DEFAULT-NEXT:    movl $1, %eax663; DEFAULT-NEXT:    cmovel %ecx, %eax664; DEFAULT-NEXT:    imull %edi, %eax665; DEFAULT-NEXT:    movl %eax, %ecx666; DEFAULT-NEXT:  .LBB14_2: # %return667; DEFAULT-NEXT:    movslq %ecx, %rax668; DEFAULT-NEXT:    retq669;670; EQ2ICMP-LABEL: i_a_op_b_2:671; EQ2ICMP:       # %bb.0: # %entry672; EQ2ICMP-NEXT:    movl %esi, %ecx673; EQ2ICMP-NEXT:    movl %edi, %eax674; EQ2ICMP-NEXT:    shll %cl, %eax675; EQ2ICMP-NEXT:    cmpl $2, %eax676; EQ2ICMP-NEXT:    jg .LBB14_2677; EQ2ICMP-NEXT:  # %bb.1: # %if.end678; EQ2ICMP-NEXT:    movl $1, %eax679; EQ2ICMP-NEXT:    cmovll %eax, %ecx680; EQ2ICMP-NEXT:    imull %edi, %ecx681; EQ2ICMP-NEXT:  .LBB14_2: # %return682; EQ2ICMP-NEXT:    movslq %ecx, %rax683; EQ2ICMP-NEXT:    retq684entry:685  %shl = shl i32 %a, %b686  %cmp = icmp sgt i32 %shl, 2687  br i1 %cmp, label %return, label %if.end688 689if.end:                                           ; preds = %entry690  %cmp2 = icmp eq i32 %shl, 2691  %mul = select i1 %cmp2, i32 %b, i32 1692  %spec.select = mul nsw i32 %mul, %a693  br label %return694 695return:                                           ; preds = %if.end, %entry696  %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]697  %retval.0 = sext i32 %retval.0.in to i64698  ret i64 %retval.0699}700 701define i64 @i_a__2(i32 signext %a, i32 signext %b) {702; DEFAULT-LABEL: i_a__2:703; DEFAULT:       # %bb.0: # %entry704; DEFAULT-NEXT:    cmpl $-2, %edi705; DEFAULT-NEXT:    jg .LBB15_2706; DEFAULT-NEXT:  # %bb.1: # %if.end707; DEFAULT-NEXT:    movl $1, %eax708; DEFAULT-NEXT:    cmovel %esi, %eax709; DEFAULT-NEXT:    imull %edi, %eax710; DEFAULT-NEXT:    movl %eax, %esi711; DEFAULT-NEXT:  .LBB15_2: # %return712; DEFAULT-NEXT:    movslq %esi, %rax713; DEFAULT-NEXT:    retq714;715; EQ2ICMP-LABEL: i_a__2:716; EQ2ICMP:       # %bb.0: # %entry717; EQ2ICMP-NEXT:    cmpl $-2, %edi718; EQ2ICMP-NEXT:    jg .LBB15_2719; EQ2ICMP-NEXT:  # %bb.1: # %if.end720; EQ2ICMP-NEXT:    movl $1, %eax721; EQ2ICMP-NEXT:    cmovll %eax, %esi722; EQ2ICMP-NEXT:    imull %edi, %esi723; EQ2ICMP-NEXT:  .LBB15_2: # %return724; EQ2ICMP-NEXT:    movslq %esi, %rax725; EQ2ICMP-NEXT:    retq726entry:727  %cmp = icmp sgt i32 %a, -2728  br i1 %cmp, label %return, label %if.end729 730if.end:                                           ; preds = %entry731  %cmp1 = icmp eq i32 %a, -2732  %mul = select i1 %cmp1, i32 %b, i32 1733  %spec.select = mul nsw i32 %mul, %a734  br label %return735 736return:                                           ; preds = %if.end, %entry737  %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]738  %retval.0 = sext i32 %retval.0.in to i64739  ret i64 %retval.0740}741 742define i64 @i_a__1(i32 signext %a, i32 signext %b) {743; DEFAULT-LABEL: i_a__1:744; DEFAULT:       # %bb.0: # %entry745; DEFAULT-NEXT:    testl %edi, %edi746; DEFAULT-NEXT:    js .LBB16_1747; DEFAULT-NEXT:  # %bb.2: # %return748; DEFAULT-NEXT:    movslq %esi, %rax749; DEFAULT-NEXT:    retq750; DEFAULT-NEXT:  .LBB16_1: # %if.end751; DEFAULT-NEXT:    cmpl $-1, %edi752; DEFAULT-NEXT:    movl $1, %eax753; DEFAULT-NEXT:    cmovel %esi, %eax754; DEFAULT-NEXT:    imull %edi, %eax755; DEFAULT-NEXT:    movl %eax, %esi756; DEFAULT-NEXT:    movslq %esi, %rax757; DEFAULT-NEXT:    retq758;759; EQ2ICMP-LABEL: i_a__1:760; EQ2ICMP:       # %bb.0: # %entry761; EQ2ICMP-NEXT:    testl %edi, %edi762; EQ2ICMP-NEXT:    js .LBB16_1763; EQ2ICMP-NEXT:  # %bb.2: # %return764; EQ2ICMP-NEXT:    movslq %esi, %rax765; EQ2ICMP-NEXT:    retq766; EQ2ICMP-NEXT:  .LBB16_1: # %if.end767; EQ2ICMP-NEXT:    cmpl $-1, %edi768; EQ2ICMP-NEXT:    movl $1, %eax769; EQ2ICMP-NEXT:    cmovll %eax, %esi770; EQ2ICMP-NEXT:    imull %edi, %esi771; EQ2ICMP-NEXT:    movslq %esi, %rax772; EQ2ICMP-NEXT:    retq773entry:774  %cmp = icmp sgt i32 %a, -1775  br i1 %cmp, label %return, label %if.end776 777if.end:                                           ; preds = %entry778  %cmp1 = icmp eq i32 %a, -1779  %mul = select i1 %cmp1, i32 %b, i32 1780  %spec.select = mul nsw i32 %mul, %a781  br label %return782 783return:                                           ; preds = %if.end, %entry784  %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]785  %retval.0 = sext i32 %retval.0.in to i64786  ret i64 %retval.0787}788 789define i64 @i_a_0(i32 signext %a, i32 signext %b) {790; DEFAULT-LABEL: i_a_0:791; DEFAULT:       # %bb.0: # %entry792; DEFAULT-NEXT:    testl %edi, %edi793; DEFAULT-NEXT:    jle .LBB17_1794; DEFAULT-NEXT:  # %bb.2: # %return795; DEFAULT-NEXT:    movslq %esi, %rax796; DEFAULT-NEXT:    retq797; DEFAULT-NEXT:  .LBB17_1: # %if.end798; DEFAULT-NEXT:    movl $1, %eax799; DEFAULT-NEXT:    cmovel %esi, %eax800; DEFAULT-NEXT:    imull %edi, %eax801; DEFAULT-NEXT:    movl %eax, %esi802; DEFAULT-NEXT:    movslq %esi, %rax803; DEFAULT-NEXT:    retq804;805; EQ2ICMP-LABEL: i_a_0:806; EQ2ICMP:       # %bb.0: # %entry807; EQ2ICMP-NEXT:    testl %edi, %edi808; EQ2ICMP-NEXT:    jle .LBB17_1809; EQ2ICMP-NEXT:  # %bb.2: # %return810; EQ2ICMP-NEXT:    movslq %esi, %rax811; EQ2ICMP-NEXT:    retq812; EQ2ICMP-NEXT:  .LBB17_1: # %if.end813; EQ2ICMP-NEXT:    movl $1, %eax814; EQ2ICMP-NEXT:    cmovsl %eax, %esi815; EQ2ICMP-NEXT:    imull %edi, %esi816; EQ2ICMP-NEXT:    movslq %esi, %rax817; EQ2ICMP-NEXT:    retq818entry:819  %cmp = icmp sgt i32 %a, 0820  br i1 %cmp, label %return, label %if.end821 822if.end:                                           ; preds = %entry823  %cmp1 = icmp eq i32 %a, 0824  %mul = select i1 %cmp1, i32 %b, i32 1825  %spec.select = mul nsw i32 %mul, %a826  br label %return827 828return:                                           ; preds = %if.end, %entry829  %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]830  %retval.0 = sext i32 %retval.0.in to i64831  ret i64 %retval.0832}833 834define i64 @i_a_1(i32 signext %a, i32 signext %b) {835; DEFAULT-LABEL: i_a_1:836; DEFAULT:       # %bb.0: # %entry837; DEFAULT-NEXT:    cmpl $1, %edi838; DEFAULT-NEXT:    jg .LBB18_2839; DEFAULT-NEXT:  # %bb.1: # %if.end840; DEFAULT-NEXT:    movl $1, %eax841; DEFAULT-NEXT:    cmovel %esi, %eax842; DEFAULT-NEXT:    imull %edi, %eax843; DEFAULT-NEXT:    movl %eax, %esi844; DEFAULT-NEXT:  .LBB18_2: # %return845; DEFAULT-NEXT:    movslq %esi, %rax846; DEFAULT-NEXT:    retq847;848; EQ2ICMP-LABEL: i_a_1:849; EQ2ICMP:       # %bb.0: # %entry850; EQ2ICMP-NEXT:    cmpl $1, %edi851; EQ2ICMP-NEXT:    jg .LBB18_2852; EQ2ICMP-NEXT:  # %bb.1: # %if.end853; EQ2ICMP-NEXT:    movl $1, %eax854; EQ2ICMP-NEXT:    cmovll %eax, %esi855; EQ2ICMP-NEXT:    imull %edi, %esi856; EQ2ICMP-NEXT:  .LBB18_2: # %return857; EQ2ICMP-NEXT:    movslq %esi, %rax858; EQ2ICMP-NEXT:    retq859entry:860  %cmp = icmp sgt i32 %a, 1861  br i1 %cmp, label %return, label %if.end862 863if.end:                                           ; preds = %entry864  %cmp1 = icmp eq i32 %a, 1865  %mul = select i1 %cmp1, i32 %b, i32 1866  %spec.select = mul nsw i32 %mul, %a867  br label %return868 869return:                                           ; preds = %if.end, %entry870  %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]871  %retval.0 = sext i32 %retval.0.in to i64872  ret i64 %retval.0873}874 875define i64 @i_a_2(i32 signext %a, i32 signext %b) {876; DEFAULT-LABEL: i_a_2:877; DEFAULT:       # %bb.0: # %entry878; DEFAULT-NEXT:    cmpl $2, %edi879; DEFAULT-NEXT:    jg .LBB19_2880; DEFAULT-NEXT:  # %bb.1: # %if.end881; DEFAULT-NEXT:    movl $1, %eax882; DEFAULT-NEXT:    cmovel %esi, %eax883; DEFAULT-NEXT:    imull %edi, %eax884; DEFAULT-NEXT:    movl %eax, %esi885; DEFAULT-NEXT:  .LBB19_2: # %return886; DEFAULT-NEXT:    movslq %esi, %rax887; DEFAULT-NEXT:    retq888;889; EQ2ICMP-LABEL: i_a_2:890; EQ2ICMP:       # %bb.0: # %entry891; EQ2ICMP-NEXT:    cmpl $2, %edi892; EQ2ICMP-NEXT:    jg .LBB19_2893; EQ2ICMP-NEXT:  # %bb.1: # %if.end894; EQ2ICMP-NEXT:    movl $1, %eax895; EQ2ICMP-NEXT:    cmovll %eax, %esi896; EQ2ICMP-NEXT:    imull %edi, %esi897; EQ2ICMP-NEXT:  .LBB19_2: # %return898; EQ2ICMP-NEXT:    movslq %esi, %rax899; EQ2ICMP-NEXT:    retq900entry:901  %cmp = icmp sgt i32 %a, 2902  br i1 %cmp, label %return, label %if.end903 904if.end:                                           ; preds = %entry905  %cmp1 = icmp eq i32 %a, 2906  %mul = select i1 %cmp1, i32 %b, i32 1907  %spec.select = mul nsw i32 %mul, %a908  br label %return909 910return:                                           ; preds = %if.end, %entry911  %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]912  %retval.0 = sext i32 %retval.0.in to i64913  ret i64 %retval.0914}915