optimization/3701: can't optimize asm version of lrint()

cartley@lgc.com cartley@lgc.com
Mon Jul 16 16:06:00 GMT 2001


>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



More information about the Gcc-bugs mailing list