From 0be6953fee765c08c952462938f133fed181166e Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 19 Nov 2018 16:50:41 -0800 Subject: [PATCH] arch: Make the ISA parser always use binary floating point accessors. Any operands which use read_code or write_code would need to start using the floatToBits and bitsToFloat, but only ARM is using that mechanism, and not on float operands. Also I notice that the "predicate" mechanism for operands ignores the read_code and write_code mechanism, and using both will not work correctly. This change makes no attempt to fix that problem, but shouldn't contribute to it either. Change-Id: I0e3a7f78ed28f40cb66958ef12c32e862950fde0 Reviewed-on: https://gem5-review.googlesource.com/c/14456 Reviewed-by: Giacomo Travaglini Reviewed-by: Brandon Potter Maintainer: Gabe Black --- src/arch/isa_parser.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/arch/isa_parser.py b/src/arch/isa_parser.py index a65149fe0..9ac761279 100755 --- a/src/arch/isa_parser.py +++ b/src/arch/isa_parser.py @@ -617,35 +617,37 @@ class FloatRegOperand(Operand): return c_src + c_dest def makeRead(self, predRead): - bit_select = 0 - if (self.ctype == 'float' or self.ctype == 'double'): - func = 'readFloatRegOperand' - else: - func = 'readFloatRegOperandBits' if self.read_code != None: - return self.buildReadCode(func) + return self.buildReadCode('readFloatRegOperandBits') if predRead: rindex = '_sourceIndex++' else: rindex = '%d' % self.src_reg_idx - return '%s = xc->%s(this, %s);\n' % \ - (self.base_name, func, rindex) + code = 'xc->readFloatRegOperandBits(this, %s)' % rindex + if self.ctype == 'float': + code = 'bitsToFloat32(%s)' % code + elif self.ctype == 'double': + code = 'bitsToFloat64(%s)' % code + return '%s = %s;\n' % (self.base_name, code) def makeWrite(self, predWrite): - if (self.ctype == 'float' or self.ctype == 'double'): - func = 'setFloatRegOperand' - else: - func = 'setFloatRegOperandBits' if self.write_code != None: - return self.buildWriteCode(func) + return self.buildWriteCode('setFloatRegOperandBits') if predWrite: wp = '_destIndex++' else: wp = '%d' % self.dest_reg_idx - wp = 'xc->%s(this, %s, final_val);' % (func, wp) + + val = 'final_val' + if self.ctype == 'float': + val = 'floatToBits32(%s)' % val + elif self.ctype == 'double': + val = 'floatToBits64(%s)' % val + + wp = 'xc->setFloatRegOperandBits(this, %s, %s);' % (wp, val) wb = ''' { -- 2.30.2