[llvm-dev] Unexplained absolute addressing mode generated on amd64/FreeBSD. Bug?

Robert Clausecker via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 22 09:33:17 PST 2021


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

-- 
()  ascii ribbon campaign - for an 8-bit clean world 
/\  - against html email  - against proprietary attachments


More information about the llvm-dev mailing list