Skip to content

Commit 82aeff7

Browse files
committed
add tests for selects with different FPMs
1 parent d85f8df commit 82aeff7

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

llvm/test/Transforms/VectorCombine/X86/shuffle-of-selects.ll

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,48 @@ define <4 x float> @src_v2tov4_float_nnan_ninf_nsz(<2 x i1> %a, <2 x i1> %b, <2
494494
ret <4 x float> %res
495495
}
496496

497+
; Negative - different FPM
498+
define <4 x float> @src_v2tov4_float_nonfpm_with_fpm1(<2 x i1> %a, <2 x i1> %b, <2 x float> %x, <2 x float> %y, <2 x float> %z) {
499+
; CHECK-LABEL: define <4 x float> @src_v2tov4_float_nonfpm_with_fpm1(
500+
; CHECK-SAME: <2 x i1> [[A:%.*]], <2 x i1> [[B:%.*]], <2 x float> [[X:%.*]], <2 x float> [[Y:%.*]], <2 x float> [[Z:%.*]]) #[[ATTR0]] {
501+
; CHECK-NEXT: [[SELECT_XZ:%.*]] = select <2 x i1> [[A]], <2 x float> [[X]], <2 x float> [[Z]]
502+
; CHECK-NEXT: [[SELECT_YX:%.*]] = select nnan nsz <2 x i1> [[B]], <2 x float> [[Y]], <2 x float> [[X]]
503+
; CHECK-NEXT: [[RES:%.*]] = shufflevector <2 x float> [[SELECT_XZ]], <2 x float> [[SELECT_YX]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
504+
; CHECK-NEXT: ret <4 x float> [[RES]]
505+
;
506+
%select.xz = select <2 x i1> %a, <2 x float> %x, <2 x float> %z
507+
%select.yx = select nnan nsz <2 x i1> %b, <2 x float> %y, <2 x float> %x
508+
%res = shufflevector <2 x float> %select.xz, <2 x float> %select.yx, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
509+
ret <4 x float> %res
510+
}
511+
512+
define <4 x float> @src_v2tov4_float_nonfpm_with_fpm2(<2 x i1> %a, <2 x i1> %b, <2 x float> %x, <2 x float> %y, <2 x float> %z) {
513+
; CHECK-LABEL: define <4 x float> @src_v2tov4_float_nonfpm_with_fpm2(
514+
; CHECK-SAME: <2 x i1> [[A:%.*]], <2 x i1> [[B:%.*]], <2 x float> [[X:%.*]], <2 x float> [[Y:%.*]], <2 x float> [[Z:%.*]]) #[[ATTR0]] {
515+
; CHECK-NEXT: [[SELECT_XZ:%.*]] = select nnan nsz <2 x i1> [[A]], <2 x float> [[X]], <2 x float> [[Z]]
516+
; CHECK-NEXT: [[SELECT_YX:%.*]] = select <2 x i1> [[B]], <2 x float> [[Y]], <2 x float> [[X]]
517+
; CHECK-NEXT: [[RES:%.*]] = shufflevector <2 x float> [[SELECT_XZ]], <2 x float> [[SELECT_YX]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
518+
; CHECK-NEXT: ret <4 x float> [[RES]]
519+
;
520+
%select.xz = select nnan nsz <2 x i1> %a, <2 x float> %x, <2 x float> %z
521+
%select.yx = select <2 x i1> %b, <2 x float> %y, <2 x float> %x
522+
%res = shufflevector <2 x float> %select.xz, <2 x float> %select.yx, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
523+
ret <4 x float> %res
524+
}
525+
526+
define <4 x float> @src_v2tov4_float_diff_fpm(<2 x i1> %a, <2 x i1> %b, <2 x float> %x, <2 x float> %y, <2 x float> %z) {
527+
; CHECK-LABEL: define <4 x float> @src_v2tov4_float_diff_fpm(
528+
; CHECK-SAME: <2 x i1> [[A:%.*]], <2 x i1> [[B:%.*]], <2 x float> [[X:%.*]], <2 x float> [[Y:%.*]], <2 x float> [[Z:%.*]]) #[[ATTR0]] {
529+
; CHECK-NEXT: [[SELECT_XZ:%.*]] = select ninf nsz <2 x i1> [[A]], <2 x float> [[X]], <2 x float> [[Z]]
530+
; CHECK-NEXT: [[SELECT_YX:%.*]] = select nnan nsz <2 x i1> [[B]], <2 x float> [[Y]], <2 x float> [[X]]
531+
; CHECK-NEXT: [[RES:%.*]] = shufflevector <2 x float> [[SELECT_XZ]], <2 x float> [[SELECT_YX]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
532+
; CHECK-NEXT: ret <4 x float> [[RES]]
533+
;
534+
%select.xz = select ninf nsz <2 x i1> %a, <2 x float> %x, <2 x float> %z
535+
%select.yx = select nnan nsz <2 x i1> %b, <2 x float> %y, <2 x float> %x
536+
%res = shufflevector <2 x float> %select.xz, <2 x float> %select.yx, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
537+
ret <4 x float> %res
538+
}
497539

498540
; Negative - Vector order
499541
define <4 x i32> @src_v2tov4_i32_backward(<2 x i1> %a, <2 x i1> %b, <2 x i32> %x, <2 x i32> %y, <2 x i32> %z) {

0 commit comments

Comments
 (0)