brintos

brintos / llvm-project-archived public Read only

0
0
Text · 12.8 KiB · ab88807 Raw
439 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -enable-cse-in-irtranslator=0 -enable-cse-in-legalizer=0 -mtriple=i386-linux-gnu -mattr=+sse2  -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X323; RUN: llc -enable-cse-in-irtranslator=0 -enable-cse-in-legalizer=0 -mtriple=x86_64-linux-gnu             -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X644 5define i32 @test_ret_i32() {6; X32-LABEL: test_ret_i32:7; X32:       # %bb.0:8; X32-NEXT:    movl $20, %eax9; X32-NEXT:    retl10;11; X64-LABEL: test_ret_i32:12; X64:       # %bb.0:13; X64-NEXT:    movl $20, %eax14; X64-NEXT:    retq15  ret i32 2016}17 18define i64 @test_ret_i64() {19; X32-LABEL: test_ret_i64:20; X32:       # %bb.0:21; X32-NEXT:    movl $-1, %eax22; X32-NEXT:    movl $15, %edx23; X32-NEXT:    retl24;25; X64-LABEL: test_ret_i64:26; X64:       # %bb.0:27; X64-NEXT:    movabsq $68719476735, %rax # imm = 0xFFFFFFFFF28; X64-NEXT:    retq29  ret i64 6871947673530}31 32define i8 @test_arg_i8(i8 %a) {33; X32-LABEL: test_arg_i8:34; X32:       # %bb.0:35; X32-NEXT:    movzbl {{[0-9]+}}(%esp), %eax36; X32-NEXT:    # kill: def $al killed $al killed $eax37; X32-NEXT:    retl38;39; X64-LABEL: test_arg_i8:40; X64:       # %bb.0:41; X64-NEXT:    movl %edi, %eax42; X64-NEXT:    # kill: def $al killed $al killed $eax43; X64-NEXT:    retq44  ret i8 %a45}46 47define i16 @test_arg_i16(i16 %a) {48; X32-LABEL: test_arg_i16:49; X32:       # %bb.0:50; X32-NEXT:    movzwl {{[0-9]+}}(%esp), %eax51; X32-NEXT:    # kill: def $ax killed $ax killed $eax52; X32-NEXT:    retl53;54; X64-LABEL: test_arg_i16:55; X64:       # %bb.0:56; X64-NEXT:    movl %edi, %eax57; X64-NEXT:    # kill: def $ax killed $ax killed $eax58; X64-NEXT:    retq59  ret i16 %a60}61 62define i32 @test_arg_i32(i32 %a) {63; X32-LABEL: test_arg_i32:64; X32:       # %bb.0:65; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax66; X32-NEXT:    retl67;68; X64-LABEL: test_arg_i32:69; X64:       # %bb.0:70; X64-NEXT:    movl %edi, %eax71; X64-NEXT:    retq72  ret i32 %a73}74 75define i64 @test_arg_i64(i64 %a) {76; X32-LABEL: test_arg_i64:77; X32:       # %bb.0:78; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax79; X32-NEXT:    movl {{[0-9]+}}(%esp), %edx80; X32-NEXT:    retl81;82; X64-LABEL: test_arg_i64:83; X64:       # %bb.0:84; X64-NEXT:    movq %rdi, %rax85; X64-NEXT:    retq86  ret i64 %a87}88 89define i64 @test_i64_args_8(i64 %arg1, i64 %arg2, i64 %arg3, i64 %arg4, i64 %arg5, i64 %arg6, i64 %arg7, i64 %arg8) {90; X32-LABEL: test_i64_args_8:91; X32:       # %bb.0:92; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax93; X32-NEXT:    movl {{[0-9]+}}(%esp), %edx94; X32-NEXT:    retl95;96; X64-LABEL: test_i64_args_8:97; X64:       # %bb.0:98; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax99; X64-NEXT:    retq100  ret i64 %arg8101}102 103define <4 x i32> @test_v4i32_args(<4 x i32> %arg1, <4 x i32> %arg2) {104; X32-LABEL: test_v4i32_args:105; X32:       # %bb.0:106; X32-NEXT:    movaps %xmm1, %xmm0107; X32-NEXT:    retl108;109; X64-LABEL: test_v4i32_args:110; X64:       # %bb.0:111; X64-NEXT:    movaps %xmm1, %xmm0112; X64-NEXT:    retq113  ret <4 x i32> %arg2114}115 116define <8 x i32> @test_v8i32_args(<8 x i32> %arg1, <8 x i32> %arg2) {117; X32-LABEL: test_v8i32_args:118; X32:       # %bb.0:119; X32-NEXT:    subl $12, %esp120; X32-NEXT:    .cfi_def_cfa_offset 16121; X32-NEXT:    movaps %xmm2, %xmm0122; X32-NEXT:    movaps {{[0-9]+}}(%esp), %xmm1123; X32-NEXT:    addl $12, %esp124; X32-NEXT:    .cfi_def_cfa_offset 4125; X32-NEXT:    retl126;127; X64-LABEL: test_v8i32_args:128; X64:       # %bb.0:129; X64-NEXT:    movaps %xmm2, %xmm0130; X64-NEXT:    movaps %xmm3, %xmm1131; X64-NEXT:    retq132  ret <8 x i32> %arg2133}134 135declare void @trivial_callee()136define void @test_trivial_call() {137; X32-LABEL: test_trivial_call:138; X32:       # %bb.0:139; X32-NEXT:    subl $12, %esp140; X32-NEXT:    .cfi_def_cfa_offset 16141; X32-NEXT:    calll trivial_callee142; X32-NEXT:    addl $12, %esp143; X32-NEXT:    .cfi_def_cfa_offset 4144; X32-NEXT:    retl145;146; X64-LABEL: test_trivial_call:147; X64:       # %bb.0:148; X64-NEXT:    pushq %rax149; X64-NEXT:    .cfi_def_cfa_offset 16150; X64-NEXT:    callq trivial_callee151; X64-NEXT:    popq %rax152; X64-NEXT:    .cfi_def_cfa_offset 8153; X64-NEXT:    retq154  call void @trivial_callee()155  ret void156}157 158declare void @simple_arg_callee(i32 %in0, i32 %in1)159define void @test_simple_arg_call(i32 %in0, i32 %in1) {160; X32-LABEL: test_simple_arg_call:161; X32:       # %bb.0:162; X32-NEXT:    subl $12, %esp163; X32-NEXT:    .cfi_def_cfa_offset 16164; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax165; X32-NEXT:    movl {{[0-9]+}}(%esp), %ecx166; X32-NEXT:    movl %ecx, (%esp)167; X32-NEXT:    movl %eax, {{[0-9]+}}(%esp)168; X32-NEXT:    calll simple_arg_callee169; X32-NEXT:    addl $12, %esp170; X32-NEXT:    .cfi_def_cfa_offset 4171; X32-NEXT:    retl172;173; X64-LABEL: test_simple_arg_call:174; X64:       # %bb.0:175; X64-NEXT:    pushq %rax176; X64-NEXT:    .cfi_def_cfa_offset 16177; X64-NEXT:    movl %edi, %eax178; X64-NEXT:    movl %esi, %edi179; X64-NEXT:    movl %eax, %esi180; X64-NEXT:    callq simple_arg_callee181; X64-NEXT:    popq %rax182; X64-NEXT:    .cfi_def_cfa_offset 8183; X64-NEXT:    retq184  call void @simple_arg_callee(i32 %in1, i32 %in0)185  ret void186}187 188declare void @simple_arg8_callee(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %arg5, i32 %arg6, i32 %arg7, i32 %arg8)189define void @test_simple_arg8_call(i32 %in0) {190; X32-LABEL: test_simple_arg8_call:191; X32:       # %bb.0:192; X32-NEXT:    subl $44, %esp193; X32-NEXT:    .cfi_def_cfa_offset 48194; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax195; X32-NEXT:    movl %eax, (%esp)196; X32-NEXT:    movl %eax, {{[0-9]+}}(%esp)197; X32-NEXT:    movl %eax, {{[0-9]+}}(%esp)198; X32-NEXT:    movl %eax, {{[0-9]+}}(%esp)199; X32-NEXT:    movl %eax, {{[0-9]+}}(%esp)200; X32-NEXT:    movl %eax, {{[0-9]+}}(%esp)201; X32-NEXT:    movl %eax, {{[0-9]+}}(%esp)202; X32-NEXT:    movl %eax, {{[0-9]+}}(%esp)203; X32-NEXT:    calll simple_arg8_callee204; X32-NEXT:    addl $44, %esp205; X32-NEXT:    .cfi_def_cfa_offset 4206; X32-NEXT:    retl207;208; X64-LABEL: test_simple_arg8_call:209; X64:       # %bb.0:210; X64-NEXT:    subq $24, %rsp211; X64-NEXT:    .cfi_def_cfa_offset 32212; X64-NEXT:    movl %edi, (%rsp)213; X64-NEXT:    movl %edi, {{[0-9]+}}(%rsp)214; X64-NEXT:    movl %edi, %esi215; X64-NEXT:    movl %edi, %edx216; X64-NEXT:    movl %edi, %ecx217; X64-NEXT:    movl %edi, %r8d218; X64-NEXT:    movl %edi, %r9d219; X64-NEXT:    callq simple_arg8_callee220; X64-NEXT:    addq $24, %rsp221; X64-NEXT:    .cfi_def_cfa_offset 8222; X64-NEXT:    retq223  call void @simple_arg8_callee(i32 %in0, i32 %in0, i32 %in0, i32 %in0,i32 %in0, i32 %in0, i32 %in0, i32 %in0)224  ret void225}226 227declare i32 @simple_return_callee(i32 %in0)228define i32 @test_simple_return_callee() {229; X32-LABEL: test_simple_return_callee:230; X32:       # %bb.0:231; X32-NEXT:    subl $12, %esp232; X32-NEXT:    .cfi_def_cfa_offset 16233; X32-NEXT:    movl $5, (%esp)234; X32-NEXT:    calll simple_return_callee235; X32-NEXT:    addl %eax, %eax236; X32-NEXT:    addl $12, %esp237; X32-NEXT:    .cfi_def_cfa_offset 4238; X32-NEXT:    retl239;240; X64-LABEL: test_simple_return_callee:241; X64:       # %bb.0:242; X64-NEXT:    pushq %rax243; X64-NEXT:    .cfi_def_cfa_offset 16244; X64-NEXT:    movl $5, %edi245; X64-NEXT:    callq simple_return_callee246; X64-NEXT:    addl %eax, %eax247; X64-NEXT:    popq %rcx248; X64-NEXT:    .cfi_def_cfa_offset 8249; X64-NEXT:    retq250  %call = call i32 @simple_return_callee(i32 5)251  %r = add i32 %call, %call252  ret i32 %r253}254 255declare <8 x i32> @split_return_callee(<8 x i32> %in0)256define <8 x i32> @test_split_return_callee(<8 x i32> %arg1, <8 x i32> %arg2) {257; X32-LABEL: test_split_return_callee:258; X32:       # %bb.0:259; X32-NEXT:    subl $44, %esp260; X32-NEXT:    .cfi_def_cfa_offset 48261; X32-NEXT:    movaps %xmm0, (%esp) # 16-byte Spill262; X32-NEXT:    movaps %xmm1, {{[-0-9]+}}(%e{{[sb]}}p) # 16-byte Spill263; X32-NEXT:    movdqa %xmm2, %xmm0264; X32-NEXT:    movdqa {{[0-9]+}}(%esp), %xmm1265; X32-NEXT:    calll split_return_callee266; X32-NEXT:    paddd (%esp), %xmm0 # 16-byte Folded Reload267; X32-NEXT:    paddd {{[-0-9]+}}(%e{{[sb]}}p), %xmm1 # 16-byte Folded Reload268; X32-NEXT:    addl $44, %esp269; X32-NEXT:    .cfi_def_cfa_offset 4270; X32-NEXT:    retl271;272; X64-LABEL: test_split_return_callee:273; X64:       # %bb.0:274; X64-NEXT:    subq $40, %rsp275; X64-NEXT:    .cfi_def_cfa_offset 48276; X64-NEXT:    movaps %xmm0, (%rsp) # 16-byte Spill277; X64-NEXT:    movaps %xmm1, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill278; X64-NEXT:    movdqa %xmm2, %xmm0279; X64-NEXT:    movdqa %xmm3, %xmm1280; X64-NEXT:    callq split_return_callee281; X64-NEXT:    paddd (%rsp), %xmm0 # 16-byte Folded Reload282; X64-NEXT:    paddd {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 16-byte Folded Reload283; X64-NEXT:    addq $40, %rsp284; X64-NEXT:    .cfi_def_cfa_offset 8285; X64-NEXT:    retq286  %call = call <8 x i32> @split_return_callee(<8 x i32> %arg2)287  %r = add <8 x i32> %arg1, %call288  ret  <8 x i32> %r289}290 291define void @test_indirect_call(ptr %func) {292; X32-LABEL: test_indirect_call:293; X32:       # %bb.0:294; X32-NEXT:    subl $12, %esp295; X32-NEXT:    .cfi_def_cfa_offset 16296; X32-NEXT:    calll *{{[0-9]+}}(%esp)297; X32-NEXT:    addl $12, %esp298; X32-NEXT:    .cfi_def_cfa_offset 4299; X32-NEXT:    retl300;301; X64-LABEL: test_indirect_call:302; X64:       # %bb.0:303; X64-NEXT:    pushq %rax304; X64-NEXT:    .cfi_def_cfa_offset 16305; X64-NEXT:    callq *%rdi306; X64-NEXT:    popq %rax307; X64-NEXT:    .cfi_def_cfa_offset 8308; X64-NEXT:    retq309  call void %func()310  ret void311}312 313declare void @take_char(i8)314define void @test_abi_exts_call(ptr %addr) {315; X32-LABEL: test_abi_exts_call:316; X32:       # %bb.0:317; X32-NEXT:    pushl %ebx318; X32-NEXT:    .cfi_def_cfa_offset 8319; X32-NEXT:    pushl %esi320; X32-NEXT:    .cfi_def_cfa_offset 12321; X32-NEXT:    pushl %eax322; X32-NEXT:    .cfi_def_cfa_offset 16323; X32-NEXT:    .cfi_offset %esi, -12324; X32-NEXT:    .cfi_offset %ebx, -8325; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax326; X32-NEXT:    movzbl (%eax), %ebx327; X32-NEXT:    movzbl %bl, %esi328; X32-NEXT:    movl %esi, (%esp)329; X32-NEXT:    calll take_char330; X32-NEXT:    movsbl %bl, %eax331; X32-NEXT:    movl %eax, (%esp)332; X32-NEXT:    calll take_char333; X32-NEXT:    movl %esi, (%esp)334; X32-NEXT:    calll take_char335; X32-NEXT:    addl $4, %esp336; X32-NEXT:    .cfi_def_cfa_offset 12337; X32-NEXT:    popl %esi338; X32-NEXT:    .cfi_def_cfa_offset 8339; X32-NEXT:    popl %ebx340; X32-NEXT:    .cfi_def_cfa_offset 4341; X32-NEXT:    retl342;343; X64-LABEL: test_abi_exts_call:344; X64:       # %bb.0:345; X64-NEXT:    pushq %rbx346; X64-NEXT:    .cfi_def_cfa_offset 16347; X64-NEXT:    .cfi_offset %rbx, -16348; X64-NEXT:    movzbl (%rdi), %eax349; X64-NEXT:    movzbl %al, %ebx350; X64-NEXT:    movl %ebx, %edi351; X64-NEXT:    callq take_char352; X64-NEXT:    movsbl %bl, %edi353; X64-NEXT:    callq take_char354; X64-NEXT:    movl %ebx, %edi355; X64-NEXT:    callq take_char356; X64-NEXT:    popq %rbx357; X64-NEXT:    .cfi_def_cfa_offset 8358; X64-NEXT:    retq359  %val = load i8, ptr %addr360  call void @take_char(i8 %val)361  call void @take_char(i8 signext %val)362  call void @take_char(i8 zeroext %val)363 ret void364}365 366declare void @variadic_callee(ptr, ...)367define void @test_variadic_call_1(ptr %addr_ptr, ptr %val_ptr) {368; X32-LABEL: test_variadic_call_1:369; X32:       # %bb.0:370; X32-NEXT:    subl $12, %esp371; X32-NEXT:    .cfi_def_cfa_offset 16372; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax373; X32-NEXT:    movl {{[0-9]+}}(%esp), %ecx374; X32-NEXT:    movl (%eax), %eax375; X32-NEXT:    movl (%ecx), %ecx376; X32-NEXT:    movl %eax, (%esp)377; X32-NEXT:    movl %ecx, {{[0-9]+}}(%esp)378; X32-NEXT:    calll variadic_callee379; X32-NEXT:    addl $12, %esp380; X32-NEXT:    .cfi_def_cfa_offset 4381; X32-NEXT:    retl382;383; X64-LABEL: test_variadic_call_1:384; X64:       # %bb.0:385; X64-NEXT:    pushq %rax386; X64-NEXT:    .cfi_def_cfa_offset 16387; X64-NEXT:    movq (%rdi), %rdi388; X64-NEXT:    movl (%rsi), %esi389; X64-NEXT:    movb $0, %al390; X64-NEXT:    callq variadic_callee391; X64-NEXT:    popq %rax392; X64-NEXT:    .cfi_def_cfa_offset 8393; X64-NEXT:    retq394 395  %addr = load ptr, ptr %addr_ptr396  %val = load i32, ptr %val_ptr397  call void (ptr, ...) @variadic_callee(ptr %addr, i32 %val)398  ret void399}400 401define void @test_variadic_call_2(ptr %addr_ptr, ptr %val_ptr) {402; X32-LABEL: test_variadic_call_2:403; X32:       # %bb.0:404; X32-NEXT:    subl $12, %esp405; X32-NEXT:    .cfi_def_cfa_offset 16406; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax407; X32-NEXT:    movl {{[0-9]+}}(%esp), %ecx408; X32-NEXT:    movl (%eax), %eax409; X32-NEXT:    movl (%ecx), %edx410; X32-NEXT:    movl 4(%ecx), %ecx411; X32-NEXT:    movl %eax, (%esp)412; X32-NEXT:    movl $4, %eax413; X32-NEXT:    addl %esp, %eax414; X32-NEXT:    movl %edx, {{[0-9]+}}(%esp)415; X32-NEXT:    movl %ecx, 4(%eax)416; X32-NEXT:    calll variadic_callee417; X32-NEXT:    addl $12, %esp418; X32-NEXT:    .cfi_def_cfa_offset 4419; X32-NEXT:    retl420;421; X64-LABEL: test_variadic_call_2:422; X64:       # %bb.0:423; X64-NEXT:    pushq %rax424; X64-NEXT:    .cfi_def_cfa_offset 16425; X64-NEXT:    movq (%rdi), %rdi426; X64-NEXT:    movq (%rsi), %rax427; X64-NEXT:    movq %rax, %xmm0428; X64-NEXT:    movb $1, %al429; X64-NEXT:    callq variadic_callee430; X64-NEXT:    popq %rax431; X64-NEXT:    .cfi_def_cfa_offset 8432; X64-NEXT:    retq433 434  %addr = load ptr, ptr %addr_ptr435  %val = load double, ptr %val_ptr436  call void (ptr, ...) @variadic_callee(ptr %addr, double %val)437  ret void438}439