Index: lib/Target/Mips/MicroMipsInstrInfo.td =================================================================== --- lib/Target/Mips/MicroMipsInstrInfo.td +++ lib/Target/Mips/MicroMipsInstrInfo.td @@ -1271,6 +1271,8 @@ def : MipsPat<(bswap GPR32:$rt), (ROTR_MM (WSBH_MM GPR32:$rt), 16)>, ISA_MICROMIPS; +def : MipsPat<(MipsJmpLink (i32 texternalsym:$dst)), + (JAL_MM texternalsym:$dst)>, ISA_MICROMIPS32_NOT_MIPS32R6; def : MipsPat<(MipsTailCall (iPTR tglobaladdr:$dst)), (TAILCALL_MM tglobaladdr:$dst)>, ISA_MICROMIPS32_NOT_MIPS32R6; def : MipsPat<(MipsTailCall (iPTR texternalsym:$dst)), Index: test/CodeGen/Mips/micromips-target-external-symbol-reloc.ll =================================================================== --- /dev/null +++ test/CodeGen/Mips/micromips-target-external-symbol-reloc.ll @@ -0,0 +1,13 @@ +; RUN: llc -mtriple=mips-mti-linux-gnu -mcpu=mips32r2 -mattr=+micromips -stop-after=expand-isel-pseudos < %s | FileCheck %s + +; CHECK: JAL_MM +; CHECK-NOT: JALR16_MM + +define dso_local void @foo(i32* nocapture %ar) local_unnamed_addr { +entry: + %0 = bitcast i32* %ar to i8* + tail call void @llvm.memset.p0i8.i32(i8* align 4 %0, i8 0, i32 100, i1 false) + ret void +} + +declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1)