>]
/// CHECK-START: double Main.DoubleDivision() constant_folding_after_inlining (after)
/// CHECK-DAG: <
> DoubleConstant 3.2
/// CHECK-DAG: Return [<>]
/// CHECK-START: double Main.DoubleDivision() constant_folding_after_inlining (after)
/// CHECK-NOT: Div
public static double DoubleDivision() {
double a, b, c;
a = $inline$double(8D);
b = $inline$double(2.5D);
c = a / b;
return c;
}
/**
* Exercise constant folding on remainder.
*/
/// CHECK-START: int Main.IntRemainder() constant_folding_after_inlining (before)
/// CHECK-DAG: <> IntConstant 8
/// CHECK-DAG: <> IntConstant 3
/// CHECK-DAG: <> DivZeroCheck [<>]
/// CHECK-DAG: <> Rem [<>,<>]
/// CHECK-DAG: Return [<>]
/// CHECK-START: int Main.IntRemainder() constant_folding_after_inlining (after)
/// CHECK-DAG: <> IntConstant 2
/// CHECK-DAG: Return [<>]
/// CHECK-START: int Main.IntRemainder() constant_folding_after_inlining (after)
/// CHECK-NOT: DivZeroCheck
/// CHECK-NOT: Rem
public static int IntRemainder() {
int a, b, c;
a = $inline$int(8);
b = $inline$int(3);
c = a % b;
return c;
}
/// CHECK-START: long Main.LongRemainder() constant_folding_after_inlining (before)
/// CHECK-DAG: <> LongConstant 8
/// CHECK-DAG: <> LongConstant 3
/// CHECK-DAG: <> DivZeroCheck [<>]
/// CHECK-DAG: <> Rem [<>,<>]
/// CHECK-DAG: Return [<>]
/// CHECK-START: long Main.LongRemainder() constant_folding_after_inlining (after)
/// CHECK-DAG: <> LongConstant 2
/// CHECK-DAG: Return [<>]
/// CHECK-START: long Main.LongRemainder() constant_folding_after_inlining (after)
/// CHECK-NOT: DivZeroCheck
/// CHECK-NOT: Rem
public static long LongRemainder() {
long a, b, c;
a = $inline$long(8L);
b = $inline$long(3L);
c = a % b;
return c;
}
/// CHECK-START: float Main.FloatRemainder() constant_folding_after_inlining (before)
/// CHECK-DAG: <> FloatConstant 8
/// CHECK-DAG: <> FloatConstant 2.5
/// CHECK-DAG: <> Rem [<>,<>]
/// CHECK-DAG: Return [<>]
/// CHECK-START: float Main.FloatRemainder() constant_folding_after_inlining (after)
/// CHECK-DAG: <> FloatConstant 0.5
/// CHECK-DAG: Return [<>]
/// CHECK-START: float Main.FloatRemainder() constant_folding_after_inlining (after)
/// CHECK-NOT: Rem
public static float FloatRemainder() {
float a, b, c;
a = $inline$float(8F);
b = $inline$float(2.5F);
c = a % b;
return c;
}
/// CHECK-START: double Main.DoubleRemainder() constant_folding_after_inlining (before)
/// CHECK-DAG: <> DoubleConstant 8
/// CHECK-DAG: <> DoubleConstant 2.5
/// CHECK-DAG: <> Rem [<>,<>]
/// CHECK-DAG: Return [<>]
/// CHECK-START: double Main.DoubleRemainder() constant_folding_after_inlining (after)
/// CHECK-DAG: <> DoubleConstant 0.5
/// CHECK-DAG: Return [<>]
/// CHECK-START: double Main.DoubleRemainder() constant_folding_after_inlining (after)
/// CHECK-NOT: Rem
public static double DoubleRemainder() {
double a, b, c;
a = $inline$double(8D);
b = $inline$double(2.5D);
c = a % b;
return c;
}
/**
* Exercise constant folding on left shift.
*/
/// CHECK-START: int Main.ShlIntLong() constant_folding_after_inlining (before)
/// CHECK-DAG: <> IntConstant 1
/// CHECK-DAG: <> LongConstant 2
/// CHECK-DAG: <> TypeConversion [<>]
/// CHECK-DAG: <> Shl [<>,<>]
/// CHECK-DAG: Return [<>]
/// CHECK-START: int Main.ShlIntLong() constant_folding_after_inlining (after)
/// CHECK-DAG: <> IntConstant 4
/// CHECK-DAG: Return [<>]
/// CHECK-START: int Main.ShlIntLong() constant_folding_after_inlining (after)
/// CHECK-NOT: Shl
public static int ShlIntLong() {
int lhs = $inline$int(1);
long rhs = $inline$long(2L);
return lhs << rhs;
}
/// CHECK-START: long Main.ShlLongInt() constant_folding_after_inlining (before)
/// CHECK-DAG: <> LongConstant 3
/// CHECK-DAG: <> IntConstant 2
/// CHECK-DAG: <> Shl [<>,<>]
/// CHECK-DAG: Return [<>]
/// CHECK-START: long Main.ShlLongInt() constant_folding_after_inlining (after)
/// CHECK-DAG: <> LongConstant 12
/// CHECK-DAG: Return [<>]
/// CHECK-START: long Main.ShlLongInt() constant_folding_after_inlining (after)
/// CHECK-NOT: Shl
public static long ShlLongInt() {
long lhs = $inline$long(3L);
int rhs = $inline$int(2);
return lhs << rhs;
}
/**
* Exercise constant folding on right shift.
*/
/// CHECK-START: int Main.ShrIntLong() constant_folding_after_inlining (before)
/// CHECK-DAG: <> IntConstant 7
/// CHECK-DAG: <> LongConstant 2
/// CHECK-DAG: <> TypeConversion [<>]
/// CHECK-DAG: <> Shr [<>,<>]
/// CHECK-DAG: Return [<>]
/// CHECK-START: int Main.ShrIntLong() constant_folding_after_inlining (after)
/// CHECK-DAG: <> IntConstant 1
/// CHECK-DAG: Return [<>]
/// CHECK-START: int Main.ShrIntLong() constant_folding_after_inlining (after)
/// CHECK-NOT: Shr
public static int ShrIntLong() {
int lhs = $inline$int(7);
long rhs = $inline$long(2L);
return lhs >> rhs;
}
/// CHECK-START: long Main.ShrLongInt() constant_folding_after_inlining (before)
/// CHECK-DAG: <> LongConstant 9
/// CHECK-DAG: <> IntConstant 2
/// CHECK-DAG: <> Shr [<>,<>]
/// CHECK-DAG: Return [<>]
/// CHECK-START: long Main.ShrLongInt() constant_folding_after_inlining (after)
/// CHECK-DAG: <> LongConstant 2
/// CHECK-DAG: Return [<>]
/// CHECK-START: long Main.ShrLongInt() constant_folding_after_inlining (after)
/// CHECK-NOT: Shr
public static long ShrLongInt() {
long lhs = $inline$long(9);
int rhs = $inline$int(2);
return lhs >> rhs;
}
/**
* Exercise constant folding on unsigned right shift.
*/
/// CHECK-START: int Main.UShrIntLong() constant_folding_after_inlining (before)
/// CHECK-DAG: <> IntConstant -7
/// CHECK-DAG: <> LongConstant 2
/// CHECK-DAG: <> TypeConversion [<>]
/// CHECK-DAG: <> UShr [<>,<>]
/// CHECK-DAG: Return [<>]
/// CHECK-START: int Main.UShrIntLong() constant_folding_after_inlining (after)
/// CHECK-DAG: <> IntConstant 1073741822
/// CHECK-DAG: Return [<