Skip to content

Commit 3844109

Browse files
committed
--- Merging r127731 into '.':
U test/CodeGen/X86/byval2.ll U test/CodeGen/X86/byval4.ll U test/CodeGen/X86/byval.ll U test/CodeGen/X86/byval3.ll U test/CodeGen/X86/byval5.ll --- Merging r127732 into '.': U test/CodeGen/X86/stdarg.ll U test/CodeGen/X86/fold-mul-lohi.ll U test/CodeGen/X86/scalar-min-max-fill-operand.ll U test/CodeGen/X86/tailcallbyval64.ll U test/CodeGen/X86/stride-reuse.ll U test/CodeGen/X86/sse-align-3.ll U test/CodeGen/X86/sse-commute.ll U test/CodeGen/X86/stride-nine-with-base-reg.ll U test/CodeGen/X86/coalescer-commute2.ll U test/CodeGen/X86/sse-align-7.ll U test/CodeGen/X86/sse_reload_fold.ll U test/CodeGen/X86/sse-align-0.ll --- Merging r127733 into '.': U test/CodeGen/X86/peep-vector-extract-concat.ll U test/CodeGen/X86/pmulld.ll U test/CodeGen/X86/widen_load-0.ll U test/CodeGen/X86/v2f32.ll U test/CodeGen/X86/apm.ll U test/CodeGen/X86/h-register-store.ll U test/CodeGen/X86/h-registers-0.ll --- Merging r127734 into '.': U test/CodeGen/X86/2007-01-08-X86-64-Pointer.ll U test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll U test/CodeGen/X86/avoid-lea-scale2.ll U test/CodeGen/X86/lea-3.ll U test/CodeGen/X86/vec_set-8.ll U test/CodeGen/X86/i64-mem-copy.ll U test/CodeGen/X86/x86-64-malloc.ll U test/CodeGen/X86/mmx-copy-gprs.ll U test/CodeGen/X86/vec_shuffle-17.ll U test/CodeGen/X86/2007-07-18-Vector-Extract.ll --- Merging r127775 into '.': U test/CodeGen/X86/constant-pool-remat-0.ll --- Merging r127872 into '.': U utils/lit/lit/TestingConfig.py U lib/Support/raw_ostream.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_29@128258 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 76c60c3 commit 3844109

37 files changed

+401
-84
lines changed

lib/Support/raw_ostream.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,36 @@ raw_ostream &raw_ostream::operator<<(const void *P) {
220220
}
221221

222222
raw_ostream &raw_ostream::operator<<(double N) {
223+
#ifdef _WIN32
224+
// On MSVCRT and compatible, output of %e is incompatible to Posix
225+
// by default. Number of exponent digits should be at least 2. "%+03d"
226+
// FIXME: Implement our formatter to here or Support/Format.h!
227+
int fpcl = _fpclass(N);
228+
229+
// negative zero
230+
if (fpcl == _FPCLASS_NZ)
231+
return *this << "-0.000000e+00";
232+
233+
char buf[16];
234+
unsigned len;
235+
len = snprintf(buf, sizeof(buf), "%e", N);
236+
if (len <= sizeof(buf) - 2) {
237+
if (len >= 5 && buf[len - 5] == 'e' && buf[len - 3] == '0') {
238+
int cs = buf[len - 4];
239+
if (cs == '+' || cs == '-') {
240+
int c1 = buf[len - 2];
241+
int c0 = buf[len - 1];
242+
if (isdigit(c1) && isdigit(c0)) {
243+
// Trim leading '0': "...e+012" -> "...e+12\0"
244+
buf[len - 3] = c1;
245+
buf[len - 2] = c0;
246+
buf[--len] = 0;
247+
}
248+
}
249+
}
250+
return this->operator<<(buf);
251+
}
252+
#endif
223253
return this->operator<<(format("%e", N));
224254
}
225255

