Home | History | Annotate | Download | only in X86
      1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
      2 ; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=sse2 < %s   | FileCheck --check-prefix=SSE %s
      3 ; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=sse4.1 < %s | FileCheck --check-prefix=SSE %s
      4 ; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=avx < %s    | FileCheck --check-prefix=AVX %s
      5 
      6 ; PR21507 - https://llvm.org/bugs/show_bug.cgi?id=21507
      7 ; Each function should be a single math op; no extra moves.
      8 
      9 
     10 define <4 x float> @recip(<4 x float> %x) {
     11 ; SSE-LABEL: recip:
     12 ; SSE:       # BB#0:
     13 ; SSE-NEXT:    rcpss %xmm0, %xmm0
     14 ; SSE-NEXT:    retq
     15 ;
     16 ; AVX-LABEL: recip:
     17 ; AVX:       # BB#0:
     18 ; AVX-NEXT:    vrcpss %xmm0, %xmm0, %xmm0
     19 ; AVX-NEXT:    retq
     20   %y = tail call <4 x float> @llvm.x86.sse.rcp.ss(<4 x float> %x)
     21   %shuf = shufflevector <4 x float> %y, <4 x float> %x, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
     22   ret <4 x float> %shuf
     23 }
     24 
     25 define <4 x float> @recip_square_root(<4 x float> %x) {
     26 ; SSE-LABEL: recip_square_root:
     27 ; SSE:       # BB#0:
     28 ; SSE-NEXT:    rsqrtss %xmm0, %xmm0
     29 ; SSE-NEXT:    retq
     30 ;
     31 ; AVX-LABEL: recip_square_root:
     32 ; AVX:       # BB#0:
     33 ; AVX-NEXT:    vrsqrtss %xmm0, %xmm0, %xmm0
     34 ; AVX-NEXT:    retq
     35   %y = tail call <4 x float> @llvm.x86.sse.rsqrt.ss(<4 x float> %x)
     36   %shuf = shufflevector <4 x float> %y, <4 x float> %x, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
     37   ret <4 x float> %shuf
     38 }
     39 
     40 define <4 x float> @square_root(<4 x float> %x) {
     41 ; SSE-LABEL: square_root:
     42 ; SSE:       # BB#0:
     43 ; SSE-NEXT:    sqrtss %xmm0, %xmm0
     44 ; SSE-NEXT:    retq
     45 ;
     46 ; AVX-LABEL: square_root:
     47 ; AVX:       # BB#0:
     48 ; AVX-NEXT:    vsqrtss %xmm0, %xmm0, %xmm0
     49 ; AVX-NEXT:    retq
     50   %y = tail call <4 x float> @llvm.x86.sse.sqrt.ss(<4 x float> %x)
     51   %shuf = shufflevector <4 x float> %y, <4 x float> %x, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
     52   ret <4 x float> %shuf
     53 }
     54 
     55 define <2 x double> @square_root_double(<2 x double> %x) {
     56 ; SSE-LABEL: square_root_double:
     57 ; SSE:       # BB#0:
     58 ; SSE-NEXT:    sqrtsd %xmm0, %xmm0
     59 ; SSE-NEXT:    retq
     60 ;
     61 ; AVX-LABEL: square_root_double:
     62 ; AVX:       # BB#0:
     63 ; AVX-NEXT:    vsqrtsd %xmm0, %xmm0, %xmm0
     64 ; AVX-NEXT:    retq
     65   %y = tail call <2 x double> @llvm.x86.sse2.sqrt.sd(<2 x double> %x)
     66   %shuf = shufflevector <2 x double> %y, <2 x double> %x, <2 x i32> <i32 0, i32 3>
     67   ret <2 x double> %shuf
     68 }
     69 
     70 declare <4 x float> @llvm.x86.sse.rcp.ss(<4 x float>)
     71 declare <4 x float> @llvm.x86.sse.rsqrt.ss(<4 x float>)
     72 declare <4 x float> @llvm.x86.sse.sqrt.ss(<4 x float>)
     73 declare <2 x double> @llvm.x86.sse2.sqrt.sd(<2 x double>)
     74 
     75