Skip to content

Commit 311b63f

Browse files
committedMar 26, 2018
Revert r328386 "[X86] Fix Windows i1 zeroext conventions to use i8 instead of i32"
This broke Chromium (see crbug.com/825748). It looks like mstorsjo's follow-up patch at D44876 fixes this, but let's revert back to green for now until that's ready to land. (Also reverts r328443.) > Both GCC and MSVC only look at the low byte of a boolean when it is > passed. llvm-svn: 328482
1 parent 8840f64 commit 311b63f

File tree

9 files changed

+7
-91
lines changed

9 files changed

+7
-91
lines changed
 

‎llvm/lib/Target/X86/X86CallingConv.td

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,8 @@ def CC_X86_Win64_C : CallingConv<[
593593
// FIXME: Handle byval stuff.
594594
// FIXME: Handle varargs.
595595

596-
// Promote i1/v1i1 arguments to i8.
597-
CCIfType<[i1, v1i1], CCPromoteToType<i8>>,
596+
// Promote i1/i8/i16/v1i1 arguments to i32.
597+
CCIfType<[i1, i8, i16, v1i1], CCPromoteToType<i32>>,
598598

599599
// The 'nest' parameter, if any, is passed in R10.
600600
CCIfNest<CCAssignToReg<[R10]>>,
@@ -619,10 +619,6 @@ def CC_X86_Win64_C : CallingConv<[
619619
CCIfType<[x86mmx], CCBitConvertToType<i64>>,
620620

621621
// The first 4 integer arguments are passed in integer registers.
622-
CCIfType<[i8 ], CCAssignToRegWithShadow<[CL , DL , R8B , R9B ],
623-
[XMM0, XMM1, XMM2, XMM3]>>,
624-
CCIfType<[i16], CCAssignToRegWithShadow<[CX , DX , R8W , R9W ],
625-
[XMM0, XMM1, XMM2, XMM3]>>,
626622
CCIfType<[i32], CCAssignToRegWithShadow<[ECX , EDX , R8D , R9D ],
627623
[XMM0, XMM1, XMM2, XMM3]>>,
628624

@@ -851,15 +847,13 @@ def CC_X86_32_MCU : CallingConv<[
851847
]>;
852848

853849
def CC_X86_32_FastCall : CallingConv<[
854-
// Promote i1 to i8.
855-
CCIfType<[i1], CCPromoteToType<i8>>,
850+
// Promote i1/i8/i16/v1i1 arguments to i32.
851+
CCIfType<[i1, i8, i16, v1i1], CCPromoteToType<i32>>,
856852

857853
// The 'nest' parameter, if any, is passed in EAX.
858854
CCIfNest<CCAssignToReg<[EAX]>>,
859855

860856
// The first 2 integer arguments are passed in ECX/EDX
861-
CCIfInReg<CCIfType<[ i8], CCAssignToReg<[ CL, DL]>>>,
862-
CCIfInReg<CCIfType<[i16], CCAssignToReg<[ CX, DX]>>>,
863857
CCIfInReg<CCIfType<[i32], CCAssignToReg<[ECX, EDX]>>>,
864858

865859
// Otherwise, same as everything else.

‎llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3034,11 +3034,7 @@ SDValue X86TargetLowering::LowerFormalArguments(
30343034
getv64i1Argument(VA, ArgLocs[++I], Chain, DAG, dl, Subtarget);
30353035
} else {
30363036
const TargetRegisterClass *RC;
3037-
if (RegVT == MVT::i8)
3038-
RC = &X86::GR8RegClass;
3039-
else if (RegVT == MVT::i16)
3040-
RC = &X86::GR16RegClass;
3041-
else if (RegVT == MVT::i32)
3037+
if (RegVT == MVT::i32)
30423038
RC = &X86::GR32RegClass;
30433039
else if (Is64Bit && RegVT == MVT::i64)
30443040
RC = &X86::GR64RegClass;

‎llvm/test/CodeGen/X86/avx512-intel-ocl.ll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,6 @@ define <16 x float> @testf16_inp_mask(<16 x float> %a, i16 %mask) {
420420
; WIN64-KNL-NEXT: subq $40, %rsp
421421
; WIN64-KNL-NEXT: .seh_stackalloc 40
422422
; WIN64-KNL-NEXT: .seh_endprologue
423-
; WIN64-KNL-NEXT: # kill: def $dx killed $dx def $edx
424423
; WIN64-KNL-NEXT: vmovaps (%rcx), %zmm0
425424
; WIN64-KNL-NEXT: kmovw %edx, %k1
426425
; WIN64-KNL-NEXT: callq func_float16_mask
@@ -436,7 +435,6 @@ define <16 x float> @testf16_inp_mask(<16 x float> %a, i16 %mask) {
436435
; WIN64-SKX-NEXT: subq $40, %rsp
437436
; WIN64-SKX-NEXT: .seh_stackalloc 40
438437
; WIN64-SKX-NEXT: .seh_endprologue
439-
; WIN64-SKX-NEXT: # kill: def $dx killed $dx def $edx
440438
; WIN64-SKX-NEXT: vmovaps (%rcx), %zmm0
441439
; WIN64-SKX-NEXT: kmovd %edx, %k1
442440
; WIN64-SKX-NEXT: callq func_float16_mask

‎llvm/test/CodeGen/X86/h-registers-0.ll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ define i16 @qux16(i16 inreg %x) nounwind {
9898
; X86-64: movzbl %ah, %eax
9999

100100
; WIN64-LABEL: qux16:
101-
; WIN64: movzwl %cx, %eax
102-
; WIN64: shrl $8, %eax
101+
; WIN64: movzbl %ch, %eax
103102

104103
; X86-32-LABEL: qux16:
105104
; X86-32: movzbl %ah, %eax

‎llvm/test/CodeGen/X86/test-shrink.ll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ define void @g16xh(i16 inreg %x) nounwind {
186186
; CHECK-WIN32-64-LABEL: g16xh:
187187
; CHECK-WIN32-64: # %bb.0:
188188
; CHECK-WIN32-64-NEXT: subq $40, %rsp
189-
; CHECK-WIN32-64-NEXT: # kill: def $cx killed $cx def $ecx
190189
; CHECK-WIN32-64-NEXT: testl $2048, %ecx # imm = 0x800
191190
; CHECK-WIN32-64-NEXT: jne .LBB4_2
192191
; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
@@ -229,7 +228,6 @@ define void @g16xl(i16 inreg %x) nounwind {
229228
; CHECK-WIN32-64-LABEL: g16xl:
230229
; CHECK-WIN32-64: # %bb.0:
231230
; CHECK-WIN32-64-NEXT: subq $40, %rsp
232-
; CHECK-WIN32-64-NEXT: # kill: def $cx killed $cx def $ecx
233231
; CHECK-WIN32-64-NEXT: testb $8, %cl
234232
; CHECK-WIN32-64-NEXT: jne .LBB5_2
235233
; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
@@ -499,7 +497,6 @@ define void @truncand32(i16 inreg %x) nounwind {
499497
; CHECK-WIN32-64-LABEL: truncand32:
500498
; CHECK-WIN32-64: # %bb.0:
501499
; CHECK-WIN32-64-NEXT: subq $40, %rsp
502-
; CHECK-WIN32-64-NEXT: # kill: def $cx killed $cx def $ecx
503500
; CHECK-WIN32-64-NEXT: testl $2049, %ecx # imm = 0x801
504501
; CHECK-WIN32-64-NEXT: je .LBB11_1
505502
; CHECK-WIN32-64-NEXT: # %bb.2: # %no
@@ -546,7 +543,6 @@ define void @testw(i16 inreg %x) nounwind minsize {
546543
; CHECK-WIN32-64-LABEL: testw:
547544
; CHECK-WIN32-64: # %bb.0:
548545
; CHECK-WIN32-64-NEXT: subq $40, %rsp
549-
; CHECK-WIN32-64-NEXT: # kill: def $cx killed $cx def $ecx
550546
; CHECK-WIN32-64-NEXT: testw $2049, %cx # imm = 0x801
551547
; CHECK-WIN32-64-NEXT: jne .LBB12_2
552548
; CHECK-WIN32-64-NEXT: # %bb.1: # %yes

‎llvm/test/CodeGen/X86/vec_cast.ll

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ define <3 x i32> @b(<3 x i16> %a) nounwind {
3737
;
3838
; CHECK-WIN-LABEL: b:
3939
; CHECK-WIN: # %bb.0:
40-
; CHECK-WIN-NEXT: # kill: def $r8w killed $r8w def $r8d
41-
; CHECK-WIN-NEXT: # kill: def $dx killed $dx def $edx
42-
; CHECK-WIN-NEXT: # kill: def $cx killed $cx def $ecx
4340
; CHECK-WIN-NEXT: movd %ecx, %xmm0
4441
; CHECK-WIN-NEXT: pinsrw $1, %edx, %xmm0
4542
; CHECK-WIN-NEXT: pinsrw $2, %r8d, %xmm0
@@ -61,7 +58,6 @@ define <1 x i32> @c(<1 x i16> %a) nounwind {
6158
;
6259
; CHECK-WIN-LABEL: c:
6360
; CHECK-WIN: # %bb.0:
64-
; CHECK-WIN-NEXT: # kill: def $cx killed $cx def $ecx
6561
; CHECK-WIN-NEXT: movd %ecx, %xmm0
6662
; CHECK-WIN-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[0,0,2,1,4,5,6,7]
6763
; CHECK-WIN-NEXT: psrad $16, %xmm0
@@ -104,9 +100,6 @@ define <3 x i32> @e(<3 x i16> %a) nounwind {
104100
;
105101
; CHECK-WIN-LABEL: e:
106102
; CHECK-WIN: # %bb.0:
107-
; CHECK-WIN-NEXT: # kill: def $r8w killed $r8w def $r8d
108-
; CHECK-WIN-NEXT: # kill: def $dx killed $dx def $edx
109-
; CHECK-WIN-NEXT: # kill: def $cx killed $cx def $ecx
110103
; CHECK-WIN-NEXT: movd %ecx, %xmm0
111104
; CHECK-WIN-NEXT: pinsrw $1, %edx, %xmm0
112105
; CHECK-WIN-NEXT: pinsrw $2, %r8d, %xmm0
@@ -128,7 +121,6 @@ define <1 x i32> @f(<1 x i16> %a) nounwind {
128121
;
129122
; CHECK-WIN-LABEL: f:
130123
; CHECK-WIN: # %bb.0:
131-
; CHECK-WIN-NEXT: # kill: def $cx killed $cx def $ecx
132124
; CHECK-WIN-NEXT: movd %ecx, %xmm0
133125
; CHECK-WIN-NEXT: pxor %xmm1, %xmm1
134126
; CHECK-WIN-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]

‎llvm/test/CodeGen/X86/win32-bool.ll

Lines changed: 0 additions & 33 deletions
This file was deleted.

‎llvm/test/CodeGen/X86/win64-bool.ll

Lines changed: 0 additions & 23 deletions
This file was deleted.

‎llvm/test/CodeGen/X86/xor.ll

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ define i16 @test5(i16 %a, i16 %b) nounwind {
167167
;
168168
; X64-WIN-LABEL: test5:
169169
; X64-WIN: # %bb.0: # %entry
170-
; X64-WIN-NEXT: # kill: def $dx killed $dx def $edx
171-
; X64-WIN-NEXT: # kill: def $cx killed $cx def $ecx
172170
; X64-WIN-NEXT: .p2align 4, 0x90
173171
; X64-WIN-NEXT: .LBB4_1: # %bb
174172
; X64-WIN-NEXT: # =>This Inner Loop Header: Depth=1
@@ -429,8 +427,7 @@ define i32 @PR17487(i1 %tobool) {
429427
;
430428
; X64-WIN-LABEL: PR17487:
431429
; X64-WIN: # %bb.0:
432-
; X64-WIN-NEXT: movzbl %cl, %eax
433-
; X64-WIN-NEXT: movd %eax, %xmm0
430+
; X64-WIN-NEXT: movd %ecx, %xmm0
434431
; X64-WIN-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,0,1]
435432
; X64-WIN-NEXT: pandn __xmm@{{.*}}(%rip), %xmm0
436433
; X64-WIN-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]

0 commit comments

Comments
 (0)
Please sign in to comment.