inlining produces inefficient code
Original Reporter info from Mantis: Thorsten Engler
-
Reporter name: Thorsten Engler
Original Reporter info from Mantis: Thorsten Engler
- Reporter name: Thorsten Engler
Description:
The source under "Additional Information" creates the following code (with -O3p3):
movl $1382236160,88(%esp)
movl $116415,92(%esp)
movl $0,96(%esp)
movl 88(%esp),%eax
movl %eax,(%esp)
movl 92(%esp),%eax
movl %eax,4(%esp)
movl 96(%esp),%eax
movl %eax,8(%esp)
I should be able to recognize that no temp is required here and directly write into the variable?
Additional information:
type
Int96 = packed record
case Integer of
0:
(
{$IFDEF ENDIAN_LITTLE}
Lo32 : DWord;
case Integer of
0:
(
Mid32 : DWord;
Hi32 : LongInt;
);
1:
( Hi64: Int64; );
{$ELSE ENDIAN_LITTLE}
Hi32 : LongInt;
case Integer of
0:
(
Mid32 : DWord;
Lo32 : DWord;
);
1:
( Lo64: QWord; );
{$ENDIF ENDIAN_LITTLE}
);
1:
(
{$IFDEF ENDIAN_LITTLE}
Lo64 : QWord;
{$ELSE ENDIAN_LITTLE}
Hi64 : Int64;
{$ENDIF ENDIAN_LITTLE}
);
end;
operator := (const Right: QWord) Result : Int96; inline;
begin
Result.Lo64 := Right;
Result.Hi32 := 0;
end;
procedure Test;
var
a : Int96;
begin
a := 500000000000000;
end;
Mantis conversion info:
- Mantis ID: 8283
- Version: 2.2.0
- Fixed in version: 2.2.0
- Fixed in revision: 6380 (#00e16ec7)
- Target version: 2.4.0