25
25
package com .oracle .svm .core .graal .amd64 ;
26
26
27
27
import static com .oracle .svm .core .util .VMError .unsupportedFeature ;
28
+ import static jdk .vm .ci .amd64 .AMD64 .k0 ;
28
29
import static jdk .vm .ci .amd64 .AMD64 .k1 ;
29
30
import static jdk .vm .ci .amd64 .AMD64 .k2 ;
30
31
import static jdk .vm .ci .amd64 .AMD64 .k3 ;
@@ -129,14 +130,14 @@ public SubstrateAMD64RegisterConfig(ConfigKind config, MetaAccessProvider metaAc
129
130
boolean haveAVX512 = ((AMD64 ) target .arch ).getFeatures ().contains (AMD64 .CPUFeature .AVX512F );
130
131
ArrayList <Register > regs ;
131
132
if (haveAVX512 ) {
132
- /*
133
- * GR-40969: We would like to use valueRegistersAVX512. However, we emit a mix of VEX
134
- * and EVEX encoded instructions, and the VEX variants cannot address the extended
135
- * AVX-512 registers (XMM16-31). For now, limit ourselves to XMM0-15.
136
- */
137
133
regs = new ArrayList <>();
138
134
regs .addAll (valueRegistersAVX512 );
139
- regs .addAll (MASK_REGISTERS );
135
+ /*
136
+ * valueRegistersAVX512 contains all mask registers, including k0. k0 is not a general
137
+ * allocatable register, most instructions that read it interpret it as "no opmask"
138
+ * rather than as a real opmask register.
139
+ */
140
+ regs .remove (k0 );
140
141
} else {
141
142
regs = new ArrayList <>();
142
143
regs .addAll (valueRegistersSSE );
@@ -146,6 +147,7 @@ public SubstrateAMD64RegisterConfig(ConfigKind config, MetaAccessProvider metaAc
146
147
regs .addAll (MASK_REGISTERS );
147
148
}
148
149
}
150
+ VMError .guarantee (!regs .contains (k0 ), "We must never treat k0 as a general allocatable register." );
149
151
150
152
if (Platform .includedIn (InternalPlatform .WINDOWS_BASE .class )) {
151
153
// This is the Windows 64-bit ABI for parameters.
0 commit comments