xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/avx512-round.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl --show-mc-encoding| FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workerdefine <16 x float> @floor_v16f32(<16 x float> %a) {
4*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: floor_v16f32
5*9880d681SAndroid Build Coastguard Worker; CHECK: vrndscaleps $1, {{.*}}encoding: [0x62,0xf3,0x7d,0x48,0x08,0xc0,0x01]
6*9880d681SAndroid Build Coastguard Worker  %res = call <16 x float> @llvm.floor.v16f32(<16 x float> %a)
7*9880d681SAndroid Build Coastguard Worker  ret <16 x float> %res
8*9880d681SAndroid Build Coastguard Worker}
9*9880d681SAndroid Build Coastguard Workerdeclare <16 x float> @llvm.floor.v16f32(<16 x float> %p)
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workerdefine <8 x double> @floor_v8f64(<8 x double> %a) {
12*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: floor_v8f64
13*9880d681SAndroid Build Coastguard Worker; CHECK: vrndscalepd $1, {{.*}}encoding: [0x62,0xf3,0xfd,0x48,0x09,0xc0,0x01]
14*9880d681SAndroid Build Coastguard Worker  %res = call <8 x double> @llvm.floor.v8f64(<8 x double> %a)
15*9880d681SAndroid Build Coastguard Worker  ret <8 x double> %res
16*9880d681SAndroid Build Coastguard Worker}
17*9880d681SAndroid Build Coastguard Workerdeclare <8 x double> @llvm.floor.v8f64(<8 x double> %p)
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Workerdefine <16 x float> @ceil_v16f32(<16 x float> %a) {
20*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: ceil_v16f32
21*9880d681SAndroid Build Coastguard Worker; CHECK: vrndscaleps $2, {{.*}}encoding: [0x62,0xf3,0x7d,0x48,0x08,0xc0,0x02]
22*9880d681SAndroid Build Coastguard Worker  %res = call <16 x float> @llvm.ceil.v16f32(<16 x float> %a)
23*9880d681SAndroid Build Coastguard Worker  ret <16 x float> %res
24*9880d681SAndroid Build Coastguard Worker}
25*9880d681SAndroid Build Coastguard Workerdeclare <16 x float> @llvm.ceil.v16f32(<16 x float> %p)
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerdefine <8 x double> @ceil_v8f64(<8 x double> %a) {
28*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: ceil_v8f64
29*9880d681SAndroid Build Coastguard Worker; CHECK: vrndscalepd $2, {{.*}}encoding: [0x62,0xf3,0xfd,0x48,0x09,0xc0,0x02]
30*9880d681SAndroid Build Coastguard Worker  %res = call <8 x double> @llvm.ceil.v8f64(<8 x double> %a)
31*9880d681SAndroid Build Coastguard Worker  ret <8 x double> %res
32*9880d681SAndroid Build Coastguard Worker}
33*9880d681SAndroid Build Coastguard Workerdeclare <8 x double> @llvm.ceil.v8f64(<8 x double> %p)
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Workerdefine <16 x float> @trunc_v16f32(<16 x float> %a) {
36*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: trunc_v16f32
37*9880d681SAndroid Build Coastguard Worker; CHECK: vrndscaleps $3, {{.*}}encoding: [0x62,0xf3,0x7d,0x48,0x08,0xc0,0x03]
38*9880d681SAndroid Build Coastguard Worker  %res = call <16 x float> @llvm.trunc.v16f32(<16 x float> %a)
39*9880d681SAndroid Build Coastguard Worker  ret <16 x float> %res
40*9880d681SAndroid Build Coastguard Worker}
41*9880d681SAndroid Build Coastguard Workerdeclare <16 x float> @llvm.trunc.v16f32(<16 x float> %p)
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Workerdefine <8 x double> @trunc_v8f64(<8 x double> %a) {
44*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: trunc_v8f64
45*9880d681SAndroid Build Coastguard Worker; CHECK: vrndscalepd $3, {{.*}}encoding: [0x62,0xf3,0xfd,0x48,0x09,0xc0,0x03]
46*9880d681SAndroid Build Coastguard Worker  %res = call <8 x double> @llvm.trunc.v8f64(<8 x double> %a)
47*9880d681SAndroid Build Coastguard Worker  ret <8 x double> %res
48*9880d681SAndroid Build Coastguard Worker}
49*9880d681SAndroid Build Coastguard Workerdeclare <8 x double> @llvm.trunc.v8f64(<8 x double> %p)
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Workerdefine <16 x float> @rint_v16f32(<16 x float> %a) {
52*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: rint_v16f32
53*9880d681SAndroid Build Coastguard Worker; CHECK: vrndscaleps $4, {{.*}}encoding: [0x62,0xf3,0x7d,0x48,0x08,0xc0,0x04]
54*9880d681SAndroid Build Coastguard Worker  %res = call <16 x float> @llvm.rint.v16f32(<16 x float> %a)
55*9880d681SAndroid Build Coastguard Worker  ret <16 x float> %res
56*9880d681SAndroid Build Coastguard Worker}
57*9880d681SAndroid Build Coastguard Workerdeclare <16 x float> @llvm.rint.v16f32(<16 x float> %p)
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Workerdefine <8 x double> @rint_v8f64(<8 x double> %a) {
60*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: rint_v8f64
61*9880d681SAndroid Build Coastguard Worker; CHECK: vrndscalepd $4, {{.*}}encoding: [0x62,0xf3,0xfd,0x48,0x09,0xc0,0x04]
62*9880d681SAndroid Build Coastguard Worker  %res = call <8 x double> @llvm.rint.v8f64(<8 x double> %a)
63*9880d681SAndroid Build Coastguard Worker  ret <8 x double> %res
64*9880d681SAndroid Build Coastguard Worker}
65*9880d681SAndroid Build Coastguard Workerdeclare <8 x double> @llvm.rint.v8f64(<8 x double> %p)
66*9880d681SAndroid Build Coastguard Worker
67*9880d681SAndroid Build Coastguard Workerdefine <16 x float> @nearbyint_v16f32(<16 x float> %a) {
68*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: nearbyint_v16f32
69*9880d681SAndroid Build Coastguard Worker; CHECK: vrndscaleps $12, {{.*}}encoding: [0x62,0xf3,0x7d,0x48,0x08,0xc0,0x0c]
70*9880d681SAndroid Build Coastguard Worker  %res = call <16 x float> @llvm.nearbyint.v16f32(<16 x float> %a)
71*9880d681SAndroid Build Coastguard Worker  ret <16 x float> %res
72*9880d681SAndroid Build Coastguard Worker}
73*9880d681SAndroid Build Coastguard Workerdeclare <16 x float> @llvm.nearbyint.v16f32(<16 x float> %p)
74*9880d681SAndroid Build Coastguard Worker
75*9880d681SAndroid Build Coastguard Workerdefine <8 x double> @nearbyint_v8f64(<8 x double> %a) {
76*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: nearbyint_v8f64
77*9880d681SAndroid Build Coastguard Worker; CHECK: vrndscalepd $12, {{.*}}encoding: [0x62,0xf3,0xfd,0x48,0x09,0xc0,0x0c]
78*9880d681SAndroid Build Coastguard Worker  %res = call <8 x double> @llvm.nearbyint.v8f64(<8 x double> %a)
79*9880d681SAndroid Build Coastguard Worker  ret <8 x double> %res
80*9880d681SAndroid Build Coastguard Worker}
81*9880d681SAndroid Build Coastguard Workerdeclare <8 x double> @llvm.nearbyint.v8f64(<8 x double> %p)
82*9880d681SAndroid Build Coastguard Worker
83*9880d681SAndroid Build Coastguard Workerdefine double @nearbyint_f64(double %a) {
84*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: nearbyint_f64
85*9880d681SAndroid Build Coastguard Worker; CHECK: vrndscalesd $12, {{.*}}encoding: [0x62,0xf3,0xfd,0x08,0x0b,0xc0,0x0c]
86*9880d681SAndroid Build Coastguard Worker  %res = call double @llvm.nearbyint.f64(double %a)
87*9880d681SAndroid Build Coastguard Worker  ret double %res
88*9880d681SAndroid Build Coastguard Worker}
89*9880d681SAndroid Build Coastguard Workerdeclare double @llvm.nearbyint.f64(double %p)
90*9880d681SAndroid Build Coastguard Worker
91*9880d681SAndroid Build Coastguard Workerdefine float @floor_f32(float %a) {
92*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: floor_f32
93*9880d681SAndroid Build Coastguard Worker; CHECK: vrndscaless $1, {{.*}}encoding: [0x62,0xf3,0x7d,0x08,0x0a,0xc0,0x01]
94*9880d681SAndroid Build Coastguard Worker  %res = call float @llvm.floor.f32(float %a)
95*9880d681SAndroid Build Coastguard Worker  ret float %res
96*9880d681SAndroid Build Coastguard Worker}
97*9880d681SAndroid Build Coastguard Workerdeclare float @llvm.floor.f32(float %p)
98*9880d681SAndroid Build Coastguard Worker
99*9880d681SAndroid Build Coastguard Workerdefine float @floor_f32m(float* %aptr) {
100*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: floor_f32m
101*9880d681SAndroid Build Coastguard Worker; CHECK: vrndscaless $1, (%rdi), {{.*}}encoding: [0x62,0xf3,0x7d,0x08,0x0a,0x07,0x01]
102*9880d681SAndroid Build Coastguard Worker  %a = load float, float* %aptr, align 4
103*9880d681SAndroid Build Coastguard Worker  %res = call float @llvm.floor.f32(float %a)
104*9880d681SAndroid Build Coastguard Worker  ret float %res
105*9880d681SAndroid Build Coastguard Worker}
106*9880d681SAndroid Build Coastguard Worker
107