Mercurial > projects > ldc
diff gen/asm-x86-64.h @ 1320:1ad5a58b5c9d
Restrict second arg of certain floating-point stores to ST. Fix type postfix
for the two argument form of fistp and fisttp.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sat, 09 May 2009 08:58:41 +0200 |
parents | 85b80c4fe48a |
children | 5a9dc345c70a |
line wrap: on
line diff
--- a/gen/asm-x86-64.h Thu May 07 21:49:58 2009 +0200 +++ b/gen/asm-x86-64.h Sat May 09 08:58:41 2009 +0200 @@ -1849,6 +1849,16 @@ else mnemonic = opIdent->string; + // handle two-operand form where second arg is ignored. + // must be done before type_char detection + if ( op == Op_FidR_P || op == Op_fxch || op == Op_FfdRR_P ) + { + if (operands[1].cls == Opr_Reg && operands[1].reg == Reg_ST ) + nOperands = 1; + else + stmt->error("instruction allows only ST as second argument"); + } + if ( opInfo->needsType ) { PtrType exact_type = Default_Ptr; @@ -1913,27 +1923,6 @@ if ( operands[0].dataSize == Far_Ptr ) // %% type=Far_Ptr not set by Seg:Ofss OTOH, we don't support that.. insnTemplate << 'l'; } - else if ( op == Op_fxch || op == Op_FfdRR_P || op == Op_FidR_P ) - { - if ( operands[0].cls == Opr_Mem && op == Op_FidR_P ) - { - nOperands = 1; - } - // gas won't accept the two-operand form - else if ( operands[1].cls == Opr_Reg && operands[1].reg == Reg_ST ) - { - nOperands = 1; - } - else if ( operands[0].cls == Opr_Reg && (operands[0].reg == Reg_ST1 || operands[0].reg == Reg_ST )) - { - //fix previous update to allow single operand form of fstp - } - else - { - stmt->error ( "invalid operands" ); - return false; - } - } else if ( op == Op_FMath0 || op == Op_FdST0ST1 ) { operands[0].cls = Opr_Reg;