This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
optimization/3701: can't optimize asm version of lrint()
- To: gcc-gnats at gcc dot gnu dot org
- Subject: optimization/3701: can't optimize asm version of lrint()
- From: cartley at lgc dot com
- Date: 16 Jul 2001 23:02:21 -0000
- Reply-To: cartley at lgc dot com
>Number: 3701
>Category: optimization
>Synopsis: can't optimize asm version of lrint()
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 16 16:06:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Craig Artley
>Release: gcc version 3.0
>Organization:
>Environment:
Linux 2.4.2 kernel, glibc 2.2.12, Intel P-III
>Description:
Attempts to use standard lrint() function from math.h
or similar asm() calls fail when optimization is turned on.
Generates errors like:
$ g++ -O3 round.cpp
/usr/include/bits/mathinline.h: In function `int main(int, char**)':
/usr/include/bits/mathinline.h:666: output number 0 not directly addressable
round.cpp:11: output number 0 not directly addressable
The lrint() uses the fistpl instruction via asm().
>How-To-Repeat:
Save as round.cpp and compile with
g++ -O3 round.cpp
/usr/include/bits/mathinline.h: In function `int main(int, char**)':
/usr/include/bits/mathinline.h:666: output number 0 not directly addressable
round.cpp:11: output number 0 not directly addressable
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="round.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="round.cpp"
Lyogc2F2ZSB0aGlzIGFzIHJvdW5kLmNwcCBhbmQgY29tcGlsZSB3aXRoIGcrKyAtTzMgcm91bmQu
Y3BwICovCgojaW5jbHVkZSA8bWF0aC5oPgojaW5jbHVkZSA8c3RkbGliLmg+CiNpbmNsdWRlIDxp
b3N0cmVhbT4KCi8qIHRoaXMgaXMgYmFzaWNhbGx5IHRoZSBlcXVpdmFsZW50IG9mIGxyaW50KCkg
Ki8Kc3RhdGljIGlubGluZSBsb25nIGZhc3Ryb3VuZCAoZmxvYXQgdmFsKQp7CiAgbG9uZyByZXQ7
CiAgYXNtICgiZmlzdHBsICUwIiA6ICI9bSIgKHJldCkgOiAidCIgKHZhbCkgOiAic3QiKTsKICBy
ZXR1cm4gcmV0Owp9CgppbnQKbWFpbiAoaW50IGFyZ2MsIGNoYXIqIGFyZ3ZbXSkKewogIGZsb2F0
IHggPSAwLjVmOwoKICBzdGQ6OmNvdXQgPDx4IDw8IjogICIgPDxscmludCh4KSA8PCJcbiI7CiAg
c3RkOjpjb3V0IDw8eCA8PCI6ICAiIDw8ZmFzdHJvdW5kKHgpIDw8IlxuIjsKCiAgcmV0dXJuIDA7
Cn0K