brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.8 KiB · f2627df Raw
220 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=i386-unknown-unknown   | FileCheck %s --check-prefix=X863; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X644 5define i32 @t1(i32 %t, i32 %val) nounwind {6; X86-LABEL: t1:7; X86:       # %bb.0:8; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx9; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax10; X86-NEXT:    shll %cl, %eax11; X86-NEXT:    retl12;13; X64-LABEL: t1:14; X64:       # %bb.0:15; X64-NEXT:    movl %esi, %eax16; X64-NEXT:    movl %edi, %ecx17; X64-NEXT:    # kill: def $cl killed $cl killed $ecx18; X64-NEXT:    shll %cl, %eax19; X64-NEXT:    retq20       %shamt = and i32 %t, 3121       %res = shl i32 %val, %shamt22       ret i32 %res23}24 25define i32 @t2(i32 %t, i32 %val) nounwind {26; X86-LABEL: t2:27; X86:       # %bb.0:28; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx29; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax30; X86-NEXT:    shll %cl, %eax31; X86-NEXT:    retl32;33; X64-LABEL: t2:34; X64:       # %bb.0:35; X64-NEXT:    movl %esi, %eax36; X64-NEXT:    movl %edi, %ecx37; X64-NEXT:    # kill: def $cl killed $cl killed $ecx38; X64-NEXT:    shll %cl, %eax39; X64-NEXT:    retq40       %shamt = and i32 %t, 6341       %res = shl i32 %val, %shamt42       ret i32 %res43}44 45@X = internal global i16 046 47define void @t3(i16 %t) nounwind {48; X86-LABEL: t3:49; X86:       # %bb.0:50; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx51; X86-NEXT:    sarw %cl, X52; X86-NEXT:    retl53;54; X64-LABEL: t3:55; X64:       # %bb.0:56; X64-NEXT:    movl %edi, %ecx57; X64-NEXT:    # kill: def $cl killed $cl killed $ecx58; X64-NEXT:    sarw %cl, X(%rip)59; X64-NEXT:    retq60       %shamt = and i16 %t, 3161       %tmp = load i16, ptr @X62       %tmp1 = ashr i16 %tmp, %shamt63       store i16 %tmp1, ptr @X64       ret void65}66 67define i64 @t4(i64 %t, i64 %val) nounwind {68; X86-LABEL: t4:69; X86:       # %bb.0:70; X86-NEXT:    pushl %esi71; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx72; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax73; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi74; X86-NEXT:    movl %esi, %edx75; X86-NEXT:    shrl %cl, %edx76; X86-NEXT:    shrdl %cl, %esi, %eax77; X86-NEXT:    testb $32, %cl78; X86-NEXT:    je .LBB3_279; X86-NEXT:  # %bb.1:80; X86-NEXT:    movl %edx, %eax81; X86-NEXT:    xorl %edx, %edx82; X86-NEXT:  .LBB3_2:83; X86-NEXT:    popl %esi84; X86-NEXT:    retl85;86; X64-LABEL: t4:87; X64:       # %bb.0:88; X64-NEXT:    movq %rsi, %rax89; X64-NEXT:    movq %rdi, %rcx90; X64-NEXT:    # kill: def $cl killed $cl killed $rcx91; X64-NEXT:    shrq %cl, %rax92; X64-NEXT:    retq93       %shamt = and i64 %t, 6394       %res = lshr i64 %val, %shamt95       ret i64 %res96}97 98define i64 @t5(i64 %t, i64 %val) nounwind {99; X86-LABEL: t5:100; X86:       # %bb.0:101; X86-NEXT:    pushl %esi102; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx103; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax104; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi105; X86-NEXT:    movl %esi, %edx106; X86-NEXT:    shrl %cl, %edx107; X86-NEXT:    shrdl %cl, %esi, %eax108; X86-NEXT:    testb $32, %cl109; X86-NEXT:    je .LBB4_2110; X86-NEXT:  # %bb.1:111; X86-NEXT:    movl %edx, %eax112; X86-NEXT:    xorl %edx, %edx113; X86-NEXT:  .LBB4_2:114; X86-NEXT:    popl %esi115; X86-NEXT:    retl116;117; X64-LABEL: t5:118; X64:       # %bb.0:119; X64-NEXT:    movq %rsi, %rax120; X64-NEXT:    movq %rdi, %rcx121; X64-NEXT:    # kill: def $cl killed $cl killed $rcx122; X64-NEXT:    shrq %cl, %rax123; X64-NEXT:    retq124       %shamt = and i64 %t, 191125       %res = lshr i64 %val, %shamt126       ret i64 %res127}128 129define void @t5ptr(i64 %t, ptr %ptr) nounwind {130; X86-LABEL: t5ptr:131; X86:       # %bb.0:132; X86-NEXT:    pushl %edi133; X86-NEXT:    pushl %esi134; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx135; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax136; X86-NEXT:    movl (%eax), %edx137; X86-NEXT:    movl 4(%eax), %edi138; X86-NEXT:    movl %edi, %esi139; X86-NEXT:    shrl %cl, %esi140; X86-NEXT:    shrdl %cl, %edi, %edx141; X86-NEXT:    testb $32, %cl142; X86-NEXT:    je .LBB5_2143; X86-NEXT:  # %bb.1:144; X86-NEXT:    movl %esi, %edx145; X86-NEXT:    xorl %esi, %esi146; X86-NEXT:  .LBB5_2:147; X86-NEXT:    movl %edx, (%eax)148; X86-NEXT:    movl %esi, 4(%eax)149; X86-NEXT:    popl %esi150; X86-NEXT:    popl %edi151; X86-NEXT:    retl152;153; X64-LABEL: t5ptr:154; X64:       # %bb.0:155; X64-NEXT:    movq %rdi, %rcx156; X64-NEXT:    # kill: def $cl killed $cl killed $rcx157; X64-NEXT:    shrq %cl, (%rsi)158; X64-NEXT:    retq159       %shamt = and i64 %t, 191160       %tmp = load i64, ptr %ptr161       %tmp1 = lshr i64 %tmp, %shamt162       store i64 %tmp1, ptr %ptr163       ret void164}165 166 167; rdar://11866926168define i64 @t6(i64 %key, ptr nocapture %val) nounwind {169; X86-LABEL: t6:170; X86:       # %bb.0:171; X86-NEXT:    pushl %esi172; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx173; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx174; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi175; X86-NEXT:    shrdl $3, %esi, %ecx176; X86-NEXT:    shrl $3, %esi177; X86-NEXT:    movl (%edx), %eax178; X86-NEXT:    movl 4(%edx), %edx179; X86-NEXT:    addl $-1, %eax180; X86-NEXT:    adcl $-1, %edx181; X86-NEXT:    andl %ecx, %eax182; X86-NEXT:    andl %esi, %edx183; X86-NEXT:    popl %esi184; X86-NEXT:    retl185;186; X64-LABEL: t6:187; X64:       # %bb.0:188; X64-NEXT:    shrq $3, %rdi189; X64-NEXT:    movq (%rsi), %rax190; X64-NEXT:    decq %rax191; X64-NEXT:    andq %rdi, %rax192; X64-NEXT:    retq193  %shr = lshr i64 %key, 3194  %1 = load i64, ptr %val, align 8195  %sub = add i64 %1, 2305843009213693951196  %and = and i64 %sub, %shr197  ret i64 %and198}199 200define i64 @big_mask_constant(i64 %x) nounwind {201; X86-LABEL: big_mask_constant:202; X86:       # %bb.0:203; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax204; X86-NEXT:    andl $4, %eax205; X86-NEXT:    shll $25, %eax206; X86-NEXT:    xorl %edx, %edx207; X86-NEXT:    retl208;209; X64-LABEL: big_mask_constant:210; X64:       # %bb.0:211; X64-NEXT:    movq %rdi, %rax212; X64-NEXT:    shrq $7, %rax213; X64-NEXT:    andl $134217728, %eax # imm = 0x8000000214; X64-NEXT:    retq215  %and = and i64 %x, 17179869184 ; 0x400000000216  %sh = lshr i64 %and, 7217  ret i64 %sh218}219 220