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