// #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);

    $$set_rounding_mode(0);

    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)
  call void @llvm.set.rounding(i32 0)
