1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-linux-gnu < %s | FileCheck %s
4 ; Ensure vectorized FREMs are not widened/unrolled such that they get lowered
5 ; into libcalls on undef elements.
7 define float @frem(<2 x float> %a0, <2 x float> %a1, <2 x float> %a2, ptr%p3) nounwind {
10 ; CHECK-NEXT: pushq %rbx
11 ; CHECK-NEXT: subq $64, %rsp
12 ; CHECK-NEXT: movq %rdi, %rbx
13 ; CHECK-NEXT: movaps %xmm2, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
14 ; CHECK-NEXT: movaps %xmm1, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
15 ; CHECK-NEXT: movaps %xmm0, (%rsp) # 16-byte Spill
16 ; CHECK-NEXT: callq fmodf@PLT
17 ; CHECK-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
18 ; CHECK-NEXT: movaps (%rsp), %xmm0 # 16-byte Reload
19 ; CHECK-NEXT: shufps {{.*#+}} xmm0 = xmm0[1,1,1,1]
20 ; CHECK-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 16-byte Reload
21 ; CHECK-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,1,1,1]
22 ; CHECK-NEXT: callq fmodf@PLT
23 ; CHECK-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 16-byte Reload
24 ; CHECK-NEXT: unpcklps {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
25 ; CHECK-NEXT: divps {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 16-byte Folded Reload
26 ; CHECK-NEXT: movaps %xmm1, %xmm0
27 ; CHECK-NEXT: shufps {{.*#+}} xmm0 = xmm0[1,1],xmm1[1,1]
28 ; CHECK-NEXT: addss %xmm1, %xmm0
29 ; CHECK-NEXT: movlps %xmm1, (%rbx)
30 ; CHECK-NEXT: addq $64, %rsp
31 ; CHECK-NEXT: popq %rbx
33 %frem = frem <2 x float> %a0, %a1
34 %fdiv = fdiv <2 x float> %frem, %a2
35 %ex0 = extractelement <2 x float> %fdiv, i32 0
36 %ex1 = extractelement <2 x float> %fdiv, i32 1
37 %res = fadd float %ex0, %ex1
38 store <2 x float> %fdiv, ptr%p3