test/CodeGen/X86/2007-01-08-X86-64-Pointer.ll

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
; RUN: llc %s -o - -march=x86-64 | grep {(%rdi,%rax,8)}
2-
; RUN: llc %s -o - -march=x86-64 | not grep {addq.*8}
1+
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s
2+
; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s
3+
; CHECK-NOT: {{addq.*8}}
4+
; CHECK: ({{%rdi|%rcx}},%rax,8)
5+
; CHECK-NOT: {{addq.*8}}
36

47
define void @foo(double* %y) nounwind {
58
entry:

test/CodeGen/X86/2007-07-18-Vector-Extract.ll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
; RUN: llc < %s -march=x86-64 -mattr=+sse | grep {movq (%rdi), %rax}
2-
; RUN: llc < %s -march=x86-64 -mattr=+sse | grep {movq 8(%rdi), %rax}
1+
; RUN: llc < %s -mtriple=x86_64-linux -mattr=+sse | FileCheck %s
2+
; RUN: llc < %s -mtriple=x86_64-win32 -mattr=+sse | FileCheck %s
3+
; CHECK: movq ([[A0:%rdi|%rcx]]), %rax
4+
; CHECK: movq 8([[A0]]), %rax
35
define i64 @foo_0(<2 x i64>* %val) {
46
entry:
57
%val12 = getelementptr <2 x i64>* %val, i32 0, i32 0 ; <i64*> [#uses=1]

test/CodeGen/X86/apm.ll

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
; RUN: llc < %s -o - -march=x86-64 | FileCheck %s
1+
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s
2+
; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN64
23
; PR8573
34

45
; CHECK: foo:
56
; CHECK: leaq (%rdi), %rax
67
; CHECK-NEXT: movl %esi, %ecx
78
; CHECK-NEXT: monitor
9+
; WIN64: foo:
10+
; WIN64: leaq (%rcx), %rax
11+
; WIN64-NEXT: movl %edx, %ecx
12+
; WIN64-NEXT: movl %r8d, %edx
13+
; WIN64-NEXT: monitor
814
define void @foo(i8* %P, i32 %E, i32 %H) nounwind {
915
entry:
1016
tail call void @llvm.x86.sse3.monitor(i8* %P, i32 %E, i32 %H)
@@ -17,6 +23,9 @@ declare void @llvm.x86.sse3.monitor(i8*, i32, i32) nounwind
1723
; CHECK: movl %edi, %ecx
1824
; CHECK-NEXT: movl %esi, %eax
1925
; CHECK-NEXT: mwait
26+
; WIN64: bar:
27+
; WIN64: movl %edx, %eax
28+
; WIN64-NEXT: mwait
2029
define void @bar(i32 %E, i32 %H) nounwind {
2130
entry:
2231
tail call void @llvm.x86.sse3.mwait(i32 %E, i32 %H)

test/CodeGen/X86/avoid-lea-scale2.ll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
; RUN: llc < %s -march=x86-64 | grep {leal.*-2(\[%\]rdi,\[%\]rdi)}
1+
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s
2+
; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s
3+
; CHECK: leal -2({{%rdi,%rdi|%rcx,%rcx}})
24

35
define i32 @foo(i32 %x) nounwind readnone {
46
%t0 = shl i32 %x, 1

test/CodeGen/X86/byval.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
; RUN: llc < %s -march=x86-64 | FileCheck -check-prefix=X86-64 %s
1+
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck -check-prefix=X86-64 %s
2+
; Win64 has not supported byval yet.
23
; RUN: llc < %s -march=x86 | FileCheck -check-prefix=X86 %s
34

45
; X86: movl 4(%esp), %eax

test/CodeGen/X86/byval2.ll

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
1-
; RUN: llc < %s -march=x86-64 | grep rep.movsq | count 2
2-
; RUN: llc < %s -march=x86 | grep rep.movsl | count 2
1+
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64
2+
; X64-NOT: movsq
3+
; X64: rep
4+
; X64-NOT: rep
5+
; X64: movsq
6+
; X64-NOT: movsq
7+
; X64: rep
8+
; X64-NOT: rep
9+
; X64: movsq
10+
; X64-NOT: rep
11+
; X64-NOT: movsq
12+
13+
; Win64 has not supported byval yet.
14+
15+
; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=X32
16+
; X32-NOT: movsl
17+
; X32: rep
18+
; X32-NOT: rep
19+
; X32: movsl
20+
; X32-NOT: movsl
21+
; X32: rep
22+
; X32-NOT: rep
23+
; X32: movsl
24+
; X32-NOT: rep
25+
; X32-NOT: movsl
326

427
%struct.s = type { i64, i64, i64, i64, i64, i64, i64, i64,
528
i64, i64, i64, i64, i64, i64, i64, i64,

test/CodeGen/X86/byval3.ll

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
1-
; RUN: llc < %s -march=x86-64 | grep rep.movsq | count 2
2-
; RUN: llc < %s -march=x86 | grep rep.movsl | count 2
1+
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64
2+
; X64-NOT: movsq
3+
; X64: rep
4+
; X64-NOT: rep
5+
; X64: movsq
6+
; X64-NOT: movsq
7+
; X64: rep
8+
; X64-NOT: rep
9+
; X64: movsq
10+
; X64-NOT: rep
11+
; X64-NOT: movsq
12+
13+
; Win64 has not supported byval yet.
14+
15+
; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=X32
16+
; X32-NOT: movsl
17+
; X32: rep
18+
; X32-NOT: rep
19+
; X32: movsl
20+
; X32-NOT: movsl
21+
; X32: rep
22+
; X32-NOT: rep
23+
; X32: movsl
24+
; X32-NOT: rep
25+
; X32-NOT: movsl
326

427
%struct.s = type { i32, i32, i32, i32, i32, i32, i32, i32,
528
i32, i32, i32, i32, i32, i32, i32, i32,

test/CodeGen/X86/byval4.ll

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
1-
; RUN: llc < %s -march=x86-64 | grep rep.movsq | count 2
2-
; RUN: llc < %s -march=x86 | grep rep.movsl | count 2
1+
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64
2+
; X64-NOT: movsq
3+
; X64: rep
4+
; X64-NOT: rep
5+
; X64: movsq
6+
; X64-NOT: movsq
7+
; X64: rep
8+
; X64-NOT: rep
9+
; X64: movsq
10+
; X64-NOT: rep
11+
; X64-NOT: movsq
12+
13+
; Win64 has not supported byval yet.
14+
15+
; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=X32
16+
; X32-NOT: movsl
17+
; X32: rep
18+
; X32-NOT: rep
19+
; X32: movsl
20+
; X32-NOT: movsl
21+
; X32: rep
22+
; X32-NOT: rep
23+
; X32: movsl
24+
; X32-NOT: rep
25+
; X32-NOT: movsl
326

427
%struct.s = type { i16, i16, i16, i16, i16, i16, i16, i16,
528
i16, i16, i16, i16, i16, i16, i16, i16,

test/CodeGen/X86/byval5.ll

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
1-
; RUN: llc < %s -march=x86-64 | grep rep.movsq | count 2
2-
; RUN: llc < %s -march=x86 | grep rep.movsl | count 2
1+
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64
2+
; X64-NOT: movsq
3+
; X64: rep
4+
; X64-NOT: rep
5+
; X64: movsq
6+
; X64-NOT: movsq
7+
; X64: rep
8+
; X64-NOT: rep
9+
; X64: movsq
10+
; X64-NOT: rep
11+
; X64-NOT: movsq
12+
13+
; Win64 has not supported byval yet.
14+
15+
; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=X32
16+
; X32-NOT: movsl
17+
; X32: rep
18+
; X32-NOT: rep
19+
; X32: movsl
20+
; X32-NOT: movsl
21+
; X32: rep
22+
; X32-NOT: rep
23+
; X32: movsl
24+
; X32-NOT: rep
25+
; X32-NOT: movsl
326

427
%struct.s = type { i8, i8, i8, i8, i8, i8, i8, i8,
528
i8, i8, i8, i8, i8, i8, i8, i8,

0 commit comments

Comments
 (0)