let Predicates = [HasStdExtZbt] in {
def : Pat<(or (and (not GPR:$rs2), GPR:$rs3), (and GPR:$rs2, GPR:$rs1)),
(CMIX GPR:$rs1, GPR:$rs2, GPR:$rs3)>;
+
def : Pat<(select (XLenVT (setne GPR:$rs2, 0)), GPR:$rs1, GPR:$rs3),
(CMOV GPR:$rs1, GPR:$rs2, GPR:$rs3)>;
def : Pat<(select (XLenVT (seteq GPR:$rs2, 0)), GPR:$rs3, GPR:$rs1),
(CMOV GPR:$rs1, GPR:$rs2, GPR:$rs3)>;
+def : Pat<(select (XLenVT (setne GPR:$x, simm12_plus1:$y)), GPR:$rs1, GPR:$rs3),
+ (CMOV GPR:$rs1, (ADDI GPR:$x, (NegImm simm12_plus1:$y)), GPR:$rs3)>;
+def : Pat<(select (XLenVT (seteq GPR:$x, simm12_plus1:$y)), GPR:$rs3, GPR:$rs1),
+ (CMOV GPR:$rs1, (ADDI GPR:$x, (NegImm simm12_plus1:$y)), GPR:$rs3)>;
def : Pat<(select (XLenVT (setne GPR:$x, GPR:$y)), GPR:$rs1, GPR:$rs3),
(CMOV GPR:$rs1, (XOR GPR:$x, GPR:$y), GPR:$rs3)>;
def : Pat<(select (XLenVT (seteq GPR:$x, GPR:$y)), GPR:$rs3, GPR:$rs1),
;
; RV32IBT-LABEL: cmovcc64:
; RV32IBT: # %bb.0: # %entry
-; RV32IBT-NEXT: addi a5, zero, 123
-; RV32IBT-NEXT: xor a5, a0, a5
+; RV32IBT-NEXT: addi a5, a0, -123
; RV32IBT-NEXT: cmov a0, a5, a3, a1
; RV32IBT-NEXT: cmov a1, a5, a4, a2
; RV32IBT-NEXT: ret
;
; RV64IBT-LABEL: cmovcc64:
; RV64IBT: # %bb.0: # %entry
-; RV64IBT-NEXT: addi a3, zero, 123
-; RV64IBT-NEXT: xor a0, a0, a3
+; RV64IBT-NEXT: addi a0, a0, -123
; RV64IBT-NEXT: cmov a0, a0, a2, a1
; RV64IBT-NEXT: ret
entry:
;
; RV64IBT-LABEL: cmovcc128:
; RV64IBT: # %bb.0: # %entry
-; RV64IBT-NEXT: addi a5, zero, 123
-; RV64IBT-NEXT: xor a5, a0, a5
+; RV64IBT-NEXT: addi a5, a0, -123
; RV64IBT-NEXT: cmov a0, a5, a3, a1
; RV64IBT-NEXT: cmov a1, a5, a4, a2
; RV64IBT-NEXT: ret
;
; RV32IBT-LABEL: cmovccdep:
; RV32IBT: # %bb.0: # %entry
-; RV32IBT-NEXT: addi a4, zero, 123
-; RV32IBT-NEXT: xor a0, a0, a4
+; RV32IBT-NEXT: addi a0, a0, -123
; RV32IBT-NEXT: cmov a1, a0, a2, a1
; RV32IBT-NEXT: cmov a0, a0, a3, a1
; RV32IBT-NEXT: add a0, a1, a0
;
; RV64IBT-LABEL: cmovccdep:
; RV64IBT: # %bb.0: # %entry
-; RV64IBT-NEXT: addi a4, zero, 123
-; RV64IBT-NEXT: xor a0, a0, a4
+; RV64IBT-NEXT: addi a0, a0, -123
; RV64IBT-NEXT: cmov a1, a0, a2, a1
; RV64IBT-NEXT: cmov a0, a0, a3, a1
; RV64IBT-NEXT: addw a0, a1, a0