259 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=i386-apple-darwin -mcpu=yonah -regalloc=basic | FileCheck %s --check-prefix=X863; RUN: llc < %s -mtriple=x86_64-apple-darwin -regalloc=basic | FileCheck %s --check-prefix=X644 5; This testcase should need to spill the -1 value on both x86-32 and x86-64,6; so it shouldn't use pcmpeqd to materialize an all-ones vector; it7; should use a constant-pool load instead.8;9; RAGreedy defeats the test by splitting live ranges.10 11; There should be no pcmpeqd instructions, everybody should the constant pool.12 13 %struct.__ImageExecInfo = type <{ <4 x i32>, <4 x float>, <2 x i64>, ptr, ptr, ptr, i32, i32, i32, i32, i32 }>14 %struct._cl_image_format_t = type <{ i32, i32, i32 }>15 %struct._image2d_t = type <{ ptr, %struct._cl_image_format_t, i32, i32, i32, i32, i32, i32 }>16 17define void @program_1(ptr %dest, ptr %t0, <4 x float> %p0, <4 x float> %p1, <4 x float> %p4, <4 x float> %p5, <4 x float> %p6) nounwind {18; X86-LABEL: program_1:19; X86: ## %bb.0: ## %entry20; X86-NEXT: cmpl $0, 021; X86-NEXT: jle LBB0_222; X86-NEXT: ## %bb.1: ## %forcond23; X86-NEXT: cmpl $0, 024; X86-NEXT: jg LBB0_325; X86-NEXT: LBB0_2: ## %ifthen26; X86-NEXT: retl27; X86-NEXT: LBB0_3: ## %forbody28; X86-NEXT: pushl %esi29; X86-NEXT: subl $88, %esp30; X86-NEXT: movaps {{.*#+}} xmm1 = [1.28E+2,1.28E+2,1.28E+2,1.28E+2]31; X86-NEXT: minps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm132; X86-NEXT: cvttps2dq %xmm1, %xmm033; X86-NEXT: cvtdq2ps %xmm0, %xmm034; X86-NEXT: subps %xmm0, %xmm135; X86-NEXT: movaps %xmm1, {{[-0-9]+}}(%e{{[sb]}}p) ## 16-byte Spill36; X86-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm0 ## 16-byte Reload37; X86-NEXT: mulps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm038; X86-NEXT: movaps %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) ## 16-byte Spill39; X86-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm0 ## 16-byte Reload40; X86-NEXT: addps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm041; X86-NEXT: movaps %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) ## 16-byte Spill42; X86-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm0 ## 16-byte Reload43; X86-NEXT: mulps %xmm1, %xmm044; X86-NEXT: movaps %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) ## 16-byte Spill45; X86-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm0 ## 16-byte Reload46; X86-NEXT: addps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm047; X86-NEXT: movaps %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) ## 16-byte Spill48; X86-NEXT: movdqa {{[-0-9]+}}(%e{{[sb]}}p), %xmm0 ## 16-byte Reload49; X86-NEXT: psubd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm050; X86-NEXT: movdqa %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) ## 16-byte Spill51; X86-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm0 ## 16-byte Reload52; X86-NEXT: mulps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm053; X86-NEXT: movaps %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) ## 16-byte Spill54; X86-NEXT: xorps %xmm0, %xmm055; X86-NEXT: movaps %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) ## 16-byte Spill56; X86-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm0 ## 16-byte Reload57; X86-NEXT: mulps %xmm0, %xmm058; X86-NEXT: movaps %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) ## 16-byte Spill59; X86-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm0 ## 16-byte Reload60; X86-NEXT: mulps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm061; X86-NEXT: movaps %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) ## 16-byte Spill62; X86-NEXT: xorps %xmm0, %xmm063; X86-NEXT: movaps %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) ## 16-byte Spill64; X86-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm0 ## 16-byte Reload65; X86-NEXT: cmpunordps %xmm0, %xmm066; X86-NEXT: movaps %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) ## 16-byte Spill67; X86-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm0 ## 16-byte Reload68; X86-NEXT: minps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm069; X86-NEXT: movaps %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) ## 16-byte Spill70; X86-NEXT: xorps %xmm0, %xmm071; X86-NEXT: movaps %xmm0, {{[0-9]+}}(%esp)72; X86-NEXT: movl $0, (%esp)73; X86-NEXT: xorl %esi, %esi74; X86-NEXT: xorps %xmm3, %xmm375; X86-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm0 ## 16-byte Reload76; X86-NEXT: movdqa {{[-0-9]+}}(%e{{[sb]}}p), %xmm1 ## 16-byte Reload77; X86-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm2 ## 16-byte Reload78; X86-NEXT: calll *%esi79; X86-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm0 ## 16-byte Reload80; X86-NEXT: minps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm081; X86-NEXT: movaps %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) ## 16-byte Spill82; X86-NEXT: pxor %xmm1, %xmm183; X86-NEXT: psubd {{[-0-9]+}}(%e{{[sb]}}p), %xmm1 ## 16-byte Folded Reload84; X86-NEXT: movdqa {{[-0-9]+}}(%e{{[sb]}}p), %xmm0 ## 16-byte Reload85; X86-NEXT: psubd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm086; X86-NEXT: movdqa %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) ## 16-byte Spill87; X86-NEXT: movdqa {{[-0-9]+}}(%e{{[sb]}}p), %xmm0 ## 16-byte Reload88; X86-NEXT: por %xmm1, %xmm089; X86-NEXT: movdqa %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) ## 16-byte Spill90; X86-NEXT: pxor %xmm0, %xmm091; X86-NEXT: movdqa %xmm0, {{[0-9]+}}(%esp)92; X86-NEXT: movl $0, (%esp)93; X86-NEXT: xorps %xmm3, %xmm394; X86-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm0 ## 16-byte Reload95; X86-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm1 ## 16-byte Reload96; X86-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm2 ## 16-byte Reload97; X86-NEXT: calll *%esi98; X86-NEXT: ud299;100; X64-LABEL: program_1:101; X64: ## %bb.0: ## %entry102; X64-NEXT: cmpl $0, 0103; X64-NEXT: jle LBB0_2104; X64-NEXT: ## %bb.1: ## %forcond105; X64-NEXT: cmpl $0, 0106; X64-NEXT: jg LBB0_3107; X64-NEXT: LBB0_2: ## %ifthen108; X64-NEXT: retq109; X64-NEXT: LBB0_3: ## %forbody110; X64-NEXT: pushq %rbx111; X64-NEXT: subq $64, %rsp112; X64-NEXT: xorps %xmm0, %xmm0113; X64-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) ## 16-byte Spill114; X64-NEXT: movaps {{.*#+}} xmm1 = [1.28E+2,1.28E+2,1.28E+2,1.28E+2]115; X64-NEXT: minps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1116; X64-NEXT: cvttps2dq %xmm1, %xmm0117; X64-NEXT: cvtdq2ps %xmm0, %xmm0118; X64-NEXT: subps %xmm0, %xmm1119; X64-NEXT: movaps %xmm1, (%rsp) ## 16-byte Spill120; X64-NEXT: movaps (%rsp), %xmm0 ## 16-byte Reload121; X64-NEXT: mulps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0122; X64-NEXT: movaps %xmm0, (%rsp) ## 16-byte Spill123; X64-NEXT: movaps (%rsp), %xmm0 ## 16-byte Reload124; X64-NEXT: addps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0125; X64-NEXT: movaps %xmm0, (%rsp) ## 16-byte Spill126; X64-NEXT: movaps (%rsp), %xmm0 ## 16-byte Reload127; X64-NEXT: mulps %xmm1, %xmm0128; X64-NEXT: movaps %xmm0, (%rsp) ## 16-byte Spill129; X64-NEXT: movaps (%rsp), %xmm0 ## 16-byte Reload130; X64-NEXT: addps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0131; X64-NEXT: movaps %xmm0, (%rsp) ## 16-byte Spill132; X64-NEXT: movdqa (%rsp), %xmm0 ## 16-byte Reload133; X64-NEXT: psubd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0134; X64-NEXT: movdqa %xmm0, (%rsp) ## 16-byte Spill135; X64-NEXT: movaps (%rsp), %xmm0 ## 16-byte Reload136; X64-NEXT: mulps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0137; X64-NEXT: movaps %xmm0, (%rsp) ## 16-byte Spill138; X64-NEXT: xorps %xmm0, %xmm0139; X64-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) ## 16-byte Spill140; X64-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 ## 16-byte Reload141; X64-NEXT: mulps %xmm0, %xmm0142; X64-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) ## 16-byte Spill143; X64-NEXT: movaps (%rsp), %xmm0 ## 16-byte Reload144; X64-NEXT: mulps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0145; X64-NEXT: movaps %xmm0, (%rsp) ## 16-byte Spill146; X64-NEXT: xorps %xmm0, %xmm0147; X64-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) ## 16-byte Spill148; X64-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 ## 16-byte Reload149; X64-NEXT: cmpunordps %xmm0, %xmm0150; X64-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) ## 16-byte Spill151; X64-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 ## 16-byte Reload152; X64-NEXT: minps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0153; X64-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) ## 16-byte Spill154; X64-NEXT: xorl %ebx, %ebx155; X64-NEXT: xorps %xmm3, %xmm3156; X64-NEXT: xorps %xmm4, %xmm4157; X64-NEXT: movaps (%rsp), %xmm0 ## 16-byte Reload158; X64-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 ## 16-byte Reload159; X64-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm2 ## 16-byte Reload160; X64-NEXT: xorl %edi, %edi161; X64-NEXT: callq *%rbx162; X64-NEXT: movaps (%rsp), %xmm0 ## 16-byte Reload163; X64-NEXT: minps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0164; X64-NEXT: movaps %xmm0, (%rsp) ## 16-byte Spill165; X64-NEXT: movdqa {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 ## 16-byte Reload166; X64-NEXT: psubd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 ## 16-byte Folded Reload167; X64-NEXT: movdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) ## 16-byte Spill168; X64-NEXT: movdqa {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 ## 16-byte Reload169; X64-NEXT: psubd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0170; X64-NEXT: movdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) ## 16-byte Spill171; X64-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 ## 16-byte Reload172; X64-NEXT: orps {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 ## 16-byte Folded Reload173; X64-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) ## 16-byte Spill174; X64-NEXT: xorps %xmm3, %xmm3175; X64-NEXT: xorps %xmm4, %xmm4176; X64-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 ## 16-byte Reload177; X64-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 ## 16-byte Reload178; X64-NEXT: movaps (%rsp), %xmm2 ## 16-byte Reload179; X64-NEXT: xorl %edi, %edi180; X64-NEXT: callq *%rbx181; X64-NEXT: ud2182entry:183 %tmp3.i = load i32, ptr null ; <i32> [#uses=1]184 %cmp = icmp slt i32 0, %tmp3.i ; <i1> [#uses=1]185 br i1 %cmp, label %forcond, label %ifthen186 187ifthen: ; preds = %entry188 ret void189 190forcond: ; preds = %entry191 %tmp3.i536 = load i32, ptr null ; <i32> [#uses=1]192 %cmp12 = icmp slt i32 0, %tmp3.i536 ; <i1> [#uses=1]193 br i1 %cmp12, label %forbody, label %afterfor194 195forbody: ; preds = %forcond196 %bitcast204.i104 = bitcast <4 x i32> zeroinitializer to <4 x float> ; <<4 x float>> [#uses=1]197 %tmp78 = call <4 x float> @llvm.x86.sse.min.ps(<4 x float> < float 1.280000e+02, float 1.280000e+02, float 1.280000e+02, float 1.280000e+02 >, <4 x float> zeroinitializer) nounwind ; <<4 x float>> [#uses=2]198 %tmp79 = call <4 x i32> @llvm.x86.sse2.cvttps2dq(<4 x float> %tmp78) nounwind ; <<4 x i32>> [#uses=1]199 %tmp80 = call <4 x float> @llvm.x86.sse2.cvtdq2ps(<4 x i32> %tmp79) nounwind ; <<4 x float>> [#uses=1]200 %sub140.i = fsub <4 x float> %tmp78, %tmp80 ; <<4 x float>> [#uses=2]201 %mul166.i = fmul <4 x float> zeroinitializer, %sub140.i ; <<4 x float>> [#uses=1]202 %add167.i = fadd <4 x float> %mul166.i, < float 0x3FE62ACB60000000, float 0x3FE62ACB60000000, float 0x3FE62ACB60000000, float 0x3FE62ACB60000000 > ; <<4 x float>> [#uses=1]203 %mul171.i = fmul <4 x float> %add167.i, %sub140.i ; <<4 x float>> [#uses=1]204 %add172.i = fadd <4 x float> %mul171.i, < float 0x3FF0000A40000000, float 0x3FF0000A40000000, float 0x3FF0000A40000000, float 0x3FF0000A40000000 > ; <<4 x float>> [#uses=1]205 %bitcast176.i = bitcast <4 x float> %add172.i to <4 x i32> ; <<4 x i32>> [#uses=1]206 %andnps178.i = add <4 x i32> %bitcast176.i, <i32 1, i32 1, i32 1, i32 1> ; <<4 x i32>> [#uses=1]207 %bitcast179.i = bitcast <4 x i32> %andnps178.i to <4 x float> ; <<4 x float>> [#uses=1]208 %mul186.i = fmul <4 x float> %bitcast179.i, zeroinitializer ; <<4 x float>> [#uses=1]209 %bitcast190.i = bitcast <4 x float> %mul186.i to <4 x i32> ; <<4 x i32>> [#uses=1]210 %andnps192.i = add <4 x i32> %bitcast190.i, <i32 1, i32 1, i32 1, i32 1> ; <<4 x i32>> [#uses=1]211 %xorps.i = xor <4 x i32> zeroinitializer, < i32 -1, i32 -1, i32 -1, i32 -1 > ; <<4 x i32>> [#uses=1]212 %orps203.i = add <4 x i32> %andnps192.i, %xorps.i ; <<4 x i32>> [#uses=1]213 %bitcast204.i = bitcast <4 x i32> %orps203.i to <4 x float> ; <<4 x float>> [#uses=1]214 %mul310 = fmul <4 x float> %bitcast204.i104, zeroinitializer ; <<4 x float>> [#uses=2]215 %mul313 = fmul <4 x float> %bitcast204.i, zeroinitializer ; <<4 x float>> [#uses=1]216 %cmpunord.i11 = call <4 x float> @llvm.x86.sse.cmp.ps(<4 x float> zeroinitializer, <4 x float> zeroinitializer, i8 3) nounwind ; <<4 x float>> [#uses=1]217 %tmp83 = call <4 x float> @llvm.x86.sse.min.ps(<4 x float> %mul310, <4 x float> zeroinitializer) nounwind ; <<4 x float>> [#uses=1]218 %bitcast.i3 = bitcast <4 x float> %mul310 to <4 x i32> ; <<4 x i32>> [#uses=1]219 %andps.i5 = and <4 x i32> %bitcast.i3, zeroinitializer ; <<4 x i32>> [#uses=1]220 221 call void null(<4 x float> %mul313, <4 x float> %cmpunord.i11, <4 x float> %tmp83, <4 x float> zeroinitializer, ptr null, <4 x i32> zeroinitializer) nounwind222 223 %tmp84 = call <4 x float> @llvm.x86.sse.min.ps(<4 x float> %mul313, <4 x float> zeroinitializer) nounwind ; <<4 x float>> [#uses=1]224 225 %bitcast6.i13 = bitcast <4 x float> %cmpunord.i11 to <4 x i32> ; <<4 x i32>> [#uses=2]226 %andps.i14 = add <4 x i32> <i32 1, i32 1, i32 1, i32 1>, %bitcast6.i13 ; <<4 x i32>> [#uses=1]227 %not.i16 = xor <4 x i32> %bitcast6.i13, < i32 -1, i32 -1, i32 -1, i32 -1 > ; <<4 x i32>> [#uses=1]228 %andnps.i17 = add <4 x i32> <i32 1, i32 1, i32 1, i32 1>, %not.i16 ; <<4 x i32>> [#uses=1]229 %orps.i18 = or <4 x i32> %andnps.i17, %andps.i14 ; <<4 x i32>> [#uses=1]230 %bitcast17.i19 = bitcast <4 x i32> %orps.i18 to <4 x float> ; <<4 x float>> [#uses=1]231 232 %bitcast11.i6 = bitcast <4 x float> %tmp83 to <4 x i32> ; <<4 x i32>> [#uses=1]233 %not.i7 = xor <4 x i32> zeroinitializer, < i32 -1, i32 -1, i32 -1, i32 -1 > ; <<4 x i32>> [#uses=1]234 %andnps.i8 = and <4 x i32> %bitcast11.i6, %not.i7 ; <<4 x i32>> [#uses=1]235 %orps.i9 = or <4 x i32> %andnps.i8, %andps.i5 ; <<4 x i32>> [#uses=1]236 %bitcast17.i10 = bitcast <4 x i32> %orps.i9 to <4 x float> ; <<4 x float>> [#uses=1]237 238 %bitcast6.i = bitcast <4 x float> zeroinitializer to <4 x i32> ; <<4 x i32>> [#uses=2]239 %andps.i = and <4 x i32> zeroinitializer, %bitcast6.i ; <<4 x i32>> [#uses=1]240 %bitcast11.i = bitcast <4 x float> %tmp84 to <4 x i32> ; <<4 x i32>> [#uses=1]241 %not.i = xor <4 x i32> %bitcast6.i, < i32 -1, i32 -1, i32 -1, i32 -1 > ; <<4 x i32>> [#uses=1]242 %andnps.i = and <4 x i32> %bitcast11.i, %not.i ; <<4 x i32>> [#uses=1]243 %orps.i = or <4 x i32> %andnps.i, %andps.i ; <<4 x i32>> [#uses=1]244 %bitcast17.i = bitcast <4 x i32> %orps.i to <4 x float> ; <<4 x float>> [#uses=1]245 call void null(<4 x float> %bitcast17.i19, <4 x float> %bitcast17.i10, <4 x float> %bitcast17.i, <4 x float> zeroinitializer, ptr null, <4 x i32> zeroinitializer) nounwind246 unreachable247 248afterfor: ; preds = %forcond249 ret void250}251 252declare <4 x float> @llvm.x86.sse.cmp.ps(<4 x float>, <4 x float>, i8) nounwind readnone253 254declare <4 x float> @llvm.x86.sse2.cvtdq2ps(<4 x i32>) nounwind readnone255 256declare <4 x i32> @llvm.x86.sse2.cvttps2dq(<4 x float>) nounwind readnone257 258declare <4 x float> @llvm.x86.sse.min.ps(<4 x float>, <4 x float>) nounwind readnone259