678 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefixes=X86,X86-FAST3; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+slow-shld | FileCheck %s --check-prefixes=X86,X86-SLOW4; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefixes=X64,X64-FAST5; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+slow-shld | FileCheck %s --check-prefixes=X64,X64-SLOW6 7declare i8 @llvm.fshr.i8(i8, i8, i8) nounwind readnone8declare i16 @llvm.fshr.i16(i16, i16, i16) nounwind readnone9declare i32 @llvm.fshr.i32(i32, i32, i32) nounwind readnone10declare i64 @llvm.fshr.i64(i64, i64, i64) nounwind readnone11declare i128 @llvm.fshr.i128(i128, i128, i128) nounwind readnone12 13;14; Variable Funnel Shift15;16 17define i8 @var_shift_i8(i8 %x, i8 %y, i8 %z) nounwind {18; X86-LABEL: var_shift_i8:19; X86: # %bb.0:20; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx21; X86-NEXT: movzbl {{[0-9]+}}(%esp), %edx22; X86-NEXT: movl {{[0-9]+}}(%esp), %eax23; X86-NEXT: shll $8, %eax24; X86-NEXT: orl %edx, %eax25; X86-NEXT: andb $7, %cl26; X86-NEXT: shrl %cl, %eax27; X86-NEXT: # kill: def $al killed $al killed $eax28; X86-NEXT: retl29;30; X64-LABEL: var_shift_i8:31; X64: # %bb.0:32; X64-NEXT: movl %edx, %ecx33; X64-NEXT: shll $8, %edi34; X64-NEXT: movzbl %sil, %eax35; X64-NEXT: orl %edi, %eax36; X64-NEXT: andb $7, %cl37; X64-NEXT: # kill: def $cl killed $cl killed $ecx38; X64-NEXT: shrl %cl, %eax39; X64-NEXT: # kill: def $al killed $al killed $eax40; X64-NEXT: retq41 %tmp = tail call i8 @llvm.fshr.i8(i8 %x, i8 %y, i8 %z)42 ret i8 %tmp43}44 45define i16 @var_shift_i16(i16 %x, i16 %y, i16 %z) nounwind {46; X86-FAST-LABEL: var_shift_i16:47; X86-FAST: # %bb.0:48; X86-FAST-NEXT: movzwl {{[0-9]+}}(%esp), %edx49; X86-FAST-NEXT: movzwl {{[0-9]+}}(%esp), %eax50; X86-FAST-NEXT: movzbl {{[0-9]+}}(%esp), %ecx51; X86-FAST-NEXT: andb $15, %cl52; X86-FAST-NEXT: shrdw %cl, %dx, %ax53; X86-FAST-NEXT: retl54;55; X86-SLOW-LABEL: var_shift_i16:56; X86-SLOW: # %bb.0:57; X86-SLOW-NEXT: movzbl {{[0-9]+}}(%esp), %ecx58; X86-SLOW-NEXT: movzwl {{[0-9]+}}(%esp), %edx59; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax60; X86-SLOW-NEXT: shll $16, %eax61; X86-SLOW-NEXT: orl %edx, %eax62; X86-SLOW-NEXT: andb $15, %cl63; X86-SLOW-NEXT: shrl %cl, %eax64; X86-SLOW-NEXT: # kill: def $ax killed $ax killed $eax65; X86-SLOW-NEXT: retl66;67; X64-FAST-LABEL: var_shift_i16:68; X64-FAST: # %bb.0:69; X64-FAST-NEXT: movl %edx, %ecx70; X64-FAST-NEXT: movl %esi, %eax71; X64-FAST-NEXT: andb $15, %cl72; X64-FAST-NEXT: # kill: def $cl killed $cl killed $ecx73; X64-FAST-NEXT: shrdw %cl, %di, %ax74; X64-FAST-NEXT: # kill: def $ax killed $ax killed $eax75; X64-FAST-NEXT: retq76;77; X64-SLOW-LABEL: var_shift_i16:78; X64-SLOW: # %bb.0:79; X64-SLOW-NEXT: movl %edx, %ecx80; X64-SLOW-NEXT: shll $16, %edi81; X64-SLOW-NEXT: movzwl %si, %eax82; X64-SLOW-NEXT: orl %edi, %eax83; X64-SLOW-NEXT: andb $15, %cl84; X64-SLOW-NEXT: # kill: def $cl killed $cl killed $ecx85; X64-SLOW-NEXT: shrl %cl, %eax86; X64-SLOW-NEXT: # kill: def $ax killed $ax killed $eax87; X64-SLOW-NEXT: retq88 %tmp = tail call i16 @llvm.fshr.i16(i16 %x, i16 %y, i16 %z)89 ret i16 %tmp90}91 92define i32 @var_shift_i32(i32 %x, i32 %y, i32 %z) nounwind {93; X86-FAST-LABEL: var_shift_i32:94; X86-FAST: # %bb.0:95; X86-FAST-NEXT: movzbl {{[0-9]+}}(%esp), %ecx96; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %edx97; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %eax98; X86-FAST-NEXT: shrdl %cl, %edx, %eax99; X86-FAST-NEXT: retl100;101; X86-SLOW-LABEL: var_shift_i32:102; X86-SLOW: # %bb.0:103; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax104; X86-SLOW-NEXT: movzbl {{[0-9]+}}(%esp), %ecx105; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %edx106; X86-SLOW-NEXT: shrl %cl, %edx107; X86-SLOW-NEXT: notb %cl108; X86-SLOW-NEXT: addl %eax, %eax109; X86-SLOW-NEXT: shll %cl, %eax110; X86-SLOW-NEXT: orl %edx, %eax111; X86-SLOW-NEXT: retl112;113; X64-FAST-LABEL: var_shift_i32:114; X64-FAST: # %bb.0:115; X64-FAST-NEXT: movl %edx, %ecx116; X64-FAST-NEXT: movl %esi, %eax117; X64-FAST-NEXT: # kill: def $cl killed $cl killed $ecx118; X64-FAST-NEXT: shrdl %cl, %edi, %eax119; X64-FAST-NEXT: retq120;121; X64-SLOW-LABEL: var_shift_i32:122; X64-SLOW: # %bb.0:123; X64-SLOW-NEXT: movl %edx, %ecx124; X64-SLOW-NEXT: # kill: def $edi killed $edi def $rdi125; X64-SLOW-NEXT: shrl %cl, %esi126; X64-SLOW-NEXT: leal (%rdi,%rdi), %eax127; X64-SLOW-NEXT: notb %cl128; X64-SLOW-NEXT: # kill: def $cl killed $cl killed $ecx129; X64-SLOW-NEXT: shll %cl, %eax130; X64-SLOW-NEXT: orl %esi, %eax131; X64-SLOW-NEXT: retq132 %tmp = tail call i32 @llvm.fshr.i32(i32 %x, i32 %y, i32 %z)133 ret i32 %tmp134}135 136define i32 @var_shift_i32_optsize(i32 %x, i32 %y, i32 %z) nounwind optsize {137; X86-LABEL: var_shift_i32_optsize:138; X86: # %bb.0:139; X86-NEXT: movb {{[0-9]+}}(%esp), %cl140; X86-NEXT: movl {{[0-9]+}}(%esp), %edx141; X86-NEXT: movl {{[0-9]+}}(%esp), %eax142; X86-NEXT: shrdl %cl, %edx, %eax143; X86-NEXT: retl144;145; X64-LABEL: var_shift_i32_optsize:146; X64: # %bb.0:147; X64-NEXT: movl %edx, %ecx148; X64-NEXT: movl %esi, %eax149; X64-NEXT: # kill: def $cl killed $cl killed $ecx150; X64-NEXT: shrdl %cl, %edi, %eax151; X64-NEXT: retq152 %tmp = tail call i32 @llvm.fshr.i32(i32 %x, i32 %y, i32 %z)153 ret i32 %tmp154}155 156define i32 @var_shift_i32_pgso(i32 %x, i32 %y, i32 %z) nounwind !prof !14 {157; X86-LABEL: var_shift_i32_pgso:158; X86: # %bb.0:159; X86-NEXT: movb {{[0-9]+}}(%esp), %cl160; X86-NEXT: movl {{[0-9]+}}(%esp), %edx161; X86-NEXT: movl {{[0-9]+}}(%esp), %eax162; X86-NEXT: shrdl %cl, %edx, %eax163; X86-NEXT: retl164;165; X64-LABEL: var_shift_i32_pgso:166; X64: # %bb.0:167; X64-NEXT: movl %edx, %ecx168; X64-NEXT: movl %esi, %eax169; X64-NEXT: # kill: def $cl killed $cl killed $ecx170; X64-NEXT: shrdl %cl, %edi, %eax171; X64-NEXT: retq172 %tmp = tail call i32 @llvm.fshr.i32(i32 %x, i32 %y, i32 %z)173 ret i32 %tmp174}175 176define i64 @var_shift_i64(i64 %x, i64 %y, i64 %z) nounwind {177; X86-FAST-LABEL: var_shift_i64:178; X86-FAST: # %bb.0:179; X86-FAST-NEXT: pushl %esi180; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %eax181; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %esi182; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %ecx183; X86-FAST-NEXT: testb $32, %cl184; X86-FAST-NEXT: je .LBB5_1185; X86-FAST-NEXT: # %bb.2:186; X86-FAST-NEXT: movl %esi, %edx187; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %esi188; X86-FAST-NEXT: jmp .LBB5_3189; X86-FAST-NEXT: .LBB5_1:190; X86-FAST-NEXT: movl %eax, %edx191; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %eax192; X86-FAST-NEXT: .LBB5_3:193; X86-FAST-NEXT: shrdl %cl, %edx, %eax194; X86-FAST-NEXT: # kill: def $cl killed $cl killed $ecx195; X86-FAST-NEXT: shrdl %cl, %esi, %edx196; X86-FAST-NEXT: popl %esi197; X86-FAST-NEXT: retl198;199; X86-SLOW-LABEL: var_shift_i64:200; X86-SLOW: # %bb.0:201; X86-SLOW-NEXT: pushl %ebx202; X86-SLOW-NEXT: pushl %edi203; X86-SLOW-NEXT: pushl %esi204; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax205; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %edx206; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %ebx207; X86-SLOW-NEXT: testb $32, %bl208; X86-SLOW-NEXT: je .LBB5_1209; X86-SLOW-NEXT: # %bb.2:210; X86-SLOW-NEXT: movl %edx, %esi211; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %edx212; X86-SLOW-NEXT: jmp .LBB5_3213; X86-SLOW-NEXT: .LBB5_1:214; X86-SLOW-NEXT: movl %eax, %esi215; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax216; X86-SLOW-NEXT: .LBB5_3:217; X86-SLOW-NEXT: leal (%esi,%esi), %edi218; X86-SLOW-NEXT: movb %bl, %ch219; X86-SLOW-NEXT: notb %ch220; X86-SLOW-NEXT: movb %ch, %cl221; X86-SLOW-NEXT: shll %cl, %edi222; X86-SLOW-NEXT: movb %bl, %cl223; X86-SLOW-NEXT: shrl %cl, %eax224; X86-SLOW-NEXT: orl %edi, %eax225; X86-SLOW-NEXT: shrl %cl, %esi226; X86-SLOW-NEXT: addl %edx, %edx227; X86-SLOW-NEXT: movb %ch, %cl228; X86-SLOW-NEXT: shll %cl, %edx229; X86-SLOW-NEXT: orl %esi, %edx230; X86-SLOW-NEXT: popl %esi231; X86-SLOW-NEXT: popl %edi232; X86-SLOW-NEXT: popl %ebx233; X86-SLOW-NEXT: retl234;235; X64-FAST-LABEL: var_shift_i64:236; X64-FAST: # %bb.0:237; X64-FAST-NEXT: movq %rdx, %rcx238; X64-FAST-NEXT: movq %rsi, %rax239; X64-FAST-NEXT: # kill: def $cl killed $cl killed $rcx240; X64-FAST-NEXT: shrdq %cl, %rdi, %rax241; X64-FAST-NEXT: retq242;243; X64-SLOW-LABEL: var_shift_i64:244; X64-SLOW: # %bb.0:245; X64-SLOW-NEXT: movq %rdx, %rcx246; X64-SLOW-NEXT: shrq %cl, %rsi247; X64-SLOW-NEXT: leaq (%rdi,%rdi), %rax248; X64-SLOW-NEXT: notb %cl249; X64-SLOW-NEXT: # kill: def $cl killed $cl killed $rcx250; X64-SLOW-NEXT: shlq %cl, %rax251; X64-SLOW-NEXT: orq %rsi, %rax252; X64-SLOW-NEXT: retq253 %tmp = tail call i64 @llvm.fshr.i64(i64 %x, i64 %y, i64 %z)254 ret i64 %tmp255}256 257define i128 @var_shift_i128(i128 %x, i128 %y, i128 %z) nounwind {258; X86-FAST-LABEL: var_shift_i128:259; X86-FAST: # %bb.0:260; X86-FAST-NEXT: pushl %ebp261; X86-FAST-NEXT: movl %esp, %ebp262; X86-FAST-NEXT: pushl %ebx263; X86-FAST-NEXT: pushl %edi264; X86-FAST-NEXT: pushl %esi265; X86-FAST-NEXT: andl $-16, %esp266; X86-FAST-NEXT: subl $16, %esp267; X86-FAST-NEXT: movl 24(%ebp), %esi268; X86-FAST-NEXT: movl 28(%ebp), %eax269; X86-FAST-NEXT: movl 48(%ebp), %edx270; X86-FAST-NEXT: movl 56(%ebp), %ecx271; X86-FAST-NEXT: testb $64, %cl272; X86-FAST-NEXT: movl 52(%ebp), %ebx273; X86-FAST-NEXT: je .LBB6_1274; X86-FAST-NEXT: # %bb.2:275; X86-FAST-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill276; X86-FAST-NEXT: movl %esi, %edx277; X86-FAST-NEXT: movl 32(%ebp), %esi278; X86-FAST-NEXT: movl %ebx, %edi279; X86-FAST-NEXT: movl %eax, %ebx280; X86-FAST-NEXT: movl 36(%ebp), %eax281; X86-FAST-NEXT: testb $32, %cl282; X86-FAST-NEXT: je .LBB6_4283; X86-FAST-NEXT: jmp .LBB6_5284; X86-FAST-NEXT: .LBB6_1:285; X86-FAST-NEXT: movl 40(%ebp), %edi286; X86-FAST-NEXT: movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill287; X86-FAST-NEXT: movl 44(%ebp), %edi288; X86-FAST-NEXT: testb $32, %cl289; X86-FAST-NEXT: jne .LBB6_5290; X86-FAST-NEXT: .LBB6_4:291; X86-FAST-NEXT: movl %esi, %eax292; X86-FAST-NEXT: movl %ebx, %esi293; X86-FAST-NEXT: movl %edx, %ebx294; X86-FAST-NEXT: movl %edi, %edx295; X86-FAST-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload296; X86-FAST-NEXT: .LBB6_5:297; X86-FAST-NEXT: shrdl %cl, %edx, %edi298; X86-FAST-NEXT: shrdl %cl, %ebx, %edx299; X86-FAST-NEXT: shrdl %cl, %esi, %ebx300; X86-FAST-NEXT: # kill: def $cl killed $cl killed $ecx301; X86-FAST-NEXT: shrdl %cl, %eax, %esi302; X86-FAST-NEXT: movl 8(%ebp), %eax303; X86-FAST-NEXT: movl %esi, 12(%eax)304; X86-FAST-NEXT: movl %ebx, 8(%eax)305; X86-FAST-NEXT: movl %edx, 4(%eax)306; X86-FAST-NEXT: movl %edi, (%eax)307; X86-FAST-NEXT: leal -12(%ebp), %esp308; X86-FAST-NEXT: popl %esi309; X86-FAST-NEXT: popl %edi310; X86-FAST-NEXT: popl %ebx311; X86-FAST-NEXT: popl %ebp312; X86-FAST-NEXT: retl $4313;314; X86-SLOW-LABEL: var_shift_i128:315; X86-SLOW: # %bb.0:316; X86-SLOW-NEXT: pushl %ebp317; X86-SLOW-NEXT: movl %esp, %ebp318; X86-SLOW-NEXT: pushl %ebx319; X86-SLOW-NEXT: pushl %edi320; X86-SLOW-NEXT: pushl %esi321; X86-SLOW-NEXT: andl $-16, %esp322; X86-SLOW-NEXT: subl $16, %esp323; X86-SLOW-NEXT: movl 24(%ebp), %edx324; X86-SLOW-NEXT: movl 28(%ebp), %esi325; X86-SLOW-NEXT: movl 48(%ebp), %edi326; X86-SLOW-NEXT: movl 56(%ebp), %eax327; X86-SLOW-NEXT: testb $64, %al328; X86-SLOW-NEXT: movl 52(%ebp), %eax329; X86-SLOW-NEXT: je .LBB6_1330; X86-SLOW-NEXT: # %bb.2:331; X86-SLOW-NEXT: movl %edi, (%esp) # 4-byte Spill332; X86-SLOW-NEXT: movl %edx, %edi333; X86-SLOW-NEXT: movl 32(%ebp), %edx334; X86-SLOW-NEXT: movl %eax, %ecx335; X86-SLOW-NEXT: movl %esi, %eax336; X86-SLOW-NEXT: movl 36(%ebp), %esi337; X86-SLOW-NEXT: jmp .LBB6_3338; X86-SLOW-NEXT: .LBB6_1:339; X86-SLOW-NEXT: movl 40(%ebp), %ecx340; X86-SLOW-NEXT: movl %ecx, (%esp) # 4-byte Spill341; X86-SLOW-NEXT: movl 44(%ebp), %ecx342; X86-SLOW-NEXT: .LBB6_3:343; X86-SLOW-NEXT: movl 56(%ebp), %ebx344; X86-SLOW-NEXT: testb $32, %bl345; X86-SLOW-NEXT: je .LBB6_4346; X86-SLOW-NEXT: # %bb.5:347; X86-SLOW-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill348; X86-SLOW-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill349; X86-SLOW-NEXT: movl %ecx, %ebx350; X86-SLOW-NEXT: jmp .LBB6_6351; X86-SLOW-NEXT: .LBB6_4:352; X86-SLOW-NEXT: movl %edx, %esi353; X86-SLOW-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill354; X86-SLOW-NEXT: movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill355; X86-SLOW-NEXT: movl %ecx, %edi356; X86-SLOW-NEXT: movl (%esp), %ebx # 4-byte Reload357; X86-SLOW-NEXT: .LBB6_6:358; X86-SLOW-NEXT: movl 56(%ebp), %ecx359; X86-SLOW-NEXT: shrl %cl, %ebx360; X86-SLOW-NEXT: movl %ecx, %edx361; X86-SLOW-NEXT: notb %dl362; X86-SLOW-NEXT: movl %edi, %eax363; X86-SLOW-NEXT: addl %edi, %edi364; X86-SLOW-NEXT: movl %edx, %ecx365; X86-SLOW-NEXT: shll %cl, %edi366; X86-SLOW-NEXT: orl %ebx, %edi367; X86-SLOW-NEXT: movl %edi, (%esp) # 4-byte Spill368; X86-SLOW-NEXT: movl 56(%ebp), %ecx369; X86-SLOW-NEXT: # kill: def $cl killed $cl killed $ecx370; X86-SLOW-NEXT: shrl %cl, %eax371; X86-SLOW-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload372; X86-SLOW-NEXT: leal (%edi,%edi), %ebx373; X86-SLOW-NEXT: movl %edx, %ecx374; X86-SLOW-NEXT: shll %cl, %ebx375; X86-SLOW-NEXT: orl %eax, %ebx376; X86-SLOW-NEXT: movl 56(%ebp), %ecx377; X86-SLOW-NEXT: # kill: def $cl killed $cl killed $ecx378; X86-SLOW-NEXT: shrl %cl, %edi379; X86-SLOW-NEXT: movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill380; X86-SLOW-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload381; X86-SLOW-NEXT: leal (%eax,%eax), %edi382; X86-SLOW-NEXT: movl %edx, %ecx383; X86-SLOW-NEXT: shll %cl, %edi384; X86-SLOW-NEXT: orl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Folded Reload385; X86-SLOW-NEXT: movl 56(%ebp), %ecx386; X86-SLOW-NEXT: # kill: def $cl killed $cl killed $ecx387; X86-SLOW-NEXT: shrl %cl, %eax388; X86-SLOW-NEXT: addl %esi, %esi389; X86-SLOW-NEXT: movl %edx, %ecx390; X86-SLOW-NEXT: shll %cl, %esi391; X86-SLOW-NEXT: orl %eax, %esi392; X86-SLOW-NEXT: movl 8(%ebp), %eax393; X86-SLOW-NEXT: movl %esi, 12(%eax)394; X86-SLOW-NEXT: movl %edi, 8(%eax)395; X86-SLOW-NEXT: movl %ebx, 4(%eax)396; X86-SLOW-NEXT: movl (%esp), %ecx # 4-byte Reload397; X86-SLOW-NEXT: movl %ecx, (%eax)398; X86-SLOW-NEXT: leal -12(%ebp), %esp399; X86-SLOW-NEXT: popl %esi400; X86-SLOW-NEXT: popl %edi401; X86-SLOW-NEXT: popl %ebx402; X86-SLOW-NEXT: popl %ebp403; X86-SLOW-NEXT: retl $4404;405; X64-FAST-LABEL: var_shift_i128:406; X64-FAST: # %bb.0:407; X64-FAST-NEXT: movq %rdx, %rax408; X64-FAST-NEXT: testb $64, %r8b409; X64-FAST-NEXT: cmoveq %rdi, %rsi410; X64-FAST-NEXT: cmoveq %rcx, %rdi411; X64-FAST-NEXT: cmovneq %rcx, %rax412; X64-FAST-NEXT: movl %r8d, %ecx413; X64-FAST-NEXT: shrdq %cl, %rdi, %rax414; X64-FAST-NEXT: shrdq %cl, %rsi, %rdi415; X64-FAST-NEXT: movq %rdi, %rdx416; X64-FAST-NEXT: retq417;418; X64-SLOW-LABEL: var_shift_i128:419; X64-SLOW: # %bb.0:420; X64-SLOW-NEXT: testb $64, %r8b421; X64-SLOW-NEXT: cmoveq %rdi, %rsi422; X64-SLOW-NEXT: cmoveq %rcx, %rdi423; X64-SLOW-NEXT: cmovneq %rcx, %rdx424; X64-SLOW-NEXT: movl %r8d, %ecx425; X64-SLOW-NEXT: shrq %cl, %rdx426; X64-SLOW-NEXT: leaq (%rdi,%rdi), %rax427; X64-SLOW-NEXT: movl %r8d, %r9d428; X64-SLOW-NEXT: notb %r9b429; X64-SLOW-NEXT: movl %r9d, %ecx430; X64-SLOW-NEXT: shlq %cl, %rax431; X64-SLOW-NEXT: orq %rdx, %rax432; X64-SLOW-NEXT: movl %r8d, %ecx433; X64-SLOW-NEXT: shrq %cl, %rdi434; X64-SLOW-NEXT: leaq (%rsi,%rsi), %rdx435; X64-SLOW-NEXT: movl %r9d, %ecx436; X64-SLOW-NEXT: shlq %cl, %rdx437; X64-SLOW-NEXT: orq %rdi, %rdx438; X64-SLOW-NEXT: retq439 %tmp = tail call i128 @llvm.fshr.i128(i128 %x, i128 %y, i128 %z)440 ret i128 %tmp441}442 443;444; Const Funnel Shift445;446 447define i8 @const_shift_i8(i8 %x, i8 %y) nounwind {448; X86-LABEL: const_shift_i8:449; X86: # %bb.0:450; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax451; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx452; X86-NEXT: shrb $7, %cl453; X86-NEXT: addb %al, %al454; X86-NEXT: orb %cl, %al455; X86-NEXT: retl456;457; X64-LABEL: const_shift_i8:458; X64: # %bb.0:459; X64-NEXT: # kill: def $edi killed $edi def $rdi460; X64-NEXT: shrb $7, %sil461; X64-NEXT: leal (%rdi,%rdi), %eax462; X64-NEXT: orb %sil, %al463; X64-NEXT: # kill: def $al killed $al killed $eax464; X64-NEXT: retq465 %tmp = tail call i8 @llvm.fshr.i8(i8 %x, i8 %y, i8 7)466 ret i8 %tmp467}468 469define i16 @const_shift_i16(i16 %x, i16 %y) nounwind {470; X86-FAST-LABEL: const_shift_i16:471; X86-FAST: # %bb.0:472; X86-FAST-NEXT: movzwl {{[0-9]+}}(%esp), %ecx473; X86-FAST-NEXT: movzwl {{[0-9]+}}(%esp), %eax474; X86-FAST-NEXT: shrdw $7, %cx, %ax475; X86-FAST-NEXT: retl476;477; X86-SLOW-LABEL: const_shift_i16:478; X86-SLOW: # %bb.0:479; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax480; X86-SLOW-NEXT: movzwl {{[0-9]+}}(%esp), %ecx481; X86-SLOW-NEXT: shrl $7, %ecx482; X86-SLOW-NEXT: shll $9, %eax483; X86-SLOW-NEXT: orl %ecx, %eax484; X86-SLOW-NEXT: # kill: def $ax killed $ax killed $eax485; X86-SLOW-NEXT: retl486;487; X64-FAST-LABEL: const_shift_i16:488; X64-FAST: # %bb.0:489; X64-FAST-NEXT: movl %esi, %eax490; X64-FAST-NEXT: shrdw $7, %di, %ax491; X64-FAST-NEXT: # kill: def $ax killed $ax killed $eax492; X64-FAST-NEXT: retq493;494; X64-SLOW-LABEL: const_shift_i16:495; X64-SLOW: # %bb.0:496; X64-SLOW-NEXT: movzwl %si, %eax497; X64-SLOW-NEXT: shll $9, %edi498; X64-SLOW-NEXT: shrl $7, %eax499; X64-SLOW-NEXT: orl %edi, %eax500; X64-SLOW-NEXT: # kill: def $ax killed $ax killed $eax501; X64-SLOW-NEXT: retq502 %tmp = tail call i16 @llvm.fshr.i16(i16 %x, i16 %y, i16 7)503 ret i16 %tmp504}505 506define i32 @const_shift_i32(i32 %x, i32 %y) nounwind {507; X86-FAST-LABEL: const_shift_i32:508; X86-FAST: # %bb.0:509; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %ecx510; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %eax511; X86-FAST-NEXT: shrdl $7, %ecx, %eax512; X86-FAST-NEXT: retl513;514; X86-SLOW-LABEL: const_shift_i32:515; X86-SLOW: # %bb.0:516; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax517; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %ecx518; X86-SLOW-NEXT: shrl $7, %ecx519; X86-SLOW-NEXT: shll $25, %eax520; X86-SLOW-NEXT: orl %ecx, %eax521; X86-SLOW-NEXT: retl522;523; X64-FAST-LABEL: const_shift_i32:524; X64-FAST: # %bb.0:525; X64-FAST-NEXT: movl %edi, %eax526; X64-FAST-NEXT: shldl $25, %esi, %eax527; X64-FAST-NEXT: retq528;529; X64-SLOW-LABEL: const_shift_i32:530; X64-SLOW: # %bb.0:531; X64-SLOW-NEXT: # kill: def $esi killed $esi def $rsi532; X64-SLOW-NEXT: # kill: def $edi killed $edi def $rdi533; X64-SLOW-NEXT: shrl $7, %esi534; X64-SLOW-NEXT: shll $25, %edi535; X64-SLOW-NEXT: leal (%rdi,%rsi), %eax536; X64-SLOW-NEXT: retq537 %tmp = tail call i32 @llvm.fshr.i32(i32 %x, i32 %y, i32 7)538 ret i32 %tmp539}540 541define i64 @const_shift_i64(i64 %x, i64 %y) nounwind {542; X86-FAST-LABEL: const_shift_i64:543; X86-FAST: # %bb.0:544; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %edx545; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %eax546; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %ecx547; X86-FAST-NEXT: shldl $25, %ecx, %edx548; X86-FAST-NEXT: shrdl $7, %ecx, %eax549; X86-FAST-NEXT: retl550;551; X86-SLOW-LABEL: const_shift_i64:552; X86-SLOW: # %bb.0:553; X86-SLOW-NEXT: pushl %esi554; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %edx555; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %ecx556; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %esi557; X86-SLOW-NEXT: shrl $7, %ecx558; X86-SLOW-NEXT: movl %esi, %eax559; X86-SLOW-NEXT: shll $25, %eax560; X86-SLOW-NEXT: orl %ecx, %eax561; X86-SLOW-NEXT: shrl $7, %esi562; X86-SLOW-NEXT: shll $25, %edx563; X86-SLOW-NEXT: orl %esi, %edx564; X86-SLOW-NEXT: popl %esi565; X86-SLOW-NEXT: retl566;567; X64-FAST-LABEL: const_shift_i64:568; X64-FAST: # %bb.0:569; X64-FAST-NEXT: movq %rdi, %rax570; X64-FAST-NEXT: shldq $57, %rsi, %rax571; X64-FAST-NEXT: retq572;573; X64-SLOW-LABEL: const_shift_i64:574; X64-SLOW: # %bb.0:575; X64-SLOW-NEXT: shrq $7, %rsi576; X64-SLOW-NEXT: shlq $57, %rdi577; X64-SLOW-NEXT: leaq (%rdi,%rsi), %rax578; X64-SLOW-NEXT: retq579 %tmp = tail call i64 @llvm.fshr.i64(i64 %x, i64 %y, i64 7)580 ret i64 %tmp581}582 583;584; Combine Consecutive Loads585;586 587define i8 @combine_fshr_load_i8(ptr %p) nounwind {588; X86-LABEL: combine_fshr_load_i8:589; X86: # %bb.0:590; X86-NEXT: movl {{[0-9]+}}(%esp), %eax591; X86-NEXT: movzbl (%eax), %eax592; X86-NEXT: retl593;594; X64-LABEL: combine_fshr_load_i8:595; X64: # %bb.0:596; X64-NEXT: movzbl (%rdi), %eax597; X64-NEXT: retq598 %p1 = getelementptr i8, ptr %p, i32 1599 %ld0 = load i8, ptr%p600 %ld1 = load i8, ptr%p1601 %res = call i8 @llvm.fshr.i8(i8 %ld1, i8 %ld0, i8 8)602 ret i8 %res603}604 605define i16 @combine_fshr_load_i16(ptr %p) nounwind {606; X86-LABEL: combine_fshr_load_i16:607; X86: # %bb.0:608; X86-NEXT: movl {{[0-9]+}}(%esp), %eax609; X86-NEXT: movzwl 1(%eax), %eax610; X86-NEXT: retl611;612; X64-LABEL: combine_fshr_load_i16:613; X64: # %bb.0:614; X64-NEXT: movzwl 1(%rdi), %eax615; X64-NEXT: retq616 %p1 = getelementptr i16, ptr %p, i32 1617 %ld0 = load i16, ptr%p618 %ld1 = load i16, ptr%p1619 %res = call i16 @llvm.fshr.i16(i16 %ld1, i16 %ld0, i16 8)620 ret i16 %res621}622 623define i32 @combine_fshr_load_i32(ptr %p) nounwind {624; X86-LABEL: combine_fshr_load_i32:625; X86: # %bb.0:626; X86-NEXT: movl {{[0-9]+}}(%esp), %eax627; X86-NEXT: movl 9(%eax), %eax628; X86-NEXT: retl629;630; X64-LABEL: combine_fshr_load_i32:631; X64: # %bb.0:632; X64-NEXT: movl 9(%rdi), %eax633; X64-NEXT: retq634 %p0 = getelementptr i32, ptr %p, i32 2635 %p1 = getelementptr i32, ptr %p, i32 3636 %ld0 = load i32, ptr%p0637 %ld1 = load i32, ptr%p1638 %res = call i32 @llvm.fshr.i32(i32 %ld1, i32 %ld0, i32 8)639 ret i32 %res640}641 642define i64 @combine_fshr_load_i64(ptr %p) nounwind {643; X86-LABEL: combine_fshr_load_i64:644; X86: # %bb.0:645; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx646; X86-NEXT: movl 11(%ecx), %eax647; X86-NEXT: movl 15(%ecx), %edx648; X86-NEXT: retl649;650; X64-LABEL: combine_fshr_load_i64:651; X64: # %bb.0:652; X64-NEXT: movq 11(%rdi), %rax653; X64-NEXT: retq654 %p0 = getelementptr i64, ptr %p, i64 1655 %p1 = getelementptr i64, ptr %p, i64 2656 %ld0 = load i64, ptr%p0657 %ld1 = load i64, ptr%p1658 %res = call i64 @llvm.fshr.i64(i64 %ld1, i64 %ld0, i64 24)659 ret i64 %res660}661 662!llvm.module.flags = !{!0}663!0 = !{i32 1, !"ProfileSummary", !1}664!1 = !{!2, !3, !4, !5, !6, !7, !8, !9}665!2 = !{!"ProfileFormat", !"InstrProf"}666!3 = !{!"TotalCount", i64 10000}667!4 = !{!"MaxCount", i64 10}668!5 = !{!"MaxInternalCount", i64 1}669!6 = !{!"MaxFunctionCount", i64 1000}670!7 = !{!"NumCounts", i64 3}671!8 = !{!"NumFunctions", i64 3}672!9 = !{!"DetailedSummary", !10}673!10 = !{!11, !12, !13}674!11 = !{i32 10000, i64 100, i32 1}675!12 = !{i32 999000, i64 100, i32 1}676!13 = !{i32 999999, i64 1, i32 2}677!14 = !{!"function_entry_count", i64 0}678