brintos

brintos / llvm-project-archived public Read only

0
0
Text · 24.6 KiB · 8f97d26 Raw
713 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+mmx,+sse2 | FileCheck -check-prefix=X86 %s3; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+mmx,+sse2 | FileCheck -check-prefix=X64 %s4 5;; A basic functional check to make sure that MMX arithmetic actually compiles.6;; First is a straight translation of the original with bitcasts as needed.7 8define void @test0(ptr %A, ptr %B) nounwind {9; X86-LABEL: test0:10; X86:       # %bb.0: # %entry11; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx12; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax13; X86-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero14; X86-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero15; X86-NEXT:    paddb %xmm0, %xmm116; X86-NEXT:    movdq2q %xmm1, %mm017; X86-NEXT:    movq %xmm1, (%eax)18; X86-NEXT:    paddsb (%ecx), %mm019; X86-NEXT:    movq %mm0, (%eax)20; X86-NEXT:    paddusb (%ecx), %mm021; X86-NEXT:    movq2dq %mm0, %xmm022; X86-NEXT:    movq %mm0, (%eax)23; X86-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero24; X86-NEXT:    psubb %xmm1, %xmm025; X86-NEXT:    movdq2q %xmm0, %mm026; X86-NEXT:    movq %xmm0, (%eax)27; X86-NEXT:    psubsb (%ecx), %mm028; X86-NEXT:    movq %mm0, (%eax)29; X86-NEXT:    psubusb (%ecx), %mm030; X86-NEXT:    movq2dq %mm0, %xmm031; X86-NEXT:    movq %mm0, (%eax)32; X86-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero33; X86-NEXT:    punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]34; X86-NEXT:    punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]35; X86-NEXT:    pmullw %xmm0, %xmm136; X86-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm137; X86-NEXT:    packuswb %xmm1, %xmm138; X86-NEXT:    movq %xmm1, (%eax)39; X86-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero40; X86-NEXT:    pand %xmm1, %xmm041; X86-NEXT:    movq %xmm0, (%eax)42; X86-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero43; X86-NEXT:    por %xmm0, %xmm144; X86-NEXT:    movq %xmm1, (%eax)45; X86-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero46; X86-NEXT:    pxor %xmm1, %xmm047; X86-NEXT:    movq %xmm0, (%eax)48; X86-NEXT:    emms49; X86-NEXT:    retl50;51; X64-LABEL: test0:52; X64:       # %bb.0: # %entry53; X64-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero54; X64-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero55; X64-NEXT:    paddb %xmm0, %xmm156; X64-NEXT:    movdq2q %xmm1, %mm057; X64-NEXT:    movq %xmm1, (%rdi)58; X64-NEXT:    paddsb (%rsi), %mm059; X64-NEXT:    movq %mm0, (%rdi)60; X64-NEXT:    paddusb (%rsi), %mm061; X64-NEXT:    movq2dq %mm0, %xmm062; X64-NEXT:    movq %mm0, (%rdi)63; X64-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero64; X64-NEXT:    psubb %xmm1, %xmm065; X64-NEXT:    movdq2q %xmm0, %mm066; X64-NEXT:    movq %xmm0, (%rdi)67; X64-NEXT:    psubsb (%rsi), %mm068; X64-NEXT:    movq %mm0, (%rdi)69; X64-NEXT:    psubusb (%rsi), %mm070; X64-NEXT:    movq2dq %mm0, %xmm071; X64-NEXT:    movq %mm0, (%rdi)72; X64-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero73; X64-NEXT:    punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]74; X64-NEXT:    punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]75; X64-NEXT:    pmullw %xmm0, %xmm176; X64-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm177; X64-NEXT:    packuswb %xmm1, %xmm178; X64-NEXT:    movq %xmm1, (%rdi)79; X64-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero80; X64-NEXT:    pand %xmm1, %xmm081; X64-NEXT:    movq %xmm0, (%rdi)82; X64-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero83; X64-NEXT:    por %xmm0, %xmm184; X64-NEXT:    movq %xmm1, (%rdi)85; X64-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero86; X64-NEXT:    pxor %xmm1, %xmm087; X64-NEXT:    movq %xmm0, (%rdi)88; X64-NEXT:    emms89; X64-NEXT:    retq90entry:91  %tmp1 = load <1 x i64>, ptr %A92  %tmp3 = load <1 x i64>, ptr %B93  %tmp1a = bitcast <1 x i64> %tmp1 to <8 x i8>94  %tmp3a = bitcast <1 x i64> %tmp3 to <8 x i8>95  %tmp4 = add <8 x i8> %tmp1a, %tmp3a96  %tmp4a = bitcast <8 x i8> %tmp4 to <1 x i64>97  store <1 x i64> %tmp4a, ptr %A98  %tmp7 = load <1 x i64>, ptr %B99  %tmp12 = tail call <1 x i64> @llvm.x86.mmx.padds.b(<1 x i64> %tmp4a, <1 x i64> %tmp7)100  store <1 x i64> %tmp12, ptr %A101  %tmp16 = load <1 x i64>, ptr %B102  %tmp21 = tail call <1 x i64> @llvm.x86.mmx.paddus.b(<1 x i64> %tmp12, <1 x i64> %tmp16)103  store <1 x i64> %tmp21, ptr %A104  %tmp27 = load <1 x i64>, ptr %B105  %tmp21a = bitcast <1 x i64> %tmp21 to <8 x i8>106  %tmp27a = bitcast <1 x i64> %tmp27 to <8 x i8>107  %tmp28 = sub <8 x i8> %tmp21a, %tmp27a108  %tmp28a = bitcast <8 x i8> %tmp28 to <1 x i64>109  store <1 x i64> %tmp28a, ptr %A110  %tmp31 = load <1 x i64>, ptr %B111  %tmp36 = tail call <1 x i64> @llvm.x86.mmx.psubs.b(<1 x i64> %tmp28a, <1 x i64> %tmp31)112  store <1 x i64> %tmp36, ptr %A113  %tmp40 = load <1 x i64>, ptr %B114  %tmp45 = tail call <1 x i64> @llvm.x86.mmx.psubus.b(<1 x i64> %tmp36, <1 x i64> %tmp40)115  store <1 x i64> %tmp45, ptr %A116  %tmp51 = load <1 x i64>, ptr %B117  %tmp45a = bitcast <1 x i64> %tmp45 to <8 x i8>118  %tmp51a = bitcast <1 x i64> %tmp51 to <8 x i8>119  %tmp52 = mul <8 x i8> %tmp45a, %tmp51a120  %tmp52a = bitcast <8 x i8> %tmp52 to <1 x i64>121  store <1 x i64> %tmp52a, ptr %A122  %tmp57 = load <1 x i64>, ptr %B123  %tmp57a = bitcast <1 x i64> %tmp57 to <8 x i8>124  %tmp58 = and <8 x i8> %tmp52, %tmp57a125  %tmp58a = bitcast <8 x i8> %tmp58 to <1 x i64>126  store <1 x i64> %tmp58a, ptr %A127  %tmp63 = load <1 x i64>, ptr %B128  %tmp63a = bitcast <1 x i64> %tmp63 to <8 x i8>129  %tmp64 = or <8 x i8> %tmp58, %tmp63a130  %tmp64a = bitcast <8 x i8> %tmp64 to <1 x i64>131  store <1 x i64> %tmp64a, ptr %A132  %tmp69 = load <1 x i64>, ptr %B133  %tmp69a = bitcast <1 x i64> %tmp69 to <8 x i8>134  %tmp64b = bitcast <1 x i64> %tmp64a to <8 x i8>135  %tmp70 = xor <8 x i8> %tmp64b, %tmp69a136  %tmp70a = bitcast <8 x i8> %tmp70 to <1 x i64>137  store <1 x i64> %tmp70a, ptr %A138  tail call void @llvm.x86.mmx.emms()139  ret void140}141 142define void @test1(ptr %A, ptr %B) nounwind {143; X86-LABEL: test1:144; X86:       # %bb.0: # %entry145; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx146; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax147; X86-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero148; X86-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero149; X86-NEXT:    paddd %xmm1, %xmm0150; X86-NEXT:    movq %xmm0, (%eax)151; X86-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero152; X86-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]153; X86-NEXT:    pmuludq %xmm1, %xmm0154; X86-NEXT:    shufps {{.*#+}} xmm1 = xmm1[1,1,1,1]155; X86-NEXT:    pmuludq %xmm1, %xmm2156; X86-NEXT:    pshufd {{.*#+}} xmm1 = xmm2[0,2,2,3]157; X86-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]158; X86-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]159; X86-NEXT:    movq %xmm0, (%eax)160; X86-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero161; X86-NEXT:    pand %xmm0, %xmm1162; X86-NEXT:    movq %xmm1, (%eax)163; X86-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero164; X86-NEXT:    por %xmm1, %xmm0165; X86-NEXT:    movq %xmm0, (%eax)166; X86-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero167; X86-NEXT:    pxor %xmm0, %xmm1168; X86-NEXT:    movq %xmm1, (%eax)169; X86-NEXT:    emms170; X86-NEXT:    retl171;172; X64-LABEL: test1:173; X64:       # %bb.0: # %entry174; X64-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero175; X64-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero176; X64-NEXT:    paddd %xmm0, %xmm1177; X64-NEXT:    movq %xmm1, (%rdi)178; X64-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero179; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]180; X64-NEXT:    pmuludq %xmm0, %xmm1181; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]182; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]183; X64-NEXT:    pmuludq %xmm2, %xmm0184; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]185; X64-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]186; X64-NEXT:    movq %xmm1, (%rdi)187; X64-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero188; X64-NEXT:    pand %xmm1, %xmm0189; X64-NEXT:    movq %xmm0, (%rdi)190; X64-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero191; X64-NEXT:    por %xmm0, %xmm1192; X64-NEXT:    movq %xmm1, (%rdi)193; X64-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero194; X64-NEXT:    pxor %xmm1, %xmm0195; X64-NEXT:    movq %xmm0, (%rdi)196; X64-NEXT:    emms197; X64-NEXT:    retq198entry:199  %tmp1 = load <1 x i64>, ptr %A200  %tmp3 = load <1 x i64>, ptr %B201  %tmp1a = bitcast <1 x i64> %tmp1 to <2 x i32>202  %tmp3a = bitcast <1 x i64> %tmp3 to <2 x i32>203  %tmp4 = add <2 x i32> %tmp1a, %tmp3a204  %tmp4a = bitcast <2 x i32> %tmp4 to <1 x i64>205  store <1 x i64> %tmp4a, ptr %A206  %tmp9 = load <1 x i64>, ptr %B207  %tmp9a = bitcast <1 x i64> %tmp9 to <2 x i32>208  %tmp10 = sub <2 x i32> %tmp4, %tmp9a209  %tmp10a = bitcast <2 x i32> %tmp4 to <1 x i64>210  store <1 x i64> %tmp10a, ptr %A211  %tmp15 = load <1 x i64>, ptr %B212  %tmp10b = bitcast <1 x i64> %tmp10a to <2 x i32>213  %tmp15a = bitcast <1 x i64> %tmp15 to <2 x i32>214  %tmp16 = mul <2 x i32> %tmp10b, %tmp15a215  %tmp16a = bitcast <2 x i32> %tmp16 to <1 x i64>216  store <1 x i64> %tmp16a, ptr %A217  %tmp21 = load <1 x i64>, ptr %B218  %tmp16b = bitcast <1 x i64> %tmp16a to <2 x i32>219  %tmp21a = bitcast <1 x i64> %tmp21 to <2 x i32>220  %tmp22 = and <2 x i32> %tmp16b, %tmp21a221  %tmp22a = bitcast <2 x i32> %tmp22 to <1 x i64>222  store <1 x i64> %tmp22a, ptr %A223  %tmp27 = load <1 x i64>, ptr %B224  %tmp22b = bitcast <1 x i64> %tmp22a to <2 x i32>225  %tmp27a = bitcast <1 x i64> %tmp27 to <2 x i32>226  %tmp28 = or <2 x i32> %tmp22b, %tmp27a227  %tmp28a = bitcast <2 x i32> %tmp28 to <1 x i64>228  store <1 x i64> %tmp28a, ptr %A229  %tmp33 = load <1 x i64>, ptr %B230  %tmp28b = bitcast <1 x i64> %tmp28a to <2 x i32>231  %tmp33a = bitcast <1 x i64> %tmp33 to <2 x i32>232  %tmp34 = xor <2 x i32> %tmp28b, %tmp33a233  %tmp34a = bitcast <2 x i32> %tmp34 to <1 x i64>234  store <1 x i64> %tmp34a, ptr %A235  tail call void @llvm.x86.mmx.emms( )236  ret void237}238 239define void @test2(ptr %A, ptr %B) nounwind {240; X86-LABEL: test2:241; X86:       # %bb.0: # %entry242; X86-NEXT:    pushl %ebp243; X86-NEXT:    movl %esp, %ebp244; X86-NEXT:    pushl %esi245; X86-NEXT:    andl $-8, %esp246; X86-NEXT:    subl $16, %esp247; X86-NEXT:    movl 12(%ebp), %ecx248; X86-NEXT:    movl 8(%ebp), %eax249; X86-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero250; X86-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero251; X86-NEXT:    paddw %xmm0, %xmm1252; X86-NEXT:    movdq2q %xmm1, %mm0253; X86-NEXT:    movq %xmm1, (%eax)254; X86-NEXT:    paddsw (%ecx), %mm0255; X86-NEXT:    movq %mm0, (%eax)256; X86-NEXT:    paddusw (%ecx), %mm0257; X86-NEXT:    movq2dq %mm0, %xmm0258; X86-NEXT:    movq %mm0, (%eax)259; X86-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero260; X86-NEXT:    psubw %xmm1, %xmm0261; X86-NEXT:    movdq2q %xmm0, %mm0262; X86-NEXT:    movq %xmm0, (%eax)263; X86-NEXT:    psubsw (%ecx), %mm0264; X86-NEXT:    movq %mm0, (%eax)265; X86-NEXT:    psubusw (%ecx), %mm0266; X86-NEXT:    movq2dq %mm0, %xmm0267; X86-NEXT:    movq %mm0, (%eax)268; X86-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero269; X86-NEXT:    pmullw %xmm0, %xmm1270; X86-NEXT:    movdq2q %xmm1, %mm0271; X86-NEXT:    movq %xmm1, (%eax)272; X86-NEXT:    pmulhw (%ecx), %mm0273; X86-NEXT:    movq %mm0, (%eax)274; X86-NEXT:    pmaddwd (%ecx), %mm0275; X86-NEXT:    movq %mm0, (%esp)276; X86-NEXT:    movl (%esp), %edx277; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi278; X86-NEXT:    movq %mm0, (%eax)279; X86-NEXT:    andl 4(%ecx), %esi280; X86-NEXT:    movd %esi, %xmm0281; X86-NEXT:    andl (%ecx), %edx282; X86-NEXT:    movd %edx, %xmm1283; X86-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]284; X86-NEXT:    movq %xmm1, (%eax)285; X86-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero286; X86-NEXT:    por %xmm1, %xmm0287; X86-NEXT:    movq %xmm0, (%eax)288; X86-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero289; X86-NEXT:    pxor %xmm0, %xmm1290; X86-NEXT:    movq %xmm1, (%eax)291; X86-NEXT:    emms292; X86-NEXT:    leal -4(%ebp), %esp293; X86-NEXT:    popl %esi294; X86-NEXT:    popl %ebp295; X86-NEXT:    retl296;297; X64-LABEL: test2:298; X64:       # %bb.0: # %entry299; X64-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero300; X64-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero301; X64-NEXT:    paddw %xmm0, %xmm1302; X64-NEXT:    movdq2q %xmm1, %mm0303; X64-NEXT:    movq %xmm1, (%rdi)304; X64-NEXT:    paddsw (%rsi), %mm0305; X64-NEXT:    movq %mm0, (%rdi)306; X64-NEXT:    paddusw (%rsi), %mm0307; X64-NEXT:    movq2dq %mm0, %xmm0308; X64-NEXT:    movq %mm0, (%rdi)309; X64-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero310; X64-NEXT:    psubw %xmm1, %xmm0311; X64-NEXT:    movdq2q %xmm0, %mm0312; X64-NEXT:    movq %xmm0, (%rdi)313; X64-NEXT:    psubsw (%rsi), %mm0314; X64-NEXT:    movq %mm0, (%rdi)315; X64-NEXT:    psubusw (%rsi), %mm0316; X64-NEXT:    movq2dq %mm0, %xmm0317; X64-NEXT:    movq %mm0, (%rdi)318; X64-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero319; X64-NEXT:    pmullw %xmm0, %xmm1320; X64-NEXT:    movdq2q %xmm1, %mm0321; X64-NEXT:    movq %xmm1, (%rdi)322; X64-NEXT:    pmulhw (%rsi), %mm0323; X64-NEXT:    movq %mm0, (%rdi)324; X64-NEXT:    pmaddwd (%rsi), %mm0325; X64-NEXT:    movq %mm0, %rax326; X64-NEXT:    movq %mm0, (%rdi)327; X64-NEXT:    andq (%rsi), %rax328; X64-NEXT:    movq %rax, %xmm0329; X64-NEXT:    movq %rax, (%rdi)330; X64-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero331; X64-NEXT:    por %xmm0, %xmm1332; X64-NEXT:    movq %xmm1, (%rdi)333; X64-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero334; X64-NEXT:    pxor %xmm1, %xmm0335; X64-NEXT:    movq %xmm0, (%rdi)336; X64-NEXT:    emms337; X64-NEXT:    retq338entry:339  %tmp1 = load <1 x i64>, ptr %A340  %tmp3 = load <1 x i64>, ptr %B341  %tmp1a = bitcast <1 x i64> %tmp1 to <4 x i16>342  %tmp3a = bitcast <1 x i64> %tmp3 to <4 x i16>343  %tmp4 = add <4 x i16> %tmp1a, %tmp3a344  %tmp4a = bitcast <4 x i16> %tmp4 to <1 x i64>345  store <1 x i64> %tmp4a, ptr %A346  %tmp7 = load <1 x i64>, ptr %B347  %tmp12 = tail call <1 x i64> @llvm.x86.mmx.padds.w(<1 x i64> %tmp4a, <1 x i64> %tmp7)348  store <1 x i64> %tmp12, ptr %A349  %tmp16 = load <1 x i64>, ptr %B350  %tmp21 = tail call <1 x i64> @llvm.x86.mmx.paddus.w(<1 x i64> %tmp12, <1 x i64> %tmp16)351  store <1 x i64> %tmp21, ptr %A352  %tmp27 = load <1 x i64>, ptr %B353  %tmp21a = bitcast <1 x i64> %tmp21 to <4 x i16>354  %tmp27a = bitcast <1 x i64> %tmp27 to <4 x i16>355  %tmp28 = sub <4 x i16> %tmp21a, %tmp27a356  %tmp28a = bitcast <4 x i16> %tmp28 to <1 x i64>357  store <1 x i64> %tmp28a, ptr %A358  %tmp31 = load <1 x i64>, ptr %B359  %tmp36 = tail call <1 x i64> @llvm.x86.mmx.psubs.w(<1 x i64> %tmp28a, <1 x i64> %tmp31)360  store <1 x i64> %tmp36, ptr %A361  %tmp40 = load <1 x i64>, ptr %B362  %tmp45 = tail call <1 x i64> @llvm.x86.mmx.psubus.w(<1 x i64> %tmp36, <1 x i64> %tmp40)363  store <1 x i64> %tmp45, ptr %A364  %tmp51 = load <1 x i64>, ptr %B365  %tmp45a = bitcast <1 x i64> %tmp45 to <4 x i16>366  %tmp51a = bitcast <1 x i64> %tmp51 to <4 x i16>367  %tmp52 = mul <4 x i16> %tmp45a, %tmp51a368  %tmp52a = bitcast <4 x i16> %tmp52 to <1 x i64>369  store <1 x i64> %tmp52a, ptr %A370  %tmp55 = load <1 x i64>, ptr %B371  %tmp60 = tail call <1 x i64> @llvm.x86.mmx.pmulh.w(<1 x i64> %tmp52a, <1 x i64> %tmp55)372  store <1 x i64> %tmp60, ptr %A373  %tmp64 = load <1 x i64>, ptr %B374  %tmp69 = tail call <1 x i64> @llvm.x86.mmx.pmadd.wd(<1 x i64> %tmp60, <1 x i64> %tmp64)375  store <1 x i64> %tmp69, ptr %A376  %tmp75 = load <1 x i64>, ptr %B377  %tmp70a = bitcast <1 x i64> %tmp69 to <4 x i16>378  %tmp75a = bitcast <1 x i64> %tmp75 to <4 x i16>379  %tmp76 = and <4 x i16> %tmp70a, %tmp75a380  %tmp76a = bitcast <4 x i16> %tmp76 to <1 x i64>381  store <1 x i64> %tmp76a, ptr %A382  %tmp81 = load <1 x i64>, ptr %B383  %tmp76b = bitcast <1 x i64> %tmp76a to <4 x i16>384  %tmp81a = bitcast <1 x i64> %tmp81 to <4 x i16>385  %tmp82 = or <4 x i16> %tmp76b, %tmp81a386  %tmp82a = bitcast <4 x i16> %tmp82 to <1 x i64>387  store <1 x i64> %tmp82a, ptr %A388  %tmp87 = load <1 x i64>, ptr %B389  %tmp82b = bitcast <1 x i64> %tmp82a to <4 x i16>390  %tmp87a = bitcast <1 x i64> %tmp87 to <4 x i16>391  %tmp88 = xor <4 x i16> %tmp82b, %tmp87a392  %tmp88a = bitcast <4 x i16> %tmp88 to <1 x i64>393  store <1 x i64> %tmp88a, ptr %A394  tail call void @llvm.x86.mmx.emms( )395  ret void396}397 398define <1 x i64> @test3(ptr %a, ptr %b, i32 %count) nounwind {399; X86-LABEL: test3:400; X86:       # %bb.0: # %entry401; X86-NEXT:    pushl %ebp402; X86-NEXT:    pushl %ebx403; X86-NEXT:    pushl %edi404; X86-NEXT:    pushl %esi405; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx406; X86-NEXT:    xorl %eax, %eax407; X86-NEXT:    testl %ecx, %ecx408; X86-NEXT:    je .LBB3_1409; X86-NEXT:  # %bb.2: # %bb26.preheader410; X86-NEXT:    xorl %ebx, %ebx411; X86-NEXT:    xorl %edx, %edx412; X86-NEXT:    .p2align 4413; X86-NEXT:  .LBB3_3: # %bb26414; X86-NEXT:    # =>This Inner Loop Header: Depth=1415; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi416; X86-NEXT:    movl (%edi,%ebx,8), %ebp417; X86-NEXT:    movl %ecx, %esi418; X86-NEXT:    movl 4(%edi,%ebx,8), %ecx419; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi420; X86-NEXT:    addl (%edi,%ebx,8), %ebp421; X86-NEXT:    adcl 4(%edi,%ebx,8), %ecx422; X86-NEXT:    addl %ebp, %eax423; X86-NEXT:    adcl %ecx, %edx424; X86-NEXT:    movl %esi, %ecx425; X86-NEXT:    incl %ebx426; X86-NEXT:    cmpl %esi, %ebx427; X86-NEXT:    jb .LBB3_3428; X86-NEXT:    jmp .LBB3_4429; X86-NEXT:  .LBB3_1:430; X86-NEXT:    xorl %edx, %edx431; X86-NEXT:  .LBB3_4: # %bb31432; X86-NEXT:    popl %esi433; X86-NEXT:    popl %edi434; X86-NEXT:    popl %ebx435; X86-NEXT:    popl %ebp436; X86-NEXT:    retl437;438; X64-LABEL: test3:439; X64:       # %bb.0: # %entry440; X64-NEXT:    xorl %ecx, %ecx441; X64-NEXT:    xorl %eax, %eax442; X64-NEXT:    testl %edx, %edx443; X64-NEXT:    je .LBB3_2444; X64-NEXT:    .p2align 4445; X64-NEXT:  .LBB3_1: # %bb26446; X64-NEXT:    # =>This Inner Loop Header: Depth=1447; X64-NEXT:    movslq %ecx, %rcx448; X64-NEXT:    movq (%rdi,%rcx,8), %r8449; X64-NEXT:    addq (%rsi,%rcx,8), %r8450; X64-NEXT:    addq %r8, %rax451; X64-NEXT:    incl %ecx452; X64-NEXT:    cmpl %edx, %ecx453; X64-NEXT:    jb .LBB3_1454; X64-NEXT:  .LBB3_2: # %bb31455; X64-NEXT:    retq456entry:457  %tmp2942 = icmp eq i32 %count, 0458  br i1 %tmp2942, label %bb31, label %bb26459 460bb26:461  %i.037.0 = phi i32 [ 0, %entry ], [ %tmp25, %bb26 ]462  %sum.035.0 = phi <1 x i64> [ zeroinitializer, %entry ], [ %tmp22, %bb26 ]463  %tmp13 = getelementptr <1 x i64>, ptr %b, i32 %i.037.0464  %tmp14 = load <1 x i64>, ptr %tmp13465  %tmp18 = getelementptr <1 x i64>, ptr %a, i32 %i.037.0466  %tmp19 = load <1 x i64>, ptr %tmp18467  %tmp21 = add <1 x i64> %tmp19, %tmp14468  %tmp22 = add <1 x i64> %tmp21, %sum.035.0469  %tmp25 = add i32 %i.037.0, 1470  %tmp29 = icmp ult i32 %tmp25, %count471  br i1 %tmp29, label %bb26, label %bb31472 473bb31:474  %sum.035.1 = phi <1 x i64> [ zeroinitializer, %entry ], [ %tmp22, %bb26 ]475  ret <1 x i64> %sum.035.1476}477 478; There are no MMX operations here, so we use XMM or i64.479define void @ti8(double %a, double %b) nounwind {480; X86-LABEL: ti8:481; X86:       # %bb.0: # %entry482; X86-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero483; X86-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero484; X86-NEXT:    paddb %xmm0, %xmm1485; X86-NEXT:    movq %xmm1, 0486; X86-NEXT:    retl487;488; X64-LABEL: ti8:489; X64:       # %bb.0: # %entry490; X64-NEXT:    paddb %xmm1, %xmm0491; X64-NEXT:    movq %xmm0, 0492; X64-NEXT:    retq493entry:494  %tmp1 = bitcast double %a to <8 x i8>495  %tmp2 = bitcast double %b to <8 x i8>496  %tmp3 = add <8 x i8> %tmp1, %tmp2497  store <8 x i8> %tmp3, ptr null498  ret void499}500 501define void @ti16(double %a, double %b) nounwind {502; X86-LABEL: ti16:503; X86:       # %bb.0: # %entry504; X86-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero505; X86-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero506; X86-NEXT:    paddw %xmm0, %xmm1507; X86-NEXT:    movq %xmm1, 0508; X86-NEXT:    retl509;510; X64-LABEL: ti16:511; X64:       # %bb.0: # %entry512; X64-NEXT:    paddw %xmm1, %xmm0513; X64-NEXT:    movq %xmm0, 0514; X64-NEXT:    retq515entry:516  %tmp1 = bitcast double %a to <4 x i16>517  %tmp2 = bitcast double %b to <4 x i16>518  %tmp3 = add <4 x i16> %tmp1, %tmp2519  store <4 x i16> %tmp3, ptr null520  ret void521}522 523define void @ti32(double %a, double %b) nounwind {524; X86-LABEL: ti32:525; X86:       # %bb.0: # %entry526; X86-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero527; X86-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero528; X86-NEXT:    paddd %xmm0, %xmm1529; X86-NEXT:    movq %xmm1, 0530; X86-NEXT:    retl531;532; X64-LABEL: ti32:533; X64:       # %bb.0: # %entry534; X64-NEXT:    paddd %xmm1, %xmm0535; X64-NEXT:    movq %xmm0, 0536; X64-NEXT:    retq537entry:538  %tmp1 = bitcast double %a to <2 x i32>539  %tmp2 = bitcast double %b to <2 x i32>540  %tmp3 = add <2 x i32> %tmp1, %tmp2541  store <2 x i32> %tmp3, ptr null542  ret void543}544 545define void @ti64(double %a, double %b) nounwind {546; X86-LABEL: ti64:547; X86:       # %bb.0: # %entry548; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax549; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx550; X86-NEXT:    addl {{[0-9]+}}(%esp), %eax551; X86-NEXT:    adcl {{[0-9]+}}(%esp), %ecx552; X86-NEXT:    movl %eax, 0553; X86-NEXT:    movl %ecx, 4554; X86-NEXT:    retl555;556; X64-LABEL: ti64:557; X64:       # %bb.0: # %entry558; X64-NEXT:    movq %xmm0, %rax559; X64-NEXT:    movq %xmm1, %rcx560; X64-NEXT:    addq %rax, %rcx561; X64-NEXT:    movq %rcx, 0562; X64-NEXT:    retq563entry:564  %tmp1 = bitcast double %a to <1 x i64>565  %tmp2 = bitcast double %b to <1 x i64>566  %tmp3 = add <1 x i64> %tmp1, %tmp2567  store <1 x i64> %tmp3, ptr null568  ret void569}570 571; MMX intrinsics calls get us MMX instructions.572define void @ti8a(double %a, double %b) nounwind {573; X86-LABEL: ti8a:574; X86:       # %bb.0: # %entry575; X86-NEXT:    movq {{[0-9]+}}(%esp), %mm0576; X86-NEXT:    paddb {{[0-9]+}}(%esp), %mm0577; X86-NEXT:    movq %mm0, 0578; X86-NEXT:    retl579;580; X64-LABEL: ti8a:581; X64:       # %bb.0: # %entry582; X64-NEXT:    movdq2q %xmm0, %mm0583; X64-NEXT:    movdq2q %xmm1, %mm1584; X64-NEXT:    paddb %mm0, %mm1585; X64-NEXT:    movq %mm1, 0586; X64-NEXT:    retq587entry:588  %tmp1 = bitcast double %a to <1 x i64>589  %tmp2 = bitcast double %b to <1 x i64>590  %tmp3 = tail call <1 x i64> @llvm.x86.mmx.padd.b(<1 x i64> %tmp1, <1 x i64> %tmp2)591  store <1 x i64> %tmp3, ptr null592  ret void593}594 595define void @ti16a(double %a, double %b) nounwind {596; X86-LABEL: ti16a:597; X86:       # %bb.0: # %entry598; X86-NEXT:    movq {{[0-9]+}}(%esp), %mm0599; X86-NEXT:    paddw {{[0-9]+}}(%esp), %mm0600; X86-NEXT:    movq %mm0, 0601; X86-NEXT:    retl602;603; X64-LABEL: ti16a:604; X64:       # %bb.0: # %entry605; X64-NEXT:    movdq2q %xmm0, %mm0606; X64-NEXT:    movdq2q %xmm1, %mm1607; X64-NEXT:    paddw %mm0, %mm1608; X64-NEXT:    movq %mm1, 0609; X64-NEXT:    retq610entry:611  %tmp1 = bitcast double %a to <1 x i64>612  %tmp2 = bitcast double %b to <1 x i64>613  %tmp3 = tail call <1 x i64> @llvm.x86.mmx.padd.w(<1 x i64> %tmp1, <1 x i64> %tmp2)614  store <1 x i64> %tmp3, ptr null615  ret void616}617 618define void @ti32a(double %a, double %b) nounwind {619; X86-LABEL: ti32a:620; X86:       # %bb.0: # %entry621; X86-NEXT:    movq {{[0-9]+}}(%esp), %mm0622; X86-NEXT:    paddd {{[0-9]+}}(%esp), %mm0623; X86-NEXT:    movq %mm0, 0624; X86-NEXT:    retl625;626; X64-LABEL: ti32a:627; X64:       # %bb.0: # %entry628; X64-NEXT:    movdq2q %xmm0, %mm0629; X64-NEXT:    movdq2q %xmm1, %mm1630; X64-NEXT:    paddd %mm0, %mm1631; X64-NEXT:    movq %mm1, 0632; X64-NEXT:    retq633entry:634  %tmp1 = bitcast double %a to <1 x i64>635  %tmp2 = bitcast double %b to <1 x i64>636  %tmp3 = tail call <1 x i64> @llvm.x86.mmx.padd.d(<1 x i64> %tmp1, <1 x i64> %tmp2)637  store <1 x i64> %tmp3, ptr null638  ret void639}640 641define void @ti64a(double %a, double %b) nounwind {642; X86-LABEL: ti64a:643; X86:       # %bb.0: # %entry644; X86-NEXT:    movq {{[0-9]+}}(%esp), %mm0645; X86-NEXT:    paddq {{[0-9]+}}(%esp), %mm0646; X86-NEXT:    movq %mm0, 0647; X86-NEXT:    retl648;649; X64-LABEL: ti64a:650; X64:       # %bb.0: # %entry651; X64-NEXT:    movdq2q %xmm0, %mm0652; X64-NEXT:    movdq2q %xmm1, %mm1653; X64-NEXT:    paddq %mm0, %mm1654; X64-NEXT:    movq %mm1, 0655; X64-NEXT:    retq656entry:657  %tmp1 = bitcast double %a to <1 x i64>658  %tmp2 = bitcast double %b to <1 x i64>659  %tmp3 = tail call <1 x i64> @llvm.x86.mmx.padd.q(<1 x i64> %tmp1, <1 x i64> %tmp2)660  store <1 x i64> %tmp3, ptr null661  ret void662}663 664; Make sure we clamp large shift amounts to 255665define i64 @pr43922() nounwind {666; X86-LABEL: pr43922:667; X86:       # %bb.0: # %entry668; X86-NEXT:    pushl %ebp669; X86-NEXT:    movl %esp, %ebp670; X86-NEXT:    andl $-8, %esp671; X86-NEXT:    subl $8, %esp672; X86-NEXT:    movq {{\.?LCPI[0-9]+_[0-9]+}}, %mm0 # mm0 = 0x7AAAAAAA7AAAAAAA673; X86-NEXT:    psrad $255, %mm0674; X86-NEXT:    movq %mm0, (%esp)675; X86-NEXT:    movl (%esp), %eax676; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx677; X86-NEXT:    movl %ebp, %esp678; X86-NEXT:    popl %ebp679; X86-NEXT:    retl680;681; X64-LABEL: pr43922:682; X64:       # %bb.0: # %entry683; X64-NEXT:    movq {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %mm0 # mm0 = 0x7AAAAAAA7AAAAAAA684; X64-NEXT:    psrad $255, %mm0685; X64-NEXT:    movq %mm0, %rax686; X64-NEXT:    retq687entry:688  %0 = tail call <1 x i64> @llvm.x86.mmx.psrai.d(<1 x i64> bitcast (<2 x i32> <i32 2058005162, i32 2058005162> to <1 x i64>), i32 268435456)689  %1 = bitcast <1 x i64> %0 to i64690  ret i64 %1691}692declare <1 x i64> @llvm.x86.mmx.psrai.d(<1 x i64>, i32)693 694declare <1 x i64> @llvm.x86.mmx.padd.b(<1 x i64>, <1 x i64>)695declare <1 x i64> @llvm.x86.mmx.padd.w(<1 x i64>, <1 x i64>)696declare <1 x i64> @llvm.x86.mmx.padd.d(<1 x i64>, <1 x i64>)697declare <1 x i64> @llvm.x86.mmx.padd.q(<1 x i64>, <1 x i64>)698 699declare <1 x i64> @llvm.x86.mmx.paddus.b(<1 x i64>, <1 x i64>)700declare <1 x i64> @llvm.x86.mmx.psubus.b(<1 x i64>, <1 x i64>)701declare <1 x i64> @llvm.x86.mmx.paddus.w(<1 x i64>, <1 x i64>)702declare <1 x i64> @llvm.x86.mmx.psubus.w(<1 x i64>, <1 x i64>)703declare <1 x i64> @llvm.x86.mmx.pmulh.w(<1 x i64>, <1 x i64>)704declare <1 x i64> @llvm.x86.mmx.pmadd.wd(<1 x i64>, <1 x i64>)705 706declare void @llvm.x86.mmx.emms()707 708declare <1 x i64> @llvm.x86.mmx.padds.b(<1 x i64>, <1 x i64>)709declare <1 x i64> @llvm.x86.mmx.padds.w(<1 x i64>, <1 x i64>)710declare <1 x i64> @llvm.x86.mmx.psubs.b(<1 x i64>, <1 x i64>)711declare <1 x i64> @llvm.x86.mmx.psubs.w(<1 x i64>, <1 x i64>)712 713