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, ptr %dst, i32 2
33 %add.ptr51 = getelementptr inbounds i8, ptr %dst, i32 4
35 %add.ptr121 = getelementptr inbounds i8, ptr %dst, i32 20
37 %add.ptr131 = getelementptr inbounds i8, ptr %dst, i32 52
39 ; These operations are necessary, because select of two single use loads
40 ; ends up getting optimized into a select of two leas, followed by a
41 ; single load of the selected address.
43 %t33 = fadd half %v33, %v32
44 %t53 = fadd <8 x half> %v53, %v52
45 %t123 = fadd <16 x half> %v123, %v122
46 %t133 = fadd <32 x half> %v133, %v132
48 %cmp = icmp ugt i32 %v1, 31
49 %t31 = select i1 %cmp, half %v32, half %t33
50 %t51 = select i1 %cmp, <8 x half> %v52, <8 x half> %t53
51 %t121 = select i1 %cmp, <16 x half> %v122, <16 x half> %t123
52 %t131 = select i1 %cmp, <32 x half> %v132, <32 x half> %t133
54 store half %t31, ptr %add.ptr31, align 2
55 store <8 x half> %t51, ptr %add.ptr51, align 16
56 store <16 x half> %t121, ptr %add.ptr121, align 32
57 store <32 x half> %t131, ptr %add.ptr131, align 64
62 ; This test checks that only a single jne gets generated in the final code
63 ; for lowering the CMOV pseudos that get created for this IR.
64 define dso_local <32 x half> @foo3(<32 x half> %a, <32 x half> %b, i1 zeroext %sign) local_unnamed_addr #0 {
69 %spec.select = select i1 %sign, <32 x half> %a, <32 x half> %b
70 ret <32 x half> %spec.select
73 ; This test checks that only a single jne gets generated in the final code
74 ; for lowering the CMOV pseudos that get created for this IR.
75 define dso_local <16 x half> @foo4(<16 x half> %a, <16 x half> %b, i1 zeroext %sign) local_unnamed_addr #0 {
80 %spec.select = select i1 %sign, <16 x half> %a, <16 x half> %b
81 ret <16 x half> %spec.select
84 ; This test checks that only a single jne gets generated in the final code
85 ; for lowering the CMOV pseudos that get created for this IR.
86 define dso_local <8 x half> @foo5(<8 x half> %a, <8 x half> %b, i1 zeroext %sign) local_unnamed_addr #0 {
91 %spec.select = select i1 %sign, <8 x half> %a, <8 x half> %b
92 ret <8 x half> %spec.select