xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/avx-minmax.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86-64 -mattr=+avx -asm-verbose=false -enable-unsafe-fp-math -enable-no-nans-fp-math | FileCheck -check-prefix=UNSAFE %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; UNSAFE-LABEL: maxpd:
4*9880d681SAndroid Build Coastguard Worker; UNSAFE: vmaxpd {{.+}}, %xmm
5*9880d681SAndroid Build Coastguard Workerdefine <2 x double> @maxpd(<2 x double> %x, <2 x double> %y) {
6*9880d681SAndroid Build Coastguard Worker  %max_is_x = fcmp oge <2 x double> %x, %y
7*9880d681SAndroid Build Coastguard Worker  %max = select <2 x i1> %max_is_x, <2 x double> %x, <2 x double> %y
8*9880d681SAndroid Build Coastguard Worker  ret <2 x double> %max
9*9880d681SAndroid Build Coastguard Worker}
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker; UNSAFE-LABEL: minpd:
12*9880d681SAndroid Build Coastguard Worker; UNSAFE: vminpd {{.+}}, %xmm
13*9880d681SAndroid Build Coastguard Workerdefine <2 x double> @minpd(<2 x double> %x, <2 x double> %y) {
14*9880d681SAndroid Build Coastguard Worker  %min_is_x = fcmp ole <2 x double> %x, %y
15*9880d681SAndroid Build Coastguard Worker  %min = select <2 x i1> %min_is_x, <2 x double> %x, <2 x double> %y
16*9880d681SAndroid Build Coastguard Worker  ret <2 x double> %min
17*9880d681SAndroid Build Coastguard Worker}
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker; UNSAFE-LABEL: maxps:
20*9880d681SAndroid Build Coastguard Worker; UNSAFE: vmaxps {{.+}}, %xmm
21*9880d681SAndroid Build Coastguard Workerdefine <4 x float> @maxps(<4 x float> %x, <4 x float> %y) {
22*9880d681SAndroid Build Coastguard Worker  %max_is_x = fcmp oge <4 x float> %x, %y
23*9880d681SAndroid Build Coastguard Worker  %max = select <4 x i1> %max_is_x, <4 x float> %x, <4 x float> %y
24*9880d681SAndroid Build Coastguard Worker  ret <4 x float> %max
25*9880d681SAndroid Build Coastguard Worker}
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Worker; UNSAFE-LABEL: minps:
28*9880d681SAndroid Build Coastguard Worker; UNSAFE: vminps {{.+}}, %xmm
29*9880d681SAndroid Build Coastguard Workerdefine <4 x float> @minps(<4 x float> %x, <4 x float> %y) {
30*9880d681SAndroid Build Coastguard Worker  %min_is_x = fcmp ole <4 x float> %x, %y
31*9880d681SAndroid Build Coastguard Worker  %min = select <4 x i1> %min_is_x, <4 x float> %x, <4 x float> %y
32*9880d681SAndroid Build Coastguard Worker  ret <4 x float> %min
33*9880d681SAndroid Build Coastguard Worker}
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Worker; UNSAFE-LABEL: vmaxpd:
36*9880d681SAndroid Build Coastguard Worker; UNSAFE: vmaxpd {{.+}}, %ymm
37*9880d681SAndroid Build Coastguard Workerdefine <4 x double> @vmaxpd(<4 x double> %x, <4 x double> %y) {
38*9880d681SAndroid Build Coastguard Worker  %max_is_x = fcmp oge <4 x double> %x, %y
39*9880d681SAndroid Build Coastguard Worker  %max = select <4 x i1> %max_is_x, <4 x double> %x, <4 x double> %y
40*9880d681SAndroid Build Coastguard Worker  ret <4 x double> %max
41*9880d681SAndroid Build Coastguard Worker}
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Worker; UNSAFE-LABEL: vminpd:
44*9880d681SAndroid Build Coastguard Worker; UNSAFE: vminpd {{.+}}, %ymm
45*9880d681SAndroid Build Coastguard Workerdefine <4 x double> @vminpd(<4 x double> %x, <4 x double> %y) {
46*9880d681SAndroid Build Coastguard Worker  %min_is_x = fcmp ole <4 x double> %x, %y
47*9880d681SAndroid Build Coastguard Worker  %min = select <4 x i1> %min_is_x, <4 x double> %x, <4 x double> %y
48*9880d681SAndroid Build Coastguard Worker  ret <4 x double> %min
49*9880d681SAndroid Build Coastguard Worker}
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Worker; UNSAFE-LABEL: vmaxps:
52*9880d681SAndroid Build Coastguard Worker; UNSAFE: vmaxps {{.+}}, %ymm
53*9880d681SAndroid Build Coastguard Workerdefine <8 x float> @vmaxps(<8 x float> %x, <8 x float> %y) {
54*9880d681SAndroid Build Coastguard Worker  %max_is_x = fcmp oge <8 x float> %x, %y
55*9880d681SAndroid Build Coastguard Worker  %max = select <8 x i1> %max_is_x, <8 x float> %x, <8 x float> %y
56*9880d681SAndroid Build Coastguard Worker  ret <8 x float> %max
57*9880d681SAndroid Build Coastguard Worker}
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Worker; UNSAFE-LABEL: vminps:
60*9880d681SAndroid Build Coastguard Worker; UNSAFE: vminps {{.+}}, %ymm
61*9880d681SAndroid Build Coastguard Workerdefine <8 x float> @vminps(<8 x float> %x, <8 x float> %y) {
62*9880d681SAndroid Build Coastguard Worker  %min_is_x = fcmp ole <8 x float> %x, %y
63*9880d681SAndroid Build Coastguard Worker  %min = select <8 x i1> %min_is_x, <8 x float> %x, <8 x float> %y
64*9880d681SAndroid Build Coastguard Worker  ret <8 x float> %min
65*9880d681SAndroid Build Coastguard Worker}
66