if (i.imm_operands)
optimize_imm ();
- if (i.disp_operands && !want_disp32 (current_templates->start))
+ if (i.disp_operands && !want_disp32 (current_templates->start)
+ && (!current_templates->start->opcode_modifier.jump
+ || i.jumpabsolute || i.types[0].bitfield.baseindex))
{
for (j = 0; j < i.operands; ++j)
{
/* Optimize 64-bit displacement to 32-bit for 64-bit BFD. */
if ((i.types[op].bitfield.disp32
|| (flag_code == CODE_64BIT
- && want_disp32 (current_templates->start)))
+ && want_disp32 (current_templates->start)
+ && (!current_templates->start->opcode_modifier.jump
+ || i.jumpabsolute || i.types[op].bitfield.baseindex)))
&& fits_in_unsigned_long (op_disp))
{
/* If this operand is at most 32 bits, convert
run_dump_test "x86-64-branch-3"
run_list_test "x86-64-branch-4" "-al -mintel64"
run_list_test "x86-64-branch-5" "-al"
+ run_dump_test "x86-64-branch-6"
run_dump_test "x86-64-rip-2"
--- /dev/null
+#objdump: -r
+#name: x86-64 branch 6
+#warning_output: x86-64-branch-6.e
+
+.*: +file format .*
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET +TYPE +VALUE *
+0+01 R_X86_64_PC32 +\*ABS\*\+0x000000008765431d
+0+11 R_X86_64_PC32 +\*ABS\*\+0x000000087654320c
+0+21 R_X86_64_PC32 +\*ABS\*\+0x000000008765431d
+0+31 R_X86_64_PC32 +\*ABS\*\+0x000000087654320c
+0+07 R_X86_64_PC32 +\*ABS\*\+0x000000008765431d
+0+0c R_X86_64_PC32 +\*ABS\*\+0x000000008765431d
+0+17 R_X86_64_PC32 +\*ABS\*\+0x000000087654320c
+0+1c R_X86_64_PC32 +\*ABS\*\+0x000000087654320c
+0+27 R_X86_64_PC32 +\*ABS\*\+0x000000008765431d
+0+2c R_X86_64_PC32 +\*ABS\*\+0x000000008765431d
+0+37 R_X86_64_PC32 +\*ABS\*\+0x000000087654320c
+0+3c R_X86_64_PC32 +\*ABS\*\+0x000000087654320c
+#pass
--- /dev/null
+.*: Assembler messages:
+.*:12: Warning: skipping prefixes on `call'
+.*:13: Warning: skipping prefixes on `je'
+.*:14: Warning: skipping prefixes on `jmp'
+.*:16: Warning: skipping prefixes on `call'
+.*:17: Warning: skipping prefixes on `je'
+.*:18: Warning: skipping prefixes on `jmp'
--- /dev/null
+ .text
+
+branch_6:
+ call 0x87654321
+ je 0x87654321
+ jmp 0x87654321
+
+ call 0x876543210
+ je 0x876543210
+ jmp 0x876543210
+
+ addr32 call 0x87654321
+ addr32 je 0x87654321
+ addr32 jmp 0x87654321
+
+ addr32 call 0x876543210
+ addr32 je 0x876543210
+ addr32 jmp 0x876543210