x86: replace Reg8, Reg16, Reg32, and Reg64
[deliverable/binutils-gdb.git] / gas / config / tc-riscv.c
index 8bb400e1001bbb74ade4db73c6c2c3e552634ee5..c2e5f30e506e3a4b4d4530565bd6d05e9c7bd5a7 100644 (file)
@@ -2319,10 +2319,18 @@ bfd_boolean
 riscv_frag_align_code (int n)
 {
   bfd_vma bytes = (bfd_vma) 1 << n;
-  bfd_vma worst_case_bytes = bytes - (riscv_opts.rvc ? 2 : 4);
-  char *nops = frag_more (worst_case_bytes);
+  bfd_vma insn_alignment = riscv_opts.rvc ? 2 : 4;
+  bfd_vma worst_case_bytes = bytes - insn_alignment;
+  char *nops;
   expressionS ex;
 
+  /* If we are moving to a smaller alignment than the instruction size, then no
+     alignment is required. */
+  if (bytes <= insn_alignment)
+    return TRUE;
+
+  nops = frag_more (worst_case_bytes);
+
   /* When not relaxing, riscv_handle_align handles code alignment.  */
   if (!riscv_opts.relax)
     return FALSE;
This page took 0.022996 seconds and 4 git commands to generate.