Good evening!
I'm experiencing weird code generation on amd64 FreeBSD with the
system's clang 10.0.1. specifically, an absolute addressing mode is
unexpectedly chosen for ucomisd with a memory constant where I would
normally expect a rip-relative addressing mode. The behaviour has
proven to be hard to reproduce. Any attempt to simplify the code leads
to perfectly fine code. To reproduce, download my project:
http://fuz.su/~fuz/dobutsu/dobutsu-2.tar.xz
and compile dobutsu.c with -O3 on amd64/FreeBSD (Linux should work,
too). The output has a bunch of instructions like this:
ucomisd .LCPI0_0, %xmm1
with an absolute addressing mode where I would expect a relative
addressing mode like
ucomisd .LCPI0_0(%rip), %xmm1
I wonder what the reason for this could be. I can reproduce this
error with clang 11.0.1 from FreeBSD but haven't been able to test
12.0. Will continue to try and reduce the example.
Yours,
Robert Clausecker