342 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 52; NOTE: Fast Isel is not added because it does not support x87 stores.3 4; RUN: llc < %s -mtriple=x86_64-- -mattr=+x87,-sse,-sse2 -global-isel=0 | FileCheck %s --check-prefixes X64,SDAG-X645; RUN: llc < %s -mtriple=x86_64-- -mattr=+x87,-sse,-sse2 -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes X64,GISEL-X646; RUN: llc < %s -mtriple=i686-- -mattr=+x87,-sse,-sse2 -global-isel=0 | FileCheck %s --check-prefixes X86,SDAG-X867; TODO: The last RUN line fails GISEL for f64/double cases and will fallback to DAG due to lack of support for8; loads/stores in X86 mode, support is expected soon enough, for this reason the isel-sint-to-fp64-x86.mir test is added.9; RUN: llc < %s -mtriple=i686-- -mattr=+x87,-sse,-sse2 -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes X86,GISEL-X8610 11define void @test_int8_to_float(i8 %x, ptr %p) nounwind {12; SDAG-X64-LABEL: test_int8_to_float:13; SDAG-X64: # %bb.0: # %entry14; SDAG-X64-NEXT: movsbl %dil, %eax15; SDAG-X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)16; SDAG-X64-NEXT: filds -{{[0-9]+}}(%rsp)17; SDAG-X64-NEXT: fstps (%rsi)18; SDAG-X64-NEXT: retq19;20; GISEL-X64-LABEL: test_int8_to_float:21; GISEL-X64: # %bb.0: # %entry22; GISEL-X64-NEXT: shlw $8, %di23; GISEL-X64-NEXT: sarw $8, %di24; GISEL-X64-NEXT: movw %di, -{{[0-9]+}}(%rsp)25; GISEL-X64-NEXT: filds -{{[0-9]+}}(%rsp)26; GISEL-X64-NEXT: fstps (%rsi)27; GISEL-X64-NEXT: retq28;29; SDAG-X86-LABEL: test_int8_to_float:30; SDAG-X86: # %bb.0: # %entry31; SDAG-X86-NEXT: pushl %eax32; SDAG-X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax33; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx34; SDAG-X86-NEXT: movw %ax, {{[0-9]+}}(%esp)35; SDAG-X86-NEXT: filds {{[0-9]+}}(%esp)36; SDAG-X86-NEXT: fstps (%ecx)37; SDAG-X86-NEXT: popl %eax38; SDAG-X86-NEXT: retl39;40; GISEL-X86-LABEL: test_int8_to_float:41; GISEL-X86: # %bb.0: # %entry42; GISEL-X86-NEXT: pushl %eax43; GISEL-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax44; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx45; GISEL-X86-NEXT: shlw $8, %ax46; GISEL-X86-NEXT: sarw $8, %ax47; GISEL-X86-NEXT: movw %ax, {{[0-9]+}}(%esp)48; GISEL-X86-NEXT: filds {{[0-9]+}}(%esp)49; GISEL-X86-NEXT: fstps (%ecx)50; GISEL-X86-NEXT: popl %eax51; GISEL-X86-NEXT: retl52entry:53 %conv = sitofp i8 %x to float54 store float %conv, ptr %p, align 455 ret void56}57 58define void @test_int16_to_float(i16 %x, ptr %p) nounwind {59; X64-LABEL: test_int16_to_float:60; X64: # %bb.0: # %entry61; X64-NEXT: movw %di, -{{[0-9]+}}(%rsp)62; X64-NEXT: filds -{{[0-9]+}}(%rsp)63; X64-NEXT: fstps (%rsi)64; X64-NEXT: retq65;66; SDAG-X86-LABEL: test_int16_to_float:67; SDAG-X86: # %bb.0: # %entry68; SDAG-X86-NEXT: pushl %eax69; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax70; SDAG-X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx71; SDAG-X86-NEXT: movw %cx, {{[0-9]+}}(%esp)72; SDAG-X86-NEXT: filds {{[0-9]+}}(%esp)73; SDAG-X86-NEXT: fstps (%eax)74; SDAG-X86-NEXT: popl %eax75; SDAG-X86-NEXT: retl76;77; GISEL-X86-LABEL: test_int16_to_float:78; GISEL-X86: # %bb.0: # %entry79; GISEL-X86-NEXT: pushl %eax80; GISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax81; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx82; GISEL-X86-NEXT: movw %ax, {{[0-9]+}}(%esp)83; GISEL-X86-NEXT: filds {{[0-9]+}}(%esp)84; GISEL-X86-NEXT: fstps (%ecx)85; GISEL-X86-NEXT: popl %eax86; GISEL-X86-NEXT: retl87entry:88 %conv = sitofp i16 %x to float89 store float %conv, ptr %p, align 490 ret void91}92 93define void @test_int32_to_float(i32 %x, ptr %p) nounwind {94; X64-LABEL: test_int32_to_float:95; X64: # %bb.0: # %entry96; X64-NEXT: movl %edi, -{{[0-9]+}}(%rsp)97; X64-NEXT: fildl -{{[0-9]+}}(%rsp)98; X64-NEXT: fstps (%rsi)99; X64-NEXT: retq100;101; SDAG-X86-LABEL: test_int32_to_float:102; SDAG-X86: # %bb.0: # %entry103; SDAG-X86-NEXT: pushl %eax104; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax105; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx106; SDAG-X86-NEXT: movl %ecx, (%esp)107; SDAG-X86-NEXT: fildl (%esp)108; SDAG-X86-NEXT: fstps (%eax)109; SDAG-X86-NEXT: popl %eax110; SDAG-X86-NEXT: retl111;112; GISEL-X86-LABEL: test_int32_to_float:113; GISEL-X86: # %bb.0: # %entry114; GISEL-X86-NEXT: pushl %eax115; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax116; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx117; GISEL-X86-NEXT: movl %eax, (%esp)118; GISEL-X86-NEXT: fildl (%esp)119; GISEL-X86-NEXT: fstps (%ecx)120; GISEL-X86-NEXT: popl %eax121; GISEL-X86-NEXT: retl122entry:123 %conv = sitofp i32 %x to float124 store float %conv, ptr %p, align 4125 ret void126}127 128define void @test_int64_to_float(i64 %x, ptr %p) nounwind {129; X64-LABEL: test_int64_to_float:130; X64: # %bb.0: # %entry131; X64-NEXT: movq %rdi, -{{[0-9]+}}(%rsp)132; X64-NEXT: fildll -{{[0-9]+}}(%rsp)133; X64-NEXT: fstps (%rsi)134; X64-NEXT: retq135;136; X86-LABEL: test_int64_to_float:137; X86: # %bb.0: # %entry138; X86-NEXT: movl {{[0-9]+}}(%esp), %eax139; X86-NEXT: fildll {{[0-9]+}}(%esp)140; X86-NEXT: fstps (%eax)141; X86-NEXT: retl142entry:143 %conv = sitofp i64 %x to float144 store float %conv, ptr %p, align 4145 ret void146}147 148define x86_fp80 @test_int8to_longdouble(i8 %a) nounwind {149; SDAG-X64-LABEL: test_int8to_longdouble:150; SDAG-X64: # %bb.0:151; SDAG-X64-NEXT: movsbl %dil, %eax152; SDAG-X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)153; SDAG-X64-NEXT: filds -{{[0-9]+}}(%rsp)154; SDAG-X64-NEXT: retq155;156; GISEL-X64-LABEL: test_int8to_longdouble:157; GISEL-X64: # %bb.0:158; GISEL-X64-NEXT: shlw $8, %di159; GISEL-X64-NEXT: sarw $8, %di160; GISEL-X64-NEXT: movw %di, -{{[0-9]+}}(%rsp)161; GISEL-X64-NEXT: filds -{{[0-9]+}}(%rsp)162; GISEL-X64-NEXT: retq163;164; SDAG-X86-LABEL: test_int8to_longdouble:165; SDAG-X86: # %bb.0:166; SDAG-X86-NEXT: pushl %eax167; SDAG-X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax168; SDAG-X86-NEXT: movw %ax, {{[0-9]+}}(%esp)169; SDAG-X86-NEXT: filds {{[0-9]+}}(%esp)170; SDAG-X86-NEXT: popl %eax171; SDAG-X86-NEXT: retl172;173; GISEL-X86-LABEL: test_int8to_longdouble:174; GISEL-X86: # %bb.0:175; GISEL-X86-NEXT: pushl %eax176; GISEL-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax177; GISEL-X86-NEXT: shlw $8, %ax178; GISEL-X86-NEXT: sarw $8, %ax179; GISEL-X86-NEXT: movw %ax, {{[0-9]+}}(%esp)180; GISEL-X86-NEXT: filds {{[0-9]+}}(%esp)181; GISEL-X86-NEXT: popl %eax182; GISEL-X86-NEXT: retl183 %conv = sitofp i8 %a to x86_fp80184 ret x86_fp80 %conv185}186 187define x86_fp80 @test_int16_to_longdouble(i16 %a) nounwind {188; X64-LABEL: test_int16_to_longdouble:189; X64: # %bb.0:190; X64-NEXT: movw %di, -{{[0-9]+}}(%rsp)191; X64-NEXT: filds -{{[0-9]+}}(%rsp)192; X64-NEXT: retq193;194; X86-LABEL: test_int16_to_longdouble:195; X86: # %bb.0:196; X86-NEXT: pushl %eax197; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax198; X86-NEXT: movw %ax, {{[0-9]+}}(%esp)199; X86-NEXT: filds {{[0-9]+}}(%esp)200; X86-NEXT: popl %eax201; X86-NEXT: retl202 %conv = sitofp i16 %a to x86_fp80203 ret x86_fp80 %conv204}205 206define x86_fp80 @test_int32_to_longdouble(i32 %a) nounwind {207; X64-LABEL: test_int32_to_longdouble:208; X64: # %bb.0:209; X64-NEXT: movl %edi, -{{[0-9]+}}(%rsp)210; X64-NEXT: fildl -{{[0-9]+}}(%rsp)211; X64-NEXT: retq212;213; X86-LABEL: test_int32_to_longdouble:214; X86: # %bb.0:215; X86-NEXT: pushl %eax216; X86-NEXT: movl {{[0-9]+}}(%esp), %eax217; X86-NEXT: movl %eax, (%esp)218; X86-NEXT: fildl (%esp)219; X86-NEXT: popl %eax220; X86-NEXT: retl221 %conv = sitofp i32 %a to x86_fp80222 ret x86_fp80 %conv223}224 225define x86_fp80 @test_int64_to_longdouble(i64 %a, ptr %p) nounwind {226; X64-LABEL: test_int64_to_longdouble:227; X64: # %bb.0:228; X64-NEXT: movq %rdi, -{{[0-9]+}}(%rsp)229; X64-NEXT: fildll -{{[0-9]+}}(%rsp)230; X64-NEXT: retq231;232; X86-LABEL: test_int64_to_longdouble:233; X86: # %bb.0:234; X86-NEXT: fildll {{[0-9]+}}(%esp)235; X86-NEXT: retl236 %conv = sitofp i64 %a to x86_fp80237 ret x86_fp80 %conv238}239 240 241define void @test_int8to_double(i8 %x, ptr %p) nounwind {242; SDAG-X64-LABEL: test_int8to_double:243; SDAG-X64: # %bb.0: # %entry244; SDAG-X64-NEXT: movsbl %dil, %eax245; SDAG-X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)246; SDAG-X64-NEXT: filds -{{[0-9]+}}(%rsp)247; SDAG-X64-NEXT: fstpl (%rsi)248; SDAG-X64-NEXT: retq249;250; GISEL-X64-LABEL: test_int8to_double:251; GISEL-X64: # %bb.0: # %entry252; GISEL-X64-NEXT: shlw $8, %di253; GISEL-X64-NEXT: sarw $8, %di254; GISEL-X64-NEXT: movw %di, -{{[0-9]+}}(%rsp)255; GISEL-X64-NEXT: filds -{{[0-9]+}}(%rsp)256; GISEL-X64-NEXT: fstpl (%rsi)257; GISEL-X64-NEXT: retq258;259; X86-LABEL: test_int8to_double:260; X86: # %bb.0: # %entry261; X86-NEXT: pushl %eax262; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax263; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx264; X86-NEXT: movw %ax, {{[0-9]+}}(%esp)265; X86-NEXT: filds {{[0-9]+}}(%esp)266; X86-NEXT: fstpl (%ecx)267; X86-NEXT: popl %eax268; X86-NEXT: retl269entry:270 %conv = sitofp i8 %x to double271 store double %conv, ptr %p, align 4272 ret void273}274 275define void @test_int16_to_double(i16 %x, ptr %p) nounwind {276; X64-LABEL: test_int16_to_double:277; X64: # %bb.0: # %entry278; X64-NEXT: movw %di, -{{[0-9]+}}(%rsp)279; X64-NEXT: filds -{{[0-9]+}}(%rsp)280; X64-NEXT: fstpl (%rsi)281; X64-NEXT: retq282;283; X86-LABEL: test_int16_to_double:284; X86: # %bb.0: # %entry285; X86-NEXT: pushl %eax286; X86-NEXT: movl {{[0-9]+}}(%esp), %eax287; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx288; X86-NEXT: movw %cx, {{[0-9]+}}(%esp)289; X86-NEXT: filds {{[0-9]+}}(%esp)290; X86-NEXT: fstpl (%eax)291; X86-NEXT: popl %eax292; X86-NEXT: retl293entry:294 %conv = sitofp i16 %x to double295 store double %conv, ptr %p, align 4296 ret void297}298 299define void @test_int32_to_double(i32 %x, ptr %p) nounwind {300; X64-LABEL: test_int32_to_double:301; X64: # %bb.0: # %entry302; X64-NEXT: movl %edi, -{{[0-9]+}}(%rsp)303; X64-NEXT: fildl -{{[0-9]+}}(%rsp)304; X64-NEXT: fstpl (%rsi)305; X64-NEXT: retq306;307; X86-LABEL: test_int32_to_double:308; X86: # %bb.0: # %entry309; X86-NEXT: pushl %eax310; X86-NEXT: movl {{[0-9]+}}(%esp), %eax311; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx312; X86-NEXT: movl %ecx, (%esp)313; X86-NEXT: fildl (%esp)314; X86-NEXT: fstpl (%eax)315; X86-NEXT: popl %eax316; X86-NEXT: retl317entry:318 %conv = sitofp i32 %x to double319 store double %conv, ptr %p, align 4320 ret void321}322 323define void @test_int64_to_double(i64 %x, ptr %p) nounwind {324; X64-LABEL: test_int64_to_double:325; X64: # %bb.0: # %entry326; X64-NEXT: movq %rdi, -{{[0-9]+}}(%rsp)327; X64-NEXT: fildll -{{[0-9]+}}(%rsp)328; X64-NEXT: fstpl (%rsi)329; X64-NEXT: retq330;331; X86-LABEL: test_int64_to_double:332; X86: # %bb.0: # %entry333; X86-NEXT: movl {{[0-9]+}}(%esp), %eax334; X86-NEXT: fildll {{[0-9]+}}(%esp)335; X86-NEXT: fstpl (%eax)336; X86-NEXT: retl337entry:338 %conv = sitofp i64 %x to double339 store double %conv, ptr %p, align 4340 ret void341}342