brintos

brintos / llvm-project-archived public Read only

0
0
Text · 11.2 KiB · cdde03f Raw
383 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 42; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefix=X863; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X644 5declare void @use.i1(i1)6declare void @use.i32(i32)7define i32 @sitofp_signbit_only(i32 %i_in) nounwind {8; X86-LABEL: sitofp_signbit_only:9; X86:       # %bb.0:10; X86-NEXT:    subl $8, %esp11; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax12; X86-NEXT:    movl %eax, (%esp)13; X86-NEXT:    fildl (%esp)14; X86-NEXT:    fstps {{[0-9]+}}(%esp)15; X86-NEXT:    movl $-2147483648, %eax # imm = 0x8000000016; X86-NEXT:    andl {{[0-9]+}}(%esp), %eax17; X86-NEXT:    addl $8, %esp18; X86-NEXT:    retl19;20; X64-LABEL: sitofp_signbit_only:21; X64:       # %bb.0:22; X64-NEXT:    cvtsi2ss %edi, %xmm023; X64-NEXT:    movmskps %xmm0, %eax24; X64-NEXT:    shll $31, %eax25; X64-NEXT:    retq26  %f = sitofp i32 %i_in to float27  %i = bitcast float %f to i3228  %r = and i32 %i, 214748364829  ret i32 %r30}31 32define i32 @sitofp_signbit_only_okay_width(i16 %i_in) nounwind {33; X86-LABEL: sitofp_signbit_only_okay_width:34; X86:       # %bb.0:35; X86-NEXT:    subl $8, %esp36; X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax37; X86-NEXT:    movw %ax, {{[0-9]+}}(%esp)38; X86-NEXT:    filds {{[0-9]+}}(%esp)39; X86-NEXT:    fstps {{[0-9]+}}(%esp)40; X86-NEXT:    movl $-2147483648, %eax # imm = 0x8000000041; X86-NEXT:    andl {{[0-9]+}}(%esp), %eax42; X86-NEXT:    addl $8, %esp43; X86-NEXT:    retl44;45; X64-LABEL: sitofp_signbit_only_okay_width:46; X64:       # %bb.0:47; X64-NEXT:    movswl %di, %eax48; X64-NEXT:    cvtsi2ss %eax, %xmm049; X64-NEXT:    movmskps %xmm0, %eax50; X64-NEXT:    shll $31, %eax51; X64-NEXT:    retq52  %f = sitofp i16 %i_in to float53  %i = bitcast float %f to i3254  %r = and i32 %i, 214748364855  ret i32 %r56}57 58define i32 @sitofp_signbit_only_fail_bad_width1(i64 %i_in) nounwind {59; X86-LABEL: sitofp_signbit_only_fail_bad_width1:60; X86:       # %bb.0:61; X86-NEXT:    pushl %eax62; X86-NEXT:    fildll {{[0-9]+}}(%esp)63; X86-NEXT:    fstps (%esp)64; X86-NEXT:    movl $-2147483648, %eax # imm = 0x8000000065; X86-NEXT:    andl (%esp), %eax66; X86-NEXT:    popl %ecx67; X86-NEXT:    retl68;69; X64-LABEL: sitofp_signbit_only_fail_bad_width1:70; X64:       # %bb.0:71; X64-NEXT:    cvtsi2ss %rdi, %xmm072; X64-NEXT:    movmskps %xmm0, %eax73; X64-NEXT:    shll $31, %eax74; X64-NEXT:    retq75  %f = sitofp i64 %i_in to float76  %i = bitcast float %f to i3277  %r = and i32 %i, 214748364878  ret i32 %r79}80 81define <2 x i16> @sitofp_signbit_only_fail_bad_width2(i32 %i_in) nounwind {82; X86-LABEL: sitofp_signbit_only_fail_bad_width2:83; X86:       # %bb.0:84; X86-NEXT:    subl $8, %esp85; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax86; X86-NEXT:    movl %eax, (%esp)87; X86-NEXT:    fildl (%esp)88; X86-NEXT:    fstps {{[0-9]+}}(%esp)89; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax90; X86-NEXT:    movl %eax, %edx91; X86-NEXT:    shrl $16, %edx92; X86-NEXT:    andl $32768, %eax # imm = 0x800093; X86-NEXT:    andl $32768, %edx # imm = 0x800094; X86-NEXT:    # kill: def $ax killed $ax killed $eax95; X86-NEXT:    # kill: def $dx killed $dx killed $edx96; X86-NEXT:    addl $8, %esp97; X86-NEXT:    retl98;99; X64-LABEL: sitofp_signbit_only_fail_bad_width2:100; X64:       # %bb.0:101; X64-NEXT:    cvtsi2ss %edi, %xmm0102; X64-NEXT:    andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0103; X64-NEXT:    retq104  %f = sitofp i32 %i_in to float105  %i2xi16 = bitcast float %f to <2 x i16>106  %r = and <2 x i16> %i2xi16, <i16 32768, i16 32768>107  ret <2 x i16> %r108}109 110define i32 @sitofp_many_bits_fail(i32 %i_in) nounwind {111; X86-LABEL: sitofp_many_bits_fail:112; X86:       # %bb.0:113; X86-NEXT:    subl $8, %esp114; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax115; X86-NEXT:    movl %eax, (%esp)116; X86-NEXT:    fildl (%esp)117; X86-NEXT:    fstps {{[0-9]+}}(%esp)118; X86-NEXT:    movl $-2147483647, %eax # imm = 0x80000001119; X86-NEXT:    andl {{[0-9]+}}(%esp), %eax120; X86-NEXT:    addl $8, %esp121; X86-NEXT:    retl122;123; X64-LABEL: sitofp_many_bits_fail:124; X64:       # %bb.0:125; X64-NEXT:    cvtsi2ss %edi, %xmm0126; X64-NEXT:    movd %xmm0, %eax127; X64-NEXT:    andl $-2147483647, %eax # imm = 0x80000001128; X64-NEXT:    retq129  %f = sitofp i32 %i_in to float130  %i = bitcast float %f to i32131  %r = and i32 %i, 2147483649132  ret i32 %r133}134 135define i32 @sitofp_multiuse_fail(i32 %i_in) nounwind {136; X86-LABEL: sitofp_multiuse_fail:137; X86:       # %bb.0:138; X86-NEXT:    subl $12, %esp139; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax140; X86-NEXT:    movl %eax, {{[0-9]+}}(%esp)141; X86-NEXT:    fildl {{[0-9]+}}(%esp)142; X86-NEXT:    fsts {{[0-9]+}}(%esp)143; X86-NEXT:    fstps (%esp)144; X86-NEXT:    calll use.i32@PLT145; X86-NEXT:    movl $-2147483648, %eax # imm = 0x80000000146; X86-NEXT:    andl {{[0-9]+}}(%esp), %eax147; X86-NEXT:    addl $12, %esp148; X86-NEXT:    retl149;150; X64-LABEL: sitofp_multiuse_fail:151; X64:       # %bb.0:152; X64-NEXT:    pushq %rbx153; X64-NEXT:    cvtsi2ss %edi, %xmm0154; X64-NEXT:    movd %xmm0, %ebx155; X64-NEXT:    movl %ebx, %edi156; X64-NEXT:    callq use.i32@PLT157; X64-NEXT:    andl $-2147483648, %ebx # imm = 0x80000000158; X64-NEXT:    movl %ebx, %eax159; X64-NEXT:    popq %rbx160; X64-NEXT:    retq161  %f = sitofp i32 %i_in to float162  %i = bitcast float %f to i32163  call void @use.i32(i32 %i)164  %r = and i32 %i, 2147483648165  ret i32 %r166}167 168define i32 @sitofp_multiuse_okay(i32 %i_in) nounwind {169; X86-LABEL: sitofp_multiuse_okay:170; X86:       # %bb.0:171; X86-NEXT:    subl $12, %esp172; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax173; X86-NEXT:    movl %eax, {{[0-9]+}}(%esp)174; X86-NEXT:    fildl {{[0-9]+}}(%esp)175; X86-NEXT:    fsts {{[0-9]+}}(%esp)176; X86-NEXT:    fstps (%esp)177; X86-NEXT:    calll use.i1@PLT178; X86-NEXT:    movl $-2147483648, %eax # imm = 0x80000000179; X86-NEXT:    andl {{[0-9]+}}(%esp), %eax180; X86-NEXT:    addl $12, %esp181; X86-NEXT:    retl182;183; X64-LABEL: sitofp_multiuse_okay:184; X64:       # %bb.0:185; X64-NEXT:    pushq %rbx186; X64-NEXT:    cvtsi2ss %edi, %xmm0187; X64-NEXT:    movd %xmm0, %ebx188; X64-NEXT:    movl %ebx, %edi189; X64-NEXT:    callq use.i1@PLT190; X64-NEXT:    andl $-2147483648, %ebx # imm = 0x80000000191; X64-NEXT:    movl %ebx, %eax192; X64-NEXT:    popq %rbx193; X64-NEXT:    retq194  %f = sitofp i32 %i_in to float195  %i = bitcast float %f to i32196  %cmp = icmp slt i32 %i, 0197  call void @use.i1(i32 %i)198  %r = and i32 %i, 2147483648199  ret i32 %r200}201 202define i32 @uitofp_signbit_only(i32 %i_in) nounwind {203; X86-LABEL: uitofp_signbit_only:204; X86:       # %bb.0:205; X86-NEXT:    xorl %eax, %eax206; X86-NEXT:    retl207;208; X64-LABEL: uitofp_signbit_only:209; X64:       # %bb.0:210; X64-NEXT:    xorl %eax, %eax211; X64-NEXT:    retq212  %f = uitofp i32 %i_in to float213  %i = bitcast float %f to i32214  %r = and i32 %i, 2147483648215  ret i32 %r216}217 218define i32 @uitofp_signbit_only_okay_width(i16 %i_in) nounwind {219; X86-LABEL: uitofp_signbit_only_okay_width:220; X86:       # %bb.0:221; X86-NEXT:    xorl %eax, %eax222; X86-NEXT:    retl223;224; X64-LABEL: uitofp_signbit_only_okay_width:225; X64:       # %bb.0:226; X64-NEXT:    xorl %eax, %eax227; X64-NEXT:    retq228  %f = uitofp i16 %i_in to float229  %i = bitcast float %f to i32230  %r = and i32 %i, 2147483648231  ret i32 %r232}233 234define i32 @uitofp_signbit_only_okay_width1(i64 %i_in) nounwind {235; X86-LABEL: uitofp_signbit_only_okay_width1:236; X86:       # %bb.0:237; X86-NEXT:    xorl %eax, %eax238; X86-NEXT:    retl239;240; X64-LABEL: uitofp_signbit_only_okay_width1:241; X64:       # %bb.0:242; X64-NEXT:    xorl %eax, %eax243; X64-NEXT:    retq244  %f = uitofp i64 %i_in to float245  %i = bitcast float %f to i32246  %r = and i32 %i, 2147483648247  ret i32 %r248}249 250define <2 x i16> @uitofp_signbit_only_fail_bad_width2(i32 %i_in) nounwind {251; X86-LABEL: uitofp_signbit_only_fail_bad_width2:252; X86:       # %bb.0:253; X86-NEXT:    pushl %ebp254; X86-NEXT:    movl %esp, %ebp255; X86-NEXT:    andl $-8, %esp256; X86-NEXT:    subl $16, %esp257; X86-NEXT:    movl 8(%ebp), %eax258; X86-NEXT:    movl %eax, {{[0-9]+}}(%esp)259; X86-NEXT:    movl $0, {{[0-9]+}}(%esp)260; X86-NEXT:    fildll {{[0-9]+}}(%esp)261; X86-NEXT:    fstps {{[0-9]+}}(%esp)262; X86-NEXT:    movl $32768, %eax # imm = 0x8000263; X86-NEXT:    andl {{[0-9]+}}(%esp), %eax264; X86-NEXT:    # kill: def $ax killed $ax killed $eax265; X86-NEXT:    xorl %edx, %edx266; X86-NEXT:    movl %ebp, %esp267; X86-NEXT:    popl %ebp268; X86-NEXT:    retl269;270; X64-LABEL: uitofp_signbit_only_fail_bad_width2:271; X64:       # %bb.0:272; X64-NEXT:    movl %edi, %eax273; X64-NEXT:    cvtsi2ss %rax, %xmm0274; X64-NEXT:    andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0275; X64-NEXT:    retq276  %f = uitofp i32 %i_in to float277  %i2xi16 = bitcast float %f to <2 x i16>278  %r = and <2 x i16> %i2xi16, <i16 32768, i16 32768>279  ret <2 x i16> %r280}281 282define i32 @uitofp_many_bits_fail(i32 %i_in) nounwind {283; X86-LABEL: uitofp_many_bits_fail:284; X86:       # %bb.0:285; X86-NEXT:    pushl %ebp286; X86-NEXT:    movl %esp, %ebp287; X86-NEXT:    andl $-8, %esp288; X86-NEXT:    subl $16, %esp289; X86-NEXT:    movl 8(%ebp), %eax290; X86-NEXT:    movl %eax, {{[0-9]+}}(%esp)291; X86-NEXT:    movl $0, {{[0-9]+}}(%esp)292; X86-NEXT:    fildll {{[0-9]+}}(%esp)293; X86-NEXT:    fstps {{[0-9]+}}(%esp)294; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax295; X86-NEXT:    andl $1, %eax296; X86-NEXT:    movl %ebp, %esp297; X86-NEXT:    popl %ebp298; X86-NEXT:    retl299;300; X64-LABEL: uitofp_many_bits_fail:301; X64:       # %bb.0:302; X64-NEXT:    movl %edi, %eax303; X64-NEXT:    cvtsi2ss %rax, %xmm0304; X64-NEXT:    movd %xmm0, %eax305; X64-NEXT:    andl $1, %eax306; X64-NEXT:    retq307  %f = uitofp i32 %i_in to float308  %i = bitcast float %f to i32309  %r = and i32 %i, 2147483649310  ret i32 %r311}312 313define i32 @uitofp_multiuse_fail(i32 %i_in) nounwind {314; X86-LABEL: uitofp_multiuse_fail:315; X86:       # %bb.0:316; X86-NEXT:    pushl %ebp317; X86-NEXT:    movl %esp, %ebp318; X86-NEXT:    andl $-8, %esp319; X86-NEXT:    subl $16, %esp320; X86-NEXT:    movl 8(%ebp), %eax321; X86-NEXT:    movl %eax, {{[0-9]+}}(%esp)322; X86-NEXT:    movl $0, {{[0-9]+}}(%esp)323; X86-NEXT:    fildll {{[0-9]+}}(%esp)324; X86-NEXT:    fstps (%esp)325; X86-NEXT:    calll use.i32@PLT326; X86-NEXT:    xorl %eax, %eax327; X86-NEXT:    movl %ebp, %esp328; X86-NEXT:    popl %ebp329; X86-NEXT:    retl330;331; X64-LABEL: uitofp_multiuse_fail:332; X64:       # %bb.0:333; X64-NEXT:    pushq %rax334; X64-NEXT:    movl %edi, %eax335; X64-NEXT:    cvtsi2ss %rax, %xmm0336; X64-NEXT:    movd %xmm0, %edi337; X64-NEXT:    callq use.i32@PLT338; X64-NEXT:    xorl %eax, %eax339; X64-NEXT:    popq %rcx340; X64-NEXT:    retq341  %f = uitofp i32 %i_in to float342  %i = bitcast float %f to i32343  call void @use.i32(i32 %i)344  %r = and i32 %i, 2147483648345  ret i32 %r346}347 348define i32 @uitofp_multiuse_okay(i32 %i_in) nounwind {349; X86-LABEL: uitofp_multiuse_okay:350; X86:       # %bb.0:351; X86-NEXT:    pushl %ebp352; X86-NEXT:    movl %esp, %ebp353; X86-NEXT:    andl $-8, %esp354; X86-NEXT:    subl $16, %esp355; X86-NEXT:    movl 8(%ebp), %eax356; X86-NEXT:    movl %eax, {{[0-9]+}}(%esp)357; X86-NEXT:    movl $0, {{[0-9]+}}(%esp)358; X86-NEXT:    fildll {{[0-9]+}}(%esp)359; X86-NEXT:    fstps (%esp)360; X86-NEXT:    calll use.i1@PLT361; X86-NEXT:    xorl %eax, %eax362; X86-NEXT:    movl %ebp, %esp363; X86-NEXT:    popl %ebp364; X86-NEXT:    retl365;366; X64-LABEL: uitofp_multiuse_okay:367; X64:       # %bb.0:368; X64-NEXT:    pushq %rax369; X64-NEXT:    movl %edi, %eax370; X64-NEXT:    cvtsi2ss %rax, %xmm0371; X64-NEXT:    movd %xmm0, %edi372; X64-NEXT:    callq use.i1@PLT373; X64-NEXT:    xorl %eax, %eax374; X64-NEXT:    popq %rcx375; X64-NEXT:    retq376  %f = uitofp i32 %i_in to float377  %i = bitcast float %f to i32378  %cmp = icmp slt i32 %i, 0379  call void @use.i1(i32 %i)380  %r = and i32 %i, 2147483648381  ret i32 %r382}383