Mercurial > hg > CbC > CbC_llvm
comparison test/CodeGen/X86/sse-fcopysign.ll @ 120:1172e4bd9c6f
update 4.0.0
author | mir3636 |
---|---|
date | Fri, 25 Nov 2016 19:14:25 +0900 |
parents | afa8332a0e37 |
children | 803732b1fca8 |
comparison
equal
deleted
inserted
replaced
101:34baf5011add | 120:1172e4bd9c6f |
---|---|
1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | |
1 ; RUN: llc < %s -mtriple=i686-unknown -mattr=+sse2 | FileCheck %s --check-prefix=ALL --check-prefix=X32 | 2 ; RUN: llc < %s -mtriple=i686-unknown -mattr=+sse2 | FileCheck %s --check-prefix=ALL --check-prefix=X32 |
2 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse2 | FileCheck %s --check-prefix=ALL --check-prefix=X64 | 3 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse2 | FileCheck %s --check-prefix=ALL --check-prefix=X64 |
3 | 4 |
4 ; | 5 ; |
5 ; Library Functions | 6 ; Library Functions |
6 ; | 7 ; |
7 | 8 |
8 define float @tst1(float %a, float %b) { | 9 define float @tst1(float %a, float %b) nounwind { |
9 ; X32-LABEL: @tst1 | 10 ; X32-LABEL: tst1: |
10 ; X32: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero | 11 ; X32: # BB#0: |
11 ; X32-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero | 12 ; X32-NEXT: subl $8, %esp |
12 ; X32-NEXT: movss %xmm1, 4(%esp) | 13 ; X32-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero |
13 ; X32-NEXT: movss %xmm0, (%esp) | 14 ; X32-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero |
14 ; X32-NEXT: calll copysignf | 15 ; X32-NEXT: movss %xmm1, {{[0-9]+}}(%esp) |
15 ; X32-NEXT: addl $8, %esp | 16 ; X32-NEXT: movss %xmm0, (%esp) |
16 ; X32-NEXT: retl | 17 ; X32-NEXT: calll copysignf |
18 ; X32-NEXT: addl $8, %esp | |
19 ; X32-NEXT: retl | |
17 ; | 20 ; |
18 ; X64-LABEL: @tst1 | 21 ; X64-LABEL: tst1: |
19 ; X64: movaps %xmm0, %xmm2 | 22 ; X64: # BB#0: |
20 ; X64-NEXT: movaps %xmm1, %xmm0 | 23 ; X64-NEXT: movaps %xmm0, %xmm2 |
21 ; X64-NEXT: movaps %xmm2, %xmm1 | 24 ; X64-NEXT: movaps %xmm1, %xmm0 |
22 ; X64-NEXT: jmp copysignf | 25 ; X64-NEXT: movaps %xmm2, %xmm1 |
26 ; X64-NEXT: jmp copysignf # TAILCALL | |
23 %tmp = tail call float @copysignf( float %b, float %a ) | 27 %tmp = tail call float @copysignf( float %b, float %a ) |
24 ret float %tmp | 28 ret float %tmp |
25 } | 29 } |
26 | 30 |
27 define double @tst2(double %a, float %b, float %c) { | 31 define double @tst2(double %a, float %b, float %c) nounwind { |
28 ; X32-LABEL: @tst2 | 32 ; X32-LABEL: tst2: |
29 ; X32: movsd {{.*#+}} xmm0 = mem[0],zero | 33 ; X32: # BB#0: |
30 ; X32-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero | 34 ; X32-NEXT: subl $16, %esp |
31 ; X32-NEXT: addss 32(%esp), %xmm1 | 35 ; X32-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero |
32 ; X32-NEXT: cvtss2sd %xmm1, %xmm1 | 36 ; X32-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero |
33 ; X32-NEXT: movsd %xmm0, (%esp) | 37 ; X32-NEXT: addss {{[0-9]+}}(%esp), %xmm1 |
34 ; X32-NEXT: movsd %xmm1, 8(%esp) | 38 ; X32-NEXT: cvtss2sd %xmm1, %xmm1 |
35 ; X32-NEXT: calll copysign | 39 ; X32-NEXT: movsd %xmm0, (%esp) |
36 ; X32-NEXT: addl $16, %esp | 40 ; X32-NEXT: movsd %xmm1, {{[0-9]+}}(%esp) |
37 ; X32-NEXT: retl | 41 ; X32-NEXT: calll copysign |
42 ; X32-NEXT: addl $16, %esp | |
43 ; X32-NEXT: retl | |
38 ; | 44 ; |
39 ; X64-LABEL: @tst2 | 45 ; X64-LABEL: tst2: |
40 ; X64: addss %xmm2, %xmm1 | 46 ; X64: # BB#0: |
41 ; X64-NEXT: cvtss2sd %xmm1, %xmm1 | 47 ; X64-NEXT: addss %xmm2, %xmm1 |
42 ; X64-NEXT: jmp copysign | 48 ; X64-NEXT: cvtss2sd %xmm1, %xmm1 |
49 ; X64-NEXT: jmp copysign # TAILCALL | |
43 %tmp1 = fadd float %b, %c | 50 %tmp1 = fadd float %b, %c |
44 %tmp2 = fpext float %tmp1 to double | 51 %tmp2 = fpext float %tmp1 to double |
45 %tmp = tail call double @copysign( double %a, double %tmp2 ) | 52 %tmp = tail call double @copysign( double %a, double %tmp2 ) |
46 ret double %tmp | 53 ret double %tmp |
47 } | 54 } |
51 | 58 |
52 ; | 59 ; |
53 ; LLVM Intrinsic | 60 ; LLVM Intrinsic |
54 ; | 61 ; |
55 | 62 |
56 define float @int1(float %a, float %b) { | 63 define float @int1(float %a, float %b) nounwind { |
57 ; X32-LABEL: @int1 | 64 ; X32-LABEL: int1: |
58 ; X32: movss 8(%esp), %xmm0 {{.*#+}} xmm0 = mem[0],zero,zero,zero | 65 ; X32: # BB#0: |
59 ; X32-NEXT: andps .LCPI2_0, %xmm0 | 66 ; X32-NEXT: pushl %eax |
60 ; X32-NEXT: movss 12(%esp), %xmm1 {{.*#+}} xmm1 = mem[0],zero,zero,zero | 67 ; X32-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero |
61 ; X32-NEXT: andps .LCPI2_1, %xmm1 | 68 ; X32-NEXT: andps {{\.LCPI.*}}, %xmm0 |
62 ; X32-NEXT: orps %xmm0, %xmm1 | 69 ; X32-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero |
63 ; X32-NEXT: movss %xmm1, (%esp) | 70 ; X32-NEXT: andps {{\.LCPI.*}}, %xmm1 |
64 ; X32-NEXT: flds (%esp) | 71 ; X32-NEXT: orps %xmm0, %xmm1 |
65 ; X32-NEXT: popl %eax | 72 ; X32-NEXT: movss %xmm1, (%esp) |
66 ; X32-NEXT: retl | 73 ; X32-NEXT: flds (%esp) |
74 ; X32-NEXT: popl %eax | |
75 ; X32-NEXT: retl | |
67 ; | 76 ; |
68 ; X64-LABEL: @int1 | 77 ; X64-LABEL: int1: |
69 ; X64: andps .LCPI2_0(%rip), %xmm0 | 78 ; X64: # BB#0: |
70 ; X64-NEXT: andps .LCPI2_1(%rip), %xmm1 | 79 ; X64-NEXT: andps {{.*}}(%rip), %xmm0 |
71 ; X64-NEXT: orps %xmm1, %xmm0 | 80 ; X64-NEXT: andps {{.*}}(%rip), %xmm1 |
72 ; X64-NEXT: retq | 81 ; X64-NEXT: orps %xmm1, %xmm0 |
82 ; X64-NEXT: retq | |
73 %tmp = tail call float @llvm.copysign.f32( float %b, float %a ) | 83 %tmp = tail call float @llvm.copysign.f32( float %b, float %a ) |
74 ret float %tmp | 84 ret float %tmp |
75 } | 85 } |
76 | 86 |
77 define double @int2(double %a, float %b, float %c) { | 87 define double @int2(double %a, float %b, float %c) nounwind { |
78 ; X32-LABEL: @int2 | 88 ; X32-LABEL: int2: |
79 ; X32: movss 16(%ebp), %xmm0 {{.*#+}} xmm0 = mem[0],zero,zero,zero | 89 ; X32: # BB#0: |
80 ; X32-NEXT: addss 20(%ebp), %xmm0 | 90 ; X32-NEXT: pushl %ebp |
81 ; X32-NEXT: movsd 8(%ebp), %xmm1 {{.*#+}} xmm1 = mem[0],zero | 91 ; X32-NEXT: movl %esp, %ebp |
82 ; X32-NEXT: andpd .LCPI3_0, %xmm1 | 92 ; X32-NEXT: andl $-8, %esp |
83 ; X32-NEXT: cvtss2sd %xmm0, %xmm0 | 93 ; X32-NEXT: subl $8, %esp |
84 ; X32-NEXT: andpd .LCPI3_1, %xmm0 | 94 ; X32-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero |
85 ; X32-NEXT: orpd %xmm1, %xmm0 | 95 ; X32-NEXT: addss 20(%ebp), %xmm0 |
86 ; X32-NEXT: movlpd %xmm0, (%esp) | 96 ; X32-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero |
87 ; X32-NEXT: fldl (%esp) | 97 ; X32-NEXT: andpd {{\.LCPI.*}}, %xmm1 |
88 ; X32-NEXT: movl %ebp, %esp | 98 ; X32-NEXT: cvtss2sd %xmm0, %xmm0 |
89 ; X32-NEXT: popl %ebp | 99 ; X32-NEXT: andpd {{\.LCPI.*}}, %xmm0 |
90 ; X32-NEXT: retl | 100 ; X32-NEXT: orpd %xmm1, %xmm0 |
101 ; X32-NEXT: movlpd %xmm0, (%esp) | |
102 ; X32-NEXT: fldl (%esp) | |
103 ; X32-NEXT: movl %ebp, %esp | |
104 ; X32-NEXT: popl %ebp | |
105 ; X32-NEXT: retl | |
91 ; | 106 ; |
92 ; X64-LABEL: @int2 | 107 ; X64-LABEL: int2: |
93 ; X64: addss %xmm2, %xmm1 | 108 ; X64: # BB#0: |
94 ; X64-NEXT: cvtss2sd %xmm1, %xmm1 | 109 ; X64-NEXT: addss %xmm2, %xmm1 |
95 ; X64-NEXT: andpd .LCPI3_0(%rip), %xmm1 | 110 ; X64-NEXT: cvtss2sd %xmm1, %xmm1 |
96 ; X64-NEXT: andpd .LCPI3_1(%rip), %xmm0 | 111 ; X64-NEXT: andps {{.*}}(%rip), %xmm1 |
97 ; X64-NEXT: orpd %xmm1, %xmm0 | 112 ; X64-NEXT: andps {{.*}}(%rip), %xmm0 |
98 ; X64-NEXT: retq | 113 ; X64-NEXT: orps %xmm1, %xmm0 |
114 ; X64-NEXT: retq | |
99 %tmp1 = fadd float %b, %c | 115 %tmp1 = fadd float %b, %c |
100 %tmp2 = fpext float %tmp1 to double | 116 %tmp2 = fpext float %tmp1 to double |
101 %tmp = tail call double @llvm.copysign.f64( double %a, double %tmp2 ) | 117 %tmp = tail call double @llvm.copysign.f64( double %a, double %tmp2 ) |
102 ret double %tmp | 118 ret double %tmp |
103 } | 119 } |
104 | 120 |
105 define float @cst1() { | 121 define float @cst1() nounwind { |
106 ; X32-LABEL: @cst1 | 122 ; X32-LABEL: cst1: |
107 ; X32: fld1 | 123 ; X32: # BB#0: |
108 ; X32-NEXT: fchs | 124 ; X32-NEXT: fld1 |
109 ; X32-NEXT: retl | 125 ; X32-NEXT: fchs |
126 ; X32-NEXT: retl | |
110 ; | 127 ; |
111 ; X64-LABEL: @cst1 | 128 ; X64-LABEL: cst1: |
112 ; X64: movss .LCPI4_0(%rip), %xmm0 {{.*#+}} xmm0 = mem[0],zero,zero,zero | 129 ; X64: # BB#0: |
113 ; X64-NEXT: retq | 130 ; X64-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero |
131 ; X64-NEXT: retq | |
114 %tmp = tail call float @llvm.copysign.f32( float 1.0, float -2.0 ) | 132 %tmp = tail call float @llvm.copysign.f32( float 1.0, float -2.0 ) |
115 ret float %tmp | 133 ret float %tmp |
116 } | 134 } |
117 | 135 |
118 define double @cst2() { | 136 define double @cst2() nounwind { |
119 ; X32-LABEL: @cst2 | 137 ; X32-LABEL: cst2: |
120 ; X32: fldz | 138 ; X32: # BB#0: |
121 ; X32-NEXT: fchs | 139 ; X32-NEXT: fldz |
122 ; X32-NEXT: retl | 140 ; X32-NEXT: fchs |
141 ; X32-NEXT: retl | |
123 ; | 142 ; |
124 ; X64-LABEL: @cst2 | 143 ; X64-LABEL: cst2: |
125 ; X64: movsd .LCPI5_0(%rip), %xmm0 {{.*#+}} xmm0 = mem[0],zero | 144 ; X64: # BB#0: |
126 ; X64-NEXT: retq | 145 ; X64-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero |
146 ; X64-NEXT: retq | |
127 %tmp1 = fadd float -1.0, -1.0 | 147 %tmp1 = fadd float -1.0, -1.0 |
128 %tmp2 = fpext float %tmp1 to double | 148 %tmp2 = fpext float %tmp1 to double |
129 %tmp = tail call double @llvm.copysign.f64( double 0.0, double %tmp2 ) | 149 %tmp = tail call double @llvm.copysign.f64( double 0.0, double %tmp2 ) |
130 ret double %tmp | 150 ret double %tmp |
131 } | 151 } |