-
Enhancement
-
Resolution: Unresolved
-
P4
-
20
Currently, pre-conditions to apply IR checks to a test can be expressed using the following constructs:
applyIf = {FLAG, VALUE}
applyIfNot = {FLAG, VALUE}
applyIfAnd = {FLAG1, VALUE1, FLAG2, VALUE2, ...}
applyIfOr = {FLAG1, VALUE1, FLAG2, VALUE2, ...}
applyIfCPUFeature = {CPU_FEATURE, VALUE}
applyIfCPUFeatureAnd = {CPU_FEATURE, VALUE1, CPU_FEATURE, VALUE2, ...}
applyIfCPUFeatureOr = {CPU_FEATURE, VALUE1, CPU_FEATURE, VALUE2, ...}
It would be more powerful, and simpler for the user, to provide a single construct
applyIf = "EXPR"
where EXPR is a general logical expression allowing the user to mix CPU feature conditions, flags, os conditions, etc. For example:
@IR(applyIf "vm.compiler2.enabled & (vm.cpu.features ~= '.*avx2.*' | vm.cpu.features ~= ".*sve.*) & vm.opt.LoopMaxUnroll > 0", ...
As hinted in the example, pre-conditions could use the same language used by jtreg to express test requirements ("@requires"). The jtreg parser itself (https://github.com/openjdk/jtreg/blob/master/src/share/classes/com/sun/javatest/regtest/config/Expr.java) could perhaps be reused by the test IR framework.
applyIf = {FLAG, VALUE}
applyIfNot = {FLAG, VALUE}
applyIfAnd = {FLAG1, VALUE1, FLAG2, VALUE2, ...}
applyIfOr = {FLAG1, VALUE1, FLAG2, VALUE2, ...}
applyIfCPUFeature = {CPU_FEATURE, VALUE}
applyIfCPUFeatureAnd = {CPU_FEATURE, VALUE1, CPU_FEATURE, VALUE2, ...}
applyIfCPUFeatureOr = {CPU_FEATURE, VALUE1, CPU_FEATURE, VALUE2, ...}
It would be more powerful, and simpler for the user, to provide a single construct
applyIf = "EXPR"
where EXPR is a general logical expression allowing the user to mix CPU feature conditions, flags, os conditions, etc. For example:
@IR(applyIf "vm.compiler2.enabled & (vm.cpu.features ~= '.*avx2.*' | vm.cpu.features ~= ".*sve.*) & vm.opt.LoopMaxUnroll > 0", ...
As hinted in the example, pre-conditions could use the same language used by jtreg to express test requirements ("@requires"). The jtreg parser itself (https://github.com/openjdk/jtreg/blob/master/src/share/classes/com/sun/javatest/regtest/config/Expr.java) could perhaps be reused by the test IR framework.
- relates to
-
JDK-8280120 [IR Framework] Add attribute to @IR to enable/disable IR matching based on the architecture
-
- Resolved
-