[mips] Push `fixup_Mips_LO16` fixup for `jialc` and `jic` instructions

llvm-svn: 373591
This commit is contained in:
Simon Atanasyan 2019-10-03 12:08:26 +00:00
parent bf333421da
commit f6551ddfce
4 changed files with 35 additions and 2 deletions

View File

@ -485,8 +485,11 @@ getJumpOffset16OpValue(const MCInst &MI, unsigned OpNo,
assert(MO.isExpr() && assert(MO.isExpr() &&
"getJumpOffset16OpValue expects only expressions or an immediate"); "getJumpOffset16OpValue expects only expressions or an immediate");
// TODO: Push fixup. const MCExpr *Expr = MO.getExpr();
return 0; Mips::Fixups FixupKind =
isMicroMips(STI) ? Mips::fixup_MICROMIPS_LO16 : Mips::fixup_Mips_LO16;
Fixups.push_back(MCFixup::create(0, Expr, MCFixupKind(FixupKind)));
return 0;
} }
/// getJumpTargetOpValue - Return binary encoding of the jump /// getJumpTargetOpValue - Return binary encoding of the jump

View File

@ -26,6 +26,12 @@
# CHECK-FIXUP: bnezc $3, bar # encoding: [0xa0,0b011AAAAA,A,A] # CHECK-FIXUP: bnezc $3, bar # encoding: [0xa0,0b011AAAAA,A,A]
# CHECK-FIXUP: # fixup A - offset: 0, # CHECK-FIXUP: # fixup A - offset: 0,
# CHECK-FIXUP: value: bar-4, kind: fixup_MICROMIPS_PC21_S1 # CHECK-FIXUP: value: bar-4, kind: fixup_MICROMIPS_PC21_S1
# CHECK-FIXUP: jialc $5, bar # encoding: [0x80,0x05,A,A]
# CHECK-FIXUP: # fixup A - offset: 0,
# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_LO16
# CHECK-FIXUP: jic $5, bar # encoding: [0xa0,0x05,A,A]
# CHECK-FIXUP: # fixup A - offset: 0,
# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_LO16
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Check that the appropriate relocations were created. # Check that the appropriate relocations were created.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -37,6 +43,8 @@
# CHECK-ELF: 0x10 R_MICROMIPS_PC19_S2 bar 0x0 # CHECK-ELF: 0x10 R_MICROMIPS_PC19_S2 bar 0x0
# CHECK-ELF: 0x14 R_MICROMIPS_PC21_S1 bar 0x0 # CHECK-ELF: 0x14 R_MICROMIPS_PC21_S1 bar 0x0
# CHECK-ELF: 0x18 R_MICROMIPS_PC21_S1 bar 0x0 # CHECK-ELF: 0x18 R_MICROMIPS_PC21_S1 bar 0x0
# CHECK-ELF: 0x1C R_MICROMIPS_LO16 bar 0x0
# CHECK-ELF: 0x20 R_MICROMIPS_LO16 bar 0x0
# CHECK-ELF: ] # CHECK-ELF: ]
balc bar balc bar
@ -46,3 +54,5 @@
lwpc $2,bar lwpc $2,bar
beqzc $3, bar beqzc $3, bar
bnezc $3, bar bnezc $3, bar
jialc $5, bar
jic $5, bar

View File

