Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions llvm/lib/Target/Mips/MipsCondMov.td
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ let AdditionalPredicates = [NotInMicroMips] in {
}

// Instantiation of conditional move patterns.
def : MipsPat<(add GPR64:$gp, (select GPR32:$cond, (MipsGPRel tglobaladdr:$T), (MipsGPRel tglobaladdr:$F))),
(MOVN_I_I64 (i64 (DADDiu GPR64:$gp, tglobaladdr:$T)), GPR32:$cond, (i64 (DADDiu GPR64:$gp, tglobaladdr:$F)))>, ISA_MIPS3, ABI_N64;

defm : MovzPats0<GPR32, GPR32, MOVZ_I_I, SLT, SLTu, SLTi, SLTiu>,
INSN_MIPS4_32_NOT_32R6_64R6;
defm : MovzPats1<GPR32, GPR32, MOVZ_I_I, XOR>, INSN_MIPS4_32_NOT_32R6_64R6;
Expand Down
22 changes: 22 additions & 0 deletions llvm/test/CodeGen/Mips/llvm-ir/select-globaladdr.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
; RUN: llc < %s -mattr +noabicalls -mgpopt | FileCheck %s -check-prefixes=MIPS64

target datalayout = "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "mips64-unknown-linux-muslabi64"

@.str = external constant [6 x i8]
@.str.1 = external constant [6 x i8]

define ptr @tst_select_ptr_ptr(i1 %tobool.not) {
entry:
; MIPS64-LABEL: tst_select_ptr_ptr:
; MIPS64: # %bb.0: # %entry
; MIPS64: sll $1, $4, 0
; MIPS64: andi $1, $1, 1
; MIPS64: daddiu $2, $gp, %gp_rel(.str)
; MIPS64: daddiu $3, $gp, %gp_rel(.str.1)
; MIPS64: jr $ra
; MIPS64: movn $2, $3, $1

%cond = select i1 %tobool.not, ptr @.str.1, ptr @.str
ret ptr %cond
}