mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 06:19:37 +01:00 
			
		
		
		
	* transform into a real test that fails if wrong code is generated
This commit is contained in:
		
							parent
							
								
									0c0fdec501
								
							
						
					
					
						commit
						9abb839d34
					
				@ -4,23 +4,38 @@
 | 
			
		||||
{ Submitted by "Maxim Voronov" on  2002-10-03 }
 | 
			
		||||
{ e-mail: m_v_voronov@mail.ru }
 | 
			
		||||
 | 
			
		||||
{$asmmode intel}
 | 
			
		||||
Program test;
 | 
			
		||||
 | 
			
		||||
  Function TestProc:single;
 | 
			
		||||
    begin
 | 
			
		||||
{$asmmode intel}
 | 
			
		||||
  Function GetXminusYintel(x,y : extended):extended; assembler;
 | 
			
		||||
      asm
 | 
			
		||||
        push    eax
 | 
			
		||||
        fldz
 | 
			
		||||
        fldz
 | 
			
		||||
        fldz
 | 
			
		||||
        fsubp   st(2),st(0)
 | 
			
		||||
        fstp    st(0)
 | 
			
		||||
        pop     eax
 | 
			
		||||
        fld     x
 | 
			
		||||
        fld     y
 | 
			
		||||
        fsubp   st(1),st(0)
 | 
			
		||||
      end;
 | 
			
		||||
    end;
 | 
			
		||||
 | 
			
		||||
{$asmmode att}
 | 
			
		||||
  Function GetXminusYatt(x,y : extended):extended; assembler;
 | 
			
		||||
      asm
 | 
			
		||||
        fld     y
 | 
			
		||||
        fld     x
 | 
			
		||||
        fsubp   %st,%st(1)
 | 
			
		||||
      end;
 | 
			
		||||
 | 
			
		||||
  var
 | 
			
		||||
    eatt,eintel : extended;
 | 
			
		||||
 | 
			
		||||
  Begin
 | 
			
		||||
    writeln;
 | 
			
		||||
    writeln(TestProc);
 | 
			
		||||
 | 
			
		||||
    eintel:= GetXminusYintel(2.0,1.0);
 | 
			
		||||
    writeln(eintel);
 | 
			
		||||
    eatt:= GetXminusYatt(2.0,1.0);
 | 
			
		||||
    writeln(eatt);
 | 
			
		||||
    if eintel<>eatt then
 | 
			
		||||
      begin
 | 
			
		||||
        writeln('intel fsubp is not translated properly into fsubrp');
 | 
			
		||||
        halt(1);
 | 
			
		||||
      end;
 | 
			
		||||
  End.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user