brintos

brintos / llvm-project-archived public Read only

0
0
Text · 9.5 KiB · 7855ff2 Raw
244 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=i686-linux   -show-mc-encoding | FileCheck %s --check-prefix=CHECK323; RUN: llc < %s -mtriple=x86_64-linux -show-mc-encoding | FileCheck %s --check-prefix=CHECK644; RUN: llc < %s -mtriple=x86_64-win32 -show-mc-encoding | FileCheck %s --check-prefix=WIN645 6declare void @foo()7declare void @bar()8 9define void @f(i32 %x, i32 %y) !prof !14 {10; CHECK32-LABEL: f:11; CHECK32:       # %bb.0: # %entry12; CHECK32-NEXT:    movl {{[0-9]+}}(%esp), %eax # encoding: [0x8b,0x44,0x24,0x04]13; CHECK32-NEXT:    cmpl {{[0-9]+}}(%esp), %eax # encoding: [0x3b,0x44,0x24,0x08]14; CHECK32-NEXT:    jne bar@PLT # TAILCALL15; CHECK32-NEXT:    # encoding: [0x75,A]16; CHECK32-NEXT:    # fixup A - offset: 1, value: bar@PLT, kind: FK_PCRel_117; CHECK32-NEXT:  # %bb.1: # %bb118; CHECK32-NEXT:    jmp foo@PLT # TAILCALL19; CHECK32-NEXT:    # encoding: [0xeb,A]20; CHECK32-NEXT:    # fixup A - offset: 1, value: foo@PLT, kind: FK_PCRel_121;22; CHECK64-LABEL: f:23; CHECK64:       # %bb.0: # %entry24; CHECK64-NEXT:    cmpl %esi, %edi # encoding: [0x39,0xf7]25; CHECK64-NEXT:    jne bar@PLT # TAILCALL26; CHECK64-NEXT:    # encoding: [0x75,A]27; CHECK64-NEXT:    # fixup A - offset: 1, value: bar@PLT, kind: FK_PCRel_128; CHECK64-NEXT:  # %bb.1: # %bb129; CHECK64-NEXT:    jmp foo@PLT # TAILCALL30; CHECK64-NEXT:    # encoding: [0xeb,A]31; CHECK64-NEXT:    # fixup A - offset: 1, value: foo@PLT, kind: FK_PCRel_132;33; WIN64-LABEL: f:34; WIN64:       # %bb.0: # %entry35; WIN64-NEXT:    cmpl %edx, %ecx # encoding: [0x39,0xd1]36; WIN64-NEXT:    jne bar # TAILCALL37; WIN64-NEXT:    # encoding: [0x75,A]38; WIN64-NEXT:    # fixup A - offset: 1, value: bar, kind: FK_PCRel_139; WIN64-NEXT:  # %bb.1: # %bb140; WIN64-NEXT:    jmp foo # TAILCALL41; WIN64-NEXT:    # encoding: [0xeb,A]42; WIN64-NEXT:    # fixup A - offset: 1, value: foo, kind: FK_PCRel_143entry:44	%p = icmp eq i32 %x, %y45  br i1 %p, label %bb1, label %bb246bb1:47  tail call void @foo()48  ret void49bb2:50  tail call void @bar()51  ret void52 53; Check that the asm doesn't just look good, but uses the correct encoding.54}55 56define void @f_non_leaf(i32 %x, i32 %y) !prof !14 {57; CHECK32-LABEL: f_non_leaf:58; CHECK32:       # %bb.0: # %entry59; CHECK32-NEXT:    pushl %ebx # encoding: [0x53]60; CHECK32-NEXT:    .cfi_def_cfa_offset 861; CHECK32-NEXT:    .cfi_offset %ebx, -862; CHECK32-NEXT:    movl {{[0-9]+}}(%esp), %eax # encoding: [0x8b,0x44,0x24,0x08]63; CHECK32-NEXT:    #APP64; CHECK32-NEXT:    #NO_APP65; CHECK32-NEXT:    cmpl {{[0-9]+}}(%esp), %eax # encoding: [0x3b,0x44,0x24,0x0c]66; CHECK32-NEXT:    jne .LBB1_2 # encoding: [0x75,A]67; CHECK32-NEXT:    # fixup A - offset: 1, value: .LBB1_2, kind: FK_PCRel_168; CHECK32-NEXT:  # %bb.1: # %bb169; CHECK32-NEXT:    popl %ebx # encoding: [0x5b]70; CHECK32-NEXT:    .cfi_def_cfa_offset 471; CHECK32-NEXT:    jmp foo@PLT # TAILCALL72; CHECK32-NEXT:    # encoding: [0xeb,A]73; CHECK32-NEXT:    # fixup A - offset: 1, value: foo@PLT, kind: FK_PCRel_174; CHECK32-NEXT:  .LBB1_2: # %bb275; CHECK32-NEXT:    .cfi_def_cfa_offset 876; CHECK32-NEXT:    popl %ebx # encoding: [0x5b]77; CHECK32-NEXT:    .cfi_def_cfa_offset 478; CHECK32-NEXT:    jmp bar@PLT # TAILCALL79; CHECK32-NEXT:    # encoding: [0xeb,A]80; CHECK32-NEXT:    # fixup A - offset: 1, value: bar@PLT, kind: FK_PCRel_181;82; CHECK64-LABEL: f_non_leaf:83; CHECK64:       # %bb.0: # %entry84; CHECK64-NEXT:    pushq %rbx # encoding: [0x53]85; CHECK64-NEXT:    .cfi_def_cfa_offset 1686; CHECK64-NEXT:    .cfi_offset %rbx, -1687; CHECK64-NEXT:    #APP88; CHECK64-NEXT:    #NO_APP89; CHECK64-NEXT:    cmpl %esi, %edi # encoding: [0x39,0xf7]90; CHECK64-NEXT:    jne .LBB1_2 # encoding: [0x75,A]91; CHECK64-NEXT:    # fixup A - offset: 1, value: .LBB1_2, kind: FK_PCRel_192; CHECK64-NEXT:  # %bb.1: # %bb193; CHECK64-NEXT:    popq %rbx # encoding: [0x5b]94; CHECK64-NEXT:    .cfi_def_cfa_offset 895; CHECK64-NEXT:    jmp foo@PLT # TAILCALL96; CHECK64-NEXT:    # encoding: [0xeb,A]97; CHECK64-NEXT:    # fixup A - offset: 1, value: foo@PLT, kind: FK_PCRel_198; CHECK64-NEXT:  .LBB1_2: # %bb299; CHECK64-NEXT:    .cfi_def_cfa_offset 16100; CHECK64-NEXT:    popq %rbx # encoding: [0x5b]101; CHECK64-NEXT:    .cfi_def_cfa_offset 8102; CHECK64-NEXT:    jmp bar@PLT # TAILCALL103; CHECK64-NEXT:    # encoding: [0xeb,A]104; CHECK64-NEXT:    # fixup A - offset: 1, value: bar@PLT, kind: FK_PCRel_1105;106; WIN64-LABEL: f_non_leaf:107; WIN64:       # %bb.0: # %entry108; WIN64-NEXT:    pushq %rbx # encoding: [0x53]109; WIN64-NEXT:    .seh_pushreg %rbx110; WIN64-NEXT:    .seh_endprologue111; WIN64-NEXT:    #APP112; WIN64-NEXT:    #NO_APP113; WIN64-NEXT:    cmpl %edx, %ecx # encoding: [0x39,0xd1]114; WIN64-NEXT:    jne .LBB1_2 # encoding: [0x75,A]115; WIN64-NEXT:    # fixup A - offset: 1, value: .LBB1_2, kind: FK_PCRel_1116; WIN64-NEXT:  # %bb.1: # %bb1117; WIN64-NEXT:    .seh_startepilogue118; WIN64-NEXT:    popq %rbx # encoding: [0x5b]119; WIN64-NEXT:    .seh_endepilogue120; WIN64-NEXT:    jmp foo # TAILCALL121; WIN64-NEXT:    # encoding: [0xeb,A]122; WIN64-NEXT:    # fixup A - offset: 1, value: foo, kind: FK_PCRel_1123; WIN64-NEXT:  .LBB1_2: # %bb2124; WIN64-NEXT:    .seh_startepilogue125; WIN64-NEXT:    popq %rbx # encoding: [0x5b]126; WIN64-NEXT:    .seh_endepilogue127; WIN64-NEXT:    jmp bar # TAILCALL128; WIN64-NEXT:    # encoding: [0xeb,A]129; WIN64-NEXT:    # fixup A - offset: 1, value: bar, kind: FK_PCRel_1130; WIN64-NEXT:    .seh_endproc131entry:132  ; Force %ebx to be spilled on the stack, turning this into133  ; not a "leaf" function for Win64.134  tail call void asm sideeffect "", "~{ebx}"()135 136	%p = icmp eq i32 %x, %y137  br i1 %p, label %bb1, label %bb2138bb1:139  tail call void @foo()140  ret void141bb2:142  tail call void @bar()143  ret void144 145}146 147declare x86_thiscallcc zeroext i1 @baz(ptr, i32)148define x86_thiscallcc zeroext i1 @BlockPlacementTest(ptr %this, i32 %x) !prof !14 {149; CHECK32-LABEL: BlockPlacementTest:150; CHECK32:       # %bb.0: # %entry151; CHECK32-NEXT:    movl {{[0-9]+}}(%esp), %edx # encoding: [0x8b,0x54,0x24,0x04]152; CHECK32-NEXT:    testb $42, %dl # encoding: [0xf6,0xc2,0x2a]153; CHECK32-NEXT:    je .LBB2_3 # encoding: [0x74,A]154; CHECK32-NEXT:    # fixup A - offset: 1, value: .LBB2_3, kind: FK_PCRel_1155; CHECK32-NEXT:  # %bb.1: # %land.rhs156; CHECK32-NEXT:    movb $1, %al # encoding: [0xb0,0x01]157; CHECK32-NEXT:    testb $44, %dl # encoding: [0xf6,0xc2,0x2c]158; CHECK32-NEXT:    je baz@PLT # TAILCALL159; CHECK32-NEXT:    # encoding: [0x74,A]160; CHECK32-NEXT:    # fixup A - offset: 1, value: baz@PLT, kind: FK_PCRel_1161; CHECK32-NEXT:  .LBB2_2: # %land.end162; CHECK32-NEXT:    # kill: def $al killed $al killed $eax163; CHECK32-NEXT:    retl $4 # encoding: [0xc2,0x04,0x00]164; CHECK32-NEXT:  .LBB2_3:165; CHECK32-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]166; CHECK32-NEXT:    jmp .LBB2_2 # encoding: [0xeb,A]167; CHECK32-NEXT:    # fixup A - offset: 1, value: .LBB2_2, kind: FK_PCRel_1168;169; CHECK64-LABEL: BlockPlacementTest:170; CHECK64:       # %bb.0: # %entry171; CHECK64-NEXT:    testb $42, %sil # encoding: [0x40,0xf6,0xc6,0x2a]172; CHECK64-NEXT:    je .LBB2_3 # encoding: [0x74,A]173; CHECK64-NEXT:    # fixup A - offset: 1, value: .LBB2_3, kind: FK_PCRel_1174; CHECK64-NEXT:  # %bb.1: # %land.rhs175; CHECK64-NEXT:    movb $1, %al # encoding: [0xb0,0x01]176; CHECK64-NEXT:    testb $44, %sil # encoding: [0x40,0xf6,0xc6,0x2c]177; CHECK64-NEXT:    je baz@PLT # TAILCALL178; CHECK64-NEXT:    # encoding: [0x74,A]179; CHECK64-NEXT:    # fixup A - offset: 1, value: baz@PLT, kind: FK_PCRel_1180; CHECK64-NEXT:  .LBB2_2: # %land.end181; CHECK64-NEXT:    # kill: def $al killed $al killed $eax182; CHECK64-NEXT:    retq # encoding: [0xc3]183; CHECK64-NEXT:  .LBB2_3:184; CHECK64-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]185; CHECK64-NEXT:    jmp .LBB2_2 # encoding: [0xeb,A]186; CHECK64-NEXT:    # fixup A - offset: 1, value: .LBB2_2, kind: FK_PCRel_1187;188; WIN64-LABEL: BlockPlacementTest:189; WIN64:       # %bb.0: # %entry190; WIN64-NEXT:    testb $42, %dl # encoding: [0xf6,0xc2,0x2a]191; WIN64-NEXT:    je .LBB2_3 # encoding: [0x74,A]192; WIN64-NEXT:    # fixup A - offset: 1, value: .LBB2_3, kind: FK_PCRel_1193; WIN64-NEXT:  # %bb.1: # %land.rhs194; WIN64-NEXT:    movb $1, %al # encoding: [0xb0,0x01]195; WIN64-NEXT:    testb $44, %dl # encoding: [0xf6,0xc2,0x2c]196; WIN64-NEXT:    je baz # TAILCALL197; WIN64-NEXT:    # encoding: [0x74,A]198; WIN64-NEXT:    # fixup A - offset: 1, value: baz, kind: FK_PCRel_1199; WIN64-NEXT:  .LBB2_2: # %land.end200; WIN64-NEXT:    # kill: def $al killed $al killed $eax201; WIN64-NEXT:    retq # encoding: [0xc3]202; WIN64-NEXT:  .LBB2_3:203; WIN64-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]204; WIN64-NEXT:    jmp .LBB2_2 # encoding: [0xeb,A]205; WIN64-NEXT:    # fixup A - offset: 1, value: .LBB2_2, kind: FK_PCRel_1206entry:207  %and = and i32 %x, 42208  %tobool = icmp eq i32 %and, 0209  br i1 %tobool, label %land.end, label %land.rhs210 211land.rhs:212  %and6 = and i32 %x, 44213  %tobool7 = icmp eq i32 %and6, 0214  br i1 %tobool7, label %lor.rhs, label %land.end215 216lor.rhs:217  %call = tail call x86_thiscallcc zeroext i1 @baz(ptr %this, i32 %x) #2218  br label %land.end219 220land.end:221  %0 = phi i1 [ false, %entry ], [ true, %land.rhs ], [ %call, %lor.rhs ]222  ret i1 %0223 224; Make sure machine block placement isn't confused by the conditional tail call,225; but sees that it can fall through to the next block.226}227 228!llvm.module.flags = !{!0}229!0 = !{i32 1, !"ProfileSummary", !1}230!1 = !{!2, !3, !4, !5, !6, !7, !8, !9}231!2 = !{!"ProfileFormat", !"InstrProf"}232!3 = !{!"TotalCount", i64 10000}233!4 = !{!"MaxCount", i64 10}234!5 = !{!"MaxInternalCount", i64 1}235!6 = !{!"MaxFunctionCount", i64 1000}236!7 = !{!"NumCounts", i64 3}237!8 = !{!"NumFunctions", i64 3}238!9 = !{!"DetailedSummary", !10}239!10 = !{!11, !12, !13}240!11 = !{i32 10000, i64 100, i32 1}241!12 = !{i32 999000, i64 100, i32 1}242!13 = !{i32 999999, i64 1, i32 2}243!14 = !{!"function_entry_count", i64 0}244