1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f | FileCheck %s --check-prefix=ALL --check-prefix=KNL
3 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f,+avx512bw,+avx512vl,+avx512dq | FileCheck %s --check-prefix=ALL --check-prefix=SKX
5 define double @test1(double %a, double %b) nounwind {
8 ; ALL-NEXT: vucomisd %xmm1, %xmm0
10 ; ALL-NEXT: jnp LBB0_2
11 ; ALL-NEXT: LBB0_1: ## %l1
12 ; ALL-NEXT: vsubsd %xmm1, %xmm0, %xmm0
14 ; ALL-NEXT: LBB0_2: ## %l2
15 ; ALL-NEXT: vaddsd %xmm1, %xmm0, %xmm0
17 %tobool = fcmp une double %a, %b
18 br i1 %tobool, label %l1, label %l2
21 %c = fsub double %a, %b
24 %c1 = fadd double %a, %b
28 define float @test2(float %a, float %b) nounwind {
31 ; ALL-NEXT: vucomiss %xmm0, %xmm1
32 ; ALL-NEXT: jbe LBB1_2
33 ; ALL-NEXT: ## %bb.1: ## %l1
34 ; ALL-NEXT: vsubss %xmm1, %xmm0, %xmm0
36 ; ALL-NEXT: LBB1_2: ## %l2
37 ; ALL-NEXT: vaddss %xmm1, %xmm0, %xmm0
39 %tobool = fcmp olt float %a, %b
40 br i1 %tobool, label %l1, label %l2
43 %c = fsub float %a, %b
46 %c1 = fadd float %a, %b
50 define i32 @test3(float %a, float %b) {
53 ; ALL-NEXT: vcmpeqss %xmm1, %xmm0, %k0
54 ; ALL-NEXT: kmovw %k0, %eax
57 %cmp10.i = fcmp oeq float %a, %b
58 %conv11.i = zext i1 %cmp10.i to i32
62 define float @test5(float %p) #0 {
64 ; ALL: ## %bb.0: ## %entry
65 ; ALL-NEXT: vxorps %xmm1, %xmm1, %xmm1
66 ; ALL-NEXT: vucomiss %xmm1, %xmm0
67 ; ALL-NEXT: jne LBB3_1
69 ; ALL-NEXT: ## %bb.2: ## %return
71 ; ALL-NEXT: LBB3_1: ## %if.end
72 ; ALL-NEXT: vcmpltss %xmm0, %xmm1, %k1
73 ; ALL-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
74 ; ALL-NEXT: vmovss {{.*}}(%rip), %xmm0 {%k1}
77 %cmp = fcmp oeq float %p, 0.000000e+00
78 br i1 %cmp, label %return, label %if.end
80 if.end: ; preds = %entry
81 %cmp1 = fcmp ogt float %p, 0.000000e+00
82 %cond = select i1 %cmp1, float 1.000000e+00, float -1.000000e+00
85 return: ; preds = %if.end, %entry
86 %retval.0 = phi float [ %cond, %if.end ], [ %p, %entry ]
90 define i32 @test6(i32 %a, i32 %b) {
93 ; ALL-NEXT: xorl %eax, %eax
94 ; ALL-NEXT: cmpl %esi, %edi
97 %cmp = icmp eq i32 %a, %b
98 %res = zext i1 %cmp to i32
102 define i32 @test7(double %x, double %y) #2 {
104 ; ALL: ## %bb.0: ## %entry
105 ; ALL-NEXT: xorl %eax, %eax
106 ; ALL-NEXT: vucomisd %xmm1, %xmm0
107 ; ALL-NEXT: setne %al
110 %0 = fcmp one double %x, %y
111 %or = zext i1 %0 to i32
115 define i32 @test8(i32 %a1, i32 %a2, i32 %a3) {
118 ; ALL-NEXT: notl %edi
119 ; ALL-NEXT: xorl $-2147483648, %esi ## imm = 0x80000000
120 ; ALL-NEXT: testl %edx, %edx
121 ; ALL-NEXT: movl $1, %eax
122 ; ALL-NEXT: cmovel %eax, %edx
123 ; ALL-NEXT: orl %edi, %esi
124 ; ALL-NEXT: cmovnel %edx, %eax
126 %tmp1 = icmp eq i32 %a1, -1
127 %tmp2 = icmp eq i32 %a2, -2147483648
128 %tmp3 = and i1 %tmp1, %tmp2
129 %tmp4 = icmp eq i32 %a3, 0
130 %tmp5 = or i1 %tmp3, %tmp4
131 %res = select i1 %tmp5, i32 1, i32 %a3
135 define i32 @test9(i64 %a) {
138 ; ALL-NEXT: testb $1, %dil
139 ; ALL-NEXT: jne LBB7_2
140 ; ALL-NEXT: ## %bb.1: ## %A
141 ; ALL-NEXT: movl $6, %eax
143 ; ALL-NEXT: LBB7_2: ## %B
144 ; ALL-NEXT: movl $7, %eax
147 %cmp10.i = icmp eq i64 %b, 0
148 br i1 %cmp10.i, label %A, label %B
155 define i32 @test10(i64 %b, i64 %c, i1 %d) {
158 ; ALL-NEXT: movl %edx, %eax
159 ; ALL-NEXT: andb $1, %al
160 ; ALL-NEXT: cmpq %rsi, %rdi
162 ; ALL-NEXT: orb %dl, %cl
163 ; ALL-NEXT: andb $1, %cl
164 ; ALL-NEXT: cmpb %cl, %al
165 ; ALL-NEXT: je LBB8_1
166 ; ALL-NEXT: ## %bb.2: ## %if.end.i
167 ; ALL-NEXT: movl $6, %eax
169 ; ALL-NEXT: LBB8_1: ## %if.then.i
170 ; ALL-NEXT: movl $5, %eax
173 %cmp8.i = icmp eq i64 %b, %c
174 %or1 = or i1 %d, %cmp8.i
175 %xor1 = xor i1 %d, %or1
176 br i1 %xor1, label %if.end.i, label %if.then.i