x86: Fix the flag handling code in FABS and FCHS
authorAndreas Sandberg <andreas@sandberg.pp.se>
Tue, 18 Jun 2013 14:10:21 +0000 (16:10 +0200)
committerAndreas Sandberg <andreas@sandberg.pp.se>
Tue, 18 Jun 2013 14:10:21 +0000 (16:10 +0200)
This changeset fixes two problems in the FABS and FCHS
implementation. First, the ISA parser expects the assignment in
flag_code to be a pure assignment and not an and-assignment, which
leads to the isa_parser omitting the misc reg update. Second, the FCHS
and FABS macro-ops don't set the SetStatus flag, which means that the
default micro-op version, which doesn't update FSW, is executed.

src/arch/x86/isa/insts/x87/arithmetic/change_sign.py
src/arch/x86/isa/microops/fpop.isa

index 779f1b5b25e65423c1594d699970045cc0864634..207b8a0b093e7701ff63925b112fc61b02a514d5 100644 (file)
 microcode = '''
 
 def macroop FABS {
-    absfp st(0), st(0)
+    absfp st(0), st(0), SetStatus=True
 };
 
 def macroop FCHS {
-    chsfp st(0), st(0)
+    chsfp st(0), st(0), SetStatus=True
 };
 '''
index abb6abb72747e24857bee8d8b005bd6a5278be7d..e6372ba6be891e75432c89316ba787801b3fc794 100644 (file)
@@ -365,9 +365,9 @@ let {{
 
     class absfp(FpUnaryOp):
         code = 'FpDestReg = fabs(FpSrcReg1);'
-        flag_code = 'FSW &= (~CC1Bit);'
+        flag_code = 'FSW = FSW & (~CC1Bit);'
 
     class chsfp(FpUnaryOp):
         code = 'FpDestReg = (-1) * (FpSrcReg1);'
-        flag_code = 'FSW &= (~CC1Bit);'
+        flag_code = 'FSW = FSW & (~CC1Bit);'
 }};