xref: /aosp_15_r20/external/llvm/test/CodeGen/PowerPC/rounding-ops.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=-vsx < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=+vsx < %s | FileCheck -check-prefix=CHECK-VSX %s
3*9880d681SAndroid Build Coastguard Workertarget datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
4*9880d681SAndroid Build Coastguard Workertarget triple = "powerpc64-unknown-linux-gnu"
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdefine float @test1(float %x) nounwind  {
7*9880d681SAndroid Build Coastguard Worker  %call = tail call float @floorf(float %x) nounwind readnone
8*9880d681SAndroid Build Coastguard Worker  ret float %call
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test1:
11*9880d681SAndroid Build Coastguard Worker; CHECK: frim 1, 1
12*9880d681SAndroid Build Coastguard Worker; CHECK-VSX-LABEL: test1:
13*9880d681SAndroid Build Coastguard Worker; CHECK-VSX: frim 1, 1
14*9880d681SAndroid Build Coastguard Worker}
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Workerdeclare float @floorf(float) nounwind readnone
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Workerdefine double @test2(double %x) nounwind  {
19*9880d681SAndroid Build Coastguard Worker  %call = tail call double @floor(double %x) nounwind readnone
20*9880d681SAndroid Build Coastguard Worker  ret double %call
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test2:
23*9880d681SAndroid Build Coastguard Worker; CHECK: frim 1, 1
24*9880d681SAndroid Build Coastguard Worker; CHECK-VSX-LABEL: test2:
25*9880d681SAndroid Build Coastguard Worker; CHECK-VSX: xsrdpim 1, 1
26*9880d681SAndroid Build Coastguard Worker}
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Workerdeclare double @floor(double) nounwind readnone
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Workerdefine float @test3(float %x) nounwind  {
31*9880d681SAndroid Build Coastguard Worker  %call = tail call float @roundf(float %x) nounwind readnone
32*9880d681SAndroid Build Coastguard Worker  ret float %call
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test3:
35*9880d681SAndroid Build Coastguard Worker; CHECK: frin 1, 1
36*9880d681SAndroid Build Coastguard Worker; CHECK-VSX-LABEL: test3:
37*9880d681SAndroid Build Coastguard Worker; CHECK-VSX: frin 1, 1
38*9880d681SAndroid Build Coastguard Worker}
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Workerdeclare float @roundf(float) nounwind readnone
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Workerdefine double @test4(double %x) nounwind  {
43*9880d681SAndroid Build Coastguard Worker  %call = tail call double @round(double %x) nounwind readnone
44*9880d681SAndroid Build Coastguard Worker  ret double %call
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test4:
47*9880d681SAndroid Build Coastguard Worker; CHECK: frin 1, 1
48*9880d681SAndroid Build Coastguard Worker; CHECK-VSX-LABEL: test4:
49*9880d681SAndroid Build Coastguard Worker; CHECK-VSX: xsrdpi 1, 1
50*9880d681SAndroid Build Coastguard Worker}
51*9880d681SAndroid Build Coastguard Worker
52*9880d681SAndroid Build Coastguard Workerdeclare double @round(double) nounwind readnone
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Workerdefine float @test5(float %x) nounwind  {
55*9880d681SAndroid Build Coastguard Worker  %call = tail call float @ceilf(float %x) nounwind readnone
56*9880d681SAndroid Build Coastguard Worker  ret float %call
57*9880d681SAndroid Build Coastguard Worker
58*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test5:
59*9880d681SAndroid Build Coastguard Worker; CHECK: frip 1, 1
60*9880d681SAndroid Build Coastguard Worker; CHECK-VSX-LABEL: test5:
61*9880d681SAndroid Build Coastguard Worker; CHECK-VSX: frip 1, 1
62*9880d681SAndroid Build Coastguard Worker}
63*9880d681SAndroid Build Coastguard Worker
64*9880d681SAndroid Build Coastguard Workerdeclare float @ceilf(float) nounwind readnone
65*9880d681SAndroid Build Coastguard Worker
66*9880d681SAndroid Build Coastguard Workerdefine double @test6(double %x) nounwind  {
67*9880d681SAndroid Build Coastguard Worker  %call = tail call double @ceil(double %x) nounwind readnone
68*9880d681SAndroid Build Coastguard Worker  ret double %call
69*9880d681SAndroid Build Coastguard Worker
70*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test6:
71*9880d681SAndroid Build Coastguard Worker; CHECK: frip 1, 1
72*9880d681SAndroid Build Coastguard Worker; CHECK-VSX-LABEL: test6:
73*9880d681SAndroid Build Coastguard Worker; CHECK-VSX: xsrdpip 1, 1
74*9880d681SAndroid Build Coastguard Worker}
75*9880d681SAndroid Build Coastguard Worker
76*9880d681SAndroid Build Coastguard Workerdeclare double @ceil(double) nounwind readnone
77*9880d681SAndroid Build Coastguard Worker
78*9880d681SAndroid Build Coastguard Workerdefine float @test9(float %x) nounwind  {
79*9880d681SAndroid Build Coastguard Worker  %call = tail call float @truncf(float %x) nounwind readnone
80*9880d681SAndroid Build Coastguard Worker  ret float %call
81*9880d681SAndroid Build Coastguard Worker
82*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test9:
83*9880d681SAndroid Build Coastguard Worker; CHECK: friz 1, 1
84*9880d681SAndroid Build Coastguard Worker; CHECK-VSX-LABEL: test9:
85*9880d681SAndroid Build Coastguard Worker; CHECK-VSX: friz 1, 1
86*9880d681SAndroid Build Coastguard Worker}
87*9880d681SAndroid Build Coastguard Worker
88*9880d681SAndroid Build Coastguard Workerdeclare float @truncf(float) nounwind readnone
89*9880d681SAndroid Build Coastguard Worker
90*9880d681SAndroid Build Coastguard Workerdefine double @test10(double %x) nounwind  {
91*9880d681SAndroid Build Coastguard Worker  %call = tail call double @trunc(double %x) nounwind readnone
92*9880d681SAndroid Build Coastguard Worker  ret double %call
93*9880d681SAndroid Build Coastguard Worker
94*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test10:
95*9880d681SAndroid Build Coastguard Worker; CHECK: friz 1, 1
96*9880d681SAndroid Build Coastguard Worker; CHECK-VSX-LABEL: test10:
97*9880d681SAndroid Build Coastguard Worker; CHECK-VSX: xsrdpiz 1, 1
98*9880d681SAndroid Build Coastguard Worker}
99*9880d681SAndroid Build Coastguard Worker
100*9880d681SAndroid Build Coastguard Workerdeclare double @trunc(double) nounwind readnone
101*9880d681SAndroid Build Coastguard Worker
102