1; RUN: llc < %s -mtriple=i386-linux-gnu -mattr=+avx512fp16 -mattr=+avx512vl -o - | FileCheck %s 2 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. 5; CHECK-LABEL: foo1: 6; CHECK: je 7; CHECK-NOT: je 8define <8 x half> @foo1(i32 %v1, <8 x half> %v2, <8 x half> %v3, <8 x half> %v4) nounwind { 9entry: 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 14 ret <8 x half> %sub 15} 16 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. 21; CHECK-LABEL: foo2: 22; CHECK: ja 23; CHECK-NOT: ja 24define void @foo2(i32 %v1, 25 half %v32, half %v33, 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, 29 ptr %dst) nounwind { 30entry: 31 %add.ptr31 = getelementptr inbounds i8, ptr %dst, i32 2 32 33 %add.ptr51 = getelementptr inbounds i8, ptr %dst, i32 4 34 35 %add.ptr121 = getelementptr inbounds i8, ptr %dst, i32 20 36 37 %add.ptr131 = getelementptr inbounds i8, ptr %dst, i32 52 38 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. 42 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 47 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 53 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 58 59 ret void 60} 61 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. 64define dso_local <32 x half> @foo3(<32 x half> %a, <32 x half> %b, i1 zeroext %sign) local_unnamed_addr #0 { 65; CHECK-LABEL: foo3: 66; CHECK: jne 67; CHECK-NOT: jne 68entry: 69 %spec.select = select i1 %sign, <32 x half> %a, <32 x half> %b 70 ret <32 x half> %spec.select 71} 72 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. 75define dso_local <16 x half> @foo4(<16 x half> %a, <16 x half> %b, i1 zeroext %sign) local_unnamed_addr #0 { 76; CHECK-LABEL: foo4: 77; CHECK: jne 78; CHECK-NOT: jne 79entry: 80 %spec.select = select i1 %sign, <16 x half> %a, <16 x half> %b 81 ret <16 x half> %spec.select 82} 83 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. 86define dso_local <8 x half> @foo5(<8 x half> %a, <8 x half> %b, i1 zeroext %sign) local_unnamed_addr #0 { 87; CHECK-LABEL: foo5: 88; CHECK: jne 89; CHECK-NOT: jne 90entry: 91 %spec.select = select i1 %sign, <8 x half> %a, <8 x half> %b 92 ret <8 x half> %spec.select 93} 94