$ cat fpu.c long double emit_fldlg2() { return 0.3010299956639811952256464283594894482L; } long double emit_fldln2() { return 0.6931471805599453094286904741849753009L; /* or M_LN2l */ } long double emit_fldl2e() { return 1.4426950408889634073876517827983434472L; /* or M_LOG2El */ } long double emit_fldl2t() { return 3.3219280948873623478083405569094566090L; } long double emit_fldpi() { return 3.1415926535897932385128089594061862044L; /* or M_PIl */ }
for 32-bit mode we get nice output: $ gcc fpu.c -O1 -c -m32 -fomit-frame-pointer && objdump -d fpu.o 00000000 <emit_fldlg2>: 0: d9 ec fldlg2 2: c3 ret 00000003 <emit_fldln2>: 3: d9 ed fldln2 5: c3 ret 00000006 <emit_fldl2e>: 6: d9 ea fldl2e 8: c3 ret 00000009 <emit_fldl2t>: 9: d9 e9 fldl2t b: c3 ret 0000000c <emit_fldpi>: c: d9 eb fldpi e: c3 ret for 64-bits mode we get only memory loads :/ $ gcc fpu.c -O1 -c -m64 && objdump -d fpu.o 0000000000000000 <emit_fldlg2>: 0: db 2d 00 00 00 00 fldt 0(%rip) # 6 <emit_fldlg2+0x6> 6: c3 retq 0000000000000007 <emit_fldln2>: 7: db 2d 00 00 00 00 fldt 0(%rip) # d <emit_fldln2+0x6> d: c3 retq 000000000000000e <emit_fldl2e>: e: db 2d 00 00 00 00 fldt 0(%rip) # 14 <emit_fldl2e+0x6> 14: c3 retq 0000000000000015 <emit_fldl2t>: 15: db 2d 00 00 00 00 fldt 0(%rip) # 1b <emit_fldl2t+0x6> 1b: c3 retq 000000000000001c <emit_fldpi>: 1c: db 2d 00 00 00 00 fldt 0(%rip) # 22 <emit_fldpi+0x6> 22: c3 retq -- Summary: 80387 constants not emitted in 64-bit mode. Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pluto at agmk dot net GCC target triplet: x86_64-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31054