summaryrefslogtreecommitdiff
path: root/t/perf
diff options
context:
space:
mode:
authorJames Raspass <jraspass@gmail.com>2022-01-22 11:07:58 +0000
committerPaul Evans <leonerd@leonerd.org.uk>2022-01-24 00:35:51 +0000
commit17a8df707746ce70979d18c5b5f9e383c365bbff (patch)
treee5804a4a146bb23322767dca987fc9d8dbc8f493 /t/perf
parentfc23c914f8de7cb85f58830142e0164864d4601c (diff)
downloadperl-17a8df707746ce70979d18c5b5f9e383c365bbff.tar.gz
Add ceil & floor to builtin
Diffstat (limited to 't/perf')
-rw-r--r--t/perf/opcount.t15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/perf/opcount.t b/t/perf/opcount.t
index 372c47f3d6..3351f50f07 100644
--- a/t/perf/opcount.t
+++ b/t/perf/opcount.t
@@ -766,4 +766,19 @@ test_opcount(0, "builtin::reftype is replaced with direct opcode",
reftype => 1,
});
+my $one_point_five = 1.5; # Prevent const-folding.
+test_opcount(0, "builtin::ceil is replaced with direct opcode",
+ sub { builtin::ceil($one_point_five); },
+ {
+ entersub => 0,
+ ceil => 1,
+ });
+
+test_opcount(0, "builtin::floor is replaced with direct opcode",
+ sub { builtin::floor($one_point_five); },
+ {
+ entersub => 0,
+ floor => 1,
+ });
+
done_testing();