Skip to content

Commit 2c72a34

Browse files
committed
Merging from mainline
llvm-svn: 31623
1 parent f9fc189 commit 2c72a34

File tree

2 files changed

+83
-7
lines changed

2 files changed

+83
-7
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -516,10 +516,9 @@ SDOperand X86TargetLowering::LowerCCCArguments(SDOperand Op, SelectionDAG &DAG)
516516
BytesToPopOnReturn = 0; // Callee pops nothing.
517517
BytesCallerReserves = ArgOffset;
518518

519-
// If this is a struct return on Darwin/X86, the callee pops the hidden struct
520-
// pointer.
521-
if (MF.getFunction()->getCallingConv() == CallingConv::CSRet &&
522-
Subtarget->isTargetDarwin())
519+
// If this is a struct return on, the callee pops the hidden struct
520+
// pointer. This is common for Darwin/X86, Linux & Mingw32 targets.
521+
if (MF.getFunction()->getCallingConv() == CallingConv::CSRet)
523522
BytesToPopOnReturn = 4;
524523

525524
// Return the new list of results.
@@ -680,9 +679,10 @@ SDOperand X86TargetLowering::LowerCCCCallTo(SDOperand Op, SelectionDAG &DAG) {
680679
// Create the CALLSEQ_END node.
681680
unsigned NumBytesForCalleeToPush = 0;
682681

683-
// If this is is a call to a struct-return function on Darwin/X86, the callee
682+
// If this is is a call to a struct-return function, the callee
684683
// pops the hidden struct pointer, so we have to push it back.
685-
if (CallingConv == CallingConv::CSRet && Subtarget->isTargetDarwin())
684+
// This is common for Darwin/X86, Linux & Mingw32 targets.
685+
if (CallingConv == CallingConv::CSRet)
686686
NumBytesForCalleeToPush = 4;
687687

688688
NodeTys.clear();
@@ -2582,6 +2582,22 @@ bool X86::isMOVHLPSMask(SDNode *N) {
25822582
isUndefOrEqual(N->getOperand(3), 3);
25832583
}
25842584

2585+
/// isMOVHLPS_v_undef_Mask - Special case of isMOVHLPSMask for canonical form
2586+
/// of vector_shuffle v, v, <2, 3, 2, 3>, i.e. vector_shuffle v, undef,
2587+
/// <2, 3, 2, 3>
2588+
bool X86::isMOVHLPS_v_undef_Mask(SDNode *N) {
2589+
assert(N->getOpcode() == ISD::BUILD_VECTOR);
2590+
2591+
if (N->getNumOperands() != 4)
2592+
return false;
2593+
2594+
// Expect bit0 == 2, bit1 == 3, bit2 == 2, bit3 == 3
2595+
return isUndefOrEqual(N->getOperand(0), 2) &&
2596+
isUndefOrEqual(N->getOperand(1), 3) &&
2597+
isUndefOrEqual(N->getOperand(2), 2) &&
2598+
isUndefOrEqual(N->getOperand(3), 3);
2599+
}
2600+
25852601
/// isMOVLPMask - Return true if the specified VECTOR_SHUFFLE operand
25862602
/// specifies a shuffle of elements that is suitable for input to MOVLP{S|D}.
25872603
bool X86::isMOVLPMask(SDNode *N) {
@@ -3724,7 +3740,7 @@ X86TargetLowering::LowerEXTRACT_VECTOR_ELT(SDOperand Op, SelectionDAG &DAG) {
37243740
SDOperand Mask = DAG.getNode(ISD::BUILD_VECTOR, MaskVT,
37253741
&IdxVec[0], IdxVec.size());
37263742
Vec = DAG.getNode(ISD::VECTOR_SHUFFLE, Vec.getValueType(),
3727-
Vec, Vec, Mask);
3743+
Vec, DAG.getNode(ISD::UNDEF, Vec.getValueType()), Mask);
37283744
return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, VT, Vec,
37293745
DAG.getConstant(0, getPointerTy()));
37303746
} else if (MVT::getSizeInBits(VT) == 64) {
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
; RUN: llvm-as < %s | llc -march=x86 | grep 'subl $4, %esp'
2+
3+
%str = internal constant [9 x sbyte] c"%f+%f*i\0A\00" ; <[9 x sbyte]*> [#uses=1]
4+
5+
implementation ; Functions:
6+
7+
int %main() {
8+
entry:
9+
%retval = alloca int, align 4 ; <int*> [#uses=1]
10+
%tmp = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4]
11+
%tmp1 = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4]
12+
%tmp2 = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=3]
13+
%pi = alloca double, align 8 ; <double*> [#uses=2]
14+
%z = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4]
15+
"alloca point" = cast int 0 to int ; <int> [#uses=0]
16+
store double 0x400921FB54442D18, double* %pi
17+
%tmp = load double* %pi ; <double> [#uses=1]
18+
%real = getelementptr { double, double }* %tmp1, uint 0, uint 0 ; <double*> [#uses=1]
19+
store double 0.000000e+00, double* %real
20+
%real3 = getelementptr { double, double }* %tmp1, uint 0, uint 1 ; <double*> [#uses=1]
21+
store double %tmp, double* %real3
22+
%tmp = getelementptr { double, double }* %tmp, uint 0, uint 0 ; <double*> [#uses=1]
23+
%tmp4 = getelementptr { double, double }* %tmp1, uint 0, uint 0 ; <double*> [#uses=1]
24+
%tmp5 = load double* %tmp4 ; <double> [#uses=1]
25+
store double %tmp5, double* %tmp
26+
%tmp6 = getelementptr { double, double }* %tmp, uint 0, uint 1 ; <double*> [#uses=1]
27+
%tmp7 = getelementptr { double, double }* %tmp1, uint 0, uint 1 ; <double*> [#uses=1]
28+
%tmp8 = load double* %tmp7 ; <double> [#uses=1]
29+
store double %tmp8, double* %tmp6
30+
%tmp = cast { double, double }* %tmp to { long, long }* ; <{ long, long }*> [#uses=1]
31+
%tmp = getelementptr { long, long }* %tmp, uint 0, uint 0 ; <long*> [#uses=1]
32+
%tmp = load long* %tmp ; <long> [#uses=1]
33+
%tmp9 = cast { double, double }* %tmp to { long, long }* ; <{ long, long }*> [#uses=1]
34+
%tmp10 = getelementptr { long, long }* %tmp9, uint 0, uint 1 ; <long*> [#uses=1]
35+
%tmp11 = load long* %tmp10 ; <long> [#uses=1]
36+
call csretcc void %cexp( { double, double }* %tmp2, long %tmp, long %tmp11 )
37+
%tmp12 = getelementptr { double, double }* %z, uint 0, uint 0 ; <double*> [#uses=1]
38+
%tmp13 = getelementptr { double, double }* %tmp2, uint 0, uint 0 ; <double*> [#uses=1]
39+
%tmp14 = load double* %tmp13 ; <double> [#uses=1]
40+
store double %tmp14, double* %tmp12
41+
%tmp15 = getelementptr { double, double }* %z, uint 0, uint 1 ; <double*> [#uses=1]
42+
%tmp16 = getelementptr { double, double }* %tmp2, uint 0, uint 1 ; <double*> [#uses=1]
43+
%tmp17 = load double* %tmp16 ; <double> [#uses=1]
44+
store double %tmp17, double* %tmp15
45+
%tmp18 = getelementptr { double, double }* %z, uint 0, uint 1 ; <double*> [#uses=1]
46+
%tmp19 = load double* %tmp18 ; <double> [#uses=1]
47+
%tmp20 = getelementptr { double, double }* %z, uint 0, uint 0 ; <double*> [#uses=1]
48+
%tmp21 = load double* %tmp20 ; <double> [#uses=1]
49+
%tmp = getelementptr [9 x sbyte]* %str, int 0, uint 0 ; <sbyte*> [#uses=1]
50+
%tmp = call int (sbyte*, ...)* %printf( sbyte* %tmp, double %tmp21, double %tmp19 ) ; <int> [#uses=0]
51+
br label %return
52+
53+
return: ; preds = %entry
54+
%retval = load int* %retval ; <int> [#uses=1]
55+
ret int %retval
56+
}
57+
58+
declare csretcc void %cexp({ double, double }*, long, long)
59+
60+
declare int %printf(sbyte*, ...)

0 commit comments

Comments
 (0)