Normally mov rdi, [0x123456] is fine, AT&T mov 0x123456, %rdi.
In this special case, your address 0xdeadbeef is outside the low 2GiB so you can't use a normal 32-bit absolute address. But it's within the low 4GiB, so you can use a 32-bit address-size override to get a 32-bit zero-extended address instead of needing movabs with a full 64-bit absolute address (moffs), or moving an imm64 to a register to set up for mov (%rdi), %rdi
NASM syntax:
a32 mov rdi, [a32 abs 0xdeadbeef]
GAS AT&T syntax:
addr32 mov 0xdeadbeef, %rdi
Both assemble to the same machine code, which objdump disassembles as:
67 48 8b 3c 25 ef be ad de mov 0xdeadbeef(,%eiz,1),%rdi
32-bit absolute [disp32] uses a SIB with no index (the longer of the two redundant encodings in 32-bit machine code for a [disp32] absolute addressing mode), so that's probably why it disassembles that way. The shorter of the two encodings was repurposed for x86-64 to be [RIP+rel32].
An address-size prefix costs 1 extra byte, but does execute efficiently on existing CPUs. It does not cause an LCP stall on Intel CPUs unless you use it on movabs, because the length of the rest of the instruction is the same with or without it. (Unlike in 32-bit mode where it overrides the interpretation of disp32 to be disp16, and ModRM to be 16-bit style with no optional SIB).
The other option is mov $imm32, %r32 (5 bytes) to get the address zero-extended that way. This is 2 separate instructions but actually smaller machine code size: 8 total bytes vs. 9 for mov with an absolute 32-bit address. It will still decode to 2 uops, so it's less efficient than the single-instruction load.
401009: bf ef be ad de mov $0xdeadbeef,%edi
40100e: 48 8b 3f mov (%rdi),%rdi
Alternatives in NASM syntax for full 64-bit addresses, as in
Load from a 64-bit address into other register than rax
mov rsi, 0x000000efdeadbeef ; address into register
mov rsi, [rsi]
mov rax, [qword 0x00000000deadbeef] ; moffs64 load into RAX, then copy
mov rdi, rax
AT&T Disassembly:
401011: 48 be ef be ad de ef 00 00 00 movabs $0xefdeadbeef,%rsi
40101b: 48 8b 36 mov (%rsi),%rsi
40101e: 48 a1 ef be ad de 00 00 00 00 movabs 0xdeadbeef,%rax
401028: 48 89 c7 mov %rax,%rdi
If you omit the qword in [qword 0xdeadbeef], NASM will warn warning: dword data exceeds bounds and emits:
# without forcing qword address encoding for NASM, it truncates to a disp32
48 8b 04 25 ef be ad de mov rax,QWORD PTR ds:0xffffffffdeadbeef