comparison 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
comparison
equal deleted inserted replaced
1314:acc5d68a21d3 1320:1ad5a58b5c9d
1847 if ( opInfo->linkType == Out_Mnemonic ) 1847 if ( opInfo->linkType == Out_Mnemonic )
1848 mnemonic = alternateMnemonics[opInfo->link]; 1848 mnemonic = alternateMnemonics[opInfo->link];
1849 else 1849 else
1850 mnemonic = opIdent->string; 1850 mnemonic = opIdent->string;
1851 1851
1852 // handle two-operand form where second arg is ignored.
1853 // must be done before type_char detection
1854 if ( op == Op_FidR_P || op == Op_fxch || op == Op_FfdRR_P )
1855 {
1856 if (operands[1].cls == Opr_Reg && operands[1].reg == Reg_ST )
1857 nOperands = 1;
1858 else
1859 stmt->error("instruction allows only ST as second argument");
1860 }
1861
1852 if ( opInfo->needsType ) 1862 if ( opInfo->needsType )
1853 { 1863 {
1854 PtrType exact_type = Default_Ptr; 1864 PtrType exact_type = Default_Ptr;
1855 PtrType min_type = Default_Ptr; 1865 PtrType min_type = Default_Ptr;
1856 PtrType hint_type = Default_Ptr; 1866 PtrType hint_type = Default_Ptr;
1910 } 1920 }
1911 else if ( op == Op_Branch ) 1921 else if ( op == Op_Branch )
1912 { 1922 {
1913 if ( operands[0].dataSize == Far_Ptr ) // %% type=Far_Ptr not set by Seg:Ofss OTOH, we don't support that.. 1923 if ( operands[0].dataSize == Far_Ptr ) // %% type=Far_Ptr not set by Seg:Ofss OTOH, we don't support that..
1914 insnTemplate << 'l'; 1924 insnTemplate << 'l';
1915 }
1916 else if ( op == Op_fxch || op == Op_FfdRR_P || op == Op_FidR_P )
1917 {
1918 if ( operands[0].cls == Opr_Mem && op == Op_FidR_P )
1919 {
1920 nOperands = 1;
1921 }
1922 // gas won't accept the two-operand form
1923 else if ( operands[1].cls == Opr_Reg && operands[1].reg == Reg_ST )
1924 {
1925 nOperands = 1;
1926 }
1927 else if ( operands[0].cls == Opr_Reg && (operands[0].reg == Reg_ST1 || operands[0].reg == Reg_ST ))
1928 {
1929 //fix previous update to allow single operand form of fstp
1930 }
1931 else
1932 {
1933 stmt->error ( "invalid operands" );
1934 return false;
1935 }
1936 } 1925 }
1937 else if ( op == Op_FMath0 || op == Op_FdST0ST1 ) 1926 else if ( op == Op_FMath0 || op == Op_FdST0ST1 )
1938 { 1927 {
1939 operands[0].cls = Opr_Reg; 1928 operands[0].cls = Opr_Reg;
1940 operands[0].reg = Reg_ST1; 1929 operands[0].reg = Reg_ST1;