|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py |
| 2 | +; RUN: llc < %s -mtriple=x86_64-- -mattr=+sse2 | FileCheck %s |
| 3 | + |
| 4 | +define float @ext_fadd_v4f32(<4 x float> %x) { |
| 5 | +; CHECK-LABEL: ext_fadd_v4f32: |
| 6 | +; CHECK: # %bb.0: |
| 7 | +; CHECK-NEXT: addps {{.*}}(%rip), %xmm0 |
| 8 | +; CHECK-NEXT: movhlps {{.*#+}} xmm0 = xmm0[1,1] |
| 9 | +; CHECK-NEXT: retq |
| 10 | + %bo = fadd <4 x float> %x, <float 1.0, float 2.0, float 3.0, float 42.0> |
| 11 | + %ext = extractelement <4 x float> %bo, i32 2 |
| 12 | + ret float %ext |
| 13 | +} |
| 14 | + |
| 15 | +define float @ext_fsub_v4f32(<4 x float> %x) { |
| 16 | +; CHECK-LABEL: ext_fsub_v4f32: |
| 17 | +; CHECK: # %bb.0: |
| 18 | +; CHECK-NEXT: movaps {{.*#+}} xmm1 = <u,2.0E+0,u,u> |
| 19 | +; CHECK-NEXT: subps %xmm0, %xmm1 |
| 20 | +; CHECK-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,1,2,3] |
| 21 | +; CHECK-NEXT: movaps %xmm1, %xmm0 |
| 22 | +; CHECK-NEXT: retq |
| 23 | + %bo = fsub <4 x float> <float 1.0, float 2.0, float 3.0, float 42.0>, %x |
| 24 | + %ext = extractelement <4 x float> %bo, i32 1 |
| 25 | + ret float %ext |
| 26 | +} |
| 27 | + |
| 28 | +define float @ext_fmul_v4f32(<4 x float> %x) { |
| 29 | +; CHECK-LABEL: ext_fmul_v4f32: |
| 30 | +; CHECK: # %bb.0: |
| 31 | +; CHECK-NEXT: mulps {{.*}}(%rip), %xmm0 |
| 32 | +; CHECK-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,1,2,3] |
| 33 | +; CHECK-NEXT: retq |
| 34 | + %bo = fmul <4 x float> %x, <float 1.0, float 2.0, float 3.0, float 42.0> |
| 35 | + %ext = extractelement <4 x float> %bo, i32 3 |
| 36 | + ret float %ext |
| 37 | +} |
| 38 | + |
| 39 | +define float @ext_fdiv_v4f32(<4 x float> %x) { |
| 40 | +; CHECK-LABEL: ext_fdiv_v4f32: |
| 41 | +; CHECK: # %bb.0: |
| 42 | +; CHECK-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero |
| 43 | +; CHECK-NEXT: divps %xmm1, %xmm0 |
| 44 | +; CHECK-NEXT: retq |
| 45 | + %bo = fdiv <4 x float> %x, <float 1.0, float 2.0, float 3.0, float 42.0> |
| 46 | + %ext = extractelement <4 x float> %bo, i32 0 |
| 47 | + ret float %ext |
| 48 | +} |
| 49 | + |
| 50 | +define float @ext_fdiv_v4f32_constant_op0(<4 x float> %x) { |
| 51 | +; CHECK-LABEL: ext_fdiv_v4f32_constant_op0: |
| 52 | +; CHECK: # %bb.0: |
| 53 | +; CHECK-NEXT: movaps {{.*#+}} xmm1 = <u,2.0E+0,u,u> |
| 54 | +; CHECK-NEXT: divps %xmm0, %xmm1 |
| 55 | +; CHECK-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,1,2,3] |
| 56 | +; CHECK-NEXT: movaps %xmm1, %xmm0 |
| 57 | +; CHECK-NEXT: retq |
| 58 | + %bo = fdiv <4 x float> <float 1.0, float 2.0, float 3.0, float 42.0>, %x |
| 59 | + %ext = extractelement <4 x float> %bo, i32 1 |
| 60 | + ret float %ext |
| 61 | +} |
| 62 | + |
| 63 | +define float @ext_frem_v4f32(<4 x float> %x) { |
| 64 | +; CHECK-LABEL: ext_frem_v4f32: |
| 65 | +; CHECK: # %bb.0: |
| 66 | +; CHECK-NEXT: movhlps {{.*#+}} xmm0 = xmm0[1,1] |
| 67 | +; CHECK-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero |
| 68 | +; CHECK-NEXT: jmp fmodf # TAILCALL |
| 69 | + %bo = frem <4 x float> %x, <float 1.0, float 2.0, float 3.0, float 42.0> |
| 70 | + %ext = extractelement <4 x float> %bo, i32 2 |
| 71 | + ret float %ext |
| 72 | +} |
| 73 | + |
| 74 | +define float @ext_frem_v4f32_constant_op0(<4 x float> %x) { |
| 75 | +; CHECK-LABEL: ext_frem_v4f32_constant_op0: |
| 76 | +; CHECK: # %bb.0: |
| 77 | +; CHECK-NEXT: movaps %xmm0, %xmm1 |
| 78 | +; CHECK-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,1],xmm0[2,3] |
| 79 | +; CHECK-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero |
| 80 | +; CHECK-NEXT: jmp fmodf # TAILCALL |
| 81 | + %bo = frem <4 x float> <float 1.0, float 2.0, float 3.0, float 42.0>, %x |
| 82 | + %ext = extractelement <4 x float> %bo, i32 1 |
| 83 | + ret float %ext |
| 84 | +} |
| 85 | + |
0 commit comments