Repository navigation
Fix errors from ordered comparisons in iselectEvaluator - #6815
Conversation
0270a91 to
ef03f18
Compare
| FEATURES(0)), | ||
| INSTRUCTION(CMOVA4RegReg, cmova, | ||
| BINARY(VEX_L___, VEX_vNONE, PREFIX___, REX__, ESCAPE_0F__, 0x47, 0, ModRM_RM__, Immediate_0), | ||
| PROPERTY0(IA32OpProp_ModifiesTarget | IA32OpProp_SourceRegisterInModRM | IA32OpProp_IntSource | IA32OpProp_IntTarget | IA32OpProp_TestsCarryFlag | IA32OpProp_TestsZeroFlag), |
There was a problem hiding this comment.
@0xdaryl @kevindean12 Can we please review IA32OpProp properties more closely for the newly added X86Ops, especially - IA32OpProp_IntSource and IA32OpProp_IntTarget ?
| } | ||
| else if (compareSize == 2) | ||
| { | ||
| //shouldn't use Imm2 instructions |
There was a problem hiding this comment.
Can you explain this comment?
There was a problem hiding this comment.
I'm following an approach taken in similar circumstances in compareIntegersForEquality() where 2-byte immediates are avoided in favor of using the MemReg form instead, which as I understand is due to the fact that using 16-bit immediate operands can result in slower instruction decoding because of the need for an operand-size prefix in the encoding to specify the 2-byte size.
|
Would you mind rebasing this PR please so I can conduct some tests with OpenJ9? |
-Check size of comparison and emit appropriate compare instruction for 1 and 2 byte compares in compareIntegersForOrder -Use unsigned cmovcc instructions in iselectEvaluator when evaluating an unsigned comparison for the select condition
ef03f18 to
14c2be3
Compare
|
Rebased! |
|
Downstream testing is successful. Merging. |
In compareIntegersForOrder, check size of comparisons in the condition node of the iselect/lselect (the datatype of the condition is always int32, but it may be a comparison operation with operands of a different size - for example, a bcmpgt). Then emit the appropriate compare instruction for 1 and 2 byte compares in order to avoid issuing a 4-byte cmp for comparison operands smaller than 4 bytes, which potentially includes garbage in the upper part of the register in the comparison. Use unsigned cmovcc (cmova/cmovb vs cmovg/cmovl) instructions in iselectEvaluator when evaluating an unsigned comparison for the select condition.