From f0f64a573b60bf728e3253a24f049d39ca687d9c Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 22 Feb 2012 20:13:38 +0000 Subject: [PATCH] * don't pack softfpu helper records and added dummy for proper alignment, generates much better code on CPUs like arm git-svn-id: trunk@20398 - --- rtl/inc/softfpu.pp | 73 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 51 insertions(+), 22 deletions(-) diff --git a/rtl/inc/softfpu.pp b/rtl/inc/softfpu.pp index 8adea4bf17..0ab536e96f 100644 --- a/rtl/inc/softfpu.pp +++ b/rtl/inc/softfpu.pp @@ -129,24 +129,40 @@ TYPE sbits64 = int64; {$ifdef ENDIAN_LITTLE} - float64 = packed record - low: bits32; - high: bits32; + float64 = record + case byte of + 1: (low,high : bits32); + // force the record to be aligned like a double + // else *_to_double will fail for cpus like sparc + // and avoid expensive unpacking/packing operations + 2: (dummy : double); end; - int64rec = packed record - low: bits32; - high: bits32; + int64rec = record + case byte of + 1: (low,high : bits32); + // force the record to be aligned like a double + // else *_to_double will fail for cpus like sparc + // and avoid expensive unpacking/packing operations + 2: (dummy : int64); end; - floatx80 = packed record - low : qword; - high : word; + floatx80 = record + case byte of + 1: (low : qword;high : word); + // force the record to be aligned like a double + // else *_to_double will fail for cpus like sparc + // and avoid expensive unpacking/packing operations + 2: (dummy : extended); end; - float128 = packed record - low : qword; - high : qword; + float128 = record + case byte of + 1: (low,high : qword); + // force the record to be aligned like a double + // else *_to_double will fail for cpus like sparc + // and avoid expensive unpacking/packing operations + 2: (dummy : qword); end; {$else} float64 = record @@ -157,18 +173,31 @@ TYPE 2: (dummy : double); end; - int64rec = packed record - high,low : bits32; + int64rec = record + case byte of + 1: high,low : bits32; + // force the record to be aligned like a double + // else *_to_double will fail for cpus like sparc + // and avoid expensive unpacking/packing operations + 2: (dummy : int64); +end; + + floatx80 = record + case byte of + 1: (high : word;low : qword); + // force the record to be aligned like a double + // else *_to_double will fail for cpus like sparc + // and avoid expensive unpacking/packing operations + 2: (dummy : qword); end; - floatx80 = packed record - high : word; - low : qword; - end; - - float128 = packed record - high : qword; - low : qword; + float128 = record + case byte of + 1: (high : qword;low : qword); + // force the record to be aligned like a double + // else *_to_double will fail for cpus like sparc + // and avoid expensive unpacking/packing operations + 2: (dummy : qword); end; {$endif}