~pali/+junk/llvm-toolchain-3.7

« back to all changes in this revision

Viewing changes to test/CodeGen/X86/fold-load-unops.ll

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2015-07-15 17:51:08 UTC
  • Revision ID: package-import@ubuntu.com-20150715175108-l8mynwovkx4zx697
Tags: upstream-3.7~+rc2
ImportĀ upstreamĀ versionĀ 3.7~+rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+sse2 < %s | FileCheck %s --check-prefix=SSE
 
2
; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+avx < %s | FileCheck %s --check-prefix=AVX
 
3
 
 
4
; Verify that we're folding the load into the math instruction.
 
5
 
 
6
define float @rcpss(float* %a) {
 
7
; SSE-LABEL: rcpss:
 
8
; SSE:       # BB#0:
 
9
; SSE-NEXT:    rcpss (%rdi), %xmm0
 
10
; SSE-NEXT:    retq
 
11
;
 
12
; AVX-LABEL: rcpss:
 
13
; AVX:       # BB#0:
 
14
; AVX-NEXT:    vrcpss (%rdi), %xmm0, %xmm0
 
15
; AVX-NEXT:    retq
 
16
    %ld = load float, float* %a
 
17
    %ins = insertelement <4 x float> undef, float %ld, i32 0
 
18
    %res = tail call <4 x float> @llvm.x86.sse.rcp.ss(<4 x float> %ins)
 
19
    %ext = extractelement <4 x float> %res, i32 0
 
20
    ret float %ext
 
21
}
 
22
 
 
23
define float @rsqrtss(float* %a) {
 
24
; SSE-LABEL: rsqrtss:
 
25
; SSE:       # BB#0:
 
26
; SSE-NEXT:    rsqrtss (%rdi), %xmm0
 
27
; SSE-NEXT:    retq
 
28
;
 
29
; AVX-LABEL: rsqrtss:
 
30
; AVX:       # BB#0:
 
31
; AVX-NEXT:    vrsqrtss (%rdi), %xmm0, %xmm0
 
32
; AVX-NEXT:    retq
 
33
    %ld = load float, float* %a
 
34
    %ins = insertelement <4 x float> undef, float %ld, i32 0
 
35
    %res = tail call <4 x float> @llvm.x86.sse.rsqrt.ss(<4 x float> %ins)
 
36
    %ext = extractelement <4 x float> %res, i32 0
 
37
    ret float %ext
 
38
}
 
39
 
 
40
define float @sqrtss(float* %a) {
 
41
; SSE-LABEL: sqrtss:
 
42
; SSE:       # BB#0:
 
43
; SSE-NEXT:    sqrtss (%rdi), %xmm0
 
44
; SSE-NEXT:    retq
 
45
;
 
46
; AVX-LABEL: sqrtss:
 
47
; AVX:       # BB#0:
 
48
; AVX-NEXT:    vsqrtss (%rdi), %xmm0, %xmm0
 
49
; AVX-NEXT:    retq
 
50
    %ld = load float, float* %a
 
51
    %ins = insertelement <4 x float> undef, float %ld, i32 0
 
52
    %res = tail call <4 x float> @llvm.x86.sse.sqrt.ss(<4 x float> %ins)
 
53
    %ext = extractelement <4 x float> %res, i32 0
 
54
    ret float %ext
 
55
}
 
56
 
 
57
define double @sqrtsd(double* %a) {
 
58
; SSE-LABEL: sqrtsd:
 
59
; SSE:       # BB#0:
 
60
; SSE-NEXT:    sqrtsd (%rdi), %xmm0
 
61
; SSE-NEXT:    retq
 
62
;
 
63
; AVX-LABEL: sqrtsd:
 
64
; AVX:       # BB#0:
 
65
; AVX-NEXT:    vsqrtsd (%rdi), %xmm0, %xmm0
 
66
; AVX-NEXT:    retq
 
67
    %ld = load double, double* %a
 
68
    %ins = insertelement <2 x double> undef, double %ld, i32 0
 
69
    %res = tail call <2 x double> @llvm.x86.sse2.sqrt.sd(<2 x double> %ins)
 
70
    %ext = extractelement <2 x double> %res, i32 0
 
71
    ret double %ext
 
72
}
 
73
 
 
74
 
 
75
declare <4 x float> @llvm.x86.sse.rcp.ss(<4 x float>) nounwind readnone
 
76
declare <4 x float> @llvm.x86.sse.rsqrt.ss(<4 x float>) nounwind readnone
 
77
declare <4 x float> @llvm.x86.sse.sqrt.ss(<4 x float>) nounwind readnone
 
78
declare <2 x double> @llvm.x86.sse2.sqrt.sd(<2 x double>) nounwind readnone
 
79