Support target templates in bytecode tests

Avoid test data duplication
This commit is contained in:
Mikhael Bogdanov
2019-07-16 09:15:31 +02:00
parent de1e27c584
commit 496765f41e
46 changed files with 250 additions and 679 deletions
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
fun test(a: Char, b: Char): String {
var s = ""
for (i in a until b) {
@@ -16,5 +15,13 @@ fun test(a: Char, b: Char): String {
// 0 getFirst
// 0 getLast
// 0 getStep
// JVM_TEMPLATES
// 1 IF_ICMPGE
// 1 IF
// 1 IF
// JVM_IR_TEMPLATES
// 1 IFEQ
// 1 IF_ICMPGT
// 1 IF_ICMPLE
// 3 IF
@@ -1,22 +0,0 @@
// TARGET_BACKEND: JVM_IR
fun test(a: Char, b: Char): String {
var s = ""
for (i in a until b) {
s += i
}
return s
}
// JVM non-IR uses while.
// JVM IR uses if + do-while. In addition, for "until" progressions, there is a check that the range is not empty: upper bound != MIN_VALUE.
// 0 iterator
// 0 getStart
// 0 getEnd
// 0 getFirst
// 0 getLast
// 0 getStep
// 1 IFEQ
// 1 IF_ICMPGT
// 1 IF_ICMPLE
// 3 IF
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
const val M = Char.MAX_VALUE
fun f(a: Char): Int {
@@ -18,5 +17,12 @@ fun f(a: Char): Int {
// 0 getFirst
// 0 getLast
// 0 getStep
// JVM_TEMPLATES
// 1 IF_ICMPGE
// 1 IF
// 1 IF
// JVM_IR_TEMPLATES
// 1 IF_ICMPGT
// 1 IF_ICMPLE
// 2 IF
@@ -1,23 +0,0 @@
// TARGET_BACKEND: JVM_IR
const val M = Char.MAX_VALUE
fun f(a: Char): Int {
var n = 0
for (i in a until M) {
n++
}
return n
}
// JVM non-IR uses while.
// JVM IR uses if + do-while.
// 0 iterator
// 0 getStart
// 0 getEnd
// 0 getFirst
// 0 getLast
// 0 getStep
// 1 IF_ICMPGT
// 1 IF_ICMPLE
// 2 IF
@@ -1,4 +1,3 @@
// TARGET_BACKEND: JVM_IR
const val M = Char.MIN_VALUE
fun f(a: Char): Int {
@@ -18,5 +17,10 @@ fun f(a: Char): Int {
// 0 getFirst
// 0 getLast
// 0 getStep
// 0 IF
// 0 LINENUMBER 7
// 0 LINENUMBER 7
// JVM_TEMPLATES
// 1 IF
// JVM_IR_TEMPLATES
// 0 IF
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
fun test(a: Int, b: Int): Int {
var sum = 0
for (i in a until b) {
@@ -16,5 +15,14 @@ fun test(a: Int, b: Int): Int {
// 0 getFirst
// 0 getLast
// 0 getStep
// JVM_TEMPLATES
// 1 IF_ICMPGE
// 1 IF
// 1 IF
// JVM_IR_TEMPLATES
// 1 LDC -2147483648
// 1 IF_ICMPEQ
// 1 IF_ICMPGT
// 1 IF_ICMPLE
// 3 IF
@@ -1,23 +0,0 @@
// TARGET_BACKEND: JVM_IR
fun test(a: Int, b: Int): Int {
var sum = 0
for (i in a until b) {
sum = sum * 10 + i
}
return sum
}
// JVM non-IR uses while.
// JVM IR uses if + do-while. In addition, for "until" progressions, there is a check that the range is not empty: upper bound != MIN_VALUE.
// 0 iterator
// 0 getStart
// 0 getEnd
// 0 getFirst
// 0 getLast
// 0 getStep
// 1 LDC -2147483648
// 1 IF_ICMPEQ
// 1 IF_ICMPGT
// 1 IF_ICMPLE
// 3 IF
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
const val M = Int.MAX_VALUE
fun f(a: Int): Int {
@@ -18,5 +17,12 @@ fun f(a: Int): Int {
// 0 getFirst
// 0 getLast
// 0 getStep
// JVM_TEMPLATES
// 1 IF_ICMPGE
// 1 IF
// 1 IF
// JVM_IR_TEMPLATES
// 1 IF_ICMPGT
// 1 IF_ICMPLE
// 2 IF
@@ -1,23 +0,0 @@
// TARGET_BACKEND: JVM_IR
const val M = Int.MAX_VALUE
fun f(a: Int): Int {
var n = 0
for (i in a until M) {
n++
}
return n
}
// JVM non-IR uses while.
// JVM IR uses if + do-while.
// 0 iterator
// 0 getStart
// 0 getEnd
// 0 getFirst
// 0 getLast
// 0 getStep
// 1 IF_ICMPGT
// 1 IF_ICMPLE
// 2 IF
@@ -1,4 +1,3 @@
// TARGET_BACKEND: JVM_IR
const val M = Int.MIN_VALUE
fun f(a: Int): Int {
@@ -18,5 +17,10 @@ fun f(a: Int): Int {
// 0 getFirst
// 0 getLast
// 0 getStep
// 0 IF
// 0 LINENUMBER 7
// 0 LINENUMBER 7
// JVM_TEMPLATES
// 1 IF
// JVM_IR_TEMPLATES
// 0 IF
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
fun test(a: Long, b: Long): Long {
var sum = 0L
for (i in a until b) {
@@ -16,6 +15,16 @@ fun test(a: Long, b: Long): Long {
// 0 getFirst
// 0 getLast
// 0 getStep
// JVM_TEMPLATES
// 1 LCMP
// 1 IFGE
// 1 IF
// 1 IF
// JVM_IR_TEMPLATES
// 1 LDC -9223372036854775808
// 3 LCMP
// 1 IFEQ
// 1 IFGT
// 1 IFLE
// 3 IF
@@ -1,24 +0,0 @@
// TARGET_BACKEND: JVM_IR
fun test(a: Long, b: Long): Long {
var sum = 0L
for (i in a until b) {
sum = sum * 10L + i
}
return sum
}
// JVM non-IR uses while.
// JVM IR uses if + do-while. In addition, for "until" progressions, there is a check that the range is not empty: upper bound != MIN_VALUE.
// 0 iterator
// 0 getStart
// 0 getEnd
// 0 getFirst
// 0 getLast
// 0 getStep
// 1 LDC -9223372036854775808
// 3 LCMP
// 1 IFEQ
// 1 IFGT
// 1 IFLE
// 3 IF
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
const val M = Long.MAX_VALUE
fun f(a: Long): Int {
@@ -18,6 +17,14 @@ fun f(a: Long): Int {
// 0 getFirst
// 0 getLast
// 0 getStep
// JVM_TEMPLATES
// 1 LCMP
// 1 IFGE
// 1 IF
// 1 IF
// JVM_IR_TEMPLATES
// 2 LCMP
// 1 IFGT
// 1 IFLE
// 2 IF
@@ -1,24 +0,0 @@
// TARGET_BACKEND: JVM_IR
const val M = Long.MAX_VALUE
fun f(a: Long): Int {
var n = 0
for (i in a until M) {
n++
}
return n
}
// JVM non-IR uses while.
// JVM IR uses if + do-while.
// 0 iterator
// 0 getStart
// 0 getEnd
// 0 getFirst
// 0 getLast
// 0 getStep
// 2 LCMP
// 1 IFGT
// 1 IFLE
// 2 IF
@@ -1,4 +1,3 @@
// TARGET_BACKEND: JVM_IR
const val M = Long.MIN_VALUE
fun f(a: Long): Int {
@@ -18,5 +17,10 @@ fun f(a: Long): Int {
// 0 getFirst
// 0 getLast
// 0 getStep
// 0 IF
// 0 LINENUMBER 7
// 0 LINENUMBER 7
// JVM_TEMPLATES
// 1 IF
// JVM_IR_TEMPLATES
// 0 IF