llvm.org GIT mirror llvm / db03459
[release_36] Cherry-pick r232085. Original commit message: [X86] Fix a regression introduced by r223641. The permps and permd instructions have their operands swapped compared to the intrinsic definition. Therefore, they do not fall into the INTR_TYPE_2OP category. I did not create a new category for those two, as they are the only one AFAICT in that case. <rdar://problem/20108262> git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_36@232118 91177308-0d34-0410-b5e6-96231b3b80d8 Quentin Colombet 5 years ago
3 changed file(s) with 15 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
1717017170
1717117171 switch (IntNo) {
1717217172 default: return SDValue(); // Don't custom lower most intrinsics.
17173
17174 case Intrinsic::x86_avx2_permd:
17175 case Intrinsic::x86_avx2_permps:
17176 // Operands intentionally swapped. Mask is last operand to intrinsic,
17177 // but second operand for node/instruction.
17178 return DAG.getNode(X86ISD::VPERMV, dl, Op.getValueType(),
17179 Op.getOperand(2), Op.getOperand(1));
1717317180
1717417181 case Intrinsic::x86_avx512_mask_valign_q_512:
1717517182 case Intrinsic::x86_avx512_mask_valign_d_512:
174174 X86_INTRINSIC_DATA(avx2_packsswb, INTR_TYPE_2OP, X86ISD::PACKSS, 0),
175175 X86_INTRINSIC_DATA(avx2_packusdw, INTR_TYPE_2OP, X86ISD::PACKUS, 0),
176176 X86_INTRINSIC_DATA(avx2_packuswb, INTR_TYPE_2OP, X86ISD::PACKUS, 0),
177 X86_INTRINSIC_DATA(avx2_permd, INTR_TYPE_2OP, X86ISD::VPERMV, 0),
178 X86_INTRINSIC_DATA(avx2_permps, INTR_TYPE_2OP, X86ISD::VPERMV, 0),
179177 X86_INTRINSIC_DATA(avx2_phadd_d, INTR_TYPE_2OP, X86ISD::HADD, 0),
180178 X86_INTRINSIC_DATA(avx2_phadd_w, INTR_TYPE_2OP, X86ISD::HADD, 0),
181179 X86_INTRINSIC_DATA(avx2_phsub_d, INTR_TYPE_2OP, X86ISD::HSUB, 0),
784784
785785
786786 define <8 x i32> @test_x86_avx2_permd(<8 x i32> %a0, <8 x i32> %a1) {
787 ; CHECK: vpermd
787 ; Check that the arguments are swapped between the intrinsic definition
788 ; and its lowering. Indeed, the offsets are the first source in
789 ; the instruction.
790 ; CHECK: vpermd %ymm0, %ymm1, %ymm0
788791 %res = call <8 x i32> @llvm.x86.avx2.permd(<8 x i32> %a0, <8 x i32> %a1) ; <<8 x i32>> [#uses=1]
789792 ret <8 x i32> %res
790793 }
792795
793796
794797 define <8 x float> @test_x86_avx2_permps(<8 x float> %a0, <8 x float> %a1) {
795 ; CHECK: vpermps
798 ; Check that the arguments are swapped between the intrinsic definition
799 ; and its lowering. Indeed, the offsets are the first source in
800 ; the instruction.
801 ; CHECK: vpermps %ymm0, %ymm1, %ymm0
796802 %res = call <8 x float> @llvm.x86.avx2.permps(<8 x float> %a0, <8 x float> %a1) ; <<8 x float>> [#uses=1]
797803 ret <8 x float> %res
798804 }