@ -40,6 +40,12 @@
# CHECK-FIXUP: lwpc $2, bar # encoding: [0xec,0b01001AAA,A,A] # CHECK-FIXUP: lwpc $2, bar # encoding: [0xec,0b01001AAA,A,A]
# CHECK-FIXUP: # fixup A - offset: 0, # CHECK-FIXUP: # fixup A - offset: 0,
# CHECK-FIXUP: value: bar, kind: fixup_MIPS_PC19_S2 # CHECK-FIXUP: value: bar, kind: fixup_MIPS_PC19_S2
# CHECK-FIXUP: jialc $5, bar # encoding: [0xf8,0x05,A,A]
# CHECK-FIXUP: # fixup A - offset: 0,
# CHECK-FIXUP: value: bar, kind: fixup_Mips_LO16
# CHECK-FIXUP: jic $5, bar # encoding: [0xd8,0x05,A,A]
# CHECK-FIXUP: # fixup A - offset: 0,
# CHECK-FIXUP: value: bar, kind: fixup_Mips_LO16
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Check that the appropriate relocations were created. # Check that the appropriate relocations were created.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -55,6 +61,8 @@
# CHECK-ELF: 0x20 R_MIPS_PCLO16 bar 0x0 # CHECK-ELF: 0x20 R_MIPS_PCLO16 bar 0x0
# CHECK-ELF: 0x24 R_MIPS_PC19_S2 bar 0x0 # CHECK-ELF: 0x24 R_MIPS_PC19_S2 bar 0x0
# CHECK-ELF: 0x28 R_MIPS_PC19_S2 bar 0x0 # CHECK-ELF: 0x28 R_MIPS_PC19_S2 bar 0x0
# CHECK-ELF: 0x2C R_MIPS_LO16 bar 0x0
# CHECK-ELF: 0x30 R_MIPS_LO16 bar 0x0
# CHECK-ELF: ] # CHECK-ELF: ]
addiupc $2,bar addiupc $2,bar
@ -68,3 +76,5 @@
addiu $2, $2, %pcrel_lo(bar) addiu $2, $2, %pcrel_lo(bar)
lapc $2,bar lapc $2,bar
lwpc $2,bar lwpc $2,bar
jialc $5, bar
jic $5, bar

View File

@ -47,6 +47,12 @@
# CHECK-FIXUP: lwupc $2, bar # encoding: [0xec,0b01010AAA,A,A] # CHECK-FIXUP: lwupc $2, bar # encoding: [0xec,0b01010AAA,A,A]
# CHECK-FIXUP: # fixup A - offset: 0, # CHECK-FIXUP: # fixup A - offset: 0,
# CHECK-FIXUP: value: bar, kind: fixup_MIPS_PC19_S2 # CHECK-FIXUP: value: bar, kind: fixup_MIPS_PC19_S2
# CHECK-FIXUP: jialc $5, bar # encoding: [0xf8,0x05,A,A]
# CHECK-FIXUP: # fixup A - offset: 0,
# CHECK-FIXUP: value: bar, kind: fixup_Mips_LO16
# CHECK-FIXUP: jic $5, bar # encoding: [0xd8,0x05,A,A]
# CHECK-FIXUP: # fixup A - offset: 0,
# CHECK-FIXUP: value: bar, kind: fixup_Mips_LO16
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Check that the appropriate relocations were created. # Check that the appropriate relocations were created.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -64,6 +70,8 @@
# CHECK-ELF: 0x28 R_MIPS_PC18_S3/R_MIPS_NONE/R_MIPS_NONE bar 0x0 # CHECK-ELF: 0x28 R_MIPS_PC18_S3/R_MIPS_NONE/R_MIPS_NONE bar 0x0
# CHECK-ELF: 0x2C R_MIPS_PC19_S2/R_MIPS_NONE/R_MIPS_NONE bar 0x0 # CHECK-ELF: 0x2C R_MIPS_PC19_S2/R_MIPS_NONE/R_MIPS_NONE bar 0x0
# CHECK-ELF: 0x30 R_MIPS_PC19_S2/R_MIPS_NONE/R_MIPS_NONE bar 0x0 # CHECK-ELF: 0x30 R_MIPS_PC19_S2/R_MIPS_NONE/R_MIPS_NONE bar 0x0
# CHECK-ELF: 0x34 R_MIPS_LO16/R_MIPS_NONE/R_MIPS_NONE bar 0x0
# CHECK-ELF: 0x38 R_MIPS_LO16/R_MIPS_NONE/R_MIPS_NONE bar 0x0
# CHECK-ELF: ] # CHECK-ELF: ]
addiupc $2,bar addiupc $2,bar
@ -79,3 +87,5 @@
ldpc $2,bar ldpc $2,bar
lwpc $2,bar lwpc $2,bar
lwupc $2,bar lwupc $2,bar
jialc $5, bar
jic $5, bar