Index: lib/Target/Mips/MicroMipsInstrInfo.td =================================================================== --- lib/Target/Mips/MicroMipsInstrInfo.td +++ lib/Target/Mips/MicroMipsInstrInfo.td @@ -1451,3 +1451,5 @@ def : MipsInstAlias<"mthgc0 $rt, $rs", (MTHGC0_MM COP0Opnd:$rs, GPR32Opnd:$rt, 0), 0>, ISA_MICROMIPS32R5, ASE_VIRT; +def : MipsPat<(MipsJmpLink (i32 texternalsym:$dst)), + (JAL_MM texternalsym:$dst)>, ISA_MICROMIPS32_NOT_MIPS32R6; \ No newline at end of file Index: test/CodeGen/Mips/micromips-target-external-symbol-reloc.ll =================================================================== --- /dev/null +++ test/CodeGen/Mips/micromips-target-external-symbol-reloc.ll @@ -0,0 +1,14 @@ +; RUN: llc -mtriple=mips-mti-linux-gnu -mcpu=mips32r2 -mattr=+micromips -filetype=obj < %s | llvm-objdump -D -r - | FileCheck %s + +; CHECK: R_MICROMIPS_26_S1 memset +; CHECK-NOT: R_MIPS_32 memset + +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) +