mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Add new built-ins (#551)
* Added new built-ins: $$copysign, $$exp2, $$floor, $$llrint, $$llround, $$lrint, $$lround, $$nearbyint, $$rint, $$round, $$roundeven * Disable $$llrint, $$llround, $$lrint and $$lround
This commit is contained in:
48
test/test_suite/builtins/rounding_builtins.c3t
Normal file
48
test/test_suite/builtins/rounding_builtins.c3t
Normal file
@@ -0,0 +1,48 @@
|
||||
// #target: macos-x64
|
||||
module test;
|
||||
|
||||
fn void main()
|
||||
{
|
||||
double d = 1.2345;
|
||||
|
||||
double d1 = $$ceil(d);
|
||||
double d2 = $$floor(d);
|
||||
// double d3 = $$llrint(d);
|
||||
// double d4 = $$llround(d);
|
||||
// double d5 = $$lrint(d);
|
||||
// double d6 = $$lround(d);
|
||||
double d7 = $$nearbyint(d);
|
||||
double d8 = $$rint(d);
|
||||
double d9 = $$round(d);
|
||||
double d10 = $$roundeven(d);
|
||||
|
||||
double[<2>] vd = { 1.2345, 0.6789 };
|
||||
|
||||
double[<2>] vd1 = $$ceil(vd);
|
||||
double[<2>] vd2 = $$floor(vd);
|
||||
// double[<2>] vd3 = $$llrint(vd);
|
||||
// double[<2>] vd4 = $$llround(vd);
|
||||
// double[<2>] vd5 = $$lrint(vd);
|
||||
// double[<2>] vd6 = $$lround(vd);
|
||||
double[<2>] vd7 = $$nearbyint(vd);
|
||||
double[<2>] vd8 = $$rint(vd);
|
||||
double[<2>] vd9 = $$round(vd);
|
||||
double[<2>] vd10 = $$roundeven(vd);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// #expect: test.ll
|
||||
|
||||
%1 = call double @llvm.ceil.f64(double %0)
|
||||
%3 = call double @llvm.floor.f64(double %2)
|
||||
%5 = call double @llvm.nearbyint.f64(double %4)
|
||||
%7 = call double @llvm.rint.f64(double %6)
|
||||
%9 = call double @llvm.round.f64(double %8)
|
||||
%11 = call double @llvm.roundeven.f64(double %10)
|
||||
%13 = call <2 x double> @llvm.ceil.v2f64(<2 x double> %12)
|
||||
%15 = call <2 x double> @llvm.floor.v2f64(<2 x double> %14)
|
||||
%17 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %16)
|
||||
%19 = call <2 x double> @llvm.rint.v2f64(<2 x double> %18)
|
||||
%21 = call <2 x double> @llvm.round.v2f64(<2 x double> %20)
|
||||
%23 = call <2 x double> @llvm.roundeven.v2f64(<2 x double> %22)
|
||||
Reference in New Issue
Block a user