Skip to content

Commit ec5b63b

Browse files
committed
[X86] Add tests showing failure to merge shuffles through xop shift binops
1 parent 42185ad commit ec5b63b

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

llvm/test/CodeGen/X86/xop-shifts.ll

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
22
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+xop | FileCheck %s
33

4+
;
5+
; SimplifyDemandedVectorEltsForTargetNode Handling
6+
;
7+
48
define <16 x i8> @demandedelts_vpshab(<16 x i8> %a0, <16 x i8> %a1) {
59
; CHECK-LABEL: demandedelts_vpshab:
610
; CHECK: # %bb.0:
@@ -26,6 +30,40 @@ define <4 x i32> @demandedelts_vpshld(<4 x i32> %a0, <4 x i32> %a1) {
2630
ret <4 x i32> %result
2731
}
2832

33+
;
34+
; isBinOp Handling (TODO)
35+
;
36+
37+
define <8 x i16> @binop_shuffle_vpshaw(<8 x i16> %a0, <8 x i16> %a1) {
38+
; CHECK-LABEL: binop_shuffle_vpshaw:
39+
; CHECK: # %bb.0:
40+
; CHECK-NEXT: vpshuflw {{.*#+}} xmm0 = xmm0[3,2,1,0,4,5,6,7]
41+
; CHECK-NEXT: vpshuflw {{.*#+}} xmm1 = xmm1[3,2,1,0,4,5,6,7]
42+
; CHECK-NEXT: vpshlw %xmm1, %xmm0, %xmm0
43+
; CHECK-NEXT: vpshuflw {{.*#+}} xmm0 = xmm0[3,2,1,0,4,5,6,7]
44+
; CHECK-NEXT: retq
45+
%shuffle0 = shufflevector <8 x i16> %a0, <8 x i16> undef, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 4, i32 5, i32 6, i32 7>
46+
%shuffle1 = shufflevector <8 x i16> %a1, <8 x i16> undef, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 4, i32 5, i32 6, i32 7>
47+
%shift = call <8 x i16> @llvm.x86.xop.vpshlw(<8 x i16> %shuffle0, <8 x i16> %shuffle1)
48+
%result = shufflevector <8 x i16> %shift, <8 x i16> undef, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 4, i32 5, i32 6, i32 7>
49+
ret <8 x i16> %result
50+
}
51+
52+
define <2 x i64> @binop_shuffle_vpshlq(<2 x i64> %a0, <2 x i64> %a1) {
53+
; CHECK-LABEL: binop_shuffle_vpshlq:
54+
; CHECK: # %bb.0:
55+
; CHECK-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
56+
; CHECK-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[0,1,0,1]
57+
; CHECK-NEXT: vpshlq %xmm1, %xmm0, %xmm0
58+
; CHECK-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
59+
; CHECK-NEXT: retq
60+
%shuffle0 = shufflevector <2 x i64> %a0, <2 x i64> undef, <2 x i32> <i32 1, i32 0>
61+
%shuffle1 = shufflevector <2 x i64> %a1, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
62+
%shift = call <2 x i64> @llvm.x86.xop.vpshlq(<2 x i64> %shuffle0, <2 x i64> %shuffle1)
63+
%result = shufflevector <2 x i64> %shift, <2 x i64> undef, <2 x i32> <i32 1, i32 0>
64+
ret <2 x i64> %result
65+
}
66+
2967
declare <16 x i8> @llvm.x86.xop.vpshab(<16 x i8>, <16 x i8>) nounwind readnone
3068
declare <4 x i32> @llvm.x86.xop.vpshad(<4 x i32>, <4 x i32>) nounwind readnone
3169
declare <2 x i64> @llvm.x86.xop.vpshaq(<2 x i64>, <2 x i64>) nounwind readnone

0 commit comments

Comments
 (0)