llvm.org GIT mirror llvm / 62131ab
Merging r182486: ------------------------------------------------------------------------ r182486 | d0k | 2013-05-22 10:01:12 -0700 (Wed, 22 May 2013) | 3 lines X86: When expanding PCMPGTQ to PCMPGTD we always want to compare the lower halves as unsigned. Take #2 on fixing PR15977. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182489 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 7 years ago
2 changed file(s) with 25 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
93469346 Op1 = DAG.getNode(ISD::BITCAST, dl, MVT::v4i32, Op1);
93479347
93489348 // Since SSE has no unsigned integer comparisons, we need to flip the sign
9349 // bits of the inputs before performing those operations.
9349 // bits of the inputs before performing those operations. The lower
9350 // compare is always unsigned.
9351 SDValue SB;
93509352 if (FlipSigns) {
9351 SDValue SB = DAG.getConstant(0x80000000U, MVT::v4i32);
9352 Op0 = DAG.getNode(ISD::XOR, dl, MVT::v4i32, Op0, SB);
9353 Op1 = DAG.getNode(ISD::XOR, dl, MVT::v4i32, Op1, SB);
9353 SB = DAG.getConstant(0x80000000U, MVT::v4i32);
9354 } else {
9355 SDValue Sign = DAG.getConstant(0x80000000U, MVT::i32);
9356 SDValue Zero = DAG.getConstant(0x00000000U, MVT::i32);
9357 SB = DAG.getNode(ISD::BUILD_VECTOR, dl, MVT::v4i32,
9358 Sign, Zero, Sign, Zero);
93549359 }
9360 Op0 = DAG.getNode(ISD::XOR, dl, MVT::v4i32, Op0, SB);
9361 Op1 = DAG.getNode(ISD::XOR, dl, MVT::v4i32, Op1, SB);
93559362
93569363 // Emulate PCMPGTQ with (hi1 > hi2) | ((hi1 == hi2) & (lo1 > lo2))
93579364 SDValue GT = DAG.getNode(X86ISD::PCMPGT, dl, MVT::v4i32, Op0, Op1);
6666 }
6767
6868 define <2 x i64> @test7(<2 x i64> %A, <2 x i64> %B) nounwind {
69 ; CHECK: [[CONSTSEG:[A-Z0-9_]*]]:
70 ; CHECK: .long 2147483648
71 ; CHECK-NEXT: .long 0
72 ; CHECK-NEXT: .long 2147483648
73 ; CHECK-NEXT: .long 0
6974 ; CHECK: test7:
75 ; CHECK: movdqa [[CONSTSEG]], [[CONSTREG:%xmm[0-9]*]]
76 ; CHECK: pxor [[CONSTREG]]
77 ; CHECK: pxor [[CONSTREG]]
7078 ; CHECK: pcmpgtd %xmm1
7179 ; CHECK: pshufd $-96
7280 ; CHECK: pcmpeqd
8290
8391 define <2 x i64> @test8(<2 x i64> %A, <2 x i64> %B) nounwind {
8492 ; CHECK: test8:
93 ; CHECK: pxor
94 ; CHECK: pxor
8595 ; CHECK: pcmpgtd %xmm0
8696 ; CHECK: pshufd $-96
8797 ; CHECK: pcmpeqd
97107
98108 define <2 x i64> @test9(<2 x i64> %A, <2 x i64> %B) nounwind {
99109 ; CHECK: test9:
110 ; CHECK: pxor
111 ; CHECK: pxor
100112 ; CHECK: pcmpgtd %xmm0
101113 ; CHECK: pshufd $-96
102114 ; CHECK: pcmpeqd
114126
115127 define <2 x i64> @test10(<2 x i64> %A, <2 x i64> %B) nounwind {
116128 ; CHECK: test10:
129 ; CHECK: pxor
130 ; CHECK: pxor
117131 ; CHECK: pcmpgtd %xmm1
118132 ; CHECK: pshufd $-96
119133 ; CHECK: pcmpeqd