1 ; RUN: llc < %s -mtriple=i386-linux-gnu -mattr=+avx512fp16 -mattr=+avx512vl -o - | FileCheck %s
3 ; This test checks that only a single je gets generated in the final code
4 ; for lowering the CMOV pseudos that get created for this IR.
8 define <8 x half> @foo1(i32 %v1, <8 x half> %v2, <8 x half> %v3, <8 x half> %v4) nounwind {
10 %cmp = icmp eq i32 %v1, 0
11 %t1 = select i1 %cmp, <8 x half> %v2, <8 x half> %v3
12 %t2 = select i1 %cmp, <8 x half> %v3, <8 x half> %v4
13 %sub = fsub <8 x half> %t1, %t2
17 ; This test checks that only a single ja gets generated in the final code
18 ; for lowering the CMOV pseudos that get created for this IR. This combines
19 ; all the supported types together into one long string of selects based
20 ; on the same condition.
24 define void @foo2(i32 %v1,
26 <8 x half> %v52, <8 x half> %v53,
27 <16 x half> %v122, <16 x half> %v123,
28 <32 x half> %v132, <32 x half> %v133,
31 %add.ptr31 = getelementptr inbounds i8, i8* %dst, i32 2
32 %a31 = bitcast i8* %add.ptr31 to half*
34 %add.ptr51 = getelementptr inbounds i8, i8* %dst, i32 4
35 %a51 = bitcast i8* %add.ptr51 to <8 x half>*
37 %add.ptr121 = getelementptr inbounds i8, i8* %dst, i32 20
38 %a121 = bitcast i8* %add.ptr121 to <16 x half>*
40 %add.ptr131 = getelementptr inbounds i8, i8* %dst, i32 52
41 %a131 = bitcast i8* %add.ptr131 to <32 x half>*
43 ; These operations are necessary, because select of two single use loads
44 ; ends up getting optimized into a select of two leas, followed by a
45 ; single load of the selected address.
47 %t33 = fadd half %v33, %v32
48 %t53 = fadd <8 x half> %v53, %v52
49 %t123 = fadd <16 x half> %v123, %v122
50 %t133 = fadd <32 x half> %v133, %v132
52 %cmp = icmp ugt i32 %v1, 31
53 %t31 = select i1 %cmp, half %v32, half %t33
54 %t51 = select i1 %cmp, <8 x half> %v52, <8 x half> %t53
55 %t121 = select i1 %cmp, <16 x half> %v122, <16 x half> %t123
56 %t131 = select i1 %cmp, <32 x half> %v132, <32 x half> %t133
58 store half %t31, half* %a31, align 2
59 store <8 x half> %t51, <8 x half>* %a51, align 16
60 store <16 x half> %t121, <16 x half>* %a121, align 32
61 store <32 x half> %t131, <32 x half>* %a131, align 64
66 ; This test checks that only a single jne gets generated in the final code
67 ; for lowering the CMOV pseudos that get created for this IR.
68 define dso_local <32 x half> @foo3(<32 x half> %a, <32 x half> %b, i1 zeroext %sign) local_unnamed_addr #0 {
73 %spec.select = select i1 %sign, <32 x half> %a, <32 x half> %b
74 ret <32 x half> %spec.select
77 ; This test checks that only a single jne gets generated in the final code
78 ; for lowering the CMOV pseudos that get created for this IR.
79 define dso_local <16 x half> @foo4(<16 x half> %a, <16 x half> %b, i1 zeroext %sign) local_unnamed_addr #0 {
84 %spec.select = select i1 %sign, <16 x half> %a, <16 x half> %b
85 ret <16 x half> %spec.select
88 ; This test checks that only a single jne gets generated in the final code
89 ; for lowering the CMOV pseudos that get created for this IR.
90 define dso_local <8 x half> @foo5(<8 x half> %a, <8 x half> %b, i1 zeroext %sign) local_unnamed_addr #0 {
95 %spec.select = select i1 %sign, <8 x half> %a, <8 x half> %b
96 ret <8 x half> %spec.select