changeset 355:0b4d4f06bf91

Add support for setcc in x86 module. Add support for translating il skipIf:else and il bool instructions in x86 module.
author Michael Pavone <pavone@retrodev.com>
date Wed, 15 Apr 2015 21:14:44 -0700
parents a6cdcc1b1c02
children 3b023e5a0b42
files modules/x86.tp
diffstat 1 files changed, 24 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/modules/x86.tp	Wed Apr 15 20:08:38 2015 -0700
+++ b/modules/x86.tp	Wed Apr 15 21:14:44 2015 -0700
@@ -580,6 +580,13 @@
 				inst: 0xFFu8 | (mod_rm: (opex: 2u8) callDest)
 			}
 		}
+		
+		setcc <- :cond dst {
+			src <- opex: 0u8
+			base <- 0x0Fu8 | (0x90u8 or (cond cc)) | (mod_rm: (opex: 0u8) dst)
+			
+			inst: (prefix: fakesrc dst b withInstruction: base)
+		}
 
 		push <- :src {
 			if: (src isInteger?) {
@@ -812,7 +819,20 @@
 					outarr append: endlab
 				}
 				//skipIf:else
-				{ }
+				{
+					endlab <- label:
+					elselab <- label:
+					outarr append: (jcc: (mapcond: (inst cond)) elselab)
+					foreach: (inst toskip) :_ inst {
+						convertIL: inst to: outarr withLabels: labels withSaved: saved
+					}
+					outarr append: (jmp: endlab)
+					outarr append: elselab
+					foreach: (inst else) :_ inst {
+						convertIL: inst to: outarr withLabels: labels withSaved: saved
+					}
+					outarr append: endlab
+				}
 				{
 					//save
 					newsave <- []
@@ -830,7 +850,9 @@
 					}
 				}
 				//bool
-				{ }
+				{
+					outarr append: (setcc: (mapcond: (inst cond)) (inst out))
+				}
 			]
 			print: "Opcode: " . (inst opcode) . "\n"
 			fun <- opmap get: (inst opcode)