llvm.org GIT mirror llvm / 2e858fc
Quick fix: Triple::isOSMSVCRT() should be false for targeting cygwin. It affected callee's stack pop in x86. It is one of devergences between cygwin and mingw since mingw-gcc-4.6. Added testcases to llvm/test/CodeGen/X86/win32_sret.ll for cygwin. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205688 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 5 years ago
2 changed file(s) with 24 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
361361
362362 /// \brief Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
363363 bool isOSMSVCRT() const {
364 return getOS() == Triple::Win32 || getOS() == Triple::MinGW32;
364 return isWindowsMSVCEnvironment() || isWindowsGNUEnvironment();
365365 }
366366
367367 /// \brief Tests whether the OS is Windows.
11 ; some setups (e.g., Atom) from affecting the output.
22 ; RUN: llc < %s -mcpu=core2 -mtriple=i686-pc-win32 | FileCheck %s -check-prefix=WIN32
33 ; RUN: llc < %s -mcpu=core2 -mtriple=i686-pc-mingw32 | FileCheck %s -check-prefix=MINGW_X86
4 ; RUN: llc < %s -mcpu=core2 -mtriple=i686-pc-cygwin | FileCheck %s -check-prefix=CYGWIN
45 ; RUN: llc < %s -mcpu=core2 -mtriple=i386-pc-linux | FileCheck %s -check-prefix=LINUX
56 ; RUN: llc < %s -mcpu=core2 -O0 -mtriple=i686-pc-win32 | FileCheck %s -check-prefix=WIN32
67 ; RUN: llc < %s -mcpu=core2 -O0 -mtriple=i686-pc-mingw32 | FileCheck %s -check-prefix=MINGW_X86
8 ; RUN: llc < %s -mcpu=core2 -O0 -mtriple=i686-pc-cygwin | FileCheck %s -check-prefix=CYGWIN
79 ; RUN: llc < %s -mcpu=core2 -O0 -mtriple=i386-pc-linux | FileCheck %s -check-prefix=LINUX
810
911 ; The SysV ABI used by most Unixes and Mingw on x86 specifies that an sret pointer
1921
2022 ; MINGW_X86-LABEL: _sret1:
2123 ; MINGW_X86: {{retl$}}
24
25 ; CYGWIN-LABEL: _sret1:
26 ; CYGWIN: retl $4
2227
2328 ; LINUX-LABEL: sret1:
2429 ; LINUX: retl $4
3742 ; MINGW_X86-LABEL: _sret2:
3843 ; MINGW_X86: {{retl$}}
3944
45 ; CYGWIN-LABEL: _sret2:
46 ; CYGWIN: retl $4
47
4048 ; LINUX-LABEL: sret2:
4149 ; LINUX: retl $4
4250
5462
5563 ; MINGW_X86-LABEL: _sret3:
5664 ; MINGW_X86: {{retl$}}
65
66 ; CYGWIN-LABEL: _sret3:
67 ; CYGWIN: retl $4
5768
5869 ; LINUX-LABEL: sret3:
5970 ; LINUX: retl $4
7687 ; MINGW_X86-LABEL: _sret4:
7788 ; MINGW_X86: {{retl$}}
7889
90 ; CYGWIN-LABEL: _sret4:
91 ; CYGWIN: retl $4
92
7993 ; LINUX-LABEL: sret4:
8094 ; LINUX: retl $4
8195
97111 ret void
98112 ; WIN32-LABEL: {{^}}"?foo@C5@@QAE?AUS5@@XZ":
99113 ; MINGW_X86-LABEL: {{^}}"?foo@C5@@QAE?AUS5@@XZ":
114 ; CYGWIN-LABEL: {{^}}"?foo@C5@@QAE?AUS5@@XZ":
100115 ; LINUX-LABEL: {{^}}"?foo@C5@@QAE?AUS5@@XZ":
101116
102117 ; The address of the return structure is passed as an implicit parameter.
114129 call x86_thiscallcc void @"\01?foo@C5@@QAE?AUS5@@XZ"(%struct.S5* sret %s, %class.C5* %c)
115130 ; WIN32-LABEL: {{^}}_call_foo5:
116131 ; MINGW_X86-LABEL: {{^}}_call_foo5:
132 ; CYGWIN-LABEL: {{^}}_call_foo5:
117133 ; LINUX-LABEL: {{^}}call_foo5:
118134
119135
134150 define void @test6_f(%struct.test6* %x) nounwind {
135151 ; WIN32-LABEL: _test6_f:
136152 ; MINGW_X86-LABEL: _test6_f:
153 ; CYGWIN-LABEL: _test6_f:
137154 ; LINUX-LABEL: test6_f:
138155
139156 ; The %x argument is moved to %ecx. It will be the this pointer.
144161 ; MINGW_X86: movl 8(%ebp), %eax
145162 ; MINGW_X86: movl %eax, (%e{{([a-d]x)|(sp)}})
146163
164 ; CYGWIN: movl 8(%ebp), %eax
165 ; CYGWIN: movl %eax, (%e{{([a-d]x)|(sp)}})
166
147167 ; The sret pointer is (%esp)
148168 ; WIN32: leal 8(%esp), %[[REG:e[a-d]x]]
149169 ; WIN32-NEXT: movl %[[REG]], (%e{{([a-d]x)|(sp)}})
152172 ; MINGW_X86-NEXT: leal 8(%esp), %ecx
153173 ; MINGW_X86-NEXT: calll _test6_g
154174
175 ; CYGWIN-NEXT: leal 8(%esp), %ecx
176 ; CYGWIN-NEXT: calll _test6_g
177
155178 %tmp = alloca %struct.test6, align 4
156179 call x86_thiscallcc void @test6_g(%struct.test6* sret %tmp, %struct.test6* %x)
157180 ret void