235 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=small < %s | FileCheck %s3; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=medium < %s | FileCheck %s4; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=large < %s | FileCheck %s --check-prefix=LARGE5; RUN: llc -mtriple=x86_64 -fast-isel -code-model=large -relocation-model=pic < %s | FileCheck %s --check-prefix=LARGE_PIC6; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=small -mattr=avx < %s | FileCheck %s --check-prefix=AVX7; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=large -mattr=avx < %s | FileCheck %s --check-prefix=LARGE_AVX8; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=small -mattr=avx512f < %s | FileCheck %s --check-prefix=AVX9; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=large -mattr=avx512f < %s | FileCheck %s --check-prefix=LARGE_AVX10 11; This large code mode shouldn't mean anything on x86 but it used to12; generate 64-bit only instructions and asserted in the encoder.13; -show-mc-encoding here to assert if this breaks again.14; RUN: llc -mtriple=i686-apple-darwin -fast-isel -code-model=large -mattr=sse2 -show-mc-encoding < %s | FileCheck %s --check-prefix=X86-LARGE15 16; Make sure fast isel uses rip-relative addressing for the small code model.17define float @constpool_float(float %x) {18; CHECK-LABEL: constpool_float:19; CHECK: ## %bb.0:20; CHECK-NEXT: movss {{.*#+}} xmm1 = [1.65E+2,0.0E+0,0.0E+0,0.0E+0]21; CHECK-NEXT: addss %xmm1, %xmm022; CHECK-NEXT: retq23;24; LARGE-LABEL: constpool_float:25; LARGE: ## %bb.0:26; LARGE-NEXT: movabsq ${{\.?LCPI[0-9]+_[0-9]+}}, %rax27; LARGE-NEXT: addss (%rax), %xmm028; LARGE-NEXT: retq29;30; LARGE_PIC-LABEL: constpool_float:31; LARGE_PIC: # %bb.0:32; LARGE_PIC-NEXT: .L0$pb:33; LARGE_PIC-NEXT: leaq .L0$pb(%rip), %rax34; LARGE_PIC-NEXT: movabsq $_GLOBAL_OFFSET_TABLE_-.L0$pb, %rcx35; LARGE_PIC-NEXT: addq %rax, %rcx36; LARGE_PIC-NEXT: movabsq ${{\.?LCPI[0-9]+_[0-9]+}}@GOTOFF, %rax37; LARGE_PIC-NEXT: addss (%rax,%rcx), %xmm038; LARGE_PIC-NEXT: retq39;40; AVX-LABEL: constpool_float:41; AVX: ## %bb.0:42; AVX-NEXT: vmovss {{.*#+}} xmm1 = [1.65E+2,0.0E+0,0.0E+0,0.0E+0]43; AVX-NEXT: vaddss %xmm1, %xmm0, %xmm044; AVX-NEXT: retq45;46; LARGE_AVX-LABEL: constpool_float:47; LARGE_AVX: ## %bb.0:48; LARGE_AVX-NEXT: movabsq ${{\.?LCPI[0-9]+_[0-9]+}}, %rax49; LARGE_AVX-NEXT: vaddss (%rax), %xmm0, %xmm050; LARGE_AVX-NEXT: retq51;52; X86-LARGE-LABEL: constpool_float:53; X86-LARGE: ## %bb.0:54; X86-LARGE-NEXT: pushl %eax ## encoding: [0x50]55; X86-LARGE-NEXT: .cfi_def_cfa_offset 856; X86-LARGE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero57; X86-LARGE-NEXT: ## encoding: [0xf3,0x0f,0x10,0x44,0x24,0x08]58; X86-LARGE-NEXT: addss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0 ## encoding: [0xf3,0x0f,0x58,0x05,A,A,A,A]59; X86-LARGE-NEXT: ## fixup A - offset: 4, value: {{\.?LCPI[0-9]+_[0-9]+}}, kind: FK_Data_460; X86-LARGE-NEXT: movss %xmm0, (%esp) ## encoding: [0xf3,0x0f,0x11,0x04,0x24]61; X86-LARGE-NEXT: flds (%esp) ## encoding: [0xd9,0x04,0x24]62; X86-LARGE-NEXT: popl %eax ## encoding: [0x58]63; X86-LARGE-NEXT: retl ## encoding: [0xc3]64 65 %1 = fadd float %x, 16.50e+0166 ret float %167}68 69define double @constpool_double(double %x) nounwind {70; CHECK-LABEL: constpool_double:71; CHECK: ## %bb.0:72; CHECK-NEXT: movsd {{.*#+}} xmm1 = [8.4999999999999998E-1,0.0E+0]73; CHECK-NEXT: addsd %xmm1, %xmm074; CHECK-NEXT: retq75;76; LARGE-LABEL: constpool_double:77; LARGE: ## %bb.0:78; LARGE-NEXT: movabsq ${{\.?LCPI[0-9]+_[0-9]+}}, %rax79; LARGE-NEXT: addsd (%rax), %xmm080; LARGE-NEXT: retq81;82; LARGE_PIC-LABEL: constpool_double:83; LARGE_PIC: # %bb.0:84; LARGE_PIC-NEXT: .L1$pb:85; LARGE_PIC-NEXT: leaq .L1$pb(%rip), %rax86; LARGE_PIC-NEXT: movabsq $_GLOBAL_OFFSET_TABLE_-.L1$pb, %rcx87; LARGE_PIC-NEXT: addq %rax, %rcx88; LARGE_PIC-NEXT: movabsq ${{\.?LCPI[0-9]+_[0-9]+}}@GOTOFF, %rax89; LARGE_PIC-NEXT: addsd (%rax,%rcx), %xmm090; LARGE_PIC-NEXT: retq91;92; AVX-LABEL: constpool_double:93; AVX: ## %bb.0:94; AVX-NEXT: vmovsd {{.*#+}} xmm1 = [8.4999999999999998E-1,0.0E+0]95; AVX-NEXT: vaddsd %xmm1, %xmm0, %xmm096; AVX-NEXT: retq97;98; LARGE_AVX-LABEL: constpool_double:99; LARGE_AVX: ## %bb.0:100; LARGE_AVX-NEXT: movabsq ${{\.?LCPI[0-9]+_[0-9]+}}, %rax101; LARGE_AVX-NEXT: vaddsd (%rax), %xmm0, %xmm0102; LARGE_AVX-NEXT: retq103;104; X86-LARGE-LABEL: constpool_double:105; X86-LARGE: ## %bb.0:106; X86-LARGE-NEXT: subl $12, %esp ## encoding: [0x83,0xec,0x0c]107; X86-LARGE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero108; X86-LARGE-NEXT: ## encoding: [0xf2,0x0f,0x10,0x44,0x24,0x10]109; X86-LARGE-NEXT: addsd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0 ## encoding: [0xf2,0x0f,0x58,0x05,A,A,A,A]110; X86-LARGE-NEXT: ## fixup A - offset: 4, value: {{\.?LCPI[0-9]+_[0-9]+}}, kind: FK_Data_4111; X86-LARGE-NEXT: movsd %xmm0, (%esp) ## encoding: [0xf2,0x0f,0x11,0x04,0x24]112; X86-LARGE-NEXT: fldl (%esp) ## encoding: [0xdd,0x04,0x24]113; X86-LARGE-NEXT: addl $12, %esp ## encoding: [0x83,0xc4,0x0c]114; X86-LARGE-NEXT: retl ## encoding: [0xc3]115 116 %1 = fadd double %x, 8.500000e-01117 ret double %1118}119 120define void @constpool_float_no_fp_args(ptr %x) nounwind {121; CHECK-LABEL: constpool_float_no_fp_args:122; CHECK: ## %bb.0:123; CHECK-NEXT: movss {{.*#+}} xmm0 = [1.65E+2,0.0E+0,0.0E+0,0.0E+0]124; CHECK-NEXT: addss (%rdi), %xmm0125; CHECK-NEXT: movss %xmm0, (%rdi)126; CHECK-NEXT: retq127;128; LARGE-LABEL: constpool_float_no_fp_args:129; LARGE: ## %bb.0:130; LARGE-NEXT: movabsq ${{\.?LCPI[0-9]+_[0-9]+}}, %rax131; LARGE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero132; LARGE-NEXT: addss (%rdi), %xmm0133; LARGE-NEXT: movss %xmm0, (%rdi)134; LARGE-NEXT: retq135;136; LARGE_PIC-LABEL: constpool_float_no_fp_args:137; LARGE_PIC: # %bb.0:138; LARGE_PIC-NEXT: .L2$pb:139; LARGE_PIC-NEXT: leaq .L2$pb(%rip), %rax140; LARGE_PIC-NEXT: movabsq $_GLOBAL_OFFSET_TABLE_-.L2$pb, %rcx141; LARGE_PIC-NEXT: addq %rax, %rcx142; LARGE_PIC-NEXT: movabsq ${{\.?LCPI[0-9]+_[0-9]+}}@GOTOFF, %rax143; LARGE_PIC-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero144; LARGE_PIC-NEXT: addss (%rdi), %xmm0145; LARGE_PIC-NEXT: movss %xmm0, (%rdi)146; LARGE_PIC-NEXT: retq147;148; AVX-LABEL: constpool_float_no_fp_args:149; AVX: ## %bb.0:150; AVX-NEXT: vmovss {{.*#+}} xmm0 = [1.65E+2,0.0E+0,0.0E+0,0.0E+0]151; AVX-NEXT: vaddss (%rdi), %xmm0, %xmm0152; AVX-NEXT: vmovss %xmm0, (%rdi)153; AVX-NEXT: retq154;155; LARGE_AVX-LABEL: constpool_float_no_fp_args:156; LARGE_AVX: ## %bb.0:157; LARGE_AVX-NEXT: movabsq ${{\.?LCPI[0-9]+_[0-9]+}}, %rax158; LARGE_AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero159; LARGE_AVX-NEXT: vaddss (%rdi), %xmm0, %xmm0160; LARGE_AVX-NEXT: vmovss %xmm0, (%rdi)161; LARGE_AVX-NEXT: retq162;163; X86-LARGE-LABEL: constpool_float_no_fp_args:164; X86-LARGE: ## %bb.0:165; X86-LARGE-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]166; X86-LARGE-NEXT: movss {{.*#+}} xmm0 = [1.65E+2,0.0E+0,0.0E+0,0.0E+0]167; X86-LARGE-NEXT: ## encoding: [0xf3,0x0f,0x10,0x05,A,A,A,A]168; X86-LARGE-NEXT: ## fixup A - offset: 4, value: {{\.?LCPI[0-9]+_[0-9]+}}, kind: FK_Data_4169; X86-LARGE-NEXT: addss (%eax), %xmm0 ## encoding: [0xf3,0x0f,0x58,0x00]170; X86-LARGE-NEXT: movss %xmm0, (%eax) ## encoding: [0xf3,0x0f,0x11,0x00]171; X86-LARGE-NEXT: retl ## encoding: [0xc3]172 %a = load float, ptr %x173 %b = fadd float %a, 16.50e+01174 store float %b, ptr %x175 ret void176}177 178define void @constpool_double_no_fp_args(ptr %x) nounwind {179; CHECK-LABEL: constpool_double_no_fp_args:180; CHECK: ## %bb.0:181; CHECK-NEXT: movsd {{.*#+}} xmm0 = [8.4999999999999998E-1,0.0E+0]182; CHECK-NEXT: addsd (%rdi), %xmm0183; CHECK-NEXT: movsd %xmm0, (%rdi)184; CHECK-NEXT: retq185;186; LARGE-LABEL: constpool_double_no_fp_args:187; LARGE: ## %bb.0:188; LARGE-NEXT: movabsq ${{\.?LCPI[0-9]+_[0-9]+}}, %rax189; LARGE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero190; LARGE-NEXT: addsd (%rdi), %xmm0191; LARGE-NEXT: movsd %xmm0, (%rdi)192; LARGE-NEXT: retq193;194; LARGE_PIC-LABEL: constpool_double_no_fp_args:195; LARGE_PIC: # %bb.0:196; LARGE_PIC-NEXT: .L3$pb:197; LARGE_PIC-NEXT: leaq .L3$pb(%rip), %rax198; LARGE_PIC-NEXT: movabsq $_GLOBAL_OFFSET_TABLE_-.L3$pb, %rcx199; LARGE_PIC-NEXT: addq %rax, %rcx200; LARGE_PIC-NEXT: movabsq ${{\.?LCPI[0-9]+_[0-9]+}}@GOTOFF, %rax201; LARGE_PIC-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero202; LARGE_PIC-NEXT: addsd (%rdi), %xmm0203; LARGE_PIC-NEXT: movsd %xmm0, (%rdi)204; LARGE_PIC-NEXT: retq205;206; AVX-LABEL: constpool_double_no_fp_args:207; AVX: ## %bb.0:208; AVX-NEXT: vmovsd {{.*#+}} xmm0 = [8.4999999999999998E-1,0.0E+0]209; AVX-NEXT: vaddsd (%rdi), %xmm0, %xmm0210; AVX-NEXT: vmovsd %xmm0, (%rdi)211; AVX-NEXT: retq212;213; LARGE_AVX-LABEL: constpool_double_no_fp_args:214; LARGE_AVX: ## %bb.0:215; LARGE_AVX-NEXT: movabsq ${{\.?LCPI[0-9]+_[0-9]+}}, %rax216; LARGE_AVX-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero217; LARGE_AVX-NEXT: vaddsd (%rdi), %xmm0, %xmm0218; LARGE_AVX-NEXT: vmovsd %xmm0, (%rdi)219; LARGE_AVX-NEXT: retq220;221; X86-LARGE-LABEL: constpool_double_no_fp_args:222; X86-LARGE: ## %bb.0:223; X86-LARGE-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]224; X86-LARGE-NEXT: movsd {{.*#+}} xmm0 = [8.4999999999999998E-1,0.0E+0]225; X86-LARGE-NEXT: ## encoding: [0xf2,0x0f,0x10,0x05,A,A,A,A]226; X86-LARGE-NEXT: ## fixup A - offset: 4, value: {{\.?LCPI[0-9]+_[0-9]+}}, kind: FK_Data_4227; X86-LARGE-NEXT: addsd (%eax), %xmm0 ## encoding: [0xf2,0x0f,0x58,0x00]228; X86-LARGE-NEXT: movsd %xmm0, (%eax) ## encoding: [0xf2,0x0f,0x11,0x00]229; X86-LARGE-NEXT: retl ## encoding: [0xc3]230 %a = load double, ptr %x231 %b = fadd double %a, 8.500000e-01232 store double %b, ptr %x233 ret void234}235