1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s 3 4define <4 x i32> @foo(<4 x i32> %t, <4 x i32> %u) { 5; CHECK-LABEL: foo: 6; CHECK: # BB#0: 7; CHECK-NEXT: pshufd {{.*#+}} xmm2 = xmm0[3,1,2,3] 8; CHECK-NEXT: movd %xmm2, %eax 9; CHECK-NEXT: pshufd {{.*#+}} xmm2 = xmm1[3,1,2,3] 10; CHECK-NEXT: movd %xmm2, %ecx 11; CHECK-NEXT: cltd 12; CHECK-NEXT: idivl %ecx 13; CHECK-NEXT: movd %edx, %xmm2 14; CHECK-NEXT: pshufd {{.*#+}} xmm3 = xmm0[1,1,2,3] 15; CHECK-NEXT: movd %xmm3, %eax 16; CHECK-NEXT: pshufd {{.*#+}} xmm3 = xmm1[1,1,2,3] 17; CHECK-NEXT: movd %xmm3, %ecx 18; CHECK-NEXT: cltd 19; CHECK-NEXT: idivl %ecx 20; CHECK-NEXT: movd %edx, %xmm3 21; CHECK-NEXT: punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1] 22; CHECK-NEXT: movd %xmm0, %eax 23; CHECK-NEXT: movd %xmm1, %ecx 24; CHECK-NEXT: cltd 25; CHECK-NEXT: idivl %ecx 26; CHECK-NEXT: movd %edx, %xmm2 27; CHECK-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,3,0,1] 28; CHECK-NEXT: movd %xmm0, %eax 29; CHECK-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,0,1] 30; CHECK-NEXT: movd %xmm0, %ecx 31; CHECK-NEXT: cltd 32; CHECK-NEXT: idivl %ecx 33; CHECK-NEXT: movd %edx, %xmm0 34; CHECK-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1] 35; CHECK-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1] 36; CHECK-NEXT: movdqa %xmm2, %xmm0 37; CHECK-NEXT: retq 38; 39 %m = srem <4 x i32> %t, %u 40 ret <4 x i32> %m 41} 42 43define <4 x i32> @bar(<4 x i32> %t, <4 x i32> %u) { 44; CHECK-LABEL: bar: 45; CHECK: # BB#0: 46; CHECK-NEXT: pshufd {{.*#+}} xmm2 = xmm0[3,1,2,3] 47; CHECK-NEXT: movd %xmm2, %eax 48; CHECK-NEXT: pshufd {{.*#+}} xmm2 = xmm1[3,1,2,3] 49; CHECK-NEXT: movd %xmm2, %ecx 50; CHECK-NEXT: xorl %edx, %edx 51; CHECK-NEXT: divl %ecx 52; CHECK-NEXT: movd %edx, %xmm2 53; CHECK-NEXT: pshufd {{.*#+}} xmm3 = xmm0[1,1,2,3] 54; CHECK-NEXT: movd %xmm3, %eax 55; CHECK-NEXT: pshufd {{.*#+}} xmm3 = xmm1[1,1,2,3] 56; CHECK-NEXT: movd %xmm3, %ecx 57; CHECK-NEXT: xorl %edx, %edx 58; CHECK-NEXT: divl %ecx 59; CHECK-NEXT: movd %edx, %xmm3 60; CHECK-NEXT: punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1] 61; CHECK-NEXT: movd %xmm0, %eax 62; CHECK-NEXT: movd %xmm1, %ecx 63; CHECK-NEXT: xorl %edx, %edx 64; CHECK-NEXT: divl %ecx 65; CHECK-NEXT: movd %edx, %xmm2 66; CHECK-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,3,0,1] 67; CHECK-NEXT: movd %xmm0, %eax 68; CHECK-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,0,1] 69; CHECK-NEXT: movd %xmm0, %ecx 70; CHECK-NEXT: xorl %edx, %edx 71; CHECK-NEXT: divl %ecx 72; CHECK-NEXT: movd %edx, %xmm0 73; CHECK-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1] 74; CHECK-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1] 75; CHECK-NEXT: movdqa %xmm2, %xmm0 76; CHECK-NEXT: retq 77; 78 %m = urem <4 x i32> %t, %u 79 ret <4 x i32> %m 80} 81 82define <4 x float> @qux(<4 x float> %t, <4 x float> %u) { 83; CHECK-LABEL: qux: 84; CHECK: # BB#0: 85; CHECK-NEXT: subq $72, %rsp 86; CHECK: movaps %xmm1, {{[0-9]+}}(%rsp) 87; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp) 88; CHECK-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,1,2,3] 89; CHECK-NEXT: shufps {{.*#+}} xmm1 = xmm1[3,1,2,3] 90; CHECK-NEXT: callq fmodf 91; CHECK-NEXT: movaps %xmm0, (%rsp) 92; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0 93; CHECK-NEXT: shufps {{.*#+}} xmm0 = xmm0[1,1,2,3] 94; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm1 95; CHECK-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,1,2,3] 96; CHECK-NEXT: callq fmodf 97; CHECK-NEXT: unpcklps (%rsp), %xmm0 98; CHECK: movaps %xmm0, (%rsp) 99; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0 100; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm1 101; CHECK-NEXT: callq fmodf 102; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp) 103; CHECK-NEXT: movapd {{[0-9]+}}(%rsp), %xmm0 104; CHECK-NEXT: shufpd {{.*#+}} xmm0 = xmm0[1,0] 105; CHECK-NEXT: movapd {{[0-9]+}}(%rsp), %xmm1 106; CHECK-NEXT: shufpd {{.*#+}} xmm1 = xmm1[1,0] 107; CHECK-NEXT: callq fmodf 108; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm1 109; CHECK-NEXT: unpcklps {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1] 110; CHECK-NEXT: unpcklps (%rsp), %xmm1 111; CHECK: movaps %xmm1, %xmm0 112; CHECK-NEXT: addq $72, %rsp 113; CHECK-NEXT: retq 114; 115 %m = frem <4 x float> %t, %u 116 ret <4 x float> %m 117} 118